/* ==========================================================================
   Mixloft — reference-app
   Software screens reskinned into the landing's design language.
   Flat print/editorial system: squared geometry, one hairline, no gradient
   "materials", no bevels, no panel shadows. Tokens lifted verbatim from the
   landing (mixloft-ux-accessibility-pass.vercel.app) — see
   02-Business/Mixloft/product/design-system.md for the annotated spec.
   ========================================================================== */

/* ---------------------------------------------------------------------- */
/* Tokens                                                                   */
/* ---------------------------------------------------------------------- */

:root,
[data-theme="light"] {
  /* raw landing tokens, verbatim */
  --ml-canvas: #f4f3ef;      /* landing page ground, measured — #f1eee4 is the landing's cream BAND tone, not its canvas */
  --ml-paper: #fbfaf5;
  --ml-paper-warm: #f2f0e8;  /* landing's pricing-card warm putty fill — for stat/offer cards, not working panels */
  --ml-metal: #d7dad4;
  --ml-ink: #181c1d;
  --ml-muted: #626661;
  --ml-line: #c8cbc4;
  --ml-signal: #4055d6;
  --ml-signal-dark: #263794;
  --ml-pencil: #a53b22;
  --ml-night: #171b1d;

  /* semantic layer the components read from */
  --canvas: var(--ml-canvas);
  --paper: var(--ml-paper);
  --paper-warm: var(--ml-paper-warm);
  --card-line: #c8cbc4;      /* landing hairline, measured — was #d0d2cc (drifted) */
  --line: var(--ml-line);
  --sidebar-bg: #ecebe5;     /* landing's .ml-preview-sidebar */
  --sidebar-active: #d9d9d3; /* landing's active nav-item bg */
  --ink: var(--ml-ink);
  --muted: var(--ml-muted);
  --faint: #858883;          /* landing's tiniest mono meta color */
  --signal: var(--ml-signal);
  --signal-dark: var(--ml-signal-dark);
  --pencil: var(--ml-pencil);

  --btn-primary-bg: var(--ml-ink);
  --btn-primary-fg: #ffffff;
  --btn-primary-hover-bg: var(--ml-signal-dark);
  --btn-secondary-bg: #fbfaf59e;

  --ok-bg: #edf4ec; --ok-line: #cbd4ca; --ok-fg: #3c5d40; --ok-dot: #4d8658;
  --info-bg: #ececf6; --info-line: #d7d9ef; --info-fg: #263794;
  --warn-bg: #f7ece6; --warn-line: #e3cec4; --warn-fg: #a53b22;
  --live-bg: #181c1d; --live-fg: #ffffff;

  /* radius scale — soft-modern surfaces, matched to the Cofounder direction */
  --r-sm: 3px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* shadow scale — replaces the old flat/no-shadow rule */
  --shadow-sm: 0 1px 2px rgba(26, 25, 21, .05);
  --shadow-md: 0 6px 20px rgba(26, 25, 21, .07);
  --shadow-lg: 0 22px 55px rgba(26, 25, 21, .11);

  color-scheme: light;
}

[data-theme="dark"] {
  --ml-canvas: #171b1d;
  --ml-paper: #20282c;   /* "raised" */
  --ml-metal: #252d31;   /* "elevated" */
  --ml-paper-warm: var(--ml-metal); /* dark theme untouched: reuses the existing "elevated" step, no new dark value */
  --ml-ink: #f0eee6;
  --ml-muted: #b9c0c1;
  --ml-line: rgba(240, 238, 230, .14);
  --ml-signal: #6e82e8;
  --ml-signal-dark: #8494ed; /* lifted — dark-mode hover brightens, it doesn't darken */
  --ml-pencil: #c4623f;
  --ml-night: #f0eee6;

  --canvas: var(--ml-canvas);
  --paper: var(--ml-paper);
  --paper-warm: var(--ml-paper-warm);
  --card-line: rgba(240, 238, 230, .16);
  --line: var(--ml-line);
  --sidebar-bg: var(--ml-paper);
  --sidebar-active: var(--ml-metal);
  --ink: var(--ml-ink);
  --muted: var(--ml-muted);
  --faint: #8b9294;
  --signal: var(--ml-signal);
  --signal-dark: var(--ml-signal-dark);
  --pencil: var(--ml-pencil);

  --btn-primary-bg: var(--ml-ink);
  --btn-primary-fg: #171b1d;
  --btn-primary-hover-bg: var(--ml-signal-dark);
  --btn-secondary-bg: rgba(37, 45, 49, .6);

  --ok-bg: rgba(77, 134, 88, .16); --ok-line: rgba(77, 134, 88, .4); --ok-fg: #8fcb9a; --ok-dot: #6fbf82;
  --info-bg: rgba(110, 130, 232, .16); --info-line: rgba(110, 130, 232, .4); --info-fg: #aeb9f2;
  --warn-bg: rgba(196, 98, 63, .16); --warn-line: rgba(196, 98, 63, .4); --warn-fg: #e2a188;
  --live-bg: #f0eee6; --live-fg: #171b1d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, .4);

  color-scheme: dark;
}

