/* A650: the admin's look — the site's restraint (thin rules, quiet type, room). Light or dark with the system, or as
   chosen in 更多 › 外观 (data-theme on <html>, set by theme.js before the first paint). On a phone the tabs sit at the
   bottom; on a wide screen, in the header. */
:root {
  --bg: #f2f2f5; --panel: #ffffff; --card: #ffffff; --fg: #121216; --fg-2: rgba(18,18,22,.66); --fg-3: rgba(18,18,22,.44); --fg-4: rgba(18,18,22,.14);
  --rule: rgba(18,18,22,.09); --rule-2: rgba(18,18,22,.18); --accent: #0891b2; --good: #15803d; --warn: #b45309; --bad: #c2410c; --chip: rgba(18,18,22,.05);
  --f-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", "SF Mono", Consolas, ui-monospace, monospace;
  --radius: 14px; --tabbar: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07070b; --panel: #0e0e14; --card: rgba(243,243,246,.035); --fg: #f3f3f6; --fg-2: rgba(243,243,246,.68); --fg-3: rgba(243,243,246,.42); --fg-4: rgba(243,243,246,.16);
    --rule: rgba(243,243,246,.1); --rule-2: rgba(243,243,246,.2); --accent: #22d3ee; --good: #4ade80; --warn: #fbbf24; --bad: #fb923c; --chip: rgba(243,243,246,.06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07070b; --panel: #0e0e14; --card: rgba(243,243,246,.035); --fg: #f3f3f6; --fg-2: rgba(243,243,246,.68); --fg-3: rgba(243,243,246,.42); --fg-4: rgba(243,243,246,.16);
  --rule: rgba(243,243,246,.1); --rule-2: rgba(243,243,246,.2); --accent: #22d3ee; --good: #4ade80; --warn: #fbbf24; --bad: #fb923c; --chip: rgba(243,243,246,.06);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg); font: 14px/1.6 var(--f-sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
code, .mono { font-family: var(--f-mono); font-size: .92em; }
.muted { color: var(--fg-3); } .small { font-size: 12px; } .center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 11px; background: var(--fg); color: var(--bg); font-weight: 600; cursor: pointer; text-decoration: none; transition: opacity .2s, transform .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--rule-2); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 45%, transparent); }
.btn.confirm { background: var(--bad); color: #fff; box-shadow: none; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.big { width: 100%; min-height: 50px; font-size: 15px; border-radius: 14px; }
.link { padding: 6px 4px; border: 0; background: none; color: var(--fg-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
input, select { min-width: 0; height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--chip); outline: none; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .2s; }
input:focus, select:focus { box-shadow: inset 0 0 0 1px var(--fg-3); }
/* the open list of a select takes its colours from the options, not the page: without these, dark text settings
   left light text on the browser's white list */
select option, select optgroup { background: var(--panel); color: var(--fg); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--fg-2); }
label.check { display: flex; align-items: center; gap: 8px; align-self: end; height: 40px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
/* icons: the inline sprite in app.html (the user's library, Material Symbols Outlined), drawn in the text colour */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: currentColor; }
.fp { width: 22px; height: 22px; }
.btn.icon-only { padding: 0; width: 36px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--chip); font-size: 13px; line-height: 1.65; }
.note.error { color: var(--bad); }

/* boot, sign-in, enrolment */
.boot { min-height: 100vh; display: grid; place-items: center; opacity: .5; }
.gate { min-height: 100vh; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; padding: max(48px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom)); }
.gate-mark { margin-top: 12vh; margin-bottom: 14px; }
.gate-mark.small { margin-top: 2vh; margin-bottom: 4px; }
.gate h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
.gate-host { color: var(--fg-3); font-family: var(--f-mono); font-size: 12.5px; }
.gate-grow { flex: 1; min-height: 40px; }
.gate-alt { margin-top: 6px; text-align: center; color: var(--fg-3); }
.gate-form { display: grid; gap: 12px; }
.gate-form input { height: 50px; font-size: 18px; letter-spacing: .1em; font-family: var(--f-mono); }
.gate-fine { margin-top: 12px; text-align: center; font: 500 11px/1.6 var(--f-mono); letter-spacing: .06em; color: var(--fg-3); }
.enrol h1 { font-size: 26px; }
.steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.step { display: grid; gap: 10px; padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--rule); }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.step h2 i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--fg); color: var(--bg); font: 600 12px/1 var(--f-mono); font-style: normal; }
.step p { color: var(--fg-2); font-size: 13px; line-height: 1.7; }
.step .done { color: var(--good); font-weight: 600; }
.secret { padding: 14px; border-radius: 12px; background: var(--chip); font-size: 15px; letter-spacing: .08em; text-align: center; word-break: break-all; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; border-radius: 12px; background: var(--chip); font-size: 14px; letter-spacing: .04em; }

