:root {
  color-scheme: light;
  --canvas: #f5f7fc;
  --ink: #18223b;
  --muted: #526079;
  --line: #dce3f0;
  --accent: #2949b1;
  --soft: #ebf0ff;
  --paper: #fff;
  --pass: #146349;
  --fail: #a62537;
  --pending: #755118;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(100% - 64px, 1200px); margin-inline: auto; }
a { color: var(--accent); text-decoration: none; }
a, button, summary, select { cursor: pointer; }
a, button, summary { transition: background-color 160ms, color 160ms; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 700; }
.brand svg { color: var(--accent); }
.brand span { color: var(--muted); font-weight: 500; }
.local-label { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: .8rem; color: var(--muted); }
.local-label i, .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7990c8; }
.logout { border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); padding: 6px 10px; font: inherit; font-size: .86rem; }
.logout:hover { background: var(--soft); }
main { padding-block: 35px 60px; }
.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  padding-block: 24px;
}
.login .add { padding: 24px; }
.login h1 { font-size: 1.6rem; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.25rem); letter-spacing: -.025em; }
h2 { font-size: 1.12rem; }
.heading p, .add p { color: var(--muted); margin-top: 5px; }
.rotation { border: 1px solid #d1dcfa; background: var(--soft); border-radius: 12px; padding: 10px 14px; min-width: 205px; }
.rotation span { color: var(--muted); font-size: .8rem; margin-right: 6px; }
.rotation strong { color: var(--accent); }
.rotation small { display: block; margin-top: 2px; color: var(--muted); white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 24px; gap: 12px; }
.stats div, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.stats div { padding: 13px 17px; }
.stats dt { color: var(--muted); font-size: .87rem; display: flex; gap: 6px; align-items: center; }
.dot.pass { background: #2a906e; }
.dot.fail { background: #cb4858; }
.dot.pending { background: #aa792a; }
.stats dd { margin: 1px 0 0; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.notice { margin-bottom: 14px; padding: 10px 14px; background: #e6f5ed; color: var(--pass); border-radius: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.section-actions { display: flex; align-items: center; gap: 8px; }
.add-account-button { min-height: 42px; padding: 8px 13px; border: 0; border-radius: 7px; background: var(--accent); color: white; font: inherit; font-size: .88rem; font-weight: 600; }
.add-account-button:hover { background: #1c3691; }
.balance-note { color: var(--muted); padding: 0 18px 10px; font-size: .8rem; }
.refresh { padding: 5px 8px; font-size: .88rem; border-radius: 6px; }
.refresh:hover, .groups a:hover, .groups [aria-current] { background: var(--soft); }
.groups { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 18px 13px; }
.groups a { border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: .8rem; white-space: nowrap; }
.groups a[aria-current] { border-color: #b9c9fc; font-weight: 700; }
.groups a span { color: var(--muted); font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 8px; border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #f8faff; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
.email { overflow-wrap: anywhere; font-weight: 550; }
.group-cell, .status-cell, .checked-cell, .actions { white-space: nowrap; }
.checked-cell { color: var(--muted); font-variant-numeric: tabular-nums; }
.matting-cell, .points-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.matting-label, .points-label { display: none; color: var(--muted); }
.task-check-label { display: none; color: var(--muted); }
.badge, .active-tag { display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: .75rem; font-weight: 600; }
.badge.pass { background: #e5f4ec; color: var(--pass); }
.badge.fail { background: #fcecf0; color: var(--fail); }
.badge.pending { background: #fff3db; color: var(--pending); }
.active-tag { background: var(--soft); color: var(--accent); margin-left: 2px; }
.actions { width: 104px; }
.delete summary { color: var(--fail); list-style: none; }
.delete summary::-webkit-details-marker { display: none; }
.delete summary:hover { text-decoration: underline; }
.delete form { margin-top: 6px; }
.danger { background: #fcecf0; color: var(--fail); border: 1px solid #edb7c2; border-radius: 5px; padding: 4px 7px; }
.danger:hover { background: #f8d8e0; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); }
.add { padding: 16px 18px 18px; }
.add p { font-size: .87rem; }
.add .form-error { background: #fcecf0; color: var(--fail); border-radius: 7px; padding: 7px 9px; margin-top: 12px; }
.add label { display: block; margin: 13px 0 4px; font-size: .86rem; font-weight: 600; }
.add input:not([type=hidden]), .add select { width: 100%; padding: 8px 9px; min-height: 41px; border-radius: 7px; border: 1px solid #bcc9e0; background: white; color: var(--ink); font: inherit; }
.add input::placeholder { color: var(--muted); font-size: .87rem; }
.primary { width: 100%; min-height: 42px; border: 0; border-radius: 7px; margin-top: 16px; background: var(--accent); color: white; font: inherit; font-weight: 650; }
.primary:hover { background: #1c3691; }
.account-dialog { width: min(440px, calc(100% - 28px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper); box-shadow: 0 20px 70px #18223b33; }
.account-dialog::backdrop { background: #18223b66; }
body:has(.account-dialog[open]) { overflow: hidden; }
.account-dialog .add { padding: 20px 24px 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-close { min-height: 44px; padding: 6px 10px; margin-right: -10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: .86rem; }
.dialog-close:hover, .secondary:hover { background: var(--soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions .primary { width: auto; margin: 0; padding: 8px 18px; min-height: 44px; }
.secondary { min-height: 44px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; }
@media (max-width: 980px) {
  .wrap { width: calc(100% - 40px); }
  .active-tag { display: table; margin: 3px 0 0; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  main { padding-top: 20px; }
  .heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stats div { padding: 9px 13px; }
  table thead { clip-path: inset(50%); position: absolute; width: 1px; height: 1px; overflow: hidden; }
  tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); padding: 10px 14px; gap: 3px; }
  tbody td, tbody td:first-child, tbody td:last-child { border: 0; padding: 0; }
  .email, .empty { grid-column: 1 / -1; }
  .checked-cell, .matting-cell, .points-cell { grid-column: 1 / -1; }
  .checked-cell { font-size: .78rem; }
  .matting-label, .points-label { display: inline; }
  .task-check-label { display: block; font-size: .75rem; }
  .actions { grid-column: 1 / -1; width: auto; }
  .delete summary { display: inline-flex; align-items: center; min-height: 36px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