/* ---------------------------------------------------------------------- */
/* Reset + base                                                             */
/* ---------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

::selection { background: var(--ml-pencil); color: #fff; }

:focus-visible {
  outline: 2px solid var(--ml-signal);
  outline-offset: 4px;
}

img, svg { display: block; max-width: 100%; }

/* ---------------------------------------------------------------------- */
/* Type roles                                                               */
/* ---------------------------------------------------------------------- */

.serif { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; }
.mono  { font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace; }

h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 650;
  letter-spacing: -.03em;
  font-size: 2rem;
  line-height: 1.05;
}
h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 610;
  letter-spacing: -.02em;
  font-size: 1.05rem;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  letter-spacing: .135em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .62rem;
  font-weight: 600;
  margin: 0 0 .9rem;
}
.eyebrow > span {
  border: 1px solid var(--line);
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  color: var(--ink);
  display: grid;
  place-items: center;
  letter-spacing: 0;
  font-size: .62rem;
}

.kicker {
  font-family: "IBM Plex Mono", monospace;
  color: var(--faint);
  letter-spacing: .11em;
  text-transform: uppercase;
  font-size: .62rem;
  font-weight: 600;
  display: block;
}

/* ---------------------------------------------------------------------- */
/* App shell                                                                */
/* ---------------------------------------------------------------------- */

.app-shell { display: flex; min-height: 100dvh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 15rem;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-line);
  display: flex;
  flex-direction: column;
  padding: 1.1rem .8rem .9rem;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-head { padding: .3rem .5rem 1.1rem; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -.03em;
}
.wordmark .mark {
  background: var(--ml-ink);
  color: var(--ml-canvas);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--r-sm);
  display: grid;
  align-content: center;
  gap: 3px;
  padding: .35rem .3rem;
}
[data-theme="dark"] .wordmark .mark { background: var(--ml-ink); color: var(--ml-night); }
.wordmark .mark i { display: block; height: 2px; border-radius: 99px; background: currentColor; }
.wordmark .mark i:nth-child(1) { width: 72%; }
.wordmark .mark i:nth-child(2) { width: 100%; }
.wordmark .mark i:nth-child(3) { width: 58%; margin-left: auto; }
.workspace {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: .62rem;
  margin-top: .3rem;
}

.nav-group { margin-top: .4rem; }
.nav-group-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  color: var(--faint);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .58rem;
  margin: .95rem .5rem .3rem;
}

.nav-item, span.nav-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  border-radius: var(--r-sm);
  padding: .52rem .55rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
}
a.nav-item { cursor: pointer; }
a.nav-item:hover, a.nav-item.active { background: var(--sidebar-active); color: var(--ink); }
a.nav-item.active { font-weight: 600; }
span.nav-item {
  color: var(--faint);
  cursor: default;
}
.nav-item .dot { width: .32rem; height: .32rem; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
a.nav-item.active .dot { background: var(--signal); opacity: 1; }
.nav-item .soon {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: .5rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
  opacity: .7;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: .9rem;
  border-top: 1px solid var(--card-line);
}
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .5rem; margin-bottom: .5rem; border-radius: var(--r-md); }
.avatar {
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--ml-night);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: .52rem;
  flex: none;
}
[data-theme="dark"] .avatar { background: var(--ml-metal); color: var(--ink); }
.user-chip .who b { display: block; font-size: .74rem; font-weight: 600; }
.user-chip .who span { display: block; font-size: .62rem; color: var(--muted); }