/* the admin */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 24px; padding-top: max(12px, env(safe-area-inset-top)); background: color-mix(in oklab, var(--bg) 86%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); box-shadow: 0 1px 0 var(--rule); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { font-size: 16px; }
.brand small { font: 500 10.5px/1 var(--f-mono); letter-spacing: .14em; color: var(--fg-3); text-transform: uppercase; }
.badge { padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--fg-2); font-size: 11.5px; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 4px; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--fg-3); cursor: pointer; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--chip); color: var(--fg); }
main { max-width: 1160px; margin: 0 auto; padding: 20px 24px calc(60px + var(--tabbar)); }
.page-title { margin: 8px 0 16px; font-size: 26px; letter-spacing: -.01em; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.card { min-width: 0; margin-bottom: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--rule); }
.grid > .card { margin-bottom: 0; }
.grid.two { margin-bottom: 12px; }
.card h2 { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.card > p { margin-top: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--rule); }
.stat .l { font-size: 12px; color: var(--fg-3); }
.stat .v { margin-top: 6px; font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { margin-top: 4px; font-size: 11.5px; color: var(--fg-3); }
.table { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; }
th { color: var(--fg-3); font-weight: 500; font-size: 12px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 8px 0; color: var(--fg-3); }
.bar { height: 6px; min-width: 2px; border-radius: 3px; background: var(--accent); opacity: .8; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; }
.tag.good { color: var(--good); } .tag.warn { color: var(--warn); } .tag.bad { color: var(--bad); }
svg.chart { width: 100%; height: 200px; display: block; margin: 4px 0 6px; }
svg.chart.small { height: 110px; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
svg.chart .area { fill: color-mix(in oklab, var(--accent) 12%, transparent); }
svg.chart .grid { stroke: var(--rule); vector-effect: non-scaling-stroke; }
/* A651: advice lines (服务器 升级建议, 发信 额度) and the small segmented controls */
.advice { display: grid; gap: 6px; margin-bottom: 10px; }
.advice:empty { display: none; }
.advice p { padding: 8px 10px 8px 12px; border-radius: 9px; background: var(--chip); font-size: 12.5px; line-height: 1.6; box-shadow: inset 3px 0 0 var(--fg-4); }
.advice p.good { box-shadow: inset 3px 0 0 var(--good); } .advice p.warn { box-shadow: inset 3px 0 0 var(--warn); } .advice p.bad { box-shadow: inset 3px 0 0 var(--bad); color: var(--fg); }
.seg.small { margin: 0; padding: 2px; border-radius: 9px; }
.seg.small button { min-width: 0; height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.srv-controls { margin-top: 12px; }
.provider { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.provider:last-of-type { border-bottom: 0; }
.provider b { font-size: 13px; }
.meter { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter i.warn { background: var(--warn); } .meter i.bad { background: var(--bad); }
/* the labels are text outside the stretched drawing, so they keep their shape on a narrow screen */
.axis { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font: 500 11px/1.4 var(--f-mono); color: var(--fg-3); }
.seg { display: inline-grid; grid-auto-flow: column; padding: 3px; margin-bottom: 8px; border-radius: 11px; background: var(--chip); }
.seg button { min-width: 72px; height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--fg-3); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--fg); color: var(--bg); font-weight: 600; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 14px; }
.form .wide { grid-column: span 2; }
.made { margin-top: 14px; padding: 16px; border-radius: 12px; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent); }
.made .codes { margin: 10px 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; font-family: var(--f-mono); font-size: 14px; }
.made .codes div { padding: 8px 10px; border-radius: 8px; background: var(--chip); white-space: nowrap; overflow-x: auto; }
.revoke-one { margin-top: 12px; }
.revoke-one input { flex: 1 1 240px; }
#u-form input { flex: 1 1 260px; }
.section-title { margin: 18px 0 8px; font-size: 13px; color: var(--fg-2); font-weight: 600; }

/* the sheet for checking again, and the toast */
.veil { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
.sheet { width: min(480px, 100%); display: grid; gap: 12px; padding: 18px 22px max(26px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--panel); box-shadow: 0 -1px 0 var(--rule-2); }
.sheet .grab { width: 38px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: var(--fg-4); }
.sheet h3 { font-size: 18px; }
.sheet p { color: var(--fg-2); font-size: 13px; line-height: 1.65; }
.sheet form input { flex: 1; letter-spacing: .1em; font-family: var(--f-mono); }
@media (min-width: 720px) { .veil { align-items: center; } .sheet { border-radius: 20px; } .sheet .grab { display: none; } }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--tabbar)); z-index: 60; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); color: #fff; }

/* phones: the tabs at the bottom, the header slimmer */
@media (max-width: 719px) {
  :root { --tabbar: 64px; }
  /* no backdrop filter here: it would make the fixed tab bar inside sit relative to the header, not the screen */
  .top { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .top .badge, .top #updated { display: none; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); background: color-mix(in oklab, var(--panel) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 -1px 0 var(--rule); }
  .tabs button { flex-direction: column; justify-content: center; gap: 4px; height: 52px; padding: 0; font-size: 10.5px; background: none !important; }
  .tabs button[aria-selected="true"] { color: var(--fg); }
  .tabs .ic { width: 24px; height: 24px; }
  main { padding: 12px 14px calc(30px + var(--tabbar) + env(safe-area-inset-bottom)); }
  .page-title { font-size: 26px; margin: 6px 2px 14px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat .v { font-size: 24px; }
  .grid.two { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .form { grid-template-columns: 1fr 1fr; }
  .form .wide { grid-column: 1 / -1; }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
  .seg button { min-width: 0; }
  #c-create { width: 100%; min-height: 46px; }
}
