:root {
  color-scheme: light dark;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --page: #f8f8fb;
  --surface: #fff;
  --subtle: #f1f1f7;
  --ink: #282939;
  --muted: #77798f;
  --line: #e1e1ed;
  --accent: #7145f4;
  --accent-soft: #eee8ff;
  --error: #ba2d45;
  --shadow: 0 12px 42px #24213e16;
}
@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) {
    --page: #14151e; --surface: #20212e; --subtle: #191a26;
    --ink: #f0eff8; --muted: #a6a4ba; --line: #343446;
    --accent: #ad91ff; --accent-soft: #33264e; --error: #ff9db0;
    --shadow: 0 12px 42px #0005;
  }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
  --page: #14151e; --surface: #20212e; --subtle: #191a26;
  --ink: #f0eff8; --muted: #a6a4ba; --line: #343446;
  --accent: #ad91ff; --accent-soft: #33264e; --error: #ff9db0;
  --shadow: 0 12px 42px #0005;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 1000px; min-height: 100vh; color: var(--ink); background: var(--page); }
button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
button { color: inherit; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.topbar { min-height: 94px; display: flex; align-items: center; justify-content: flex-end; gap: 26px; padding: 8px 32px; border-bottom: 1px solid var(--line); }
.wallet-button { display: flex; align-items: center; gap: 14px; border: 0; background: transparent; padding: 5px 0; text-align: left; color: var(--muted); }
.wallet-icon { width: 28px; height: 28px; }
.wallet-copy { display: grid; gap: 4px; font-size: 17px; line-height: 26px; white-space: nowrap; }
.wallet-copy strong { font-size: 22px; font-weight: 600; color: var(--ink); }
.theme-switch { display: flex; padding: 4px; border: 1px solid var(--line); background: var(--subtle); border-radius: 13px; }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 101px; height: 56px; padding: 0 15px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 19px; }
.theme-switch button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 2px 5px #20203b12; }
.theme-switch button:hover { color: var(--ink); }
.bill-shortcut { display: grid; place-items: center; width: 56px; height: 60px; padding: 0; border: 1px solid var(--accent); border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.bill-shortcut .icon { width: 28px; height: 28px; }
.bill-shortcut:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 16px; min-height: 76px; cursor: pointer; list-style: none; border-radius: 10px; }
.account-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 15px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.account-copy { display: grid; align-content: center; gap: 4px; min-width: 90px; max-width: 160px; }
.account-copy strong { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; font-weight: 600; line-height: 26px; }
.chevron-icon { width: 19px; height: 19px; color: var(--muted); }
.account-menu[open] .chevron-icon { transform: rotate(180deg); }
.account-popover { position: absolute; z-index: 10; right: 0; top: calc(100% + 9px); width: 248px; border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: var(--surface); box-shadow: var(--shadow); }
.account-identity { display: grid; gap: 5px; padding: 12px 12px 16px; margin-bottom: 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.account-popover > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.account-popover > button:hover { background: var(--subtle); }
.account-popover > button .icon { width: 20px; height: 20px; color: var(--muted); }
.inline-error { color: var(--error); font-size: 13px; line-height: 1.6; margin: 8px 12px; }
#workspace { min-height: calc(100vh - 94px); }
.connection-state { margin-top: 24vh; color: var(--muted); text-align: center; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - 94px); padding: 60px 0 110px; }
.login-form { width: 392px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 6px 30px #29234206; }
.login-form h1 { margin: 0; font-size: 25px; font-weight: 600; letter-spacing: -.5px; }
.login-description { margin: 10px 0 30px; color: var(--muted); font-size: 14px; }
.login-form label { display: block; margin: 19px 0 8px; font-size: 14px; font-weight: 500; }
.login-form input { display: block; width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: var(--page); }
.login-error { min-height: 40px; margin: 10px 0 8px; color: var(--error); font-size: 13px; line-height: 1.5; }
.primary-button { border: 1px solid transparent; border-radius: 9px; background: #7045ed; color: #fff; height: 46px; padding: 0 24px; font-weight: 500; }
.primary-button:hover { background: #6034d9; }
.login-submit { width: 100%; }
.password-form { width: min(420px, calc(100vw - 32px)); }
.password-form .login-description { line-height: 1.7; margin-bottom: 20px; }
.password-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.password-cancel { width: 100%; margin-top: 12px; }
#login-error[data-success="true"] { color: var(--ink); }
dialog { width: 820px; max-height: calc(100vh - 100px); padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: #10101f66; overflow: hidden; overscroll-behavior: contain; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.dialog-header h2 { margin: 0; font-size: 23px; font-weight: 600; }
.dialog-header p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { color: var(--ink); background: var(--subtle); }
.billing-balances { display: flex; gap: 64px; padding: 26px 0; margin: 16px 0 0; border-bottom: 1px solid var(--line); }
.billing-balances > div { display: grid; gap: 8px; }
.billing-balances > div > span { color: var(--muted); font-size: 14px; }
.billing-balances strong { font-size: 25px; font-weight: 600; }
.billing-balances small { font-size: 14px; font-weight: 400; color: var(--muted); }
.billing-status { padding: 40px 0; color: var(--muted); text-align: center; }
.billing-status:empty { display: none; }
.billing-status[data-error="true"] { color: var(--error); }
.billing-table { overflow: auto; max-height: 430px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; }
th, td { padding: 17px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:nth-child(n+3), td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.dialog-footer { display: flex; justify-content: center; gap: 12px; }
.dialog-footer:has(button:not([hidden])) { padding-top: 20px; }
.secondary-button { height: 38px; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.secondary-button:hover { background: var(--subtle); }
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms ease, box-shadow 120ms ease; }
}
