/* OPENENGINE portal — the only stylesheet.
   Calm, high-contrast, mobile-first. Warm paper background, ink text, one deep-teal accent,
   big rounded numerals for traffic. System CJK fonts on purpose (webfonts are blocked/slow in
   mainland China and CJK font files are megabytes). Dark mode follows the device setting. */

:root {
  --bg: #f3f2ee;
  --bg-glow: rgba(14, 124, 107, .08);
  --topbar: rgba(243, 242, 238, .86);
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #ecebe6;
  --ink: #14171b;
  --ink-2: #474d56;
  --ink-3: #777d86;
  --line: #e4e2dc;
  --line-2: #d2cfc7;
  --brand: #0e7c6b;
  --brand-hover: #0a6a5b;
  --brand-ink: #ffffff;
  --brand-soft: #dff1ec;
  --brand-text: #0a6656;
  --brand-glow: rgba(14, 124, 107, .55);
  --ok: #157a3a;
  --ok-soft: #dcf4e3;
  --warn: #9a5408;
  --warn-soft: #fcefd3;
  --warn-bar: #e59a12;
  --bad: #b42318;
  --bad-soft: #fde5e2;
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 23, 27, .04), 0 12px 32px -16px rgba(20, 23, 27, .16);
  --shadow-lg: 0 28px 70px -24px rgba(20, 23, 27, .42);
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "PingFang SC", "Hiragino Sans GB",
          "Microsoft JhengHei", "Microsoft YaHei", "Noto Sans TC", "Noto Sans SC",
          "Noto Sans CJK TC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont,
              "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1113;
    --bg-glow: rgba(43, 179, 155, .10);
    --topbar: rgba(14, 17, 19, .82);
    --surface: #161a1d;
    --surface-2: #1b2023;
    --surface-3: #22292d;
    --ink: #eef1f2;
    --ink-2: #b4bbc1;
    --ink-3: #848c93;
    --line: #283035;
    --line-2: #363f45;
    --brand: #2bb39b;
    --brand-hover: #38c6ad;
    --brand-ink: #04211c;
    --brand-soft: #133a33;
    --brand-text: #63d8c2;
    --brand-glow: rgba(43, 179, 155, .45);
    --ok: #4ade80;
    --ok-soft: #12301d;
    --warn: #f4b04c;
    --warn-soft: #382910;
    --warn-bar: #f4b04c;
    --bad: #f87171;
    --bad-soft: #3a1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .6);
    --shadow-lg: 0 28px 70px -24px rgba(0, 0, 0, .8);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg) radial-gradient(1100px 520px at 50% -220px, var(--bg-glow), transparent 72%) no-repeat;
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
main { flex: 1; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid rgba(14, 124, 107, .45); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
b, strong { font-weight: 700; }
form { margin: 0; }
.ic { display: inline-block; flex: none; vertical-align: -.2em; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: 14px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-sm { margin-top: 10px; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.wrap-mid { max-width: 920px; }
.wrap-wide { max-width: 1200px; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--topbar);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { display: flex; align-items: center; gap: 10px; height: 62px; }
.spacer { flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 15px; letter-spacing: .14em; }
.brand:hover { text-decoration: none; }
.brand .mark { flex: none; }
.brand-tag { margin-left: 2px; }
main { padding-top: 8px; padding-bottom: 40px; }
.foot { text-align: center; color: var(--ink-3); font-size: 14px; padding-top: 8px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.foot a { color: var(--ink-2); }
.foot .sep { margin: 0 10px; opacity: .6; }

/* language switch */
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-3); }
.lang a { min-width: 36px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-3); }
.lang a:hover { text-decoration: none; color: var(--ink); }
.lang a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- headings ---------- */
.page-head { margin: 22px 0 22px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { margin-top: 8px; color: var(--ink-2); }
.page-head.center { text-align: center; }
.page-head .sub-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 6px; color: var(--ink-2); font-size: 16px; font-weight: 600; }
.back:hover { color: var(--ink); text-decoration: none; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-head h2 { font-size: 20px; font-weight: 800; }
.h2 { font-size: 22px; font-weight: 800; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.card.flat { box-shadow: none; }

/* traffic hero */
.hero { padding: 24px 22px 22px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, var(--bg-glow), transparent 70%); pointer-events: none;
}
.hero .label { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--ink-2); }
.big {
  font-family: var(--font-num); font-weight: 700; font-size: clamp(50px, 15vw, 68px); line-height: 1.02;
  letter-spacing: -.025em; font-variant-numeric: tabular-nums; margin: 8px 0 16px; color: var(--ink);
}
.big small { font-size: .4em; font-weight: 700; letter-spacing: 0; color: var(--ink-2); margin-left: 8px; }
.big.dim { color: var(--ink-3); }
.meter { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.meter.warn > i { background: var(--warn-bar); }
.meter.bad > i { background: var(--bad); }
.meter.mini { height: 6px; }
.meter-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.meter-row b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.hero .notice { margin: 18px 0 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: var(--radius-md); border: 1.5px solid transparent;
  font: 700 17px/1.1 var(--font); cursor: pointer; text-decoration: none; text-align: center;
  -webkit-user-select: none; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 10px 22px -12px var(--brand-glow); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: rgba(180, 35, 24, .35); }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger-solid { background: var(--bad); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 58px; font-size: 18px; border-radius: 16px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 11px; gap: 6px; }
.btn-xs { min-height: 34px; padding: 0 11px; font-size: 14px; border-radius: 9px; gap: 5px; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 150px; }
.text-danger { color: var(--bad); }
.btn-ghost.text-danger:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.input {
  width: 100%; min-height: 54px; padding: 0 16px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 400 17px var(--font); -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 124, 107, .16); }
.input::placeholder { color: var(--ink-3); }
.input-sm { min-height: 40px; font-size: 16px; padding: 0 12px; border-radius: 11px; }
.static-field { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; border-radius: var(--radius-md); background: var(--surface-2); border: 1.5px dashed var(--line-2); font-weight: 700; }
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; border-radius: var(--radius-md); border: 1.5px solid var(--line-2); font-weight: 700; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.choice input:focus-visible + span { box-shadow: 0 0 0 4px rgba(14, 124, 107, .2); }
.form-link { margin-top: 16px; text-align: center; font-size: 15px; }
.form-foot { margin-top: 18px; text-align: center; color: var(--ink-2); font-size: 16px; }
.hint { color: var(--ink-3); font-size: 14px; margin-top: 10px; }

/* auth pages */
.auth { max-width: 420px; margin: 4vh auto 0; }
.auth .card { padding: 26px 22px; }
.status-card { text-align: center; padding: 34px 24px 26px; }
.status-card .h2 { margin-top: 16px; }
.status-card p { margin-top: 10px; color: var(--ink-2); }
.status-card .btn { margin-top: 24px; }
.badge-ico { width: 64px; height: 64px; margin: 0 auto; border-radius: 22px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.badge-ico.ok { background: var(--ok-soft); color: var(--ok); }
.badge-ico.warn { background: var(--warn-soft); color: var(--warn); }
.badge-ico.bad { background: var(--bad-soft); color: var(--bad); }
.email-chip { display: inline-block; margin-top: 12px; padding: 6px 14px; border-radius: 999px; background: var(--surface-3); font-weight: 700; word-break: break-all; color: var(--ink); }

/* ---------- notices ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-md); margin-bottom: 16px; background: var(--brand-soft); color: var(--brand-text); }
.notice > .ic { margin-top: 3px; }
.notice b { display: block; font-size: 16px; color: inherit; }
.notice p { margin-top: 3px; color: var(--ink-2); font-size: 15px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice .btn { margin-top: 12px; }

/* ---------- status & tags ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status.on { color: var(--ok); }
.status.on::before { animation: pulse 2.2s infinite; }
.status.paused { color: var(--warn); }
.status.off { color: var(--bad); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 13px; font-weight: 700; white-space: nowrap; line-height: 1.5; }
.tag.brand { background: var(--brand-soft); color: var(--brand-text); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- device list ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 18px; color: var(--ink); border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
a.item:hover { background: var(--surface-2); text-decoration: none; }
.item .dev-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-text); }
.item.is-paused .dev-ico { background: var(--warn-soft); color: var(--warn); }
.item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .name { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 14px; color: var(--ink-3); }
.item .go { color: var(--ink-3); flex: none; }
.empty { text-align: center; padding: 34px 22px; }
.empty .badge-ico { background: var(--surface-3); color: var(--ink-3); width: 58px; height: 58px; border-radius: 18px; }
.empty b { display: block; margin-top: 14px; font-size: 18px; }
.empty p { margin-top: 6px; color: var(--ink-2); }

/* ---------- device page ---------- */
.qr-card { text-align: center; padding: 26px 22px 22px; }
.qr { display: inline-block; background: #fff; padding: 14px; border-radius: 24px; box-shadow: 0 0 0 1px var(--line), 0 20px 44px -22px rgba(20, 23, 27, .45); }
.qr img { display: block; width: min(264px, 66vw); height: auto; aspect-ratio: 1 / 1; }
.qr-hint { margin: 16px 0 18px; color: var(--ink-2); font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 22px 52px; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -3px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font: 800 17px/1 var(--font-num);
}
.steps > li::after { content: ""; position: absolute; left: 17.5px; top: 40px; bottom: 6px; width: 1.5px; background: var(--line-2); }
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps b { display: block; font-size: 18px; }
.steps p { margin-top: 4px; color: var(--ink-2); font-size: 15px; }
.app-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; }
.kv:first-of-type { border-top: 0; padding-top: 0; }
.kv > span:first-child { color: var(--ink-2); }
.kv b, .kv .num { font-variant-numeric: tabular-nums; }
pre.conf { margin: 0 0 12px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font: 13px/1.6 var(--font-mono); color: var(--ink-2); white-space: pre-wrap; word-break: break-all; }
.danger-zone { margin-top: 8px; }
@media (min-width: 860px) {
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
  .split > .card { margin-bottom: 0; }
  .split + .card, .split + section { margin-top: 18px; }
}

/* ---------- accordions ---------- */
details.acc { border-top: 1px solid var(--line); }
details.acc:first-of-type { border-top: 0; }
.card > details.acc:last-child { margin-bottom: -8px; }
details.acc > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 6px 0; font-weight: 700; cursor: pointer; -webkit-user-select: none; user-select: none;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-right: 6px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
details.acc[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.acc > div { padding: 0 0 18px; color: var(--ink-2); }
details.acc > div ol, details.acc > div ul { margin: 0; padding-left: 22px; }
details.acc > div li { margin: 4px 0; }
details.acc > div p + p { margin-top: 8px; }
.summary-left { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- records ---------- */
.rec { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rec:first-child { border-top: 0; }
.rec .amt { font: 800 18px var(--font-num); font-variant-numeric: tabular-nums; }
.rec .amt.minus { color: var(--warn); }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 14px 0 22px; border-radius: 14px; background: var(--surface-3); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 11px; color: var(--ink-2); font-weight: 700; font-size: 15px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font: 800 28px/1.15 var(--font-num); font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; display: block; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 42px; }
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.thead { display: none; }
.trow {
  display: grid; gap: 12px 14px; padding: 18px; border-top: 1px solid var(--line); align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "a s" "t t" "d d" "x x";
}
.table > .trow:first-of-type, .thead + .trow { border-top: 0; }
.trow:target { background: var(--brand-soft); }
.c-a { grid-area: a; min-width: 0; }
.c-s { grid-area: s; justify-self: end; }
.c-t { grid-area: t; min-width: 0; }
.c-d { grid-area: d; min-width: 0; }
.c-x { grid-area: x; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.c-a b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-a .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.c-t .nums { font-size: 15px; font-variant-numeric: tabular-nums; }
.c-t .meter { margin: 7px 0 4px; }
.c-d { font-size: 15px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.addq { display: flex; gap: 6px; align-items: center; }
.addq .input { width: 86px; }
.dev-table .trow { grid-template-areas: "a s" "o o" "t t" "x x"; }
.dev-table .c-o { grid-area: o; min-width: 0; font-size: 15px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-table .trow { grid-template-areas: "a s" "t t" "x x"; }
@media (min-width: 1100px) {
  .thead { display: grid; gap: 14px; padding: 12px 18px; font-size: 13px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
  .acct-table .thead, .acct-table .trow { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 92px 96px 472px; grid-template-areas: "a t s d x"; }
  .acct-table .c-x { flex-wrap: nowrap; }
  .dev-table .thead, .dev-table .trow { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) 104px minmax(0, 1fr) 292px; grid-template-areas: "a o s t x"; }
  .dev-table .c-x { flex-wrap: nowrap; }
  .rec-table .thead, .rec-table .trow { grid-template-columns: 150px minmax(0, 1.4fr) 110px minmax(0, 1.6fr); grid-template-areas: "a t s x"; }
  .c-s { justify-self: start; }
}

/* popover menu (details) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 270px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.menu-pop .menu-form { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-pop .menu-form label { display: block; font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.menu-pop .row { display: flex; gap: 8px; }
.menu-pop .row .input { flex: 1; min-width: 0; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 600 15px var(--font); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover { background: var(--bad-soft); }

.create-card > summary { list-style: none; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; cursor: pointer; min-height: 30px; }
.create-card > summary::-webkit-details-marker { display: none; }
.create-card > summary .plus { margin-left: auto; color: var(--ink-3); transition: transform .2s; }
.create-card[open] > summary .plus { transform: rotate(45deg); }
.create-form { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 720px) { .create-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; } .create-form .field { margin: 0; } }

/* ---------- dialog / toast ---------- */
dialog.confirm { border: 0; padding: 0; border-radius: 24px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.confirm::backdrop { background: rgba(12, 15, 17, .48); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.confirm[open] { animation: pop .18s cubic-bezier(.2, .8, .2, 1); }
.dlg-body { padding: 26px 24px 6px; }
.dlg-body h3 { font-size: 20px; font-weight: 800; }
.dlg-body p { margin-top: 10px; color: var(--ink-2); white-space: pre-line; }
.dlg-actions { display: flex; gap: 10px; padding: 20px 24px 24px; }
.dlg-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 100;
  transform: translate(-50%, 12px); max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s, visibility .2s, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21, 122, 58, .45); } 70% { box-shadow: 0 0 0 7px rgba(21, 122, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(21, 122, 58, 0); } }
.reveal > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.reveal > *:nth-child(2) { animation-delay: .05s; }
.reveal > *:nth-child(3) { animation-delay: .10s; }
.reveal > *:nth-child(4) { animation-delay: .15s; }
.reveal > *:nth-child(5) { animation-delay: .20s; }
.reveal > *:nth-child(n+6) { animation-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 400px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .card { padding: 20px 18px; }
  .hide-xs { display: none; }
  .brand { letter-spacing: .1em; font-size: 14px; }
}
