:root {
  color: #17202a;
  background: #f4f6f8;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --line: #dfe4e8;
  --muted: #65717e;
  --surface: #ffffff;
  --primary: #155eef;
  --primary-hover: #0f4fcf;
  --danger: #c52233;
  --shadow: 0 12px 36px rgba(28, 39, 51, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f4f6f8; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 7px; color: #708090; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #e7f0ff 0, #f4f6f8 38%, #eef1f4 100%); }
.login-panel { width: min(400px, 100%); padding: 40px; border: 1px solid rgba(210,217,224,.9); border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-panel h1 { margin: 0 0 28px; font-size: 29px; line-height: 1.2; }
.brand-mark, .brand-symbol { display: flex; align-items: end; gap: 3px; }
.brand-mark { width: 38px; height: 38px; margin-bottom: 24px; padding: 8px; border-radius: 8px; background: #17202a; }
.brand-mark span, .brand-symbol span { display: block; width: 5px; border-radius: 1px; background: #fff; }
.brand-mark span:nth-child(1), .brand-symbol span:nth-child(1) { height: 11px; }
.brand-mark span:nth-child(2), .brand-symbol span:nth-child(2) { height: 18px; background: #74a2ff; }
.brand-mark span:nth-child(3), .brand-symbol span:nth-child(3) { height: 14px; }
.login-form, .editor-form { display: grid; gap: 16px; }
.login-form label, .form-grid label { display: grid; gap: 8px; color: #34404c; font-size: 13px; font-weight: 600; }
.password-wrap, .search-field { position: relative; }
.password-wrap svg, .search-field svg { position: absolute; top: 50%; left: 12px; width: 17px; transform: translateY(-50%); color: #7d8995; }
input, select { width: 100%; height: 42px; border: 1px solid #ccd4db; border-radius: 6px; background: #fff; color: #17202a; outline: none; transition: border-color .16s ease, box-shadow .16s ease; }
input { padding: 0 12px; }
select { appearance: none; padding: 0 36px 0 12px; }
input:focus, select:focus { border-color: #5a8ff4; box-shadow: 0 0 0 3px rgba(21,94,239,.11); }
.password-wrap input { padding-left: 40px; }
.form-error { min-height: 18px; margin: -4px 0 0; color: var(--danger); font-size: 13px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; transition: transform .14s ease, background .14s ease, border-color .14s ease; }
.button svg { width: 17px; height: 17px; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-wide { width: 100%; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { border-color: #d4dbe1; color: #34404c; background: #fff; }
.button-secondary:hover { border-color: #aeb8c2; background: #f8f9fa; }
.button-danger { color: #fff; background: var(--danger); }
.button-danger:hover { background: #a91c2b; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(213,220,226,.9); background: rgba(255,255,255,.9); backdrop-filter: blur(14px); }
.topbar-inner { width: min(1280px, calc(100% - 40px)); height: 64px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-symbol { width: 31px; height: 31px; justify-content: center; padding: 6px; border-radius: 7px; background: #17202a; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid #d6dde3; border-radius: 6px; color: #4c5966; background: #fff; }
.icon-button:hover { color: #17202a; border-color: #aeb9c3; background: #f7f9fa; }
.icon-button svg { width: 17px; height: 17px; }
.icon-button.compact { width: 32px; height: 32px; }
.workspace { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 56px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 102px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #7c8792; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 10px; font-size: 29px; line-height: 1; }
.stat-api::before { background: #155eef; }.stat-vip::before { background: #d97706; }.stat-sub::before { background: #168362; }
.content-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 18px rgba(28,39,51,.035); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.search-field { width: min(430px, 100%); }
.search-field input { padding-left: 39px; }
.select-field { position: relative; width: 150px; flex: 0 0 auto; }
.select-field svg { position: absolute; top: 50%; right: 11px; width: 16px; transform: translateY(-50%); color: #77838f; pointer-events: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 930px; border-collapse: collapse; }
th, td { padding: 15px 16px; border-bottom: 1px solid #e7ebee; text-align: left; vertical-align: middle; }
th { color: #687480; background: #fafbfc; font-size: 12px; font-weight: 700; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.site-badge, .ratio-badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 5px; font-size: 12px; font-weight: 650; }
.site-badge { padding: 5px 9px; }
.site-api { color: #174ea6; background: #e8f0fe; }.site-vip { color: #8a4b08; background: #fff1d6; }.site-sub { color: #11674f; background: #e1f4ed; }
.ratio-list { display: flex; flex-wrap: wrap; gap: 6px; max-width: 440px; }
.ratio-badge { padding: 4px 7px; border: 1px solid #d8dfe5; color: #45515d; background: #fff; }
.actions-head { text-align: right; }
.row-actions { display: flex; justify-content: end; gap: 6px; }
.row-actions .delete:hover { color: var(--danger); border-color: #efbac0; background: #fff5f6; }
.pagination { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; align-items: center; gap: 10px; }
.table-state { min-height: 260px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(19,27,35,.48); backdrop-filter: blur(4px); }
.modal { width: min(650px, 100%); max-height: min(88vh, 760px); overflow: auto; border: 1px solid #dce2e7; border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(14,23,32,.24); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.modal-header h2 { margin: 0; font-size: 21px; }
.editor-form { padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-two { grid-column: 1 / -1; }
.ratios-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 5px; }
.ratios-heading strong, .ratios-heading small { display: block; }
.ratios-heading strong { font-size: 14px; }.ratios-heading small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.ratios-list { display: grid; gap: 9px; }
.ratio-row { display: grid; grid-template-columns: minmax(0, 1fr) 155px 38px; gap: 9px; align-items: center; padding: 10px; border: 1px solid #e1e6ea; border-radius: 7px; background: #fafbfc; }
.ratio-row .remove-ratio { color: #7a8792; }
.ratio-row .remove-ratio:hover { color: var(--danger); }
.modal-footer { display: flex; justify-content: end; gap: 10px; padding-top: 4px; }
.confirm-modal { width: min(410px, 100%); padding: 28px; border-radius: 8px; background: #fff; text-align: center; box-shadow: 0 24px 70px rgba(14,23,32,.24); }
.danger-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: var(--danger); background: #fff0f2; }
.danger-icon svg { width: 21px; }
.confirm-modal h2 { margin: 0; font-size: 20px; }.confirm-modal p { margin: 10px 0 22px; color: var(--muted); font-size: 14px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(380px, calc(100% - 44px)); padding: 12px 15px; border: 1px solid #cad4dc; border-radius: 7px; color: #fff; background: #17202a; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: #a91c2b; border-color: #c52233; }
@media (max-width: 760px) {
  .topbar-inner, .workspace { width: min(100% - 24px, 1280px); }
  .workspace { padding-top: 26px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field, .select-field { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .ratio-row { grid-template-columns: minmax(0, 1fr) 110px 38px; }
}
@media (max-width: 480px) {
  .login-panel { padding: 28px 22px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 92px; padding: 16px; }
  .stat-card strong { font-size: 25px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 8px 8px 0 0; }
  .ratio-row { grid-template-columns: minmax(0, 1fr) 90px 36px; padding: 8px; }
}