.sidebar-links { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-links button, .sidebar-links span {
  text-align: left;
  background: none;
  border: 0;
  padding: .45rem .55rem;
  font-size: .68rem;
  color: var(--muted);
  border-radius: var(--r-md);
  cursor: default;
}

/* ---------------------------------------------------------------------- */
/* Main / topbar / page                                                    */
/* ---------------------------------------------------------------------- */

.app-main { flex: 1; margin-left: 15rem; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.6rem;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--card-line);
}
.topbar-crumb {
  font-family: "IBM Plex Mono", monospace;
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.topbar-crumb b { color: var(--ink); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }

.search-affordance {
  display: flex;
  align-items: center;
  gap: .6rem;
  height: 2.15rem;
  padding: 0 .7rem;
  border: 1px solid var(--card-line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: .74rem;
  min-width: 15rem;
}
.search-affordance kbd {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: .62rem;
  color: var(--faint);
  border: 1px solid var(--line);
  padding: .1rem .35rem;
}

.theme-toggle {
  height: 2.15rem;
  padding: 0 .7rem;
  border: 1px solid var(--card-line);
  border-radius: var(--r-md);
  background: var(--btn-secondary-bg);
  font-family: "IBM Plex Mono", monospace;
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink);
}
.theme-toggle:hover { border-color: var(--ink); }

.page { max-width: min(100%, 92rem); margin: 0 auto; padding: 2.2rem 1.6rem 4rem; }
.page-header { margin-bottom: 1.9rem; }
.page-header h1 { margin-top: 0; }
.page-sub { color: var(--muted); font-size: .85rem; margin-top: .5rem; max-width: 42rem; }

.stack { display: flex; flex-direction: column; gap: 1.6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }

.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .75rem; }
.block-head .count { font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                  */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-radius: var(--r-md);
  font-size: .78rem;
  font-weight: 650;
  min-height: 2.6rem;
  padding: 0 1rem;
  cursor: pointer;
  transition: transform .16s, background .16s, border-color .16s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: 1px solid var(--btn-primary-bg);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--btn-primary-hover-bg); border-color: var(--btn-primary-hover-bg); transform: translateY(-2px); }
.btn-ghost {
  background: var(--btn-secondary-bg);
  color: var(--ink);
  border: 1px solid var(--card-line);
}
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-2px); }
.btn-sm { min-height: 2.15rem; font-size: .7rem; padding: 0 .8rem; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------------- */
/* Cards / pills                                                            */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--paper);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.1rem 1.2rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: .3rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.pill-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.pill-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.pill-outline { background: transparent; color: var(--muted); }
.pill-live { background: var(--live-bg); border-color: var(--live-bg); color: var(--live-fg); }
.pill i.dot { width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }

/* ---------------------------------------------------------------------- */
/* Today — timeline, attention card, activity feed, project cards, stats   */
/* ---------------------------------------------------------------------- */

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.stat-tile { padding: 1.2rem 1.3rem; background: var(--paper-warm); }
.stat-num { font-family: "Instrument Serif", Georgia, serif; font-size: 2.4rem; font-weight: 400; line-height: 1; letter-spacing: -.02em; }
.stat-label { margin-top: .5rem; color: var(--muted); font-size: .74rem; }

.tl-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .95rem 0;
  border-top: 1px solid var(--card-line);
}
.tl-row:first-of-type { border-top: none; }
.tl-time { font-family: "IBM Plex Mono", monospace; font-size: .68rem; color: var(--muted); }
.tl-title { font-size: .86rem; font-weight: 600; }
.tl-meta { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.tl-row.open { opacity: .65; }
.tl-row.open .tl-title { font-weight: 500; font-style: italic; }

.attn-list { background: var(--paper); border: 1px solid var(--card-line); border-radius: var(--r-md); padding: .9rem 1.1rem; }
.attn-list li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: .5rem;
  padding: .75rem 0;
  border-top: 1px solid var(--card-line);
}
.attn-list li:first-child { border-top: none; }
.attn-list li i {
  font-family: "IBM Plex Mono", monospace;
  font-style: normal;
  font-size: .64rem;
  color: var(--faint);
}
.attn-list li p { font-size: .82rem; line-height: 1.4; }

.feed-row { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem 0; border-top: 1px solid var(--card-line); }
.feed-row:first-child { border-top: none; }
.feed-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--signal); margin-top: .35rem; flex: none; }
.feed-dot.ok { background: var(--ok-dot); }
.feed-dot.warn { background: var(--pencil); }
.feed-row p { font-size: .8rem; line-height: 1.5; }
.feed-time { display: block; font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--faint); margin-top: .2rem; }

