/* ============================================================================
   LucidFlow — Portal (Login + Home Dashboard)
   Same design system as the landing page: Brand Kit palette, serif headlines,
   IBM Plex Mono UI, 1px lines, single soft corner-wash, calm motion.
   Self-contained (no styles.css dependency) so the app shell stays lean.
   ============================================================================ */

:root {
  --canvas:      #f7f4ee;
  --canvas-2:    #fbf9f4;
  --mist:        #d6e0d4;
  --mist-soft:   #e7ede4;
  --peach:       #e8a070;
  --sage:        #8aa890;
  --amber:       #d49858;
  --ink:         #1a1a1a;
  --ink-soft:    #242424;
  --muted:       #5d5a55;
  --faint:       #8b8780;
  --line:        rgba(26, 26, 26, 0.12);
  --line-soft:   rgba(26, 26, 26, 0.07);

  --wash-sage:  radial-gradient(120% 120% at 85% 12%, rgba(138,168,144,.55), rgba(138,168,144,0) 60%);
  --wash-peach: radial-gradient(120% 120% at 88% 10%, rgba(232,160,112,.50), rgba(232,160,112,0) 58%);
  --wash-amber: radial-gradient(120% 120% at 88% 10%, rgba(212,152,88,.48), rgba(212,152,88,0) 58%);
  --aurora: linear-gradient(115deg, var(--sage) 0%, var(--mist) 32%, var(--peach) 66%, var(--amber) 100%);

  --serif: "Noto Serif", Georgia, Cambria, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-caption: 12px;
  --t-body-sm: 14px;
  --t-body:    16px;

  --r-card: 14px;
  --r-pill: 100px;

  --side-w: 252px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (min-width: 901px) { html { zoom: 0.9; } }
/* Dashboard reads denser than the showcase at the shared 0.9 zoom — scale
   the app shell up 1.2× (net 1.08) so it feels right on a real screen.
   Scoped to .app so the login (verified at 0.9) is untouched, and gated
   to desktop so phones keep 1.0. */
@media (min-width: 901px) { .app { zoom: 1.2; } }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--t-body);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--canvas); }

/* static page grain — no blend-mode on a fixed layer (recompositing tax) */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.09 0 0 0 0.022 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--ink); opacity: .45; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 28px; border-radius: var(--r-pill);
  font-family: var(--mono); font-size: var(--t-body-sm); font-weight: 500;
  letter-spacing: 0.01em; white-space: nowrap;
  transition: transform .5s var(--ease), background .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}
.btn .arr { transition: transform .5s var(--ease); }
.btn:hover .arr { transform: translateX(5px); }
.btn-primary { background: var(--ink); color: var(--canvas); }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--aurora); opacity: 0; transition: opacity .45s var(--ease); z-index: -1;
}
.btn-primary:hover { color: var(--ink); }
.btn-primary:hover::after { opacity: 1; }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: rgba(26,26,26,.04); }

