﻿:root {
  --brand: #2f5bf0;
  --brand-2: #5c9dff;
  --brand-tint: rgba(47,91,240,.08);
  --brand-line: rgba(47,91,240,.25);
  --success: #109356;
  --success-tint: rgba(16,147,86,.1);
  --info: #2f5bf0;
  --info-tint: rgba(47,91,240,.08);
  --danger: #dc2626;
  --danger-tint: rgba(220,38,38,.1);
  --amber: #ffb031;
  --purple: #574fff;
  --canvas: #f9f6f4;
  --card: #ffffff;
  --border: #e5e2e0;
  --border-strong: #d5d0cb;
  --text: #282628;
  --subtext: #58585e;
  --faint: #b3a99e;
  --sidebar-w: 220px;
  --sidebar-bg: #f5f2ef;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(40,38,40,.06);
  --shadow-md: 0 4px 18px rgba(40,38,40,.08);
  --shadow-lg: 0 30px 70px -24px rgba(40,38,40,.22);
  --font-h: "Host Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-l: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
}

[data-accent="blue"]   { --brand: #2f5bf0; --brand-2: #5c9dff; }
[data-accent="green"]  { --brand: #109356; --brand-2: #34c06b; }
[data-accent="purple"] { --brand: #574fff; --brand-2: #8f6bff; }
[data-accent="red"]    { --brand: #dc2626; --brand-2: #f14848; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-h);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-l); }
input, select, textarea { font-family: var(--font-l); font-size: 13.5px; }
::selection { background: rgba(47,91,240,.16); }

/* ---------- Icon base ---------- */
.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px; flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; stroke-width: 1.9; }


/* ---------- Auth ---------- */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
  padding-top: max(88px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: var(--canvas);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: "";
  position: absolute;
  width: min(640px, 90vw); height: min(640px, 90vw);
  top: -260px; left: -200px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(47,91,240,.13), transparent 70%);
  filter: blur(70px);
  pointer-events: none;
}
.auth-page::after {
  content: "";
  position: absolute;
  width: min(640px, 90vw); height: min(640px, 90vw);
  bottom: -280px; right: -200px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(87,79,255,.09), transparent 70%);
  filter: blur(70px);
  pointer-events: none;
}

/* Centered auth cards (verify, errors) hug the sticky site nav on phones */
@media (max-width: 640px) {
  .auth-page:not(.auth-split) {
    min-height: 0;
    padding: 40px 16px 40px;
  }
}

/* ---------- Split-panel auth (login / register): premium ---------- */
.auth-page.auth-split {
  display: grid;
  grid-template-columns: 1.04fr .96fr;
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
  width: 100%;
  height: 100vh; height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--canvas);
}
.auth-page.auth-split::before,
.auth-page.auth-split::after { display: none; }

/* Left: form column (beige) */
.auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--canvas);
  padding: clamp(26px, 4vw, 52px) clamp(28px, 7vw, 92px);
  z-index: 1;
}
.auth-top {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.auth-brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--font-h); font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  color: var(--text);
}
.auth-brand .logo-mark {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px -8px rgba(47,91,240,.6);
}
.auth-brand .logo-mark svg { width: 26px; height: 26px; }
.auth-back {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-l); font-size: 13px; font-weight: 600;
  color: var(--subtext); transition: color .15s;
}
.auth-back:hover { color: var(--brand); }

.auth-center { flex: 1; display: flex; align-items: center; width: 100%; }
.auth-form { width: 100%; max-width: 396px; margin: 0 auto; }
.auth-form h1 {
  font-family: var(--font-h); font-weight: 800;
  font-size: clamp(25px, 3vw, 31px);
  letter-spacing: -.035em; line-height: 1.1;
  color: var(--text); margin-bottom: 9px;
}
.auth-form .auth-sub { color: var(--subtext); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.auth-form .field label { color: var(--subtext); }
.auth-form .input {
  background: var(--card);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}
.auth-form .btn-pill {
  width: 100%; height: 54px;
  margin-top: 10px;
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 50px; padding: 0 18px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-l); font-size: 14px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(40,38,40,.05);
  transition: background .15s, border-color .15s, box-shadow .2s, transform .15s;
  text-decoration: none; cursor: pointer;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn-google:hover {
  background: rgba(40,38,40,.035);
  border-color: var(--brand-line);
  box-shadow: 0 2px 8px rgba(40,38,40,.08);
}
.btn-google:active { transform: scale(.985); }
.btn-google .glogo { width: 18px; height: 18px; flex: none; }
.auth-or {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 14px;
  color: var(--faint);
  font-family: var(--font-l); font-size: 10.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  white-space: nowrap;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: fit-content; height: 52px;
  padding: 6px 6px 6px 22px;
  border: 1px solid transparent; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  font-family: var(--font-l); font-size: 14.5px; font-weight: 600; letter-spacing: -.01em;
  cursor: pointer; text-align: left; line-height: 1;
  box-shadow: 0 1px 2px rgba(47,91,240,.25), 0 10px 24px -8px rgba(47,91,240,.55);
  transition: transform .2s, box-shadow .25s, filter .2s, background .2s, color .2s, border-color .2s;
}
.btn-pill:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 2px 4px rgba(47,91,240,.3), 0 14px 28px -8px rgba(47,91,240,.6); }
.btn-pill:active { transform: translateY(0); }
.btn-pill .pill-ico {
  width: 40px; height: 40px; flex: none;
  border-radius: 999px;
  background: #fff; color: var(--brand);
  display: grid; place-items: center;
  transition: transform .25s;
}
.btn-pill:hover .pill-ico { transform: translateX(3px); }
.btn-pill .pill-ico svg, .btn-pill .pill-ico .icon { width: 16px; height: 16px; }
.btn-pill--outline, a.btn-pill--outline, button.btn-pill--outline {
  background: var(--card); color: var(--text);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn-pill--outline:hover { background: var(--brand-tint); filter: none; box-shadow: none; }
.btn-pill--outline .pill-ico { background: var(--brand-tint); color: var(--brand); transform: none; }
.btn-pill--sm { height: 44px; padding: 5px 5px 5px 18px; font-size: 13.5px; }
.btn-pill--sm .pill-ico { width: 34px; height: 34px; }
.btn-pill--sm .pill-ico svg, .btn-pill--sm .pill-ico .icon { width: 15px; height: 15px; }
.btn-pill--block { width: 100%; }
.auth-links {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 18px;
  font-family: var(--font-l); font-size: 12.8px;
}
.auth-links a { color: var(--brand); font-weight: 700; }
.auth-links a:hover { text-decoration: underline; }
.auth-links .muted { color: var(--faint); }
.auth-links--center { justify-content: center; text-align: center; }
.auth-links--center a { color: var(--faint); font-weight: 500; }

.auth-secure {
  flex: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--faint); font-family: var(--font-l); font-size: 12px;
  padding-top: 20px;
}
.auth-secure .icon { color: var(--success); }