.proj-card { padding: 1.1rem 1.2rem; }
.proj-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.proj-card h3 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.55rem; letter-spacing: -.02em; line-height: 1; }
.proj-client { font-size: .7rem; color: var(--muted); margin-top: .35rem; }
.proj-stage { margin-top: .9rem; font-size: .74rem; color: var(--muted); padding-top: .8rem; border-top: 1px solid var(--card-line); }

/* ---------------------------------------------------------------------- */
/* Calendar                                                                 */
/* ---------------------------------------------------------------------- */

.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.3rem; align-items: start; }
.cal-scroll { overflow-x: auto; border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--paper); }
.cal-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(108px, 1fr));
  grid-template-rows: auto repeat(12, 48px);
  min-width: 860px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cal-head-cell {
  padding: .7rem .4rem;
  text-align: center;
  border-bottom: 1px solid var(--card-line);
  border-left: 1px solid var(--card-line);
  background: var(--sidebar-bg);
}
.cal-head-cell:first-child { border-left: none; }
.cal-head-cell.is-today { box-shadow: inset 0 -2px 0 var(--signal); }
.d-name { font-family: "IBM Plex Mono", monospace; font-size: .58rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.d-num { font-family: "Instrument Serif", Georgia, serif; font-size: 1.1rem; margin-top: .15rem; }
.cal-time-label { padding: .3rem .5rem; font-family: "IBM Plex Mono", monospace; font-size: .58rem; color: var(--faint); border-top: 1px solid var(--card-line); text-align: right; }
.cal-cell { border-top: 1px solid var(--card-line); border-left: 1px solid var(--card-line); position: relative; padding: 2px; overflow: hidden; }

.ev {
  height: 100%;
  padding: .4rem .5rem;
  font-size: .66rem;
  line-height: 1.3;
  border: 1px solid var(--info-line);
  border-radius: var(--r-sm);
  background: var(--info-bg);
  color: var(--info-fg);
  overflow: hidden;
}
.ev b { display: block; font-weight: 600; margin-bottom: .15rem; font-size: .68rem; }
.ev.money { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.ev.task { background: var(--sidebar-active); border-color: var(--card-line); color: var(--ink); }
.ev.open {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: .56rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.book-panel { padding: 1.3rem; position: sticky; top: 5.1rem; }
.book-panel h3 { font-size: .95rem; font-weight: 610; margin-bottom: 1.1rem; }
.field { margin-bottom: .85rem; }
.field label { display: block; font-family: "IBM Plex Mono", monospace; font-size: .58rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin-bottom: .35rem; }
.field-value {
  height: 2.4rem;
  display: flex;
  align-items: center;
  padding: 0 .7rem;
  border: 1px solid var(--card-line);
  border-radius: var(--r-md);
  font-size: .78rem;
}
.seg { display: flex; border: 1px solid var(--card-line); border-radius: var(--r-md); overflow: hidden; }
.seg button { flex: 1; border: none; background: transparent; padding: .55rem 0; font-size: .72rem; color: var(--muted); border-right: 1px solid var(--card-line); cursor: pointer; }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--ml-ink); color: #fff; }
[data-theme="dark"] .seg button.active { background: var(--ml-ink); color: var(--ml-night); }
.deposit-line { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem 0; border-top: 1px solid var(--card-line); margin-top: .3rem; font-size: .78rem; }
.deposit-line b { font-family: "Instrument Serif", Georgia, serif; font-size: 1.15rem; font-weight: 400; }

.openings-card { padding: 1.15rem 1.3rem; margin-top: 1rem; }
.openings-list { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 2rem; padding: 0 .65rem; border: 1px solid var(--line); border-radius: var(--r-pill); box-shadow: var(--shadow-sm); font-size: .68rem; font-family: "IBM Plex Mono", monospace; color: var(--muted); }
.chip.dashed { border-style: dashed; }
.openings-caption { margin-top: .8rem; font-size: .72rem; color: var(--muted); }

@media (max-width: 980px) {
  .cal-wrap { grid-template-columns: minmax(0, 1fr); }
  .book-panel { position: static; }
}

/* ---------------------------------------------------------------------- */
/* Client + versions                                                       */
/* ---------------------------------------------------------------------- */

.client-head { display: flex; align-items: center; gap: 1.2rem; padding: 1.3rem 1.4rem; flex-wrap: wrap; }
.client-art {
  width: 3.6rem;
  aspect-ratio: 1;
  background: #1d2428;
  color: #fff;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: none;
}
.client-art span { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-size: 1rem; z-index: 2; }
.client-art i { position: absolute; background: var(--ml-pencil); width: 180%; height: 1.5rem; transform: rotate(-27deg); }
.ch-name { font-size: 1.15rem; font-weight: 650; }
.ch-tags { display: flex; gap: .5rem; margin-top: .5rem; }
.ch-ltv { margin-left: auto; text-align: right; }
.ch-ltv .num { font-family: "Instrument Serif", Georgia, serif; font-size: 1.9rem; line-height: 1; }
.ch-ltv .lbl { font-size: .68rem; color: var(--muted); margin-top: .4rem; }

.list-row { display: flex; align-items: center; justify-content: space-between; padding: .8rem 0; border-top: 1px solid var(--card-line); gap: .7rem; }
.list-row:first-child { border-top: none; }
.lr-title { font-size: .84rem; font-weight: 600; }
.lr-meta { font-size: .7rem; color: var(--muted); margin-top: .15rem; }

.hist-item { padding: .7rem 0; border-top: 1px solid var(--card-line); }
.hist-item:first-child { border-top: none; }
.hist-item p { display: flex; justify-content: space-between; gap: .8rem; font-size: .78rem; }
.hist-item p span { font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--faint); white-space: nowrap; }

.moves-list li { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-top: 1px solid var(--card-line); font-size: .8rem; }
.moves-list li:first-child { border-top: none; }
.check { width: .85rem; height: .85rem; border: 1px solid var(--line); border-radius: var(--r-sm); flex: none; }

.section-sub { font-family: "IBM Plex Mono", monospace; color: var(--faint); letter-spacing: .11em; text-transform: uppercase; font-size: .6rem; font-weight: 600; }
.section-title { font-family: "Instrument Serif", Georgia, serif; font-size: 2.1rem; font-weight: 400; letter-spacing: -.02em; margin-top: .4rem; }

.version-card.current { padding: 1.15rem 1.2rem; box-shadow: var(--shadow-md); }
.v-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.v-name { font-weight: 650; font-size: .88rem; }
.v-date { font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--muted); }
.v-spacer { flex: 1; }

