:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --surface: #fff;
  --soft: #f1f1f1;
  --ink: #111;
  --muted: #555;
  --line: #e6e6e6;
  --line-strong: #d0d0d0;
  --focus: #245bd1;
  --success: #176443;
  --success-bg: #e6f4eb;
  --warn: #704700;
  --warn-bg: #fff3d8;
  --danger: #9d2525;
  --danger-bg: #fceaea;
  --radius: 18px;
  --font: Geist, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; color: var(--ink); background: var(--bg); font: 14px/1.6 var(--font); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.625rem, 4vw, 2rem); letter-spacing: -.035em; line-height: 1.25; }
h2 { font-size: 1.125rem; line-height: 1.4; }
.muted, .lead { color: var(--muted); }
.lead { margin-top: 8px; font-size: .94rem; }
.small { font-size: .8125rem; }

.bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-inner, .main { width: min(100%, 1152px); margin-inline: auto; padding-inline: clamp(16px, 4vw, 48px); }
.bar-inner { display: flex; justify-content: space-between; align-items: center; gap: 8px 20px; min-height: 64px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 650; white-space: nowrap; }
.brand-mark { position: relative; width: 23px; height: 23px; flex: none; border-radius: 6px; background: var(--ink); }
.brand-mark::after { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--surface); content: ""; }
.account-nav, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.account-email { max-width: 260px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.account-nav [aria-current] { color: var(--ink); background: var(--soft); }

.main { padding-block: clamp(24px, 7vw, 88px) 56px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.entry { width: min(100%, 460px); margin-inline: auto; padding: clamp(20px, 5vw, 36px); box-shadow: 0 4px 16px rgba(0, 0, 0, .035); }
.entry-symbol { display: grid; width: 42px; height: 42px; margin-bottom: 18px; place-items: center; border-radius: 12px; background: var(--soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.pulse { animation: ink 1.3s ease-in-out infinite; }
@keyframes ink { 50% { transform: scale(.68); opacity: .48; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.entry-footer { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.usage dt { color: var(--muted); font-size: .8125rem; }
.usage dd { overflow-wrap: anywhere; font-weight: 650; font-variant-numeric: tabular-nums; }
.entry > .notice, .entry > .button { margin-top: 18px; }

.form { display: grid; gap: 8px; min-width: 0; }
.entry > .form { margin-top: 22px; }
.field { font-weight: 600; }
.field:not(:first-child) { margin-top: 4px; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.check-field input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.verification { display: grid; min-width: 0; justify-items: start; gap: 4px; margin-block: 6px; }
#turnstile-widget { width: 100%; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; gap: 8px; padding: 6px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; font-weight: 550; text-align: center; }
.button:hover:not(:disabled) { background: var(--soft); }
.button.primary { color: var(--surface); background: var(--ink); }
.button.primary:hover:not(:disabled) { background: #333; }
.button.secondary { border-color: var(--line-strong); background: var(--surface); }
.button.secondary:hover:not(:disabled) { background: var(--soft); }
.button.danger { color: var(--danger); }
.button.quiet { color: var(--muted); }
.button.wide { width: 100%; min-height: 44px; }
.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); overflow-wrap: anywhere; }
.notice.warning { color: var(--warn); border-color: #ecd49f; background: var(--warn-bg); }
.notice.danger { color: var(--danger); border-color: #eec4c4; background: var(--danger-bg); }
.notice.success { color: var(--success); border-color: #bcdcc9; background: var(--success-bg); }
.global-error { margin-bottom: 16px; }

.admin { display: grid; gap: 18px; }
.admin-title { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.table-panel { overflow: hidden; }
.table-panel > h2 { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.table-empty { padding: 18px; }
.table-scroll { max-width: 100%; overflow: auto; }
.table-scroll:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
th { color: var(--muted); background: #fafafa; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.amount, td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.ident { overflow-wrap: anywhere; }
.table-meta { display: block; color: var(--muted); font-size: .75rem; white-space: normal; }
.row-actions { display: flex; align-items: center; gap: 4px; min-width: max-content; }
.row-actions > button { min-height: 34px; padding-inline: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; color: var(--muted); background: var(--soft); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.active { color: var(--success); background: var(--success-bg); }

.dialog { width: min(calc(100% - 32px), 448px); max-height: calc(100dvh - 32px); margin: auto; padding: 22px; color: var(--ink); }
.dialog::backdrop { background: rgba(0, 0, 0, .37); }
.dialog .form { gap: 10px; }
.dialog-actions { justify-content: flex-end; margin-top: 8px; }
.noscript { position: fixed; inset: auto 16px 16px; }

@media (max-width: 640px) {
  .bar-inner { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 12px; }
  .account-nav { justify-content: flex-start; }
  .account-email { width: 100%; }
  .account-nav .button:first-of-type { margin-left: -12px; }
  .admin-title { align-items: flex-start; }
}
