/* ============================================================
   PAMP — design tokens & base styles
   ============================================================ */

:root {
  /* type */
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Inter", system-ui, sans-serif;

  /* radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;

  /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* light theme (default) */
  --bg: #F6F7F9;
  --bg-deep: #EEF0F3;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F1F3F6;
  --topbar: #FFFFFF;
  --sidebar: #FFFFFF;
  --ink: #0B0D10;
  --ink-2: #3A4048;
  --ink-3: #6B7280;
  --ink-4: #9AA3AE;
  --border: #EAECEF;
  --border-strong: #D9DDE2;
  --accent: #86D694;
  --accent-soft: oklch(96% 0.05 145);
  --accent-ink: oklch(35% 0.10 145);
  --accent-glow: oklch(82% 0.13 145 / 0.28);
  --pos: oklch(58% 0.14 155);
  --pos-soft: oklch(94% 0.05 155);
  --neg: oklch(58% 0.18 25);
  --neg-soft: oklch(95% 0.04 25);
  --warn: oklch(70% 0.14 70);
  --warn-soft: oklch(95% 0.05 70);
  --info: oklch(60% 0.13 240);
  --info-soft: oklch(94% 0.04 240);

  --shadow-sm: 0 1px 0 oklch(0% 0 0 / 0.04), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-md: 0 1px 0 oklch(0% 0 0 / 0.03), 0 4px 14px oklch(0% 0 0 / 0.05);
  --shadow-lg: 0 1px 0 oklch(0% 0 0 / 0.03), 0 12px 40px oklch(0% 0 0 / 0.08);
  --shadow-xl: 0 24px 60px oklch(0% 0 0 / 0.10);

  --grid: oklch(91% 0.008 80);
}