.player { display: flex; flex-direction: column; gap: .8rem; }
.player-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; }
.play-btn {
  width: 2.2rem; height: 2.2rem;
  border-radius: 50%;
  background: var(--ml-night);
  color: #fff;
  border: 1px solid var(--ml-night);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
[data-theme="dark"] .play-btn { background: var(--ml-metal); color: var(--ink); border-color: var(--ml-metal); }
.play-btn .icon-pause { display: none; }
.play-btn[aria-pressed="true"] .icon-play { display: none; }
.play-btn[aria-pressed="true"] .icon-pause { display: block; }
.icon-play, .icon-pause { width: .55rem; height: .55rem; }

.wave-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  height: 4.4rem;
  border-block: 1px solid var(--card-line);
  overflow: hidden;
}
.wave-track::after { content: ""; position: absolute; inset: 50% 0 auto; height: 1px; background: var(--card-line); }
.wave-track i {
  width: 2px;
  min-height: 3px;
  background: var(--signal);
  opacity: .8;
  z-index: 1;
}
.wave-track .playhead {
  position: absolute;
  top: 0; bottom: 0;
  left: 22%;
  width: 1px;
  background: var(--pencil);
  box-shadow: 0 0 8px rgba(230, 94, 55, .35);
  z-index: 3;
}
.player-time { font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--muted); white-space: nowrap; }

.v-collapsed { display: flex; align-items: center; gap: .8rem; padding: .3rem; }
.v-collapsed .play-btn { width: 1.9rem; height: 1.9rem; }
.v-collapsed .v-name { font-size: .8rem; }
.v-mini-wave { flex: 1; display: flex; align-items: center; gap: 1px; height: 1.5rem; }
.v-mini-wave i { width: 1px; min-height: 2px; background: var(--muted); opacity: .6; }
.v-note-count { font-family: "IBM Plex Mono", monospace; font-size: .62rem; color: var(--faint); white-space: nowrap; }

.notes-list { display: flex; flex-direction: column; gap: .7rem; }
.note-row { display: flex; gap: .7rem; align-items: flex-start; border-left: 2px solid var(--signal); background: var(--info-bg); border-radius: var(--r-md); padding: .6rem .7rem; }
.note-time { font-family: "IBM Plex Mono", monospace; font-size: .64rem; color: var(--info-fg); white-space: nowrap; }
.note-row p { font-size: .8rem; line-height: 1.45; }
.note-input {
  margin-top: .9rem;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: .7rem .8rem;
  font-size: .76rem;
  color: var(--muted);
}