/* ========================================================================== */
/*  LOGIN                                                                      */
/* ========================================================================== */
.auth {
  position: relative; z-index: 1;
  min-height: 100vh; display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
/* Desktop applies html{zoom:0.9}; Chrome scales what 100vh resolves to, so
   a 100vh panel stops ~10% short of the real viewport and the canvas shows
   through near the bottom. Compensate by the exact zoom factor so the dark
   brand panel always reaches the page bottom. */
@media (min-width: 901px) {
  .auth { min-height: calc(100vh / 0.9); }
}
/* left — editorial brand panel (the product's "voice") */
.auth-aside {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--canvas);
  padding: clamp(40px, 5vw, 76px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside .glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(58% 70% at 12% 6%, rgba(138,168,144,.30), transparent 60%),
    radial-gradient(54% 66% at 92% 96%, rgba(232,160,112,.24), transparent 62%),
    radial-gradient(40% 48% at 70% 40%, rgba(212,152,88,.16), transparent 66%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand img { width: 34px; height: 34px; }
.auth-brand .word { font-family: var(--serif); font-size: 22px; letter-spacing: -0.03em; }
.auth-lead h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(34px, 4.4vw, 60px); line-height: 1.05; letter-spacing: -0.035em;
  max-width: 13ch;
}
.auth-lead h1 em {
  font-style: italic;
  background: var(--aurora); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-lead p {
  margin-top: 22px; max-width: 42ch; color: rgba(247,244,238,.62);
  font-size: var(--t-body-sm); line-height: 1.6;
}
.auth-aside .eyebrow { color: rgba(247,244,238,.6); }
.auth-aside .eyebrow::before { background: var(--canvas); }
.auth-foot {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px; letter-spacing: 0.04em; color: rgba(247,244,238,.45);
}
.auth-foot img { height: 20px; width: auto; opacity: .85; }
.auth-foot .sep { width: 1px; height: 22px; background: rgba(247,244,238,.18); }

/* right — the form */
.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: clamp(32px, 5vw, 72px);
}
.auth-card { width: 100%; max-width: 412px; }
.auth-card .eyebrow { margin-bottom: 22px; }
.auth-card h2 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.03em; line-height: 1.1;
}
.auth-card .sub { margin-top: 12px; color: var(--muted); font-size: var(--t-body-sm); }
.auth-form { margin-top: 38px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 9px; }
.field label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
}
.field input {
  width: 100%; padding: 15px 18px; background: var(--canvas-2);
  border: 1px solid var(--line); border-radius: 14px;
  font-family: var(--mono); font-size: var(--t-body-sm); letter-spacing: -0.01em;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.field input::placeholder { color: var(--faint); }
.field input:focus {
  outline: none; border-color: var(--sage);
  background: var(--canvas); box-shadow: 0 0 0 4px rgba(138,168,144,.14);
}
.auth-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.auth-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.auth-row input { accent-color: var(--sage); width: 14px; height: 14px; }
.auth-row a { color: var(--muted); }
.auth-row a:hover { color: var(--ink); }
.auth-form .btn { margin-top: 6px; padding: 17px 28px; }
.auth-note {
  margin-top: 26px; padding: 14px 16px; border: 1px dashed var(--line);
  border-radius: 14px; background: var(--canvas-2);
  font-size: 11.5px; line-height: 1.6; color: var(--muted);
}
.auth-note b { color: var(--ink); font-weight: 500; }
.auth-alt { margin-top: 22px; font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-alt a { color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 1px; }

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { min-height: 100vh; }
}

/* ========================================================================== */
/*  APP SHELL                                                                  */
/* ========================================================================== */
/* Showcase grammar: cards/sidebar sit on `--canvas`, the field behind
   them is the slightly lighter `--canvas-2`. Calm, flat, thin-bordered. */
.app {
  position: relative; z-index: 1; display: flex; min-height: 100vh;
  background: var(--canvas-2);
}

/* ---- sidebar ---- */
.side {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w);
  display: flex; flex-direction: column; gap: 3px;
  padding: 22px 14px;
  background: var(--canvas); border-right: 1px solid var(--line-soft);
  overflow-y: auto; z-index: 40;
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 10px 22px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.side-brand img { width: 24px; height: 24px; }
.side-brand b { font-family: var(--serif); font-weight: 400; font-size: 18px; letter-spacing: -0.02em; }
.side-grp {
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
  padding: 16px 12px 7px;
}
.side-grp:first-of-type { padding-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 12.5px; letter-spacing: -0.01em; color: var(--muted);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.nav-item .ic { width: 15px; text-align: center; font-size: 12px; color: var(--faint); transition: color .25s var(--ease); }
.nav-item .tag {
  margin-left: auto; font-size: 10px; letter-spacing: 0.04em; color: var(--faint);
}
.nav-item:hover { background: rgba(26,26,26,.035); color: var(--ink); }
.nav-item:hover .ic { color: var(--muted); }
.nav-item.is-on { background: rgba(138,168,144,.18); color: var(--ink); }
.nav-item.is-on .ic { color: var(--sage); }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 11px;
  padding: 12px 10px 4px; border-top: 1px solid var(--line-soft);
}
.side-user .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 15px; color: var(--ink);
  background: var(--mist-soft); border: 1px solid var(--line);
}
.side-user .meta { min-width: 0; flex: 1; }
.side-user .meta b { display: block; font-size: 12.5px; font-weight: 500; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .meta span { display: block; font-size: 10.5px; color: var(--faint); letter-spacing: 0.04em; }
.side-user button {
  flex: none; width: 30px; height: 30px; border-radius: 9px; color: var(--faint);
  display: grid; place-items: center; transition: background .25s var(--ease), color .25s var(--ease);
}
.side-user button:hover { background: rgba(26,26,26,.05); color: var(--ink); }

/* ---- main column ---- */
.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 20px clamp(22px, 3.4vw, 48px);
  /* solid fill — NO backdrop-filter on a sticky bar (re-blur every frame) */
  background: rgba(251,249,244,.93);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .sb-toggle { display: none; }
.greet { min-width: 0; flex: 1; }
.greet h1 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -0.025em; line-height: 1.15;
}
.greet p { margin-top: 4px; font-size: 12px; color: var(--faint); letter-spacing: 0.02em; }
.period {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--canvas-2); border: 1px solid var(--line-soft); border-radius: var(--r-pill);
}
.period button {
  padding: 6px 14px; border-radius: var(--r-pill); font-size: 12px; color: var(--muted);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.period button.is-on { background: rgba(138,168,144,.18); color: var(--ink); }
.bell {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  border: 1px solid var(--line-soft); transition: border-color .25s var(--ease), color .25s var(--ease);
}
.bell:hover { border-color: var(--line); color: var(--ink); }

.content { padding: clamp(24px, 3vw, 40px) clamp(22px, 3.4vw, 48px) 72px; }
.content > section { margin-top: clamp(20px, 2.4vw, 30px); }
.content > section:first-child { margin-top: 0; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 16px;
}
.sec-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(17px, 1.5vw, 20px);
  letter-spacing: -0.02em;
}
.sec-head a { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sec-head a:hover { color: var(--ink); }
.sec-head a .arr { transition: transform .4s var(--ease); }
.sec-head a:hover .arr { transform: translateX(4px); }

/* ---- KPI cards (F-HOME-001) ---- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
/* KPI tiles — the showcase's .sc-kpi grammar: flat, thin-bordered,
   mono micro-label, big serif value, tiny trend. No wash, no lift. */
.kpi {
  display: flex; flex-direction: column; gap: 7px;
  padding: 17px 18px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-card);
  background: var(--canvas);
  transition: border-color .35s var(--ease);
}
.kpi:hover { border-color: var(--line); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi .l { font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em; color: var(--faint); }
.kpi .help {
  width: 15px; height: 15px; flex: none; display: grid; place-items: center;
  font-size: 10px; font-style: italic; color: var(--faint); cursor: help;
}
.kpi .v {
  font-family: var(--serif); font-size: clamp(24px, 2.5vw, 32px);
  letter-spacing: -0.025em; line-height: 1; margin: 3px 0 4px;
  display: flex; align-items: baseline; gap: 4px;
}
.kpi .v .u { font-family: var(--mono); font-size: .34em; color: var(--faint); letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.kpi .delta { display: inline-flex; align-items: center; gap: 4px; }
.kpi .delta.up { color: var(--sage); }
.kpi .delta.dn { color: var(--peach); }
.kpi .delta.flat { color: var(--faint); }
.kpi .win { color: var(--faint); letter-spacing: 0.02em; }

/* ---- two-column grid: trend+table | attention ---- */
.grid2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 12px; align-items: start; }
.card {
  border: 1px solid var(--line-soft); border-radius: var(--r-card);
  background: var(--canvas); overflow: hidden;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
}
/* mono header — the showcase .sc-h grammar (not serif) */
.card-h h3 { font-family: var(--mono); font-weight: 500; font-size: 12.5px; letter-spacing: 0.01em; color: var(--ink); }
.card-h h3 span { font-weight: 400; color: var(--faint); margin-left: 7px; }
.card-h .legend, .card-h a { font-size: 11px; color: var(--faint); display: inline-flex; align-items: center; gap: 7px; }
.card-h a:hover { color: var(--ink); }
.card-h a .arr { transition: transform .4s var(--ease); }
.card-h a:hover .arr { transform: translateX(4px); }
.card-h .legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }

/* delivery trend sparkline — exact showcase grammar */
.trend-body { padding: 10px 18px 18px; }
.spark { width: 100%; height: 138px; display: block; overflow: visible; }
.spark-fill { fill: rgba(138,168,144,.15); opacity: 0; animation: scFade .9s ease 2.2s forwards; }
.spark-line {
  fill: none; stroke: var(--sage); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: scDraw 3s var(--ease) forwards;
}
.spark-dot { fill: var(--amber); opacity: 0; animation: scFade .5s ease 2.7s forwards; }
.trend-x { display: flex; justify-content: space-between; padding: 9px 2px 0;
  font-size: 10px; color: var(--faint); letter-spacing: 0.04em; }
@keyframes scDraw { to { stroke-dashoffset: 0; } }
@keyframes scFade { to { opacity: 1; } }

/* team members table (F-HOME-002) */
.t-wrap { overflow-x: auto; }
table.team { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.team thead th {
  text-align: left; padding: 11px 18px; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); font-weight: 500;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap; user-select: none;
}
.team th.sortable { cursor: pointer; }
.team th.sortable:hover { color: var(--muted); }
.team th .ar { opacity: 0; margin-left: 5px; font-size: 9px; transition: opacity .2s; }
.team th.sortable:hover .ar { opacity: .5; }
.team th.sorted .ar { opacity: 1; color: var(--sage); }
.team th.num, .team td.num { text-align: right; font-variant-numeric: tabular-nums; }
.team tbody td { padding: 11px 18px; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.team tbody tr:last-child td { border-bottom: 0; }
.team tbody tr { transition: background .2s var(--ease); }
.team tbody tr:hover { background: rgba(26,26,26,.025); }
.who { display: flex; align-items: center; gap: 10px; }
.who .av {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--serif); font-size: 12px; color: var(--ink);
  background: var(--mist-soft); border: 1px solid var(--line);
}
.who b { font-weight: 500; letter-spacing: -0.01em; }
.who small { display: block; font-size: 10px; color: var(--faint); letter-spacing: 0.02em; }
.team td .pill { font-size: 10px; color: var(--faint); }
.lt-bad { color: var(--peach); }