[data-theme="dark"] {
  --bg: #010101;
  --bg-deep: #000000;
  --surface: #1C1C1E;
  --surface-2: #232325;
  --surface-3: #2A2A2D;
  --topbar: #010101;
  --sidebar: #010101;
  --ink: #F5F5F7;
  --ink-2: #C7C9CD;
  --ink-3: #8A8E94;
  --ink-4: #5E6268;
  --border: #2A2A2D;
  --border-strong: #36363A;
  --accent: #86D694;
  --accent-soft: oklch(26% 0.06 145);
  --accent-ink: oklch(88% 0.13 145);
  --accent-glow: oklch(82% 0.13 145 / 0.28);
  --pos: oklch(72% 0.16 155);
  --pos-soft: oklch(28% 0.06 155);
  --neg: oklch(72% 0.18 25);
  --neg-soft: oklch(28% 0.07 25);
  --warn: oklch(78% 0.14 70);
  --warn-soft: oklch(28% 0.05 70);
  --info: oklch(72% 0.13 240);
  --info-soft: oklch(28% 0.06 240);

  --shadow-sm: 0 1px 0 oklch(0% 0 0 / 0.25), 0 1px 2px oklch(0% 0 0 / 0.20);
  --shadow-md: 0 4px 14px oklch(0% 0 0 / 0.40);
  --shadow-lg: 0 12px 40px oklch(0% 0 0 / 0.50);
  --shadow-xl: 0 24px 60px oklch(0% 0 0 / 0.60);

  --grid: oklch(26% 0.012 280);
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   APP SHELL
   ============================================================ */

.app-root {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ============================================================
   TYPE UTILITIES
   ============================================================ */

.display { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 500; }
.display-tight { font-family: var(--font-display); letter-spacing: -0.035em; font-weight: 500; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum", "zero"; }
.tabular { font-variant-numeric: tabular-nums; }

.h1 { font-family: var(--font-display); font-weight: 500; font-size: 36px; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
.h2 { font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -0.022em; line-height: 1.1; margin: 0; }
.h3 { font-family: var(--font-display); font-weight: 500; font-size: 19px; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.label { font-size: 13px; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.tiny { font-size: 11px; }

/* ============================================================
   PRIMITIVES
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}

.card-flush { padding: 0; overflow: hidden; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.12s cubic-bezier(0.3, 0, 0.2, 1), background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.2s, filter 0.18s;
  user-select: none;
  position: relative;
}
.btn:hover { transform: translateY(-0.5px); }
.btn:active { transform: translateY(0.5px); }

.btn-primary {
  background: var(--accent);
  color: oklch(20% 0.10 145);
  box-shadow: 0 1px 0 oklch(0% 0 0 / 0.05), inset 0 -1px 0 oklch(0% 0 0 / 0.08), 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 1px 0 oklch(0% 0 0 / 0.05), inset 0 -1px 0 oklch(0% 0 0 / 0.08), 0 8px 24px var(--accent-glow); filter: brightness(1.04); }
.btn-primary:active { filter: brightness(0.96); box-shadow: 0 1px 0 oklch(0% 0 0 / 0.05), inset 0 1px 2px oklch(0% 0 0 / 0.10); }

.btn-ink {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 1px 0 oklch(0% 0 0 / 0.06), inset 0 -1px 0 oklch(0% 0 0 / 0.15);
}
.btn-ink:hover { background: oklch(10% 0.01 145); }

.btn-accent { background: var(--accent); color: oklch(20% 0.10 145); }
.btn-accent:hover { filter: brightness(1.04); }

.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); transform: none; }

.btn-outline {
  border: 1px solid var(--border-strong);
  color: var(--ink); background: var(--surface);
  box-shadow: 0 1px 0 oklch(0% 0 0 / 0.02);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--ink); }

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.btn-soft:hover { background: var(--accent); color: oklch(20% 0.10 145); transform: none; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 14px; }
.btn-xl { height: 56px; padding: 0 28px; font-size: 15px; border-radius: 999px; }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 999px;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.chip-pos { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.chip-neg { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.input input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  font-size: 13px;
}
.input input::placeholder { color: var(--ink-4); }

.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink-3);
}

.divider { height: 1px; background: var(--border); width: 100%; }

/* ============================================================
   AVATAR
   ============================================================ */

.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-lg { width: 44px; height: 44px; font-size: 15px; }
.av-xl { width: 64px; height: 64px; font-size: 22px; }

.av-stack { display: inline-flex; }
.av-stack .av { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.av-stack .av:first-child { margin-left: 0; }

/* ============================================================
   LAYOUT — sidebar + topbar
   ============================================================ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) 1fr;
  height: 100%;
  width: 100%;
  transition: grid-template-columns 0.25s cubic-bezier(0.3, 0, 0.2, 1);
}

.shell[data-sidebar="collapsed"] { --sidebar-w: 76px; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.sidebar-head {
  padding: 20px 20px 18px;
  display: flex; align-items: center; gap: 10px;
  height: 64px;
}
.sidebar-nav {
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-section {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 14px 12px 6px;
  font-weight: 500;
}
.shell[data-sidebar="collapsed"] .sidebar-section { opacity: 0; height: 0; padding: 0; pointer-events: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.nav-item.active .ni-icon { color: var(--accent-ink); }
[data-theme="dark"] .nav-item.active { color: var(--accent); }
[data-theme="dark"] .nav-item.active .ni-icon { color: var(--accent); }
.nav-item .ni-icon { width: 18px; flex-shrink: 0; display: inline-flex; }
.nav-item .ni-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 1px 7px;
}
.shell[data-sidebar="collapsed"] .nav-item .ni-label,
.shell[data-sidebar="collapsed"] .nav-item .ni-badge { display: none; }
.shell[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 9px; }
.shell[data-sidebar="collapsed"] .sidebar-head .brand-text { display: none; }

.sidebar-foot { padding: 12px; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar);
  flex-shrink: 0;
}

.main-col { display: flex; flex-direction: column; overflow: hidden; }
.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg);
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-title {
  display: flex; flex-direction: column; gap: 6px;
}

/* ============================================================
   BRAND
   ============================================================ */

.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: -0.04em;
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 30% 20%, var(--accent) 0%, transparent 60%);
  opacity: 0.85;
}
.brand-mark span { position: relative; z-index: 1; }

.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.035em;
}

/* ============================================================
   GRIDS
   ============================================================ */

.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }

.row { display: flex; align-items: center; gap: var(--s-3); }
.row-tight { display: flex; align-items: center; gap: var(--s-2); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ============================================================
   METRIC CARD
   ============================================================ */

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  overflow: hidden;
}
.metric-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.metric-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.metric-value-sm { font-size: 28px; }
.metric-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }

.metric-spark { position: absolute; right: 14px; bottom: 14px; opacity: 0.85; }

.metric-hero {
  background: var(--ink);
  color: var(--bg);
  border-color: transparent;
}
.metric-hero .metric-label { color: oklch(75% 0.005 80); }
.metric-hero .metric-value { color: var(--bg); }
.metric-hero .metric-foot { color: oklch(75% 0.005 80); }

[data-theme="dark"] .metric-hero {
  background: linear-gradient(135deg, var(--accent) 0%, oklch(35% 0.14 290) 100%);
  color: white;
}
[data-theme="dark"] .metric-hero .metric-label,
[data-theme="dark"] .metric-hero .metric-foot { color: oklch(95% 0.02 290); }
[data-theme="dark"] .metric-hero .metric-value { color: white; }

/* ============================================================
   TABLES
   ============================================================ */

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tbl td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--ink);
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .col-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   PROGRESS
   ============================================================ */

.bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* ============================================================
   CHART helpers (SVG only)
   ============================================================ */

.chart-grid line { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-axis text { fill: var(--ink-4); font-size: 10px; font-family: var(--font-mono); }

/* ============================================================
   LANDING
   ============================================================ */

.landing {
  height: 100%;
  overflow-y: auto;
  position: relative;
  background:
    radial-gradient(circle at 20% 10%, var(--accent-glow), transparent 40%),
    radial-gradient(circle at 80% 90%, oklch(55% 0.13 290 / 0.08), transparent 50%),
    var(--bg);
}

.landing-header {
  padding: 28px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-hero {
  padding: 80px 48px 56px;
  max-width: 1200px;
  margin: 0 auto;
}

.landing-h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  margin: 0 0 28px;
}
.landing-h1 em {
  font-style: italic;
  font-family: "Bricolage Grotesque", serif;
  color: var(--accent);
  font-weight: 400;
}

.landing-sub {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 560px;
  line-height: 1.5;
  margin: 0;
}

.portal-grid {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 48px 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0, 0.1, 1), box-shadow 0.32s, border-color 0.32s;
  min-height: 520px;
  text-align: left;
}
.portal-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 24px 60px oklch(0% 0 0 / 0.10), 0 0 0 1px var(--accent-glow);
}
[data-theme="dark"] .portal-card:hover {
  box-shadow: 0 24px 60px oklch(0% 0 0 / 0.60), 0 0 0 1px var(--accent-glow);
}

