/* ============================================================
   Meridian Clientele — shared design system
   Themes: landing (dark/gold) · personal (warm/editorial) · admin (deep navy)
   ============================================================ */

:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(11, 27, 46, .06), 0 6px 18px rgba(11, 27, 46, .05);
  --shadow-lg: 0 24px 60px rgba(11, 27, 46, .18);

  --gold: #c29b45;
  --gold-soft: #e6c987;
  --ok: #1f7a54;
  --warn: #b7791f;
  --bad: #b23b3b;
}

/* ---------- personal theme (default) ---------- */
body[data-theme="personal"] {
  --bg: #f4efe6;
  --bg-tint: #ebe3d5;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --ink: #13212f;
  --ink-soft: #40505f;
  --muted: #7c8794;
  --line: #e2d9c9;
  --accent: #0e6b52;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ea;
  --nav-bg: #13212f;
  --nav-ink: #d9dfe6;
  --nav-ink-active: #ffffff;
  --nav-active: rgba(194, 155, 69, .18);
  --chip: #f1e9db;
}

/* ---------- admin theme ---------- */
body[data-theme="admin"] {
  --bg: #0a1220;
  --bg-tint: #0d1828;
  --surface: #122036;
  --surface-2: #17293f;
  --ink: #e8eef7;
  --ink-soft: #b9c7d8;
  --muted: #8ca0b6;
  --line: #223552;
  --accent: #e0b457;
  --accent-ink: #0a1220;
  --accent-soft: rgba(224, 180, 87, .16);
  --nav-bg: #0d1828;
  --nav-ink: #a8b8cb;
  --nav-ink-active: #ffffff;
  --nav-active: rgba(224, 180, 87, .14);
  --chip: #1b2c44;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .5);
}

/* ---------- landing theme ---------- */
body[data-theme="landing"] {
  --bg: #08111e;
  --surface: #101d2e;
  --ink: #f2f6fb;
  --muted: #93a5bb;
  --line: #1e3149;
  --accent: var(--gold);
  --accent-ink: #08111e;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 3.4vw, 40px); }
h2 { font-size: clamp(22px, 2.4vw, 28px); }
h3 { font-size: 19px; }
p  { margin: 0 0 1em; }
code { font-family: var(--font-mono); font-size: .92em; }

.mono, .amount, .figure {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny  { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.right { text-align: right; }
.hidden { display: none !important; }

/* ============ reveal motion ============ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s cubic-bezier(.22, .9, .28, 1); }
.reveal.is-visible { opacity: 1; transform: none; }
.stagger > * { opacity: 0; animation: fadeUp .55s cubic-bezier(.22, .9, .28, 1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .11s; }
.stagger > *:nth-child(3) { animation-delay: .18s; }
.stagger > *:nth-child(4) { animation-delay: .25s; }
.stagger > *:nth-child(5) { animation-delay: .32s; }
.stagger > *:nth-child(6) { animation-delay: .39s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ============ app shell ============ */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .24s ease; }
.sidebar {
  background: var(--nav-bg);
  color: var(--nav-ink);
  padding: 26px 18px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform .24s ease, visibility .24s ease;
}
body.sidebar-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); visibility: hidden; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, var(--gold), #8c6b24);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 19px; color: #12202f; font-weight: 600;
}
.brand-name { font-family: var(--font-display); font-size: 18px; color: var(--nav-ink-active); line-height: 1.15; }
.brand-sub { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }

.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10.5px; letter-spacing: .17em; text-transform: uppercase; color: rgba(255, 255, 255, .32); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13.6px; font-weight: 600; color: var(--nav-ink);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--nav-ink-active); transform: translateX(3px); }
.nav-item.is-active { background: var(--nav-active); color: var(--nav-ink-active); box-shadow: inset 2px 0 0 var(--gold); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: .55; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 18px 34px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-family: var(--font-display); font-size: 21px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.sidebar-toggle:hover { background: var(--surface-2); border-color: var(--muted); }
.sidebar-toggle:active { transform: scale(.97); }
.sidebar-toggle:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.sidebar-toggle-bars,
.sidebar-toggle-bars::before,
.sidebar-toggle-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; content: ''; position: relative;
}
.sidebar-toggle-bars::before { position: absolute; top: -6px; }
.sidebar-toggle-bars::after { position: absolute; top: 6px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  border: 1px solid var(--line);
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.user-chip .name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.user-chip .role { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.content { padding: 32px 34px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.page-head .eyebrow { font-size: 11px; letter-spacing: .19em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.page-head p { color: var(--muted); max-width: 62ch; margin: 0; }

/* ============ cards & grid ============ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head h3 { margin: 0; }
.card-tight { padding: 16px 18px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }

/* ============ stat tiles ============ */
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 18px;
}
.stat::after {
  content: ''; position: absolute; inset: auto -30% -60% auto;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  opacity: .8; pointer-events: none;
}
.stat .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-family: var(--font-display); font-size: 27px; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--muted); }
.stat-accent { background: linear-gradient(150deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 62%, #000) 100%); color: var(--accent-ink); border-color: transparent; }
.stat-accent .label, .stat-accent .delta { color: color-mix(in srgb, var(--accent-ink) 72%, transparent); }
.stat-accent .value { color: var(--accent-ink); }

/* ============ balance hero ============ */
.balance-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #13212f 0%, #1c3550 58%, #24506e 100%);
  color: #eef3f8; border-radius: 18px; padding: 30px 32px;
  box-shadow: var(--shadow-lg);
}
.balance-hero::before {
  content: ''; position: absolute; inset: -40% -10% auto auto; width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(224, 180, 87, .3), transparent 65%);
  pointer-events: none;
}
.balance-hero .label { font-size: 11px; letter-spacing: .19em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.balance-hero .value { font-family: var(--font-display); font-size: clamp(34px, 5vw, 50px); margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.balance-hero .meta { color: rgba(255, 255, 255, .62); font-size: 13px; }
.balance-hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 22px; border-radius: 999px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 800;
  letter-spacing: .015em; border: 1px solid transparent; cursor: pointer;
  transition: transform .16s ease, background .2s ease, color .2s ease, box-shadow .2s ease, letter-spacing .3s ease;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 28%, transparent); letter-spacing: .05em; }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-dark { background: #13212f; color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-gold { background: var(--gold); color: #12202f; }
.btn-sm { padding: 7px 15px; font-size: 12.2px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============ forms ============ */
.field { margin-bottom: 17px; }
.field label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-body); font-size: 14.5px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
body[data-theme="personal"] .field input,
body[data-theme="personal"] .field select,
body[data-theme="personal"] .field textarea { background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.field textarea { min-height: 110px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.field .error { font-size: 12px; color: var(--bad); margin-top: 6px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--ink-soft); }
.checkbox input { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--accent); }
.amount-input { position: relative; }
.amount-input .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--font-mono); }
.amount-input input { padding-left: 36px; font-family: var(--font-mono); font-size: 17px; }

.strength { height: 5px; border-radius: 99px; background: var(--line); margin-top: 9px; overflow: hidden; }
.strength::after { content: ''; display: block; height: 100%; width: 0; border-radius: 99px; background: var(--bad); transition: width .3s ease, background .3s ease; }
.strength[data-score="2"]::after { width: 50%; background: var(--warn); }
.strength[data-score="3"]::after { width: 75%; background: #6c9a3f; }
.strength[data-score="4"]::after { width: 100%; background: var(--ok); }

/* ============ filters ============ */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-2); margin-bottom: 18px;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field input, .filters .field select { padding: 9px 12px; }

/* ============ tables ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.6px; }
table.data th {
  text-align: left; padding: 13px 16px;
  font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .16s ease; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.right, table.data th.right { text-align: right; }
.cell-title { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.row-link { cursor: pointer; }
.ticket-tabs .chip { border-radius: 4px; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; font-family: var(--font-display); font-size: 18px; color: var(--ink); margin-bottom: 6px; }

/* ============ badges & chips ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok      { background: rgba(31, 122, 84, .13); color: var(--ok); border-color: rgba(31, 122, 84, .28); }
.badge-warn    { background: rgba(183, 121, 31, .14); color: var(--warn); border-color: rgba(183, 121, 31, .3); }
.badge-bad     { background: rgba(178, 59, 59, .13); color: var(--bad); border-color: rgba(178, 59, 59, .28); }
.badge-neutral { background: var(--chip); color: var(--ink-soft); border-color: var(--line); }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--chip); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
}
.chip a { color: var(--accent); }

/* ============ alerts / flash ============ */
.alert {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 13px 17px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  margin-bottom: 14px; font-size: 13.6px;
  animation: fadeUp .35s ease;
}
.alert-success { border-color: rgba(31, 122, 84, .35); background: rgba(31, 122, 84, .1); }
.alert-error   { border-color: rgba(178, 59, 59, .35); background: rgba(178, 59, 59, .1); }
.alert-warn    { border-color: rgba(183, 121, 31, .35); background: rgba(183, 121, 31, .1); }
.alert button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; }