/* Right: storytelling panel (blue) */
.auth-side {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(120% 90% at 18% 8%, rgba(92,157,255,.4), transparent 55%),
    radial-gradient(90% 80% at 95% 20%, rgba(87,79,255,.42), transparent 55%),
    radial-gradient(100% 90% at 95% 96%, rgba(87,79,255,.32), transparent 55%),
    linear-gradient(165deg, #4b78f5 0%, #2f5bf0 46%, #1b3cb8 100%);
  display: flex;
  flex-direction: column;
  padding: clamp(38px, 5vw, 64px);
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side-mark {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-h); font-weight: 700; font-size: 20px; letter-spacing: -.01em;
  flex: none;
}
.auth-side-mark .mk {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.24);
  display: grid; place-items: center;
}
.auth-side-mark .mk svg { width: 22px; height: 22px; }
.auth-side-main {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(18px, 4vh, 40px) 0;
}
.auth-side-main h2 {
  font-family: var(--font-h); font-weight: 800;
  font-size: clamp(27px, 3.2vw, 36px);
  letter-spacing: -.04em; line-height: 1.12;
  max-width: 440px;
}
.auth-side-main .lead { margin-top: 13px; color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.6; max-width: 420px; }
.auth-points { display: grid; gap: 14px; margin-top: 30px; }
.auth-points li {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-l); font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,.94);
}
.auth-points .ic {
  width: 26px; height: 26px; border-radius: 999px;
  background: rgba(255,255,255,.15);
  color: #dce6ff;
  display: grid; place-items: center; flex: none;
}
.auth-points .ic svg { width: 12px; height: 12px; }
.auth-quote {
  flex: none;
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 22px;
  max-width: 440px;
}
.auth-quote p { font-family: var(--font-h); font-size: 14.5px; line-height: 1.55; color: rgba(255,255,255,.94); }
.auth-quote .who { display: flex; align-items: center; gap: 10px; margin-top: 13px; font-family: var(--font-l); font-size: 12.5px; }
.auth-quote .who .av {
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(145deg, #5c9dff, #574fff 60%, #1b3cb8);
  border: 1px solid rgba(255,255,255,.3);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff;
}
.auth-quote .who b { display: block; font-weight: 700; margin-bottom: 2px; }
.auth-quote .who span { color: rgba(255,255,255,.62); font-size: 12px; }

/* Auth: single column on smaller screens, hide storytelling panel */
@media (max-width: 1024px) {
  .auth-page.auth-split { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .auth-side { display: none; }
  .auth-main { padding: 26px 22px 30px; }
  .auth-center { align-items: center; }
  .auth-form { margin: 0; }
  .auth-secure { padding-top: 16px; }
}

@media (max-width: 640px) {
  .auth-main { padding: 22px 18px 24px; }
  .auth-form h1 { font-size: clamp(24px, 7.5vw, 29px); }
  .auth-form .auth-sub { margin-bottom: 22px; }
  .auth-links {
    display: grid; gap: 9px;
    text-align: center; justify-items: center;
    margin-top: 18px;
  }
  .auth-links a { font-size: 13.5px; }
  .auth-top { gap: 12px; }
  .auth-form .field { gap: 7px; }
  .auth-form .input {
    height: 48px; padding: 0 14px;
    border-radius: 13px; font-size: 14.5px;
  }
  .auth-form .btn-pill { height: 50px; }
  .auth-form .btn-pill .pill-ico { width: 38px; height: 38px; }
  .btn-google { height: 50px; font-size: 13.5px; }
  .auth-or { margin: 16px 0 12px; gap: 10px; }
}

@media (max-width: 400px) {
  .auth-top { flex-wrap: wrap; row-gap: 10px; }
  .auth-brand { gap: 9px; font-size: 16.5px; }
  .auth-brand .logo-mark { width: 38px; height: 38px; border-radius: 12px; }
  .auth-brand .logo-mark svg { width: 22px; height: 22px; }
  .auth-back { font-size: 12px; }
  .auth-form h1 { font-size: 23px; }
  .auth-form .field { gap: 6px; }
  .auth-form .field label { font-size: 13px; }
  .auth-form .input {
    height: 46px; padding: 0 12px;
    border-radius: 12px; font-size: 14px;
  }
  .auth-form .btn-pill { height: 48px; padding: 5px 5px 5px 16px; }
  .auth-form .btn-pill .pill-ico { width: 36px; height: 36px; }
  .btn-google { height: 48px; padding: 0 16px; font-size: 13px; }
  .btn-google .glogo { width: 17px; height: 17px; }
  .auth-or { margin: 14px 0 10px; font-size: 10px; gap: 9px; }
  .auth-secure { padding-top: 12px; font-size: 11px; }
}

/* Center-column auth (verify pages) */
.auth-err {
  display: flex; gap: 8px; align-items: flex-start;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12.8px;
  margin-bottom: 16px;
}
.auth-box {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-box .brand-row {
  display: flex; align-items: center; gap: 11px; margin-bottom: 14px;
}
.auth-box .brand-row .logo-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(47,91,240,.5);
}
.auth-box .brand-row .logo-mark svg { width: 23px; height: 23px; }
.auth-box h1 {
  font-family: var(--font-h); font-weight: 800;
  font-size: 21px; letter-spacing: -.02em;
  color: var(--text);
}
.auth-box .auth-sub { color: var(--subtext); font-size: 13.5px; line-height: 1.55; margin-bottom: 22px; }
.auth-box .input { padding: 11px 13px; }
.auth-box .btn-primary { width: 100%; height: 46px; border-radius: 11px; }
.auth-box .btn-pill { width: 100%; height: 52px; margin-top: 6px; }
.auth-box .auth-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12.5px; }
.auth-box .auth-foot a { color: var(--brand); font-weight: 700; }

/* ---------- App shell ---------- */
.shell-header {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  padding-top: env(safe-area-inset-top);
  background: rgba(249,246,244,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.shell-header .crumb {
  font-size: 12.8px; color: var(--subtext); font-weight: 500; font-family: var(--font-l);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.shell-header .crumb b { color: var(--text); font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.site-links { display: flex; align-items: center; gap: 15px; margin-right: 8px; border-right: 1px solid var(--border); padding-right: 14px; }
.site-links a { font-size: 11.5px; font-weight: 600; color: var(--subtext); text-decoration: none; white-space: nowrap; }
.site-links a:hover { color: var(--brand); }
@media (max-width: 1080px) { .site-links { display: none; } }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--subtext);
  background: transparent;
  border: none; cursor: pointer; position: relative;
  transition: .12s;
}
.icon-btn:hover { background: var(--brand-tint); color: var(--brand); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--danger);
  border: 1.5px solid #fff;
}
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer; }
.user-chip:hover { background: rgba(40,38,40,.04); }
.chip-edit { display: grid; place-items: center; color: var(--faint); opacity: .75; }
.user-chip:hover .chip-edit { opacity: 1; color: var(--brand); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 99px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 11px; font-weight: 700; font-family: var(--font-l);
  overflow: hidden;
}
.user-avatar.has-photo { background: none; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-chip .nm { font-size: 12.5px; font-weight: 600; font-family: var(--font-l); }

.impersonation-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 18px; margin-bottom: 12px;
  background: linear-gradient(180deg, rgba(255,176,49,.16), rgba(255,176,49,.1));
  border: 1px solid rgba(209,126,10,.35);
  border-radius: 12px; color: #7a5208; font-size: 12.8px;
}
.impersonation-bar b { font-weight: 700; }
.impersonation-bar form { margin-left: auto; }

.shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 8px 6px;
  font-weight: 800; font-size: 15px; letter-spacing: .12em; text-transform: uppercase;
}
.sidebar .brand .logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(47,91,240,.35);
  flex-shrink: 0;
}
.sidebar .brand .logo-mark svg { width: 18px; height: 18px; }
.side-group { margin-top: 20px; }
.side-label {
  font-family: var(--font-l);
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint);
  padding: 0 10px; margin-bottom: 7px;
}
.side-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--subtext); font-size: 13px; font-weight: 500; font-family: var(--font-l);
  transition: .12s;
  position: relative;
}
.side-item .icon { color: var(--faint); }
.side-item:hover { background: rgba(40,38,40,.04); color: var(--text); }
.side-item.active {
  background: var(--brand-tint);
  color: var(--brand); font-weight: 600;
}
.side-item.active .icon { color: var(--brand); }
.side-count {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px;
  background: var(--brand); color: #fff;
  font-size: 10.5px; font-weight: 700; font-family: var(--font-l);
  display: inline-flex; align-items: center; justify-content: center;
}
.side-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.workspace {
  display: flex; align-items: center; gap: 9px;
  padding: 10px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
}
.workspace-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; position: relative; flex-shrink: 0;
}
.workspace-icon span { width: 7px; height: 7px; border-radius: 99px; background: var(--success); border: 1.5px solid var(--card); }
.workspace-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block; }
.workspace-text strong { display: block; font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.workspace-text span { font-size: 10.5px; color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-content {
  flex: 1; padding: 26px 30px 60px;
  padding-bottom: max(60px, calc(env(safe-area-inset-bottom) + 20px));
  width: 100%; display: flex; flex-direction: column; gap: 14px;
}
.main-content > * { width: 100%; min-width: 0; }
.page-head { margin-bottom: 0; }

/* ---------- Page head + KPI ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; letter-spacing: -.02em; font-weight: 800; }
.page-head p { color: var(--subtext); font-size: 13px; margin-top: 2px; font-family: var(--font-l); }
.actions { display: flex; align-items: center; gap: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.grid-kpi { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.grid-2b { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 0; }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s;
}
.card:hover { box-shadow: var(--shadow-md); }
.support-strip {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  color: var(--text);
}
.support-strip:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.support-strip > .icon { color: var(--faint); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; font-family: var(--font-l); }
.card-icon-tile {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--brand);
  background: var(--brand-tint);
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.card-icon-tile.brand { color: var(--brand); background: var(--brand-tint); }
.card-icon-tile.blue { color: var(--info); background: var(--info-tint); }
.card-icon-tile.green { color: var(--success); background: var(--success-tint); }
.card-icon-tile.orange { color: #b07a1a; background: rgba(255,176,49,.12); }
.kpi-value {
  font-size: 28px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
}
.kpi-sub { color: var(--faint); font-size: 12.2px; margin-top: 4px; font-family: var(--font-l); }
.kpi-sub .up { color: var(--success); display: inline-flex; align-items: center; gap: 2px; }

a.card { text-decoration: none; color: inherit; display: block; }
a.card .card-header { margin-bottom: 10px; }
.kpi-card { position: relative; }
a.kpi-link { text-decoration: none; color: inherit; display: block; }
a.kpi-link:hover .stat-label { color: var(--brand); }

.card-link { position: relative; }
.card-link .stretched { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-link a, .card-link button { position: relative; z-index: 2; }
.card-link .card-header { position: relative; z-index: 2; }
.card-link:hover { border-color: var(--brand-line); }

.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; max-width: 620px; }
.search-bar .input { flex: 1; min-width: 200px; margin-bottom: 0; }
.search-bar .select { width: auto; margin-bottom: 0; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--subtext); font-size: 12.5px; font-weight: 600;
  font-family: var(--font-l); text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.filter-chip:hover { border-color: var(--brand-line); color: var(--brand); }
.filter-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.progress-track { height: 7px; background: rgba(40,38,40,.06); border-radius: 99px; margin-top: 12px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px;
  transition: width .6s cubic-bezier(.16,1,.3,1);
}

/* ---------- Bars chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 16px; }
.bar {
  flex: 1;
  border-radius: 8px 8px 4px 4px;
  background: rgba(40,38,40,.07);
  min-height: 6px;
  transition: .2s;
  position: relative;
}
.bar:hover { background: rgba(40,38,40,.12); }
.bar.orange { background: linear-gradient(180deg, var(--amber), #e5a02d); }
.bar.blue { background: linear-gradient(180deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px -6px rgba(47,91,240,.35); }
.bar-labels { display: flex; gap: 10px; margin-top: 10px; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--faint); font-weight: 600; font-family: var(--font-l); }

/* ---------- Rings ---------- */
.rings-wrap { display: flex; align-items: center; gap: 26px; margin-top: 18px; }
.rings { position: relative; width: 118px; height: 118px; flex-shrink: 0; }
.rings .ring { position: absolute; inset: 0; border-radius: 99px; }
.rings .ring.one { border: 10px solid var(--brand); border-right-color: transparent; transform: rotate(-150deg); }
.rings .ring.two { inset: 11px; border: 9px solid rgba(47,91,240,.2); border-bottom-color: transparent; transform: rotate(45deg); }
.rings .ring.three { inset: 22px; border: 8px solid var(--border); border-top-color: transparent; transform: rotate(90deg); }
.ring-center {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: var(--text);
}
.receipt-stats { display: grid; grid-template-columns: repeat(2, auto); gap: 12px 26px; }
.stat-block { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-family: var(--font-l); }
.stat-value { font-size: 16.5px; font-weight: 700; color: var(--text); }

/* ---------- Rows / lists ---------- */
.list-rows { margin-top: 6px; }
.row-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 0; border-top: 1px solid rgba(40,38,40,.06);
}
.row-line .lt { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-line .title { font-size: 13px; font-weight: 600; font-family: var(--font-l); }
.cell-label { font-weight: 600; font-size: 13.2px; font-family: var(--font-l); }
.cell-sub { color: var(--faint); font-size: 11.6px; font-family: var(--font-l); }
.mono { font-variant-numeric: tabular-nums; font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12.6px; }
.txt-red { color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.table-wrap::before {
  content: "";
  position: sticky;
  left: 0; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, var(--card), transparent);
  pointer-events: none;
  z-index: 5;
  flex-shrink: 0;
  display: none;
}
.table-wrap::after {
  content: "";
  position: sticky;
  right: 0; top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(270deg, var(--card) 20%, transparent);
  pointer-events: none;
  z-index: 5;
  flex-shrink: 0;
}
.table-wrap.scrollable::before { display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 580px; }
thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); font-weight: 700; font-family: var(--font-l);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 3;
  white-space: nowrap;
}
thead th:first-child { position: sticky; left: 0; z-index: 4; background: var(--card); }
tbody td { padding: 12px; border-bottom: 1px solid rgba(40,38,40,.05); vertical-align: middle; font-family: var(--font-l); }
tbody td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; }
tbody tr:hover td { background: rgba(249,246,244,.6); }
tbody tr:hover td:first-child { background: rgba(249,246,244,.6); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.4px; font-weight: 600; font-family: var(--font-l);
  background: rgba(40,38,40,.06); color: var(--subtext);
}
.pill-orange { background: rgba(255,176,49,.12); color: #b07a1a; }
.pill-green { background: var(--success-tint); color: #0e7a46; }
.pill-blue { background: var(--info-tint); color: var(--brand); }
.pill-purple { background: rgba(124,58,237,.1); color: #6d28d9; }
.pill-gray { background: rgba(40,38,40,.06); color: var(--subtext); }
.pill-red { background: var(--danger-tint); color: #b3261e; }

/* ---------- Support thread ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  border: 1px solid var(--border);
  background: var(--canvas);
  border-radius: 12px;
  padding: 11px 13px;
  align-self: flex-start; max-width: 100%;
}
.bubble.is-agent {
  background: var(--brand-tint);
  border-color: var(--brand-line);
  align-self: flex-end;
}
.bubble.is-internal {
  border-style: dashed;
  background: rgba(40,38,40,.03);
  opacity: .85;
}
.bubble-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 5px;
  font-family: var(--font-l);
}
.bubble-meta strong { font-size: 12.3px; color: var(--text); }
.bubble-meta span { font-size: 10.5px; color: var(--faint); }
.prewrap { white-space: pre-wrap; word-break: break-word; font-size: 13.3px; font-family: var(--font-l); line-height: 1.55; }
.internal-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.3px; color: var(--subtext); font-family: var(--font-l); cursor: pointer;
}
.internal-toggle input { accent-color: var(--brand); }

/* ---------- Flash variants ---------- */
.flash-success {
  background: var(--success-tint);
  border: 1px solid rgba(16,147,86,.25);
  color: #0e7a46;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 18px; height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-l);
  font-size: 13px; font-weight: 600; letter-spacing: -.01em; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s, filter .15s;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn .icon { vertical-align: -2px; }

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff;
  box-shadow: 0 1px 2px rgba(47,91,240,.2), 0 4px 14px -4px rgba(47,91,240,.4);
}
.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 2px 4px rgba(47,91,240,.25), 0 10px 24px -6px rgba(47,91,240,.5);
}

/* Outline */
.btn-outline {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(40,38,40,.05);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
  box-shadow: 0 2px 10px -2px rgba(47,91,240,.18);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--subtext);
}
.btn-ghost:hover {
  background: rgba(40,38,40,.05);
  color: var(--text);
}

/* Danger */
.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fde4e4;
  border-color: #f9bfbf;
}

/* Success */
.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16,147,86,.15), 0 4px 12px -3px rgba(16,147,86,.3);
}
.btn-success:hover {
  background: #0e824c;
  box-shadow: 0 1px 2px rgba(16,147,86,.2), 0 8px 20px -4px rgba(16,147,86,.4);
}