.pc-cover {
  position: relative;
  height: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}
.pc-cover-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pc-cover-tag-num {
  background: oklch(100% 0 0 / 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.pc-cover-tag-role {
  opacity: 0.85;
}
.pc-cover-corner {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: oklch(100% 0 0 / 0.12);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.32s, background 0.3s;
}
.portal-card:hover .pc-cover-corner {
  transform: rotate(45deg);
  background: var(--accent);
  color: oklch(20% 0.10 145);
}

.pc-body {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.pc-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0;
}
.pc-desc {
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.pc-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.pc-cta-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.pc-cta-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, color 0.25s, transform 0.32s cubic-bezier(0.3, 0, 0.2, 1);
}
.portal-card:hover .pc-cta-icon {
  background: var(--accent);
  color: oklch(20% 0.10 145);
  transform: translateX(4px);
}

/* hero scene tiles - mini illustrations rendered inline */

/* ============================================================
   AUTH
   ============================================================ */

.auth-page {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.auth-left {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 40px 56px;
  overflow: hidden;
}
.auth-right {
  background: var(--ink);
  color: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
}
.auth-right::before {
  content: "";
  position: absolute;
  inset: -100px;
  background:
    radial-gradient(circle at 30% 30%, var(--accent) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, oklch(60% 0.20 320) 0%, transparent 50%);
  opacity: 0.6;
  filter: blur(40px);
}

.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.form-field .input { height: 44px; border-radius: var(--r-md); }

/* ============================================================
   CALENDAR
   ============================================================ */

.cal-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.cal-h { padding: 12px 8px; font-size: 11px; color: var(--ink-3); text-align: center; border-bottom: 1px solid var(--border); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.cal-time { padding: 0 8px; font-size: 10.5px; color: var(--ink-4); font-family: var(--font-mono); text-align: right; padding-top: 4px; border-right: 1px solid var(--border); }
.cal-cell { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-height: 56px; position: relative; }
.cal-cell:last-child { border-right: 0; }
.cal-evt {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-left: 3px solid var(--accent);
  overflow: hidden;
}
.cal-evt.evt-pos { background: var(--pos-soft); color: var(--pos); border-left-color: var(--pos); }
.cal-evt.evt-warn { background: var(--warn-soft); color: var(--warn); border-left-color: var(--warn); }
.cal-evt.evt-info { background: var(--info-soft); color: var(--info); border-left-color: var(--info); }

/* ============================================================
   MODAL
   ============================================================ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: oklch(0% 0 0 / 0.55);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  animation: backdropIn 0.2s cubic-bezier(0.2, 0, 0.1, 1);
}
[data-theme="dark"] .modal-backdrop { background: oklch(0% 0 0 / 0.75); }

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.28s cubic-bezier(0.2, 0, 0.1, 1);
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  padding: 24px 28px 18px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px;
}
.modal-title { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.025em; font-weight: 500; margin: 0; }
.modal-sub { color: var(--ink-3); font-size: 13px; margin-top: 6px; }

.modal-body {
  padding: 0 28px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 18px 28px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: 8px;
}
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--neg); margin-top: 6px; }
.field-group { display: flex; flex-direction: column; gap: 16px; }

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-input::placeholder { color: var(--ink-4); }
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
[data-theme="dark"] .text-input { background: var(--surface-2); }

textarea.text-input {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 88px;
  font-family: var(--font-body);
}

.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 13.5px;
  width: 100%;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s;
}
.select-pill:hover { border-color: var(--ink); }
.select-pill .chev { margin-left: auto; color: var(--ink-3); }

/* radio cards */
.radio-card-grid { display: grid; gap: 10px; }
.radio-card {
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--surface);
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.radio-card:hover { border-color: var(--ink); }
.radio-card[data-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.radio-card .rc-dot {
  width: 18px; height: 18px; border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0; position: relative;
}
.radio-card[data-checked="true"] .rc-dot { border-color: var(--accent); background: var(--accent); }
.radio-card[data-checked="true"] .rc-dot::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: oklch(20% 0.10 145);
}

/* checkbox */
.cb-box {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cb-box[data-checked="true"] {
  background: var(--accent); border-color: var(--accent); color: oklch(20% 0.10 145);
}

/* segmented */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 999px;
  gap: 2px;
}
.segmented button {
  height: 30px; padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.segmented button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .segmented button.active { background: var(--surface-2); }

/* file dropzone */
.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 22px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ============================================================
   SVG placeholder pattern
   ============================================================ */

.placeholder-img {
  background:
    repeating-linear-gradient(135deg, var(--surface-3), var(--surface-3) 8px, var(--surface-2) 8px, var(--surface-2) 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  border-radius: var(--r-sm);
}

/* ============================================================
   tweaks panel restyle (light)
   ============================================================ */

/* tooltips & misc */
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot-pos { background: var(--pos); }
.dot-neg { background: var(--neg); }
.dot-warn { background: var(--warn); }
.dot-info { background: var(--info); }

/* page enter */
.page-enter { animation: pageEnter 0.32s cubic-bezier(0.2, 0, 0.1, 1); }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .portal-grid { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-right { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main-scroll { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ============================================================
   PAMP ADDITIONS — toast, demo-data chip, panel close, mobile,
   collapsed-tooltip, settings nav (kept from functional build)
   ============================================================ */

/* TOAST ---------------------------------------------------- */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.pamp-toast {
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: auto;
}
.pamp-toast.show { opacity: 1; transform: translateY(0); }
.pamp-toast.success { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.pamp-toast.error   { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.pamp-toast.info    { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* DEMO DATA CHIP ------------------------------------------- */
.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px dashed currentColor;
}
.demo-chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

/* PANEL CARD CLOSE + FADE ---------------------------------- */
.card-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
}
.card-close-btn:hover { background: var(--surface-3); color: var(--neg); }
.card.closing {
  opacity: 0;
  transform: scale(0.97);
  max-height: 0;
  margin: 0 !important;
  padding: 0 !important;
  border-color: transparent;
  transition: opacity 220ms ease, transform 220ms ease, max-height 280ms ease,
              margin 280ms ease, padding 280ms ease, border-color 220ms ease;
  overflow: hidden;
}

/* COLLAPSED-SIDEBAR TOOLTIPS ------------------------------- */
.shell[data-sidebar="collapsed"] .nav-item[data-tip]::after,
.shell[data-sidebar="collapsed"] .sidebar-foot .nav-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.shell[data-sidebar="collapsed"] .nav-item[data-tip]:hover::after,
.shell[data-sidebar="collapsed"] .sidebar-foot .nav-item[data-tip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* MOBILE — sidebar becomes slide-out ----------------------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
  }
  .shell[data-sidebar="expanded"] .sidebar { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: oklch(0% 0 0 / 0.4);
    z-index: 99;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
  .topbar { padding: 0 16px; }
  .main-scroll { padding: 16px; }
  .grid-12, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr !important; }
}

/* FORM helpers used in modals + auth ----------------------- */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: block; margin-bottom: 6px; }
.field-hint  { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.field-error { font-size: 11.5px; color: var(--neg); margin-top: 6px; }

.text-input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 13px;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-input:focus,
.text-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }

textarea.text-input {
  height: auto;
  min-height: 80px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-family: inherit;
  resize: vertical;
}

select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* MODALS --------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 1000;
  background: oklch(0% 0 0 / 0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: pampFadeIn 160ms ease;
}
@keyframes pampFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: pampSlideUp 220ms cubic-bezier(0.3, 0, 0.2, 1);
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
@keyframes pampSlideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px 0;
}
.modal-title { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.02em; margin: 0; }
.modal-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* LANDING - portal grid ------------------------------------ */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 48px 48px;
}
@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; padding: 16px; }
}
.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}
.portal-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.pc-cover {
  position: relative;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  overflow: hidden;
}
.pc-cover-tag { display: flex; align-items: center; gap: 8px; position: relative; z-index: 2; }
.pc-cover-tag-num {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  padding: 3px 8px; border-radius: 999px; letter-spacing: 0.05em;
}
.pc-cover-tag-role {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.pc-cover-corner {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 2;
}
.pc-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.pc-title { font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.pc-desc { font-size: 13.5px; color: var(--ink-3); margin: 0; line-height: 1.5; }
.pc-cta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pc-cta-text { font-size: 13px; font-weight: 500; color: var(--ink); }
.pc-cta-icon {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.portal-card:hover .pc-cta-icon { background: var(--accent); color: oklch(20% 0.10 145); transform: translateX(2px); }

.landing-h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 88px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.0;
  color: var(--ink);
}
.landing-h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-ink);
}

/* AUTH two-pane -------------------------------------------- */
.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
  overflow: hidden;
}
.auth-left {
  background: var(--bg);
  padding: 28px 48px;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.auth-right {
  background:
    radial-gradient(circle at 30% 30%, oklch(40% 0.16 290 / 0.5) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, var(--accent-glow), transparent 60%),
    var(--ink);
  color: var(--bg);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-right .eyebrow { color: oklch(80% 0.04 290); }
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-right { display: none; }
  .auth-left { padding: 20px; }
}

/* PAGE ENTER ANIMATION ------------------------------------- */
.page-enter { animation: pampPageIn 320ms cubic-bezier(0.3, 0, 0.2, 1); }
@keyframes pampPageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* EMPTY STATE ---------------------------------------------- */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty-state .empty-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  margin: 0 auto 14px;
  background: var(--surface-3);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* LOADING -------------------------------------------------- */
.loading-state {
  padding: 80px 24px;
  text-align: center;
  color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.spin {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: pampSpin 0.8s linear infinite;
}
@keyframes pampSpin { to { transform: rotate(360deg); } }

/* PLACEHOLDER IMG ------------------------------------------ */
.placeholder-img {
  background:
    repeating-linear-gradient(45deg, var(--surface-3) 0 6px, transparent 6px 12px),
    var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
}

/* SETTINGS-style two-col layout (kept) --------------------- */
.settings-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
}
@media (max-width: 900px) { .settings-shell { grid-template-columns: 1fr; } }
.settings-nav {
  display: flex; flex-direction: column; gap: 2px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.settings-nav-item:hover { background: var(--surface-2); color: var(--ink); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .settings-nav-item.active { color: var(--accent); }

/* TICKETS / SUPPORT (kept) --------------------------------- */
.ticket-thread { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.ticket-msg {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ticket-msg.admin { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.ticket-msg-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}


/* =========================================================
   PHASE H - mobile sidebar drawer + responsive polish
   ========================================================= */

/* Sidebar backdrop - only visible on small screens when sidebar
   is expanded as an overlay drawer. Tap anywhere to close. */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  /* The shell becomes single-column so main content takes full width. */
  .shell { grid-template-columns: 1fr; }

  /* Sidebar overlays the content as a fixed drawer when expanded.
     Slides off-screen when collapsed. */
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 200;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 36px oklch(0% 0 0 / 0);
  }
  .shell[data-sidebar="expanded"] .sidebar {
    transform: translateX(0);
    box-shadow: 0 12px 36px oklch(0% 0 0 / 0.18);
  }
  /* Backdrop visible alongside an expanded sidebar on mobile. */
  .shell[data-sidebar="expanded"] ~ .sidebar-backdrop,
  .app-root .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.35);
    z-index: 150;
    animation: pamp-fadein 0.15s ease-out;
  }
  /* When sidebar is collapsed, the backdrop also hides. The JS only
     renders the backdrop element when sidebar is expanded, so this
     is a defensive belt-and-braces. */
  .shell[data-sidebar="collapsed"] ~ .sidebar-backdrop {
    display: none;
  }
  @keyframes pamp-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* Tighter padding so we have more room for content. */
  .main-scroll { padding: 16px; }
  .topbar { padding: 0 14px; }

  /* Grids fall back to single column on phones; 2-col was too cramped. */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* PageHead "right" actions wrap below the title rather than crowding. */
  .page-head { flex-wrap: wrap; }
  .page-head > :last-child { flex-basis: 100%; }

  /* Tables get a horizontal scroll on mobile rather than collapsing. */
  .card-flush table.tbl,
  .card table.tbl { display: block; overflow-x: auto; }

  /* Modals take more of the screen on mobile. */
  .modal { max-width: calc(100vw - 24px) !important; margin: 12px; }
  .modal-lg, .modal-xl { max-width: calc(100vw - 24px) !important; }
}

/* Slightly smaller hero metric on narrow viewports so the number
   doesn't get truncated. */
@media (max-width: 720px) {
  .metric-hero .metric-value { font-size: 36px !important; }
  .display { font-size: 28px !important; }
  .h1 { font-size: 28px !important; }
}

/* Dark mode polish - make backdrop a touch darker for better contrast
   over the dark surface. */
[data-theme="dark"] .sidebar-backdrop {
  background: oklch(0% 0 0 / 0.55) !important;
}
[data-theme="dark"] .modal-backdrop { background: oklch(0% 0 0 / 0.75); }

/* Loading state defaults consistent with our card styling. */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--ink-3);
  font-size: 13.5px;
}
.loading-state .spin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: pamp-spin 0.8s linear infinite;
}
@keyframes pamp-spin {
  to { transform: rotate(360deg); }
}