.approval-panel { padding: 1.2rem; text-align: center; }
.approval-panel p { margin-top: .7rem; font-size: .7rem; color: var(--muted); }

/* ---------------------------------------------------------------------- */
/* Quote                                                                    */
/* ---------------------------------------------------------------------- */

.quote-shell { max-width: 44rem; }
.quote-head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.3rem; gap: 1rem; flex-wrap: wrap; }
.quote-head h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.9rem; letter-spacing: -.02em; }
.qh-meta { font-size: .74rem; color: var(--muted); margin-top: .4rem; }

.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.4rem; }
.s-label { font-family: "IBM Plex Mono", monospace; font-size: .6rem; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .3rem; }
.s-value { font-size: .84rem; font-weight: 600; }

.context-line { padding: 1.6rem 1.4rem; background: var(--paper-warm); }
.ctx-sentence { font-size: .92rem; color: var(--muted); max-width: 34rem; line-height: 1.55; }
.ctx-price {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 4.2rem;
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.02em;
  margin-top: 1rem;
  border-top: 1px solid var(--card-line);
  padding-top: 1rem;
}

.included-list { display: flex; flex-direction: column; }
.included-row { display: flex; align-items: baseline; gap: .6rem; padding: .75rem 0; border-top: 1px solid var(--card-line); }
.included-row:first-child { border-top: none; }
.included-row .mk { width: .7rem; height: .7rem; border: 1px solid var(--ok-fg); border-radius: var(--r-sm); flex: none; margin-top: .2rem; position: relative; }
.included-row .mk::after { content: ""; position: absolute; inset: 2px; border-radius: 2px; background: var(--ok-fg); }
.included-row p { font-size: .82rem; }
.included-row small { display: block; color: var(--muted); font-size: .7rem; margin-top: .15rem; }

.total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 1rem; margin-top: .3rem; border-top: 1px solid var(--card-line); }
.total-row span { font-family: "IBM Plex Mono", monospace; font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.total-row b { font-family: "Instrument Serif", Georgia, serif; font-size: 1.5rem; font-weight: 400; }

.deposit-note { display: flex; justify-content: space-between; align-items: baseline; margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line); font-size: .8rem; }
.deposit-note b { font-family: "Instrument Serif", Georgia, serif; font-size: 1.15rem; font-weight: 400; }

.finish-line { padding: 1.3rem 1.4rem; background: var(--sidebar-bg); }
.finish-line .fl-label { margin-bottom: .7rem; }
.finish-line p { font-size: .84rem; line-height: 1.55; }

.quote-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.quote-actions .btn { flex: 1; min-width: 12rem; }

/* ---------------------------------------------------------------------- */
/* Mobile shell                                                            */
/* ---------------------------------------------------------------------- */

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 25;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
  padding: 0 1rem;
  background: var(--canvas);
  border-bottom: 1px solid var(--card-line);
}
.hamburger {
  display: none;
  width: 2.15rem; height: 2.15rem;
  border: 1px solid var(--card-line);
  background: var(--btn-secondary-bg);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hamburger span { display: block; width: 1rem; height: 1px; background: var(--ink); box-shadow: 0 -4px var(--ink), 0 4px var(--ink); }

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--canvas);
  padding: 1.2rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.drawer-close { width: 2.15rem; height: 2.15rem; border: 1px solid var(--card-line); border-radius: var(--r-md); background: none; cursor: pointer; }

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 25;
  background: var(--paper);
  border-top: 1px solid var(--card-line);
  grid-template-columns: repeat(4, 1fr);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .55rem 0 .7rem;
  font-size: .6rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}
.bottom-nav a.active { color: var(--signal); }
.bottom-nav svg { width: 1.1rem; height: 1.1rem; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; }
  .topbar { display: none; }
  .mobile-topbar { display: flex; }
  .hamburger { display: flex; }
  .bottom-nav { display: grid; }
  .page { padding: 1.4rem 1rem 5.5rem; }
  .grid-2, .grid-3, .stat-row { grid-template-columns: 1fr; }
  .cal-wrap { grid-template-columns: 1fr; }
  .client-head { flex-direction: column; align-items: flex-start; }
  .ch-ltv { margin-left: 0; text-align: left; }
  .quote-actions .btn { min-width: 0; }
}

@media (min-width: 901px) {
  .mobile-topbar, .mobile-drawer, .bottom-nav { display: none !important; }
}
