/* ============================================================
   MZNOVA Management on the web (mzadnova.com/team/)
   Same light-glass system as the public site (css/style.css):
   pale blue-gray wash, frosted white panels, dark ink for every
   button and the top bar, gold only for the brand. App rules kept:
   black outline icons, colored text badges for statuses, square
   avatars with initials on a black tile.
   ============================================================ */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --wash-a: #eef2f6;
  --wash-b: #dde5ec;
  --surface: rgba(252, 254, 255, 0.86);
  --surface-solid: #f8fafc;
  --well: rgba(240, 245, 249, 0.85);
  --ink: #171b26;
  --ink-hover: #232837;
  --text: #1e2432;
  --text-dim: #566274;
  --text-faint: #8a94a4;
  --line: rgba(23, 32, 51, 0.08);
  --line-strong: rgba(23, 32, 51, 0.14);
  --edge: rgba(255, 255, 255, 0.85);
  --gold: #a9741f;
  --gold-bright: #e8a33d;
  --shadow-card: 0 1px 2px rgba(23, 32, 51, 0.05), 0 10px 30px rgba(23, 32, 51, 0.08);
  --shadow-deep: 0 2px 4px rgba(23, 32, 51, 0.06), 0 18px 44px rgba(23, 32, 51, 0.16);
  --radius-panel: 22px;
  --radius-card: 16px;
  --radius-ui: 12px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --topbar: 60px;
  --sidebar: 264px;

  --green: #1f7a4e;   --green-bg: rgba(31, 122, 78, 0.11);
  --blue: #1d5fbf;    --blue-bg: rgba(29, 95, 191, 0.10);
  --orange: #b35c00;  --orange-bg: rgba(214, 120, 0, 0.12);
  --red: #b42318;     --red-bg: rgba(180, 35, 24, 0.10);
  --gray: #5b6575;    --gray-bg: rgba(23, 32, 51, 0.07);
  --teal: #0d7c86;    --teal-bg: rgba(13, 124, 134, 0.11);
  --indigo: #4b46c2;  --indigo-bg: rgba(75, 70, 194, 0.11);
  --purple: #7a3fb0;  --purple-bg: rgba(122, 63, 176, 0.11);
  --brown: #7d5a3c;   --brown-bg: rgba(125, 90, 60, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(168deg, var(--wash-a) 0%, var(--wash-b) 70%, #d5dfe8 100%) fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.has-overlay { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 3px solid rgba(23, 32, 51, 0.35); outline-offset: 2px; border-radius: 6px; }

.icon { flex-shrink: 0; display: block; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.right { text-align: right; }
.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; color: var(--ink); }
.small { font-size: 0.86rem; }

/* ---------------- Brand ---------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; color: #fff; }
.brand img { width: 28px; height: auto; }
.brand-word { font-size: 0.98rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.brand-word .dim { color: rgba(255, 255, 255, 0.58); font-weight: 500; }

.lang-btn {
  height: 34px; min-width: 46px; padding: 0 12px;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 0.86rem; font-weight: 600;
}
.lang-btn:hover { background: rgba(255, 255, 255, 0.18); }

/* ---------------- Sign-in / lock screen ---------------- */
.lock-screen { min-height: 100vh; display: flex; flex-direction: column; }
.lock-top { background: var(--ink); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.lock-top-inner {
  max-width: 1180px; margin: 0 auto; height: 64px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.lock-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px 64px; gap: 22px; }
.lock-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--edge); border-radius: var(--radius-panel); box-shadow: var(--shadow-card);
  padding: 36px 32px 30px;
}
.lock-badge {
  width: 48px; height: 48px; border-radius: 14px; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.lock-title { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; }
:root[lang^="zh"] .lock-title { letter-spacing: 0; }
.lock-sub { margin: 8px 0 22px; color: var(--text-dim); font-size: 0.98rem; }
.lock-form { display: flex; flex-direction: column; gap: 4px; }
.lock-form .btn-block { margin-top: 8px; }
.lock-note { margin-top: 14px; font-size: 0.84rem; color: var(--text-faint); text-align: center; }
.lock-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: 0.92rem; }
.lock-back:hover { color: var(--ink); }
.form-error, .form-info {
  margin: 0 0 16px; padding: 11px 14px; border-radius: var(--radius-ui); font-size: 0.92rem;
}
.form-error { background: var(--red-bg); border: 1px solid rgba(180, 35, 24, 0.25); color: #8f1d13; }
.form-info { background: var(--well); border: 1px solid var(--line); color: var(--text); }
.loading-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loading-mark { width: 40px; height: auto; }
.loading-text { color: var(--text-dim); }
.loading-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--ink);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Shell ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--topbar);
  background: var(--ink); color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; }
