:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: rgba(255, 255, 255, .92);
  --ink: #162033;
  --muted: #667085;
  --line: #e4e9f1;
  --blue: #2563eb;
  --cyan: #0ea5a4;
  --green: #16a36a;
  --amber: #d97706;
  --red: #dc3545;
  --shadow: 0 16px 45px rgba(36, 50, 75, .09);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(37,99,235,.14), transparent 30rem),
    radial-gradient(circle at 90% 0%, rgba(14,165,164,.12), transparent 28rem),
    var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.topbar {
  display: flex; justify-content: space-between; gap: 2rem; align-items: center;
  padding: 2.2rem max(2rem, calc((100vw - 1440px)/2));
  color: white; background: linear-gradient(120deg, #111b36 0%, #17376d 60%, #0e6b76 130%);
  box-shadow: 0 10px 30px rgba(14, 28, 58, .22);
}
h1 { margin: .2rem 0 .5rem; font-size: clamp(1.7rem, 3vw, 2.55rem); letter-spacing: -.03em; }
h2 { margin: .18rem 0 0; font-size: 1.25rem; }
.topbar p { margin: 0; color: #cbd8ee; }
.eyebrow { color: #69d7d0; font-weight: 700; font-size: .7rem; letter-spacing: .16em; }
.top-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; justify-content: flex-end; }
.current-user { padding: .42rem .7rem; border-radius: 999px; background: rgba(255,255,255,.11); color: #e9f2ff; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: .5rem; color: #dffaf4; white-space: nowrap; }
.live i { width: .55rem; height: .55rem; border-radius: 50%; background: #43e4a5; box-shadow: 0 0 0 5px rgba(67,228,165,.14); }
.live.paused { color: #ffe4ae; }
.live.paused i { background: #f5aa32; box-shadow: 0 0 0 5px rgba(245,170,50,.15); }
main { max-width: 1440px; margin: 0 auto; padding: 2rem; }
.settings-panel {
  display: grid; grid-template-columns: minmax(280px, 1fr) auto auto; align-items: center; gap: 1.5rem;
  margin-bottom: 1.25rem; padding: 1.15rem 1.35rem; border-radius: 18px;
  color: var(--ink); background: rgba(255,255,255,.86); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.settings-panel p { margin: .35rem 0 0; color: var(--muted); font-size: .88rem; }
.delay-editor, .quiet-editor { display: flex; align-items: center; gap: .55rem; white-space: nowrap; }
.delay-editor input, .quiet-editor input { padding: .55rem .65rem; border: 1px solid #cfd8e6; border-radius: 10px; text-align: center; color: var(--ink); background: white; }
.delay-editor input { width: 4.5rem; }
.quiet-editor input { width: 7rem; }
.quiet-editor { flex-wrap: wrap; justify-content: flex-end; }
.quiet-editor small { flex-basis: 100%; color: var(--muted); text-align: right; }
.accounts-panel { margin-top: 1.25rem; }
.accounts-head { margin-bottom: .8rem; }
.accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.accounts:has(> article:only-child) { grid-template-columns: minmax(0, 760px); justify-content: center; }
.card, .log-panel {
  background: var(--card); border: 1px solid rgba(216,224,235,.9); border-radius: 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.card { padding: 1.35rem; }
.card-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.account-name { border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--ink); font-size: 1.25rem; font-weight: 750; min-width: 0; width: 12rem; }
.account-name:focus { outline: none; border-color: var(--blue); }
.identity { margin: .55rem 0 1.15rem; min-height: 1.35rem; color: var(--muted); overflow-wrap: anywhere; }
.actions { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.device-login { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1rem; align-items: center; margin: -.35rem 0 1rem; padding: .85rem 1rem; border: 1px solid #b8cff5; border-radius: 13px; background: #eef5ff; }
.device-login strong { color: #174b9b; }
.device-login a { color: var(--blue); font-weight: 700; }
.device-login span, .device-login small { color: var(--muted); font-size: .82rem; }
.device-login code { padding: .32rem .58rem; border-radius: 8px; background: #17233d; color: white; font: 700 1.05rem/1.2 Consolas, monospace; letter-spacing: .08em; user-select: all; }
.device-login small { grid-column: 1 / -1; }
button { border: 1px solid #d5dce8; border-radius: 10px; padding: .55rem .8rem; background: white; color: #24324a; transition: .16s ease; }
button:hover { transform: translateY(-1px); border-color: #9fb4d2; box-shadow: 0 5px 15px rgba(30,60,100,.08); }
button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
button.primary { background: var(--blue); color: white; border-color: var(--blue); }
button.danger { color: var(--red); }
button.ghost { background: rgba(255,255,255,.08); color: inherit; border-color: rgba(255,255,255,.22); }
button.pause.resume { background: #e8f7f1; color: #087451; border-color: #8fd2ba; }
.quota-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; align-items: center; padding: 1rem; border-radius: 15px; background: #f6f9fe; border: 1px solid #e6edf8; }
.big-number { font-size: 2rem; font-weight: 780; letter-spacing: -.04em; }
.muted { color: var(--muted); font-size: .84rem; }
.bar { height: 10px; border-radius: 999px; overflow: hidden; background: #e2e8f2; margin-top: .65rem; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .4s ease; }
.countdown { text-align: right; font-size: 1.35rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.datum { border: 1px solid var(--line); border-radius: 12px; padding: .72rem .8rem; min-width: 0; }
.datum strong { display: block; margin-top: .2rem; font-size: .9rem; overflow-wrap: anywhere; }
.plan-note { display: block; margin-top: .42rem; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.plan-note b { color: var(--blue); font-weight: 750; font-variant-numeric: tabular-nums; }
.wide { grid-column: 1 / -1; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.badge { display: inline-flex; padding: .36rem .62rem; border-radius: 999px; background: #e8f7f1; color: #087451; font-weight: 700; font-size: .82rem; }
.badge.wait { background: #fff3df; color: #985808; }
.badge.error { background: #ffe9ec; color: #b42335; }
.badge.paused { background: #fff3df; color: #985808; }
.switch { display: inline-flex; align-items: center; gap: .55rem; color: var(--muted); white-space: nowrap; }
.switch input { width: 2.5rem; height: 1.3rem; accent-color: var(--blue); }
.error-text { margin-top: .75rem; color: var(--red); font-size: .85rem; overflow-wrap: anywhere; }
.log-panel { margin-top: 1.25rem; padding: 1.35rem; }
.logs { margin-top: 1rem; height: 260px; overflow: auto; padding: 1rem; border-radius: 13px; background: #0f172a; color: #cbd5e1; font: .84rem/1.7 Consolas, monospace; white-space: pre-wrap; }
.notice { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 12px; background: #fff3df; color: #81500c; }
.hidden { display: none; }
.auth-page { display: grid; place-items: center; }
.auth-shell { width: min(100%, 470px); padding: 1.25rem; }
.auth-card { padding: 2rem; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.auth-card h1 { margin-top: .35rem; }
.auth-card > p { color: var(--muted); line-height: 1.6; }
.auth-card form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.auth-card label { display: grid; gap: .45rem; color: #344054; font-weight: 650; }
.auth-card input { width: 100%; padding: .72rem .8rem; border: 1px solid #cfd8e6; border-radius: 10px; background: white; color: var(--ink); }
.auth-card input:focus { outline: 2px solid rgba(37,99,235,.2); border-color: var(--blue); }
.password-field { position: relative; }
.password-field input { padding-right: 3.2rem; }
.password-toggle { position: absolute; z-index: 2; top: 50%; right: .42rem; display: grid; width: 2.35rem; height: 2.35rem; padding: 0; place-items: center; transform: translateY(-50%); color: #77818c; background: transparent; border: 0; border-radius: 8px; box-shadow: none; }
.password-toggle:hover { transform: translateY(-50%); color: var(--blue); background: #f1f5fb; border-color: transparent; box-shadow: none; }
.password-toggle svg { width: 1.25rem; height: 1.25rem; }
.auth-submit { width: 100%; padding: .72rem; }
.auth-error { padding: .7rem .8rem; border-radius: 10px; background: #ffe9ec; color: #b42335; }
.auth-error.success { background: #e8f7f1; color: #087451; }
.auth-switch { text-align: center; }
.auth-switch a { color: var(--blue); font-weight: 700; }
.admin-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.summary-card { padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.summary-card span { display: block; color: var(--muted); font-size: .86rem; }
.summary-card strong { display: block; margin-top: .25rem; font-size: 1.8rem; }
.admin-users-panel { margin-top: 1.25rem; }
.admin-filters { display: flex; gap: .45rem; flex-wrap: wrap; }
.admin-table-wrap { margin-top: 1rem; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 1080px; }
.admin-table th, .admin-table td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.admin-table td { font-size: .88rem; }
.admin-table td small { display: block; margin-top: .25rem; color: var(--muted); overflow-wrap: anywhere; }
.mono { font-family: Consolas, monospace; }
.admin-modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(15,23,42,.48); }
.admin-modal.hidden { display: none; }
.admin-modal-card { width: min(100%, 460px); padding: 1.35rem; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 24px 70px rgba(15,23,42,.24); }
.admin-user-form { display: grid; gap: 1rem; margin-top: 1.2rem; }
.admin-user-form label { display: grid; gap: .42rem; color: #344054; font-weight: 650; }
.admin-user-form input { width: 100%; padding: .72rem .8rem; border: 1px solid #cfd8e6; border-radius: 10px; background: white; color: var(--ink); }
.admin-modal-actions { display: flex; justify-content: flex-end; gap: .55rem; }
@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 1.5rem; }
  main { padding: 1rem; }
  .accounts { grid-template-columns: 1fr; }
  .settings-panel { grid-template-columns: 1fr; align-items: flex-start; }
  .quiet-editor { justify-content: flex-start; }
  .quiet-editor small { text-align: left; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .quota-hero { grid-template-columns: 1fr; }
  .countdown { text-align: left; }
  .details { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .admin-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-section-head { align-items: flex-start; flex-direction: column; }
}