/* attention needed (F-HOME-003) — the showcase's .sc-sig grammar:
   colored dot · serif count · name · faint category. Compact, calm. */
.attn { display: flex; flex-direction: column; }
.attn .card-h .live {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}
.attn .card-h .live i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--sage);
  animation: pulse 2.4s var(--ease-soft) infinite;
}
.sig {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  transition: background .2s var(--ease);
}
.sig:last-child { border-bottom: 0; }
.sig:hover { background: rgba(26,26,26,.025); }
.sig .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sig .dot.q { background: var(--sage); }
.sig .dot.t { background: var(--amber); }
.sig .dot.p { background: var(--peach); }
.sig .n { font-family: var(--serif); font-size: 18px; letter-spacing: -0.02em;
  line-height: 1; min-width: 26px; color: var(--ink); }
.sig .nm { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig .cat {
  flex: none; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint);
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(138,168,144,.5); }
  70%,100% { box-shadow: 0 0 0 7px rgba(138,168,144,0); } }

/* quick navigation (F-HOME-004) */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qcard {
  display: flex; flex-direction: column; gap: 9px;
  padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--r-card);
  background: var(--canvas);
  transition: border-color .35s var(--ease);
}
.qcard:hover { border-color: var(--line); }
.qcard .qk { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sage); }
.qcard h3 {
  font-family: var(--serif); font-weight: 400; font-size: 18px; letter-spacing: -0.02em;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.qcard h3 .arr { font-size: 15px; color: var(--faint); transition: transform .4s var(--ease), color .4s var(--ease); }
.qcard:hover h3 .arr { transform: translateX(5px); color: var(--ink); }
.qcard p { font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ---- reveal-on-enter (transform/opacity only) ---- */
[data-rise] { opacity: 0; transform: translateY(20px); }
.is-ready [data-rise] { transition: opacity .8s var(--ease), transform .8s var(--ease); }
[data-rise].in { opacity: 1; transform: none; }

/* ---- toast (unbuilt-module hint) ---- */
#toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--canvas);
  font-size: 12.5px; letter-spacing: -0.005em; white-space: nowrap;
  box-shadow: 0 18px 44px -22px rgba(26,26,26,.55);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast i { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); flex: none; }

/* ---- mobile sidebar ---- */
.scrim {
  position: fixed; inset: 0; z-index: 35; background: rgba(26,26,26,.42);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }

@media (max-width: 1080px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  :root { --side-w: 0px; }
  .side {
    transform: translateX(-100%); width: 264px;
    transition: transform .4s var(--ease); box-shadow: 0 24px 60px -28px rgba(26,26,26,.4);
  }
  .side.open { transform: none; }
  .main { margin-left: 0; }
  .topbar .sb-toggle {
    display: grid; place-items: center; flex: none;
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-soft); color: var(--ink);
  }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .period { display: none; }
  .greet h1 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .spark-line { animation: none; stroke-dashoffset: 0; }
  .spark-fill, .spark-dot { animation: none; opacity: 1; }
  .attn .card-h .live i { animation: none; }
  .dotpulse i { animation: none !important; }
  [data-rise] { opacity: 1 !important; transform: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ========================================================================== */
/*  DOC AGENT — same showcase grammar: flat canvas panels, mono labels,        */
/*  serif headings, sage/peach accents.                                        */
/* ========================================================================== */
.status-chip {
  font-size: 11px; letter-spacing: 0.04em; color: var(--faint);
  border: 1px solid var(--line-soft); border-radius: var(--r-pill);
  padding: 7px 14px; white-space: nowrap;
}

.kindbar { display: flex; flex-wrap: wrap; gap: 8px; }
.kind {
  padding: 9px 16px; border-radius: var(--r-pill); font-size: 12.5px;
  color: var(--muted); border: 1px solid var(--line-soft); background: var(--canvas);
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.kind:hover { color: var(--ink); border-color: var(--line); }
.kind.is-on { background: rgba(138,168,144,.18); color: var(--ink); border-color: transparent; }

.docform-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.docform .field label {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.docform input, .docform textarea {
  width: 100%; padding: 13px 15px; background: var(--canvas-2);
  border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 13px; letter-spacing: -0.01em; color: var(--ink);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.docform textarea { resize: vertical; line-height: 1.6; min-height: 150px; }
.docform input::placeholder, .docform textarea::placeholder { color: var(--faint); }
.docform input:focus, .docform textarea:focus {
  outline: none; border-color: var(--sage); background: var(--canvas);
  box-shadow: 0 0 0 4px rgba(138,168,144,.13);
}
.docform .hint { align-self: flex-end; font-size: 10.5px; color: var(--faint); margin-top: -4px; }
.docform-actions { display: flex; gap: 10px; }
.docform-actions .btn { padding: 13px 24px; }
.ai-note { font-size: 11px; line-height: 1.55; color: var(--faint); }

.histlist { display: flex; flex-direction: column; padding: 6px; }
.hist-empty { padding: 22px 18px; font-size: 12px; color: var(--faint); }
.hist {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 12px 14px; border-radius: 11px; width: 100%;
  transition: background .2s var(--ease);
}
.hist:hover { background: rgba(26,26,26,.035); }
.hist .hk {
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
}
.hist b {
  font-weight: 500; font-size: 12.5px; letter-spacing: -0.01em; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist .ht { font-size: 10.5px; color: var(--faint); }

#resultCard { margin-top: 0; }
.res-actions { display: inline-flex; gap: 8px; }
.res-actions button {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: var(--r-pill); padding: 5px 13px;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.res-actions button:hover { color: var(--ink); border-color: var(--line); }
.result-body { padding: 22px; }

.empty { text-align: center; padding: 56px 24px; color: var(--faint); }
.empty-mark {
  font-size: 30px; color: var(--sage); margin-bottom: 14px;
  font-family: var(--serif);
}
.empty p { font-size: 13px; max-width: 42ch; margin: 0 auto; line-height: 1.6; }

.loading { text-align: center; padding: 56px 24px; color: var(--muted); }
.loading p { margin-top: 16px; font-size: 12.5px; }
.dotpulse { display: inline-flex; gap: 7px; }
.dotpulse i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--sage);
  animation: dotp 1.1s var(--ease-soft) infinite;
}
.dotpulse i:nth-child(2) { animation-delay: .15s; background: var(--amber); }
.dotpulse i:nth-child(3) { animation-delay: .3s; background: var(--peach); }
@keyframes dotp { 0%,100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-5px); } }

.errbox {
  margin: 0; padding: 18px 20px; border: 1px solid rgba(232,160,112,.5);
  background: rgba(232,160,112,.10); border-radius: 14px;
  font-size: 12.5px; line-height: 1.6; color: var(--ink);
}

.assume {
  border: 1px solid var(--line-soft); border-radius: 14px;
  background: rgba(138,168,144,.10); padding: 14px 18px; margin-bottom: 22px;
}
.assume-h {
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sage); margin-bottom: 8px;
}
.assume ul { margin: 0; padding-left: 18px; }
.assume li { font-size: 12px; line-height: 1.6; color: var(--muted); }

/* generated document — serif headings, mono body, calm */
.md-body { color: var(--ink); font-size: 13.5px; line-height: 1.72; max-width: 78ch; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em;
  line-height: 1.2; margin: 1.5em 0 .5em;
}
.md-body h1 { font-size: 26px; margin-top: 0; }
.md-body h2 { font-size: 21px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.md-body h3 { font-size: 17px; }
.md-body h4 { font-size: 14px; }
.md-body p, .md-body li { margin: .55em 0; }
.md-body ul, .md-body ol { padding-left: 22px; }
.md-body li { padding-left: 4px; }
.md-body a { color: #4f7a59; border-bottom: 1px solid rgba(138,168,144,.5); }
.md-body a:hover { color: var(--ink); }
.md-body strong { font-weight: 500; }
.md-body blockquote {
  margin: 1em 0; padding: 6px 16px; border-left: 2px solid var(--sage);
  color: var(--muted); font-style: italic;
}
.md-body code {
  font-family: var(--mono); font-size: .9em;
  background: rgba(26,26,26,.05); padding: 2px 6px; border-radius: 5px;
}
.md-body pre {
  background: var(--canvas-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 16px; overflow-x: auto; margin: 1em 0;
}
.md-body pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.6; }
.md-body table {
  width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 12.5px;
}
.md-body th, .md-body td {
  border: 1px solid var(--line-soft); padding: 9px 12px; text-align: left;
}
.md-body th { background: var(--canvas-2); font-weight: 500; }
.md-body hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.6em 0; }
.md-body img { border-radius: 10px; }

/* small faint note on the right of a section heading */
.sec-note { font-size: 11px; color: var(--faint); letter-spacing: 0.02em; }

/* scenario gallery — the default, low-friction path. One clean row, one
   card per document kind. Same calm grammar as .qcard: flat canvas card,
   thin border, hover = border + arrow nudge only. */
.scenarios { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.scn {
  display: flex; flex-direction: column; gap: 9px; text-align: left;
  width: 100%; height: 100%;
  padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--r-card);
  background: var(--canvas);
  transition: border-color .35s var(--ease);
}
.scn:hover { border-color: var(--line); }
.scn:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.scn-k {
  font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sage);
}
.scn b {
  font-family: var(--serif); font-weight: 400; font-size: 17px;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1.25;
}
.scn-b {
  font-size: 11.5px; line-height: 1.55; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.scn-go {
  margin-top: auto; padding-top: 8px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--faint);
  transition: color .3s var(--ease);
}
.scn-go .arr { font-style: normal; transition: transform .4s var(--ease); }
.scn:hover .scn-go { color: var(--ink); }
.scn:hover .scn-go .arr { transform: translateX(4px); }

/* loading subtext */
.ld-sub { display: block; margin-top: 5px; font-size: 11px; color: var(--faint); }

/* brief recap — makes the one-line-in → full-doc-out transformation visible */
.brief-recap {
  border: 1px solid var(--line-soft); border-left: 2px solid var(--amber);
  border-radius: 12px; background: var(--canvas-2);
  padding: 13px 16px; margin-bottom: 16px;
}
.brief-recap .br-k {
  display: block; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 5px;
}
.brief-recap p { font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* collapsible "write your own" — one quiet bar; the heavy form + history
   stay folded away so the default showcase view is calm and uncluttered */
.own-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; padding: 16px 22px;
  border: 1px solid var(--line-soft); border-radius: var(--r-card);
  background: var(--canvas);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.own-toggle:hover { border-color: var(--line); background: rgba(26,26,26,.015); }
.own-toggle .ot-l {
  font-family: var(--serif); font-size: 16px; letter-spacing: -0.015em; color: var(--ink);
}
.own-toggle .ot-r {
  display: inline-flex; align-items: center; gap: 13px;
  font-size: 11.5px; color: var(--faint); letter-spacing: 0.02em;
}
.own-toggle .ot-ic {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-soft); border-radius: 50%;
  font-style: normal; font-size: 14px; line-height: 1; color: var(--muted);
  transition: transform .35s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.own-toggle:hover .ot-ic { color: var(--ink); border-color: var(--line); }
.own-toggle.is-open .ot-ic { transform: rotate(45deg); }   /* + becomes × */

.own-panel {
  max-height: 0; margin-top: 0; opacity: 0; overflow: hidden;
  transition: max-height .45s var(--ease), opacity .35s var(--ease),
              margin-top .45s var(--ease);
}
.own-panel.is-open { max-height: 2200px; margin-top: 12px; opacity: 1; }

@media (max-width: 1080px) {
  .scenarios { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .docform-actions { flex-direction: column; }
  .docform-actions .btn { width: 100%; }
  .scenarios { grid-template-columns: 1fr; }
  .own-toggle { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .own-panel { transition: none; }
  .own-toggle .ot-ic { transition: none; }
}