/* ============ timeline / audit ============ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -21px; top: 5px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline-item .when { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ============ pagination ============ */
.pagination { display: flex; gap: 7px; margin-top: 18px; flex-wrap: wrap; }
.page-btn {
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); font-size: 12.6px; font-weight: 700; color: var(--ink-soft);
  transition: all .18s ease;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ============ auth pages ============ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, #0b1a2e 0%, #12314c 55%, #1b4a63 100%);
  color: #e9f0f7; padding: 56px 52px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::before {
  content: ''; position: absolute; inset: auto -120px -140px auto;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 180, 87, .28), transparent 65%);
}
.auth-aside::after {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  opacity: .05; pointer-events: none;
}
.auth-aside h2 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; max-width: 15ch; }
.auth-aside .quote { max-width: 42ch; color: rgba(233, 240, 247, .72); font-size: 15px; }
.auth-aside .metrics { display: flex; gap: 30px; margin-top: 26px; }
.auth-aside .metrics .value { font-family: var(--font-display); font-size: 26px; color: var(--gold-soft); }
.auth-aside .metrics .label { font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 46px 34px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .brand { border: 0; padding: 0 0 22px; color: var(--ink); }
.auth-card .brand-name { color: var(--ink); }
.auth-links { margin-top: 20px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-links a { color: var(--accent); font-weight: 700; }

/* simulated mailbox */
.mailbox {
  margin-top: 20px; border: 1px dashed var(--gold);
  border-radius: var(--radius-sm); padding: 13px 15px;
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  font-size: 12.4px;
}
.mailbox .title { font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); margin-bottom: 7px; }
.mailbox .code { font-family: var(--font-mono); font-size: 19px; letter-spacing: .22em; font-weight: 600; }

/* ============ landing ============ */
.landing { background: var(--bg); color: var(--ink); overflow-x: hidden; }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px clamp(20px, 5vw, 70px);
}
.landing-nav .links { display: flex; gap: 26px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.landing-nav .links a:hover { color: var(--gold); }
.landing-hero {
  position: relative;
  padding: clamp(50px, 9vw, 110px) clamp(20px, 5vw, 70px) clamp(60px, 8vw, 100px);
}
.landing-hero::before {
  content: ''; position: absolute; inset: -20% -10% auto auto;
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(194, 155, 69, .18), transparent 65%);
  pointer-events: none;
}
.landing-hero .eyebrow { letter-spacing: .28em; text-transform: uppercase; font-size: 11px; color: var(--gold); margin-bottom: 22px; }
.landing-hero h1 {
  font-size: clamp(44px, 8vw, 104px); line-height: .93; letter-spacing: -.035em;
  max-width: 15ch; margin-bottom: 26px;
}
.landing-hero h1 em { font-style: italic; color: var(--gold-soft); }
.landing-hero .lede { max-width: 52ch; font-size: clamp(16px, 1.5vw, 19px); color: var(--muted); }
.landing-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.landing-cell { background: var(--bg); padding: clamp(28px, 4vw, 52px); }
.landing-cell .num { font-family: var(--font-mono); color: var(--gold); font-size: 12px; letter-spacing: .16em; }
.landing-cell h3 { font-size: 21px; margin: 16px 0 10px; }
.landing-cell p { color: var(--muted); font-size: 14px; margin: 0; }
.landing-cell.is-wide { grid-column: span 2; background: linear-gradient(120deg, #0c1726, #102438); }
.landing-stats { display: flex; flex-wrap: wrap; gap: clamp(30px, 6vw, 80px); padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 70px); }
.landing-stats .value { font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 56px); color: var(--gold-soft); }
.landing-stats .label { color: var(--muted); font-size: 12px; letter-spacing: .17em; text-transform: uppercase; }
.landing-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px;
  padding: 34px clamp(20px, 5vw, 70px); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
}

/* ============ receipt / print ============ */
.receipt {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; max-width: 720px; margin: 0 auto;
}
.receipt .stamp {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  background: rgba(31, 122, 84, .12); color: var(--ok);
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.receipt dl { display: grid; grid-template-columns: 190px 1fr; gap: 11px 22px; margin: 26px 0 0; }
.receipt dt { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.receipt dd { margin: 0; font-weight: 600; }
.print-only { display: none; }

/* ============ session warning ============ */
.session-warn {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--warn); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow-lg); z-index: 100;
  animation: fadeUp .4s ease;
}

/* ============ misc ============ */
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 18px; font-size: 13.6px; }
.kv dt { min-width: 0; color: var(--muted); font-size: 11.5px; letter-spacing: .11em; text-transform: uppercase; overflow-wrap: anywhere; }
.kv dd { min-width: 0; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.config-snapshot .kv { grid-template-columns: minmax(0, 1fr) auto; }
.app-dialog {
  width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  overflow-y: auto; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); background: var(--surface); box-shadow: var(--shadow-lg);
}
.app-dialog::backdrop { background: rgba(5, 18, 32, .58); }
.dialog-head { margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.quick-action {
  display: flex; flex-direction: column; gap: 10px;
  padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12.8px; font-weight: 700;
  transition: transform .18s ease, border-color .18s ease;
}
.quick-action:hover { transform: translateY(-3px); border-color: var(--accent); }
.quick-action .ico {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px;
}
.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  transition: background .16s ease;
}
.mini-item:hover { background: var(--surface-2); }
.progress { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ============ responsive ============ */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .landing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-cell.is-wide { grid-column: span 2; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 60;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.22, .9, .28, 1);
  }
  body.sidebar-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .topbar { padding: 14px 18px; }
  .content { padding: 22px 18px 50px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .field-row, .field-row-3, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .receipt dl { grid-template-columns: 1fr; gap: 4px 0; }
  .receipt dd { margin-bottom: 12px; }
  .landing-grid { grid-template-columns: 1fr; }
  .landing-cell.is-wide { grid-column: auto; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .user-chip .meta { display: none; }
  .topbar-actions .hide-sm { display: none; }
}

/* ============ print ============ */
@media print {
  .sidebar, .topbar, .btn, .filters, .pagination, .no-print, .session-warn { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
  .card, .receipt { border: 1px solid #ccc; box-shadow: none; }
  .print-only { display: block; }
}