/* Sizes */
.btn-sm { padding: 0 14px; height: 34px; font-size: 12px; border-radius: 9px; gap: 5px; }
.btn-lg { padding: 0 24px; height: 46px; font-size: 14px; border-radius: 12px; }
.btn-xs { padding: 0 8px; height: 26px; font-size: 11px; border-radius: 6px; gap: 4px; }

/* Icon only */
.btn-icon { padding: 0; width: 40px; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-lg { width: 46px; }

/* Full width */
.btn-block { width: 100%; }

/* ---------- Quick action buttons (inline with text) ---------- */
.row-line .btn { flex-shrink: 0; }

/* ---------- Forms ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field label, .field .field-label { display: block; font-size: 12.3px; font-weight: 600; margin-bottom: 6px; color: var(--subtext); font-family: var(--font-l); }
.input, .select, .textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  transition: .13s;
  font-family: var(--font-l);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.textarea { min-height: 74px; resize: vertical; }
.input-sm { padding: 5px 10px; border-radius: 8px; font-size: 12.5px; }
.form-error {
  display: flex; gap: 8px; align-items: center;
  background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 10px; padding: 9px 12px; font-size: 12.8px; margin-bottom: 14px;
}

/* ---------- Flash ---------- */
.flash {
  display: flex; gap: 8px; align-items: flex-start;
  border-radius: 11px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px;
}
.flash-success { background: var(--success-tint); border: 1px solid rgba(16,147,86,.25); color: #0e7a46; }

/* ---------- Swatches / chips / empty ---------- */
.swatches { display: flex; gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 99px; border: 3px solid transparent; cursor: pointer; transition: .12s; }
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--border); }
.swatch-brand { background: var(--brand); }
.swatch-blue { background: #2563eb; }
.swatch-green { background: var(--success); }
.swatch-purple { background: var(--purple); }
.swatch-red { background: #dc2626; }

/* Responsive column hiding (apply to <th>/<td>) */
@media (max-width: 640px) { .hide-sm { display: none; } }
@media (max-width: 480px) { .hide-xs { display: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(40,38,40,.04); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
  font-size: 12.3px; font-weight: 500; font-family: var(--font-l);
}
.chip em { color: var(--faint); font-style: normal; font-size: 11.6px; }
.empty { text-align: center; padding: 44px 18px; color: var(--subtext); }
.empty .icon { width: 34px; height: 34px; color: var(--faint); margin-bottom: 12px; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 12.8px; color: var(--faint); }
.link-more { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; color: var(--brand); font-size: 12.6px; font-weight: 600; font-family: var(--font-l); }
.link-more:hover { text-decoration: underline; }
.session-pill {
  font-size: 11.4px; font-weight: 600; color: var(--subtext); font-family: var(--font-l);
  background: rgba(40,38,40,.04); padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}

/* ---------- Receipt / public ---------- */
.rcp-page {
  min-height: 100vh; min-height: 100dvh;
  background: var(--canvas);
  padding: 40px 18px;
  padding-top: max(40px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.rcp-card {
  max-width: 720px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.rcp-hero {
  padding: 26px 28px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.rcp-hero .big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.rcp-hero .sub { opacity: .85; font-size: 12.5px; }
.rcp-body { padding: 26px 28px; }
.rcp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 18px; }
.rcp-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid rgba(40,38,40,.06); font-size: 13.4px; font-family: var(--font-l); }
.rcp-row .l { color: var(--faint); }
.rcp-stamp { text-align: center; margin-top: 24px; }
.rcp-stamp .stamp {
  display: inline-block; border: 2px solid var(--success); color: var(--success);
  border-radius: 12px; padding: 8px 18px; font-weight: 800; font-size: 14px; letter-spacing: .12em;
  transform: rotate(-6deg);
}
.verified-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 700; font-size: 13px; }
.rcp-foot { text-align: center; color: var(--faint); font-size: 12px; padding: 24px 28px; border-top: 1px solid rgba(40,38,40,.06); }
@media (max-width: 520px) {
  .rcp-page { padding: 16px 10px; }
  .rcp-card { border-radius: 14px; }
  .rcp-hero { padding: 20px 18px; flex-direction: column; text-align: center; }
  .rcp-hero .big { font-size: 22px; }
  .rcp-body { padding: 20px 18px; }
  .rcp-grid { grid-template-columns: 1fr; gap: 12px; }
  .rcp-row { font-size: 12.5px; gap: 8px; }
  .rcp-foot { padding: 18px; }
}

/* ---------- Error pages ---------- */
.err-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px 16px;
  padding-top: max(88px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: var(--canvas); color: var(--text);
}
.err-page--shell { min-height: calc(100vh - 130px); padding-top: 40px; }
.err-card { text-align: center; max-width: 460px; display: flex; flex-direction: column; align-items: center; }
.err-foot { text-align: center; font-size: 11px; color: var(--faint); padding: 0 16px 22px; }
.err-card .code {
  font-size: 64px; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.err-card h1 { font-size: 19px; margin: 10px 0 6px; }
.err-card p { color: var(--subtext); font-size: 13.5px; margin-bottom: 22px; }
@media (max-width: 480px) {
  .err-card .code { font-size: 48px; }
  .err-card h1 { font-size: 17px; }
}

/* ---------- PWA install banner ---------- */
.pwa-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 100vw;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  box-shadow: 0 -8px 30px rgba(40,38,40,.12);
  z-index: 50;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.pwa-banner.show { transform: translateY(0); }
.pwa-banner-text { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pwa-banner-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; flex-shrink: 0;
}
.pwa-banner-icon svg { width: 22px; height: 22px; }
.pwa-banner-text strong { font-size: 13.5px; }
.pwa-banner-text span { font-size: 12px; color: var(--faint); display: block; margin-top: 1px; }
.pwa-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Mobile sidebar overlay ---------- */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(40,38,40,.35);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s, visibility .25s;
}
.sidebar-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.hamburger {
  display: none;
  width: 38px; height: 38px; border-radius: 10px;
  border: none; background: transparent;
  cursor: pointer; position: relative;
  z-index: 91;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  position: absolute; left: 9px; transition: .25s;
}
.hamburger span:nth-child(1) { top: 12px; }
.hamburger span:nth-child(2) { top: 18px; }
.hamburger span:nth-child(3) { top: 24px; }
.hamburger.open span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { top: 18px; transform: rotate(-45deg); }

/* ---------- Responsive ---------- */

/* Tablet landscape / small desktop */
@media (max-width: 1024px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2b { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-sidebar { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* Tablet portrait */
@media (max-width: 860px) {
  .hamburger { display: grid; place-items: center; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 91;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.16,1,.3,1);
    width: min(84vw, 300px);
    box-shadow: none;
    padding: 18px 14px;
    padding-top: calc(env(safe-area-inset-top) + 12px);
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(40,38,40,.2);
  }
  .sidebar-overlay { display: block; }
  .main { width: 100%; }
  .main-content { padding: 20px 16px 56px; }

  /* Safe-area insets for landscape/notched phones */
  .shell-header {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .main-content {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* Page head */
  .page-head { flex-direction: column; gap: 10px; }
  .page-head .actions { width: 100%; display: flex; gap: 8px; }
  .page-head .actions .btn { flex: 1; min-height: 40px; }

  /* Header */
  .user-chip .nm { display: none; }
  .shell-header .crumb { font-size: 11.5px; max-width: 180px; }
  .icon-btn { width: 38px; height: 38px; }

  /* Forms */
  .two-col { grid-template-columns: 1fr; }

  /* Tables */
  .table-wrap::before { display: block; }

  /* Cards */
  .card { padding: 16px; }
  .card-header { gap: 6px; }

  /* Receipt/rings */
  .rings-wrap { flex-wrap: wrap; justify-content: center; gap: 18px; }
  .receipt-stats { grid-template-columns: repeat(2, 1fr); gap: 10px 20px; }

  /* Row lines (quick actions, etc.) */
  .row-line { flex-wrap: wrap; gap: 8px; }
  .row-line .btn { width: 100%; min-height: 38px; }

  /* KPI values */
  .kpi-value { font-size: 26px; }

  /* Notification rows */
  .row-line .lt { min-width: 0; flex: 1; }

  /* Member fee cards - stack table content */
  .card .table-wrap table { min-width: 480px; }

  /* Settings grid */
  .grid > .card[style*="max-width"] { max-width: 100% !important; }

  /* Fee edit form buttons */
  .card form[style*="max-width"] { max-width: 100%; }

  /* Student detail */
  .grid.grid-2b > .card { overflow: visible; }
}

/* Mobile */
@media (max-width: 520px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px 12px 52px; gap: 12px; }

  /* KPI */
  .kpi-value { font-size: 22px; }
  .kpi-sub { font-size: 11.5px; }
  .page-head h2 { font-size: 17px; letter-spacing: -.01em; }
  .page-head p { font-size: 12px; }

  /* Cards */
  .card { padding: 14px; border-radius: 14px; }
  .card-icon-tile { width: 28px; height: 28px; border-radius: 8px; }
  .card-title { font-size: 12px; gap: 6px; }

  /* Header - reclaim space on tight phones */
  .shell-header .session-pill { display: none; }
  .shell-header .crumb { max-width: 40vw; }
  .icon-btn { width: 40px; height: 40px; }
  .hamburger { width: 42px; height: 42px; }

  /* Tables go horizontal scroll */
  table { min-width: 460px; font-size: 12px; }
  thead th { padding: 8px 10px; font-size: 10px; }
  tbody td { padding: 10px; font-size: 12px; }

  /* Bars chart */
  .bars { height: 110px; gap: 5px; }
  .bar-labels span { font-size: 9px; }

  /* Rings */
  .rings { width: 86px; height: 86px; }
  .rings .ring { border-width: 7px; }
  .rings .ring.two { inset: 8px; border-width: 6px; }
  .rings .ring.three { inset: 16px; border-width: 5px; }
  .ring-center { font-size: 13px; font-weight: 700; }
  .rings-wrap { gap: 14px; }
  .receipt-stats { gap: 8px 16px; }
  .stat-value { font-size: 14px; }

  /* Progress track */
  .progress-track { height: 6px; }

  /* Session pill */
  .session-pill { font-size: 10.5px; padding: 2px 8px; }

  /* Pills */
  .pill { font-size: 10.5px; padding: 2px 8px; }

  /* Auth */
  .auth-box h1 { font-size: 23px; }
  .auth-box .auth-sub { font-size: 13px; margin-bottom: 20px; }
  .auth-brand { font-size: 15.5px; gap: 8px; }
  .auth-brand .logo-mark { width: 34px; height: 34px; border-radius: 10px; }
  .auth-secure { font-size: 11px; }

  /* PWA banner */
  .pwa-banner { flex-direction: column; text-align: center; gap: 10px; padding: 12px 14px; }
  .pwa-banner-text { justify-content: center; }
  .pwa-banner-actions { width: 100%; display: flex; gap: 8px; }
  .pwa-banner-actions .btn { flex: 1; min-height: 40px; }

  /* Forms */
  .field label { font-size: 11.5px; }
  /* 16px input text stops iOS auto-zoom on focus; also fatter touch targets */
  .input, .select, .textarea {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 10px;
  }
  .input-sm { min-height: 38px; font-size: 15px; }
  .input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 3px var(--brand-tint); }

  /* Auth forms (higher specificity than the 640px rule): keep 16px to avoid iOS zoom */
  .auth-form .input { font-size: 16px; height: 50px; padding: 0 14px; }

  /* Buttons - ensure touch targets */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; padding: 0 12px; font-size: 12px; }

  /* Empty states */
  .empty { padding: 32px 14px; }
  .empty .icon { width: 28px; height: 28px; }
  .empty h3 { font-size: 14px; }
  .empty p { font-size: 12px; }

  /* Flash */
  .flash { padding: 10px 12px; font-size: 12px; border-radius: 10px; }

  /* Error page */
  .err-card .code { font-size: 48px; }
  .err-card h1 { font-size: 16px; }
  .err-card p { font-size: 12.5px; }

  /* Search input */
  form[style*="max-width:360px"] { max-width: 100% !important; }

  /* Executives/promote form */
  .grid > .card { max-width: 100% !important; }

  /* Receipt page */
  .rcp-hero { padding: 18px 16px; }
  .rcp-hero .big { font-size: 20px; }
  .rcp-body { padding: 18px 16px; }
}

/* Small mobile */
@media (max-width: 380px) {
  .main-content { padding: 12px 10px 48px; gap: 10px; }
  .card { padding: 12px; border-radius: 12px; }
  .page-head h2 { font-size: 16px; }
  .kpi-value { font-size: 20px; }
  .bars { height: 90px; gap: 4px; }
  .bar-labels span { font-size: 8px; }
  .btn { min-height: 42px; font-size: 13px; }
  .btn-sm { min-height: 34px; font-size: 11.5px; }
}

/* Mobile: lift page-head actions into a thumb-reachable bottom action bar */
@media (max-width: 640px) {
  .page-head { margin-bottom: 16px; }
  .page-head > .actions,
  .page-head > form.page-head-action {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 60;
    width: auto;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 12px 40px -10px rgba(40,38,40,.32);
  }
  .page-head > .actions .btn,
  .page-head > form.page-head-action .btn {
    flex: 1;
    min-height: 44px;
    margin: 0;
  }
  .main-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-page { padding: 12px; }
  .auth-box { max-width: 360px; }
  .auth-brand { margin-bottom: 4px; }
  .err-page { padding: 12px; }
}

/* App shell on short landscape screens */
@media (max-height: 520px) and (orientation: landscape) {
  .main-content { padding-top: 12px; padding-bottom: max(66px, env(safe-area-inset-bottom)); }
  .sidebar { padding-top: calc(env(safe-area-inset-top) + 8px); }
  .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .sidebar { transition: none; }
  .pwa-banner { transition: none; }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
  /* Reserved for dark theme */
}

/* Print */
@media print {
  .sidebar, .shell-header, .hamburger, .sidebar-overlay, .pwa-banner, .actions, .btn { display: none !important; }
  .main { width: 100%; }
  .main-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  body { background: #fff; }
}

/* Shared landing navbar & footer reused on public pages (auth, verify, errors) */
body:not(.lp) .dv-nav {
  position: sticky; top: 0; left: auto; transform: none;
  width: 100%;
  min-height: 62px;
  padding: 0 22px;
  gap: 16px;
  background: rgba(249,246,244,.86);
  border: none; border-bottom: 1px solid var(--border);
  border-radius: 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: none;
}
body:not(.lp) .dv-brand b { color: var(--text); }
body:not(.lp) .dv-brand .dv-mark,
body:not(.lp) .dv-foot-brand .dv-mark {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 6px 16px -6px rgba(47,91,240,.5);
  font-size: 0;
}
body:not(.lp) .dv-brand .dv-mark svg,
body:not(.lp) .dv-foot-brand .dv-mark svg { width: 19px; height: 19px; }
body:not(.lp) .dv-links a { color: var(--subtext); }
body:not(.lp) .dv-links a:hover { color: var(--brand); background: var(--brand-tint); }
body:not(.lp) .dv-btn-pri {
  background: var(--brand);
  box-shadow: 0 10px 24px -8px rgba(47,91,240,.55);
}
body:not(.lp) .dv-btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
body:not(.lp) .dv-btn-ghost:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }
body:not(.lp) .dv-burger { background: var(--brand-tint); border-color: var(--border-strong); color: var(--text); }
body:not(.lp) .dv-mnav { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
body:not(.lp) .dv-mnav a:not(.dv-btn) { color: var(--text); }
body:not(.lp) .dv-mnav a:not(.dv-btn):hover { background: var(--brand-tint); color: var(--brand); }
body:not(.lp) .dv-foot { background: var(--card); border-top: 1px solid var(--border); }
body:not(.lp) .dv-foot-brand b { color: var(--text); }
body:not(.lp) .dv-foot p { color: var(--subtext); }
body:not(.lp) .dv-socials a { background: var(--brand-tint); border-color: var(--border); color: var(--subtext); }
body:not(.lp) .dv-socials a:hover { color: var(--brand); border-color: var(--brand); }
body:not(.lp) .dv-fcol h5 { color: var(--text); }
body:not(.lp) .dv-fcol a { color: var(--subtext); }
body:not(.lp) .dv-fcol a:hover { color: var(--brand); }
body:not(.lp) .dv-foot-bottom { color: var(--faint); }
body:not(.lp) .dv-foot-bottom .safe { color: var(--subtext); }