.topbar-spacer { flex: 1; }
.menu-toggle {
  display: none; position: relative; width: 40px; height: 40px; border-radius: 10px; color: #fff;
  align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08);
}
.menu-toggle .dot, .btn .dot {
  position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: #e5484d; box-shadow: 0 0 0 2px var(--ink);
}
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 550; color: rgba(255, 255, 255, 0.86); border: 1px solid rgba(255, 255, 255, 0.16);
  max-width: 42vw;
}
.sync-pill .sync-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-pill.is-busy .icon { animation: spin 1.4s linear infinite; }
.sync-pill.is-warn { color: #ffd59a; border-color: rgba(255, 213, 154, 0.4); }
.user-btn { border-radius: 9px; display: flex; }
.user-btn .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }

.shell-body { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
.sidebar {
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar));
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.55); border-right: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.nav-scroll { flex: 1; overflow-y: auto; padding: 14px 12px 8px; }
.nav-section + .nav-section { margin-top: 12px; }
.nav-heading {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint); padding: 6px 12px;
}
:root[lang^="zh"] .nav-heading { letter-spacing: 0.04em; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 520; font-size: 0.95rem;
}
.nav-link:hover { background: rgba(23, 32, 51, 0.05); }
.nav-link[aria-current="page"] { background: var(--ink); color: #fff; }
.nav-count {
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: #e5484d; color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.nav-user { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.nav-user-card { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; }
.nav-user-card:hover { background: rgba(23, 32, 51, 0.05); }
.nav-user-text { display: flex; flex-direction: column; min-width: 0; }
.nav-user-name { font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-role { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-actions { display: flex; gap: 8px; }
.nav-user-actions .btn { flex: 1; justify-content: center; }
.drawer-backdrop { display: none; }

.main { min-width: 0; outline: none; }

/* ---------------- Page ---------------- */
.page { max-width: 1120px; margin: 0 auto; padding: 26px 28px 80px; }
.page-wide { max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-titles { min-width: 0; }
.page-title { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; overflow-wrap: anywhere; }
:root[lang^="zh"] .page-title { letter-spacing: 0; }
.page-sub { margin-top: 4px; color: var(--text-dim); }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: 0.9rem; color: var(--text-dim); margin-bottom: 6px; }
.back-link:hover { color: var(--ink); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.page-toolbar .search { flex: 1 1 240px; }
.page-body { display: flex; flex-direction: column; gap: 22px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.columns > * { min-width: 0; display: flex; flex-direction: column; gap: 22px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-ui);
  font-size: 0.93rem; font-weight: 600; white-space: nowrap; position: relative;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 2px 6px rgba(23, 32, 51, 0.22); }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); }
.btn-ghost { background: rgba(255, 255, 255, 0.82); border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: #fff; border-color: rgba(23, 32, 51, 0.24); }
.btn-danger { background: #fff; border: 1px solid rgba(180, 35, 24, 0.35); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-plain { color: var(--ink); }
.btn-plain:hover:not(:disabled) { background: rgba(23, 32, 51, 0.06); }
.topbar .btn-plain { color: #fff; }
.btn-link { color: var(--ink); padding-left: 0; padding-right: 0; text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 40px; }
.btn-sm.btn-icon { min-width: 32px; padding: 5px; }
.text-link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.text-link:hover { text-decoration-color: var(--ink); }

/* ---------------- Badges & tones ---------------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 650; white-space: nowrap; line-height: 1.5;
}
.tone-green { color: var(--green); background: var(--green-bg); }
.tone-blue { color: var(--blue); background: var(--blue-bg); }
.tone-orange { color: var(--orange); background: var(--orange-bg); }
.tone-red { color: var(--red); background: var(--red-bg); }
.tone-gray, .tone-secondary { color: var(--gray); background: var(--gray-bg); }
.tone-teal { color: var(--teal); background: var(--teal-bg); }
.tone-indigo { color: var(--indigo); background: var(--indigo-bg); }
.tone-purple { color: var(--purple); background: var(--purple-bg); }
.tone-brown { color: var(--brown); background: var(--brown-bg); }
.tone-ink { color: #fff; background: var(--ink); }
.tone-gold { color: #7a5214; background: rgba(232, 163, 61, 0.18); }
.tone-text-green { color: var(--green); }
.tone-text-blue { color: var(--blue); }
.tone-text-orange { color: var(--orange); }
.tone-text-red { color: var(--red); }
.tone-text-gray, .tone-text-secondary { color: var(--gray); }
.tone-text-teal { color: var(--teal); }
.tone-text-gold { color: var(--gold); }
.tone-bg-green { background: var(--green) !important; }
.tone-bg-blue { background: var(--blue) !important; }
.tone-bg-orange { background: #d97a06 !important; }
.tone-bg-red { background: var(--red) !important; }
.ink-label { display: inline-flex; align-items: center; gap: 6px; }
.ink-label .icon { color: var(--ink); }

/* ---------------- Stat cards ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.stat-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 16px 18px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-card);
}
.stat-card.is-link:hover { border-color: var(--line-strong); }
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.stat-label { font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.stat-value { font-size: 1.5rem; font-weight: 750; color: var(--ink); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 0.82rem; color: var(--text-faint); }

.hero {
  border-radius: var(--radius-panel); padding: 24px 26px; color: #eef1f5;
  background: linear-gradient(160deg, #1b2030, #14171f 70%);
  border-bottom: 4px solid var(--gold-bright); box-shadow: var(--shadow-deep);
}
.hero-label { font-size: 0.8rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-bright); }
.hero-title { font-size: 1.45rem; font-weight: 750; color: #fff; margin-top: 6px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 18px; }
.hero-stat-value { font-size: 1.5rem; font-weight: 750; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.hero-stat-label { font-size: 0.82rem; color: #aab2c0; }

/* ---------------- Groups & rows ---------------- */
.group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; min-height: 28px; }
.group-title { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
:root[lang^="zh"] .group-title { letter-spacing: 0.02em; }
.group-body {
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.group-body > * + * { border-top: 1px solid var(--line); }
.group-body > .pad { padding: 14px 16px; }
.group-foot { font-size: 0.82rem; color: var(--text-faint); padding: 0 6px; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; min-height: 52px; }
.row.is-link:hover { background: rgba(23, 32, 51, 0.035); }
.row-lead { flex-shrink: 0; display: flex; align-items: center; color: var(--ink); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.row-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.row-sub { color: var(--text-dim); font-size: 0.88rem; overflow-wrap: anywhere; }
.row-meta { color: var(--text-faint); font-size: 0.82rem; margin-top: 2px; overflow-wrap: anywhere; }
.row-trail { text-align: right; flex-shrink: 0; max-width: 45%; }
.row-trail-main { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.row-trail-sub { font-size: 0.82rem; color: var(--text-dim); }
.row-chevron { color: var(--text-faint); flex-shrink: 0; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 16px; align-items: baseline; }
.kv-label { color: var(--text-dim); flex-shrink: 0; max-width: 46%; }
.kv-value { color: var(--ink); text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; min-width: 0; }
.kv-value.wrap { text-align: left; }

.note { display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-ui); font-size: 0.9rem; background: var(--well); border: 1px solid var(--line); }
.note .icon { color: var(--ink); margin-top: 2px; }
.note-warn { background: var(--orange-bg); border-color: rgba(214, 120, 0, 0.25); color: #7a3f00; }
.note-error { background: var(--red-bg); border-color: rgba(180, 35, 24, 0.25); color: #8f1d13; }
.note-ok { background: var(--green-bg); border-color: rgba(31, 122, 78, 0.25); color: #1b5e3b; }

.text-block { padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------- Controls ---------------- */
.segmented {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--well);
  border: 1px solid var(--line); flex-wrap: wrap; max-width: 100%;
}
.seg { padding: 6px 13px; border-radius: 9px; font-size: 0.88rem; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.seg[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(23, 32, 51, 0.14); }
.segmented-sm .seg { padding: 4px 10px; font-size: 0.82rem; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.82); color: var(--ink);
}
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 42px; border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--line-strong); color: var(--text-dim);
}
.search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 32, 51, 0.1); }
.search-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 100%; color: var(--ink); }

.input, .select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-ui);
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--line-strong); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select { width: auto; padding-right: 30px; }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.45; }
.input:focus, .select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 32, 51, 0.1); }
.input:disabled { background: var(--well); color: var(--text-dim); }
.input-money { font-variant-numeric: tabular-nums; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: var(--radius-ui) 0 0 var(--radius-ui); }
.input-group .input:last-child { border-radius: 0 var(--radius-ui) var(--radius-ui) 0; }
.input-prefix, .input-suffix {
  display: flex; align-items: center; padding: 0 11px; background: var(--well); border: 1px solid var(--line-strong);
  color: var(--text-dim); font-size: 0.9rem;
}
.input-prefix { border-right: 0; border-radius: var(--radius-ui) 0 0 var(--radius-ui); }
.input-suffix { border-left: 0; border-radius: 0 var(--radius-ui) var(--radius-ui) 0; }

.switch {
  appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px;
  background: rgba(23, 32, 51, 0.18); position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.check { width: 20px; height: 20px; accent-color: var(--ink); }

.progress { height: 8px; border-radius: 999px; background: rgba(23, 32, 51, 0.09); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--ink); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
  background: var(--ink); color: #fff; font-weight: 700; letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 46px 20px; color: var(--ink); }
.empty-title { font-weight: 700; font-size: 1.05rem; }
.empty-text { color: var(--text-dim); max-width: 32rem; }
.empty .btn { margin-top: 8px; }

/* ---------------- Forms ---------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid > .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.req { color: var(--red); }
.field-hint { font-size: 0.8rem; color: var(--text-faint); }
.field-error { font-size: 0.82rem; color: var(--red); min-height: 0; }
.field-error:empty { display: none; }
.has-error .input { border-color: rgba(180, 35, 24, 0.6); }
.field-toggle .toggle-label { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 600; color: var(--ink); font-size: 0.92rem; cursor: pointer; }
.static-value { padding: 9px 0; color: var(--ink); overflow-wrap: anywhere; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); background: rgba(240, 245, 249, 0.6); }
.table td.num, .table th.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--line-strong); }

/* ---------------- Overlays ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 18, 27, 0.42);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 620px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: #f7f9fb; border-radius: var(--radius-panel); box-shadow: var(--shadow-deep);
  animation: sheet-in 0.18s ease-out;
}
.sheet-wide { max-width: 900px; }
.sheet.dialog { max-width: 440px; }
@keyframes sheet-in { from { transform: translateY(10px); opacity: 0.6; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 22px; }
.sheet-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 6px 22px 18px; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dialog-text { color: var(--text-dim); white-space: pre-wrap; }

.popmenu-backdrop { position: fixed; inset: 0; z-index: 300; }
.popmenu {
  position: fixed; min-width: 200px; max-width: 320px; padding: 6px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-deep);
}
.popmenu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; text-align: left; color: var(--ink); font-weight: 520; }
.popmenu-item:hover:not(:disabled), .popmenu-item:focus { background: rgba(23, 32, 51, 0.06); outline: none; }
.popmenu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.popmenu-item.is-danger { color: var(--red); }
.popmenu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-deep); font-size: 0.92rem; transition: opacity 0.3s, transform 0.3s; pointer-events: auto; }
.toast-error { background: #8f1d13; }
.toast-success { background: #1b5e3b; }
.toast.is-out { opacity: 0; transform: translateY(6px); }

/* ---------------- Module bits shared by several screens ---------------- */
.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.big-number { font-size: 2.2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer { font-size: 2.6rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 16px 16px 0; }
.bar-chart .bar { flex: 1; background: var(--ink); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-labels { display: flex; gap: 6px; padding: 6px 16px 14px; }
.bar-labels span { flex: 1; text-align: center; font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1023px) {
  .menu-toggle { display: inline-flex; }
  .shell-body { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; z-index: 120;
    width: min(320px, 85vw); background: #f4f7fa; box-shadow: var(--shadow-deep);
    transform: translateX(-105%); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-top: env(safe-area-inset-top);
  }
  .drawer-open .sidebar { transform: none; }
  .drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(15, 18, 27, 0.4); }
  .drawer-open { overflow: hidden; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand-word { display: none; }
  .sync-pill { padding: 0 9px; }
  .sync-pill .sync-text { display: none; }
  .page { padding: 18px 16px 72px; }
  .page-title { font-size: 1.4rem; }
  .page-actions { width: 100%; }
  .columns { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 1.25rem; }
  .overlay { padding: 0; align-items: flex-end; }
  .sheet, .sheet-wide, .sheet.dialog { max-width: none; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .sheet-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1; }
  .kv { flex-direction: column; gap: 2px; align-items: stretch; }
  .kv-label { max-width: none; font-size: 0.85rem; }
  .kv-value { text-align: left; }
  .row-trail { max-width: 40%; }
  .lock-card { padding: 28px 22px 24px; }
  .hero { padding: 20px; }
}

@media (max-width: 380px) {
  .stat-card { padding: 11px 12px; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; }
  .topbar, .sidebar, .page-actions, .page-toolbar, .back-link, .toasts { display: none !important; }
  .shell-body { display: block; }
  .page { padding: 0; max-width: none; }
  .group-body, .stat-card { box-shadow: none; border-color: #ccc; }
}

.noscript { padding: 24px; }
