/* Launch Labs OS styles. Linked by layouts/os only; lives outside
   app/assets/stylesheets so the billing require_tree never picks it up.
   Tokens + primitives follow the Lovable "Launch Labs OS" mockup. Dark is
   the default; html.light switches to the light canvas. */
/* ---------- tokens: light (base) ---------- */
:root {
  /* Native controls (date/time pickers, selects, scrollbars) follow the OS
     theme, not the system setting: no black calendar icon on dark. */
  color-scheme: light;
  --font-sans: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius: 8px;       /* buttons, inputs, any "rounded" element */
  --radius-sm: 4px;    /* badges/pills, brand mark */
  --radius-md: 8px;
  --radius-lg: 10px;   /* cards, dialogs, toasts */
  --radius-avatar: 2px;

  --background: #F6F5FE;
  --foreground: #16142B;
  --card: #FFFFFF;
  --card-foreground: var(--foreground);
  --popover: #FFFFFF;
  --primary: #4B3AEF;            /* Launch Labs purple */
  --primary-foreground: #FFFFFF;
  --brand-accent: var(--primary);
  --secondary: #EBE9F6;
  --secondary-foreground: var(--foreground);
  --muted: var(--secondary);
  --muted-foreground: #6B6983;
  --accent: var(--muted);
  --accent-foreground: var(--foreground);
  --destructive: #FE566B;
  --border: #E4E1FB;
  --input: var(--border);
  --ring: var(--brand-accent);

  /* signal colors (text-only on light canvas for AA contrast) */
  --ok: var(--brand-accent);     /* "on track" = brand purple, NOT green */
  --bad: #B91A41;
  --warn: #6F5803;
  --ext: var(--muted-foreground);
  --ok-soft: transparent;        /* soft fills are intentionally transparent */
  --bad-soft: transparent;
  --warn-soft: transparent;
  --ext-soft: transparent;

  --overlay: rgba(0, 0, 0, 0.75);
  --brand-wash: linear-gradient(180deg, rgba(75, 58, 239, 0.10), transparent);
  --shadow: none;                /* no shadows anywhere */
  --motion: 100ms;               /* all transitions/animations clamp to 100ms */

  /* touch + layout sizes (usability pass) */
  --tap: 44px;                   /* minimum touch target */
  /* text scale (one step above the mock, 11/25) */
  --text-xs: 13px;               /* labels, hints, meta */
  --text-sm: 14px;               /* list sub lines, secondary */
  --text-md: 15px;               /* body, nav, buttons, tables */
  --text-lg: 16px;               /* list titles, rows, reading text */
  --field-font: 16px;            /* 16px+ stops iOS zooming on focus */
  --header-h: calc(49px + env(safe-area-inset-top));
  --tabbar-h: calc(57px + max(0px, env(safe-area-inset-bottom) - 20px));
}

/* ---------- tokens: dark (default) ---------- */
html:not(.light) {
  color-scheme: dark;
  --background: #0D0D0D;
  --foreground: #E5E5E5;
  --card: #181818;
  --popover: var(--card);
  --brand-accent: #857AE8;       /* lighter purple; --primary stays #4B3AEF */
  --secondary: #232226;
  --muted: var(--secondary);
  --muted-foreground: #9B99A8;
  --border: #2A2833;
  --input: #5B5B5B;
  --ring: var(--brand-accent);
  --ok: var(--brand-accent);     /* #857AE8 */
  --bad: var(--destructive);     /* #FE566B */
  --warn: #EFC42C;
  --ext: var(--muted-foreground);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2:not(.os-eyebrow), h3:not(.os-eyebrow) { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }
h1, h2, h3, p { overflow-wrap: break-word; }
input, select, textarea { min-width: 0; font: inherit; color: inherit; }
button { font: inherit; color: inherit; }
button, input, textarea, select { border-radius: var(--radius); }
input[type="checkbox"] { accent-color: var(--primary); }
input[type="number"], input[type="date"], time, code { font-family: var(--font-mono); font-weight: 500; }
:where(a, button, input, textarea, select):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
*, *::before, *::after { transition-duration: var(--motion) !important; animation-duration: var(--motion) !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
/* ---- layout shell ---- */
.os-app { min-height: 100vh; }
@media (min-width: 768px) { .os-app { display: flex; } }
.os-sidebar { display: none; }
@media (min-width: 768px) {
  .os-sidebar { position: sticky; top: 0; height: 100vh; width: 240px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--card); padding: 16px; }
}
.os-sidebar__nav { margin-top: 24px; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.os-navgroup + .os-navgroup { margin-top: 6px; }
.os-navgroup__label { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; cursor: pointer; list-style: none; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-foreground); border-radius: 6px; user-select: none; }
.os-navgroup__label::-webkit-details-marker { display: none; }
.os-navgroup__label:hover { color: var(--foreground); }
.os-navgroup__chev { width: 12px; height: 12px; transition: transform .15s; transform: rotate(-90deg); }
.os-navgroup[open] .os-navgroup__chev { transform: none; }
.os-navgroup .os-navlink { margin-top: 2px; }
.os-more-section { margin: 20px 4px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-foreground); }
.os-more-section:first-of-type { margin-top: 8px; }
.os-sidebar__foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-foreground); }
.os-navlink { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: var(--text-md); font-weight: 500; border-left: 2px solid transparent; border-radius: 8px; color: var(--muted-foreground); }
.os-navlink svg { width: 16px; height: 16px; }
.os-navlink:hover { background: var(--muted); color: var(--foreground); }
.os-navlink.is-active { border-left-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
.os-content { min-width: 0; flex: 1; }
.os-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background-color: color-mix(in srgb, var(--background) 90%, transparent); background-image: var(--brand-wash); backdrop-filter: blur(8px); }
/* If the page ever draws under the status bar, the header pads down past it. 0 in a browser tab and with the default status bar style. */
@media (min-width: 768px) { .os-header { justify-content: flex-end; } .os-header .os-logo { display: none; } }
.os-main { margin: 0 auto; max-width: 768px; padding: 16px 16px 112px; }
.os-main--wide { max-width: 1400px; }
@media (min-width: 768px) { .os-main { padding: 32px 24px 48px; } }
.os-tabbar { position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border); background: var(--card); }
@media (min-width: 768px) { .os-tabbar { display: none; } }
.os-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 max(10px, env(safe-area-inset-bottom) - 20px); border-top: 2px solid transparent; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; color: var(--muted-foreground); }
/* Each tab pads past the home indicator itself, so the active fill runs to the bottom edge. 20px less than the full inset: labels sit just above the home indicator. */
.os-tab svg { width: 20px; height: 20px; }
.os-tab.is-active { border-top-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }

/* ---- logo ---- */
.os-logo { display: flex; align-items: center; gap: 8px; }
.os-logo__word { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.os-brand-mark { display: inline-flex; align-items: center; border: 1px solid var(--brand-accent); padding: 2px 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--brand-accent); border-radius: 4px; }

/* ---- role switcher ---- */
.os-roleswitch { display: flex; align-items: center; gap: 6px; }
.os-roleswitch select { border: 1px solid var(--border); background: var(--card); padding: 4px 8px; font-size: var(--text-xs); font-weight: 500; border-radius: 8px; }
.os-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--input); background: var(--background); color: var(--foreground); border-radius: 8px; cursor: pointer; }
.os-iconbtn svg { width: 14px; height: 14px; }
.os-iconbtn--lg { width: 36px; height: 36px; } .os-iconbtn--lg svg { width: 16px; height: 16px; }

/* ---- card ---- */
.os-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.os-card--tight { padding: 14px; }        /* list cards (p-3.5) */
.os-card--sm { padding: 12px; }
.os-card--flush { padding: 0; overflow: hidden; }
a.os-card:hover, .os-card--link:hover { background: var(--muted); }
.os-divide > * + * { border-top: 1px solid var(--border); }  /* card divide-y */
.os-rule-y { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); } /* "border-y" sections */
.os-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; font-size: var(--text-lg); }

/* ---- eyebrow (section label) ---- */
.os-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; color: var(--muted-foreground); margin: 0; }
.os-eyebrow::before { content: "// "; color: var(--muted-foreground); }
.os-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.os-section-head a { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--text-xs); }
.os-section-head { min-height: 0; }

/* ---- page header ---- */
.os-page-header { margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.os-page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 767px) { .os-page-header__actions { width: 100%; } }
.os-page-header > div { min-width: 0; }
.os-page-title { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
@media (min-width: 768px) { .os-page-title { font-size: 24px; line-height: 32px; } }
.os-page-sub { margin: 2px 0 0; font-size: var(--text-md); color: var(--muted-foreground); }
.os-back { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); margin: -8px 0 4px; padding-right: 8px; font-size: var(--text-md); color: var(--muted-foreground); }
.os-back:hover { color: var(--foreground); } /* "← Scorecard" with lucide arrow-left 16px */

/* ---- numbers ---- */
.os-num { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.os-num--hero { font-size: 30px; line-height: 36px; font-weight: 600; }

/* ---- status pill (Pill) ---- */
.os-pill { display: inline-flex; flex-shrink: 0; align-items: center; gap: 6px; padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; white-space: normal; background: transparent; border: 1px solid currentColor; border-radius: 4px; }
.os-pill--on { color: var(--ok); }      /* default text "On track" */
.os-pill--off { color: var(--bad); }    /* "Off" */
.os-pill--review { color: var(--warn); }/* "Needs review" */
.os-pill--ext { color: var(--ext); }    /* "Not ours" */
/* generic tag (rounded-full px-2 py-0.5 text-[11px] in mock, restyled the same way) */
.os-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: var(--foreground); }
.os-tag--ok { color: var(--ok); } .os-tag--bad { color: var(--bad); } .os-tag--warn { color: var(--warn); } .os-tag--ext, .os-tag--muted { color: var(--muted-foreground); }
.os-tag--xs { font-size: 10px; padding: 0 6px; }

/* ---- status dot ---- */
.os-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; }
.os-dot--sm { width: 8px; height: 8px; }
.os-dot--on { background: var(--ok); } .os-dot--off { background: var(--bad); } .os-dot--review { background: var(--warn); } .os-dot--ext { background: var(--ext); }
.os-dot--ring { box-shadow: 0 0 0 2px var(--card); position: absolute; right: -2px; bottom: -2px; } /* dot on avatar corner */

/* ---- avatar (initials) ---- */
.os-avatar { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--secondary); color: var(--secondary-foreground); font-family: var(--font-mono); font-weight: 600; border-radius: 2px; }
.os-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.os-avatar--md { width: 32px; height: 32px; font-size: var(--text-xs); }
.os-avatar--lg { width: 56px; height: 56px; font-size: 18px; }

/* ---- source / trust strip (SourceTrust) ---- */
.os-trust { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); }
/* content: "{source} · as of {asOf}" (auto numbers only), then optional pills:
   .os-pill--review "Source down, last good value"  (source failed and not re-synced)
   .os-pill--review "Disputed"                      (an open dispute exists) */

/* ---- source badge (SourceBadge: OS / CompAI / Jamf / Notion / "From AttendanceBot") ---- */
.os-source { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid currentColor; background: transparent; color: var(--muted-foreground); font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; white-space: nowrap; border-radius: 4px; }

/* ---- private tag ---- */
.os-private { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid currentColor; background: transparent; color: var(--muted-foreground); font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; white-space: nowrap; border-radius: 4px; } /* lucide lock 12px + "Private" */

/* ---- buttons ---- */
.os-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 8px 16px; font-size: var(--text-md); font-weight: 500; white-space: nowrap; border-radius: 8px; border: 1px solid transparent; cursor: pointer; background: transparent; color: var(--foreground); }
.os-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.os-btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.os-btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.os-btn--primary:hover { border-color: var(--foreground); }
.os-btn--outline { background: var(--background); border-color: var(--input); }
.os-btn--outline:hover { background: var(--accent); }
.os-btn--secondary { background: var(--secondary); border-color: var(--border); }
.os-btn--ghost:hover { background: var(--accent); }
.os-btn--sm { height: 32px; padding: 0 12px; font-size: var(--text-xs); }
.os-btn--lg { height: 40px; padding: 0 32px; }
.os-btn--block { width: 100%; }
/* legacy "btnPrimary/btnGhost" in mock: padding 8px 12px, 14px weight 600, gap 6px; ghost = border + card bg, hover muted */
.os-btn--strong { font-weight: 600; padding: 8px 12px; gap: 6px; }

/* ---- chips (segmented filter) ---- */
.os-chips { margin-bottom: 16px; display: flex; gap: 6px; overflow-x: auto; }
.os-chip { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 36px; padding: 6px 12px; border: 1px solid var(--input); background: var(--card); color: var(--muted-foreground); font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; border-radius: 8px; cursor: pointer; }
.os-chip:hover { color: var(--foreground); }
.os-chip.is-active { border-color: var(--foreground); background: var(--secondary); color: var(--foreground); }

/* ---- form field ---- */
.os-field { width: 100%; border: 1px solid var(--input); background: var(--background); padding: 8px 12px; min-height: 40px; font-size: var(--field-font); border-radius: 8px; outline: none; }
/* 16px everywhere (matches the mock; stops iOS zoom). Phones and touch: 44px tap target. */
@media (max-width: 767px), (pointer: coarse) {
  .os-field { min-height: var(--tap); }
}
textarea.os-field { min-height: 88px; }
.os-field[aria-invalid="true"] { border-color: var(--bad); }
.os-field-error { margin: 4px 0 0; font-size: var(--text-xs); color: var(--bad); }
.os-field:focus { box-shadow: 0 0 0 2px var(--ring); }
.os-label { display: block; font-size: var(--text-xs); font-weight: 500; }
.os-label > .os-field { margin-top: 4px; }
.os-check { display: flex; align-items: center; gap: 8px; font-size: var(--text-lg); }

/* ---- progress bar ---- */
.os-bar { height: 6px; width: 100%; overflow: hidden; border-radius: 999px; background: var(--muted); }
.os-bar--lg { height: 8px; }
.os-bar__fill { height: 100%; border-radius: 999px; background: var(--muted-foreground); } /* width = value/max % */

/* ---- banners ---- */
.os-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); font-size: var(--text-md); font-weight: 500; }
.os-banner--warn { border-color: var(--warn); background: transparent; }   /* lucide alert-circle 16px in --warn, chevron-right at end */
.os-banner--brand { align-items: flex-start; border-color: var(--primary); background: var(--accent); color: var(--accent-foreground); } /* shield-check */
.os-note { padding: 8px 12px; border-radius: 8px; background: var(--accent); font-size: var(--text-xs); }  /* inline hint box */
.os-locked { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: var(--muted-foreground); font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; white-space: nowrap; } /* lock 12px + "Locked for Q1" */

/* ---- sheet (modal: bottom sheet on mobile, centered dialog md+) ---- */
.os-sheet-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: var(--overlay); }
@media (min-width: 768px) { .os-sheet-overlay { align-items: center; } }
.os-sheet { max-height: 90dvh; width: 100%; max-width: 448px; overflow-y: auto; border: 1px solid var(--border); background: var(--card); padding: 20px 20px calc(32px + env(safe-area-inset-bottom)); border-radius: 10px 10px 0 0; }
@media (min-width: 768px) { .os-sheet { border-radius: 10px; padding-bottom: 20px; } .os-sheet__grip { display: none; } }
.os-sheet__grip { margin: 0 auto 16px; height: 4px; width: 40px; border-radius: 999px; background: var(--border); }
.os-sheet__title { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
/* closes on overlay click and Esc */

/* ---- scorecard list / grid ---- */
.os-scorelist { border-top: 1px solid var(--border); }
.os-scorelist > a { display: block; padding: 12px; background: var(--card); border-bottom: 1px solid var(--border); }
.os-scorelist > a:hover { background: var(--muted); }
.os-scorecell { width: 100%; padding: 4px 0; text-align: center; font-size: var(--text-xs); font-weight: 500; border-left: 3px solid transparent; }
.os-scorecell--on { color: var(--ok); }
.os-scorecell--off { color: var(--bad); border-left-color: var(--bad); }
.os-scorecell--missing { color: var(--warn); border-left-color: var(--warn); }
.os-scoregrid { width: 100%; min-width: 520px; table-layout: fixed; border-collapse: collapse; font-size: var(--text-md); }
.os-scoregrid th, .os-scoregrid td { border-bottom: 1px solid var(--border); padding: 10px 5px; }
.os-scoregrid th { font-family: var(--font-mono); font-weight: 500; font-size: 11px; color: var(--muted-foreground); }

/* ---- org chart ---- */
.os-org ul { position: relative; list-style: none; margin: 8px 0 0 0; padding-left: 12px; border-left: 1px solid var(--muted-foreground); display: flex; flex-direction: column; gap: 8px; }
.os-org > ul { margin: 0; padding: 0; border: 0; }
.os-org li { position: relative; }
.os-org ul > li::before { content: ""; position: absolute; left: -13px; top: 26px; width: 13px; border-top: 1px solid var(--muted-foreground); }
.os-org p, .os-org input { font-family: var(--font-mono); }
.os-org .os-card { display: flex; align-items: center; gap: 12px; padding: 10px; }
.os-org.is-editing .os-card { border-style: dashed; }

/* ---- wide-screen tint for L10 clock ---- */
.os-mission-clock { background-image: var(--brand-wash); }

/* ---- misc ---- */
.os-muted { color: var(--muted-foreground); }
.os-text-ok { color: var(--ok); } .os-text-bad { color: var(--bad); } .os-text-warn { color: var(--warn); }
.os-empty { font-size: var(--text-md); color: var(--muted-foreground); }
/* A block empty state (not a list row): centered, with room for one action. */
.os-empty:not(.os-row):not(span) { padding: 24px 16px; text-align: center; }
.os-empty__action { margin-top: 12px; }
.os-empty > p { margin: 0; }
.os-stack > * + * { margin-top: 16px; }   /* space-y-4 page rhythm */
.os-stack-sm > * + * { margin-top: 8px; } /* space-y-2 list rhythm */
.os-ext-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); } /* + lucide external-link 12px, target=_blank */

/* ---- additions for the Rails build ---- */
[data-lucide], .lucide { width: 16px; height: 16px; flex-shrink: 0; }
.os-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.os-userchip { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 500; }
/* Toasts: bottom-right on desktop; on phones, above the tab bar. */
.os-toasts { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 12px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 768px) { .os-toasts { left: auto; right: 24px; bottom: 24px; align-items: flex-end; } }
.os-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 380px; padding: 10px 8px 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--foreground); font-size: var(--text-md); font-weight: 500; opacity: 0; transform: translateY(8px); transition: opacity var(--motion) ease, transform var(--motion) ease; }
.os-toast.is-in { opacity: 1; transform: none; }
.os-toast__icon { flex: none; color: var(--primary); }
.os-toast--warn { border-color: var(--warn); }
.os-toast--warn .os-toast__icon { color: var(--warn); }
.os-toast__msg { flex: 1; min-width: 0; }
.os-toast__close { flex: none; min-width: var(--tap); min-height: var(--tap); border-color: transparent; background: transparent; }
.os-toast__action { flex: none; border: 0; background: none; padding: 0 4px; font-size: var(--text-md); font-weight: 600; color: var(--brand-accent); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .os-toast { transition: none; transform: none; } }
.os-sublinks { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; font-size: var(--text-xs); font-weight: 500; }
.os-sublinks a { flex-shrink: 0; white-space: nowrap; color: var(--muted-foreground); }
.os-sublinks a.is-active { text-decoration: underline; text-decoration-color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.os-sublinks a.is-active, .os-sublinks a:hover { color: var(--foreground); }
.os-listcard { display: flex; align-items: center; gap: 12px; }
.os-listcard__main { min-width: 0; flex: 1; }
.os-listcard__title { font-size: var(--text-lg); font-weight: 600; overflow: hidden; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 0; }
.os-listcard__sub { font-size: var(--text-sm); color: var(--muted-foreground); margin: 2px 0 0; }
.os-hscroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.os-tile { width: 96px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; }
.os-tile__name { font-size: var(--text-xs); font-weight: 500; max-width: 100%; overflow: hidden; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.os-tile__sub { font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-avatar-wrap { position: relative; display: inline-flex; }
.os-form { display: flex; flex-direction: column; gap: 16px; }
.os-form .os-chips { margin-bottom: 0; }
.os-form__actions { display: flex; gap: 8px; justify-content: flex-end; }
/* Phones: Save/Cancel stay in reach in a bar above the tab bar. Not inside sheets. */
@media (max-width: 767px) {
  .os-main .os-form__actions { position: sticky; bottom: var(--tabbar-h); z-index: 20; margin: 0 -16px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--border); }
  .os-main .os-form__actions > :is(.os-btn, input[type="submit"], button, a) { flex: 1; min-height: var(--tap); }
  .os-sheet .os-form__actions { position: static; margin: 0; padding: 0; background: none; border: 0; }
}
form[aria-busy="true"] :is([type="submit"], button[type="submit"]) { opacity: .6; cursor: progress; }
.os-errors { color: var(--bad); font-size: var(--text-md); border: 1px solid var(--bad); border-radius: 10px; padding: 12px 16px; background: transparent; }
.os-errors__title { margin: 0 0 4px; font-weight: 600; }
.os-errors ul { margin: 0; padding-left: 18px; }
.os-errors a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.os-table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.os-table th { text-align: left; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .08em; padding: 8px; border-bottom: 1px solid var(--border); }
.os-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.os-table th[data-sortable] { cursor: pointer; user-select: none; }
/* A long table in a fixed-height box that scrolls; the header row stays put. */
.os-scroll-capped { max-height: min(520px, 70vh); overflow: auto; overscroll-behavior: contain; }
.os-scroll-capped .os-table thead th { position: sticky; top: 0; z-index: 1; background: var(--card); }
.os-table th[data-sortable]:hover, .os-table th[aria-sort] { color: var(--foreground); }
.os-table th[data-sortable]:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.os-table th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
.os-table th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
.os-scroll-x { overflow-x: auto; }
.os-center-card { max-width: 420px; margin: 40px auto 0; text-align: center; }
.os-login { min-height: 100vh; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; padding: 16px; background-image: var(--brand-wash); }
.os-login .os-card { width: 100%; max-width: 380px; padding: 28px; }
.os-login__legal { margin: 0; font-size: var(--text-sm); color: var(--muted-foreground); text-align: center; }
.os-login__legal a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.os-login__legal span { margin: 0 6px; }
.os-login .os-card.os-optin { max-width: 440px; }
.os-sms-consent { display: flex; flex-direction: column; gap: 12px; }
.os-sms-consent__box { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 10px 0; font-size: var(--text-md); line-height: 1.45; cursor: pointer; }
.os-sms-consent__box input { margin-top: 1px; flex: none; width: 20px; height: 20px; }
.os-sms-consent__links { margin: 0 0 0 30px; font-size: var(--text-sm); }
.os-sms-consent__links a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.os-sms-consent__links span { margin: 0 6px; color: var(--muted-foreground); }
.os-legal { max-width: 680px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 48px; font-size: var(--text-lg); line-height: 1.6; }
.os-legal h2 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 28px 0 8px; }
.os-legal p, .os-legal ul { margin: 0 0 12px; }
.os-legal ul { padding-left: 20px; }
.os-legal li { margin-bottom: 6px; }
.os-legal a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.os-legal__foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--muted-foreground); }
.os-inline { display: inline; }
.os-mt { margin-top: 16px; }
.os-row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.os-theme-light { display: none; }
html.light .os-theme-dark { display: none; }
html.light .os-theme-light { display: inline-block; }
.os-org > ul > li::before { display: none; }
html, body { overflow-x: clip; }
.os-page-sub, .os-listcard__sub, p { overflow-wrap: anywhere; }
@media (max-width: 767px) { .os-userchip > .os-muted { display: none; } }

/* ---- dialog sheets (native <dialog>) ---- */
dialog.os-sheet { margin: auto auto 0; color: var(--foreground); }
dialog.os-sheet::backdrop { background: var(--overlay); }
@media (min-width: 768px) { dialog.os-sheet { margin: auto; } }
.os-dl { margin: 0; display: grid; gap: 10px; }
.os-dl dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground); }
.os-dl dd { margin: 2px 0 0; font-size: var(--text-md); }
.os-bignum { width: 100%; text-align: center; font-family: var(--font-mono); font-size: 48px; font-weight: 600; padding: 16px; background: var(--background); border: 1px solid var(--border); border-radius: 8px; }
.os-grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .os-grid2 { grid-template-columns: 1fr 1fr; gap: 8px; } }
.os-weeks { display: grid; grid-template-columns: repeat(4, 60px); gap: 4px; text-align: center; }
.os-weeks .os-scorecell { font-size: 11px; white-space: nowrap; }
.os-weeks__label { font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); }
.os-legend { display: flex; gap: 16px; font-size: var(--text-xs); color: var(--muted-foreground); margin-top: 12px; align-items: center; }
.os-legend span { display: inline-flex; align-items: center; gap: 6px; }
.os-agebar { height: 20px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.os-agebar > div { height: 100%; }

/* Plain flex row (no list padding, unlike .os-row). */
.os-split { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
a.os-card { display: block; }
a.os-card.os-split { display: flex; } /* a linked card that is also a split row stays flex */
a.os-card.os-listcard { display: flex; } /* linked list cards keep avatar, text and chevron in one row */

/* Rocks: on/off track toggle (a radio styled as a button). */
.os-rocktoggle { border-width: 2px; padding: 12px; font-size: var(--text-md); font-weight: 600; color: var(--muted-foreground); cursor: pointer; }
.os-rocktoggle:has(input:checked) { border-color: var(--tone); color: var(--tone); }
.os-rocktoggle:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--ring); }

/* Chips that are radios (to-do / decision). */
.os-chipradio { display: inline-flex; align-items: center; }
.os-chipradio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.os-chipradio:has(input:checked) { border-color: var(--foreground); background: var(--secondary); color: var(--foreground); }
.os-chipradio:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--ring); }
details > summary { list-style: none; display: inline-flex; width: fit-content; }
details > summary::-webkit-details-marker { display: none; }

/* Notifications: settings folded into one card */
.os-notif-settings > summary.os-notif-settings__summary { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: var(--text-md); }
.os-notif-settings__state { font-size: var(--text-xs); }
.os-notif-settings__chev { display: inline-flex; color: var(--muted-foreground); transition: transform .15s; flex-shrink: 0; }
.os-notif-settings[open] .os-notif-settings__chev { transform: rotate(180deg); }
.os-notif-settings__push { border-top: 1px solid var(--border); padding-top: 14px; }

/* L10 */
.os-l10-clock { padding: 16px 0; border-bottom: 1px solid var(--border); }
.os-l10-clock__time { font-family: var(--font-mono); font-size: 48px; font-weight: 600; line-height: 1; color: var(--ok); font-variant-numeric: tabular-nums; }
.os-l10-clock__time.is-over { color: var(--bad); }
.os-l10-clock__meta { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-foreground); margin-top: 6px; }
.os-l10-tabs { display: flex; gap: 6px; overflow-x: auto; list-style: none; margin: 16px 0 0; padding: 0 0 4px; }
.os-l10-tabs button { min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--secondary); color: var(--foreground); cursor: pointer; }
.os-l10-tabs button.is-active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.os-l10-tabs button.is-over .os-l10-tabs__time { color: var(--bad); }
.os-l10-tabs button.is-active.is-over .os-l10-tabs__time { color: inherit; text-decoration: underline; }
.os-l10-tabs__name { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.os-l10-tabs__time { font-family: var(--font-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.os-l10-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.os-l10-todos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.os-scoregrid--l10 { min-width: 640px; }
.os-scoregrid--l10 td { vertical-align: top; }
.os-dropids { position: relative; display: block; margin: 4px auto 0; padding: 0 4px; font-size: 11px; border: 0; background: none; color: var(--muted-foreground); cursor: pointer; }
.os-dropids:hover { color: var(--foreground); text-decoration: underline; }
.os-ratings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.os-ratings input { width: 64px; }
@media (min-width: 640px) { .os-ratings { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px) { .os-l10-clock__time { font-size: 72px; } }
@media (min-width: 1024px) {
  .os-l10-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
  .os-l10-todos { grid-template-columns: 1fr 1fr; }
}
.os-tag { white-space: nowrap; }

/* Compliance marks: done / to do / source down */
.os-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; border: 1px solid currentColor; border-radius: var(--radius-sm); font: 600 11px var(--font-mono); }
.os-mark--ok { color: var(--ok); }
.os-mark--todo { color: var(--bad); }
.os-mark--unknown { color: var(--muted-foreground); border-style: dashed; }
.os-mark--na { color: var(--muted-foreground); border-color: transparent; }

/* Text-style button (Remove on a win) */
.os-linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted-foreground); text-decoration: underline; cursor: pointer; }
.os-linkbtn:hover { color: var(--foreground); }

/* Notifications */
.os-unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.os-bell { position: relative; }
.os-bell .os-unread-dot { position: absolute; top: -3px; right: -3px; border: 2px solid var(--background); width: 10px; height: 10px; }

/* The hidden attribute wins over component display rules (push buttons). */
[hidden] { display: none !important; }

/* Access matrix is desktop only. */
@media (max-width: 767px) { .os-hide-mobile { display: none !important; } }

/* ---- quick nav palette (Cmd/Ctrl+K) ---- */
dialog.os-palette { width: min(560px, calc(100vw - 32px)); max-height: min(480px, 70vh); margin: 12vh auto auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--foreground); overflow: hidden; }
dialog.os-palette[open] { display: flex; flex-direction: column; }
dialog.os-palette::backdrop { background: var(--overlay); }
.os-palette__search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); }
.os-palette__search svg { width: 16px; height: 16px; flex-shrink: 0; }
.os-palette__search input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--field-font); color: var(--foreground); }
.os-palette__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.os-palette__item { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 9px 10px; border-radius: 8px; font-size: var(--text-md); cursor: pointer; }
.os-palette__item svg { width: 16px; height: 16px; }
.os-palette__item.is-selected { background: var(--secondary); }
.os-palette__label { flex: 1; }
.os-palette__section { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-foreground); }
.os-palette__empty { margin: 0; padding: 16px; color: var(--muted-foreground); font-size: var(--text-md); }
.os-kbd { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted-foreground); }
.os-searchbtn__hint { display: none; }
@media (min-width: 768px) {
  .os-searchbtn { width: auto; gap: 6px; padding: 0 6px 0 8px; }
  .os-searchbtn__hint { display: inline; }
}

/* ---------- Messages thread: chat layout ---------- */
/* Fills the viewport under the header: title on top, messages scroll,
   fixed-height reply box at the bottom. Theirs left, yours right. */
.os-chat { display: flex; flex-direction: column; height: calc(100dvh - 49px - env(safe-area-inset-top) - 128px); min-height: 360px; }
@media (min-width: 768px) { .os-chat { height: calc(100dvh - 49px - env(safe-area-inset-top) - 64px); } }
.os-chat__head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.os-chat__title { min-width: 0; flex: 1; }
.os-chat__actions { flex-shrink: 0; }
.os-chat__bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.os-artifact { display: flex; flex-direction: column; gap: 12px; height: calc(100dvh - 49px - env(safe-area-inset-top) - 128px); min-height: 420px; }
@media (min-width: 768px) { .os-artifact { height: calc(100dvh - 49px - env(safe-area-inset-top) - 64px); } }
.os-artifact__actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Artifacts are drawn on white, so they get the light scheme whatever the OS theme. */
.os-artifact__frame { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; color-scheme: light; }
@media (max-width: 640px) { .os-artifact__actions .os-btn { padding-inline: 8px; } .os-chat__head { flex-wrap: wrap; } .os-artifact__actions { margin-left: auto; } }
.os-menu { position: relative; }
.os-menu > summary { list-style: none; }
.os-menu > summary::-webkit-details-marker { display: none; }
.os-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; max-width: min(320px, calc(100vw - 32px)); padding: 6px; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; }
.os-menu__label { margin: 6px 8px 2px; font-size: 11px; color: var(--muted-foreground); }
.os-menu__item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; font-size: var(--text-md); color: var(--foreground); cursor: pointer; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-menu__item:hover, .os-menu__item.is-active { background: var(--secondary); }
.os-menu__item--danger { color: var(--destructive, #e5484d); }
.os-chat__artifact { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: var(--text-sm); color: var(--foreground); text-decoration: none; background: var(--card); max-width: 100%; }
.os-chat__artifact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-chat__artifact svg { width: 14px; height: 14px; flex-shrink: 0; }
.os-chat__earlier { margin: 0 0 12px; text-align: center; }
.os-chat__receipts summary { cursor: pointer; list-style: none; }
.os-chat__receipts summary::-webkit-details-marker { display: none; }
.os-chat__receipts summary::after { content: " ▾"; }
.os-chat__receipts[open] summary::after { content: " ▴"; }
.os-msgrow { display: flex; align-items: center; gap: 10px; }
.os-msgrow > .os-listcard { flex: 1; min-width: 0; }
.os-chat__title h1 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-chat__title p { margin: 2px 0 0; font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-chat__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 0; }
.os-chat__scroll { scrollbar-gutter: stable; padding-right: 6px; }
.os-chat__list { display: flex; flex-direction: column; gap: 14px; }
.os-chat__msg { display: flex; gap: 8px; align-items: flex-start; max-width: 85%; }
.os-chat__msg.is-theirs { align-self: flex-start; }
.os-chat__msg.is-mine { align-self: flex-end; }
.os-chat__who { position: relative; margin-top: 18px; flex-shrink: 0; display: inline-flex; }
.os-chat__bot { position: absolute; right: -5px; bottom: -5px; width: 14px; height: 14px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--background); border: 1px solid var(--border); color: var(--muted-foreground); }
.os-chat__agent { display: inline-flex; align-items: center; gap: 4px; }
.os-chat__agent svg { width: 12px; height: 12px; }
.os-chat__msg.is-agent .os-chat__col .os-chat__bubble { border-style: dashed; border-color: var(--muted-foreground); background: transparent; color: var(--foreground); }
.os-chat__msg.is-agent.is-mine .os-chat__col .os-chat__bubble { border-color: var(--primary); }
.os-chat__col { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.os-chat__msg.is-mine .os-chat__col { align-items: flex-end; }
.os-chat__meta { font-size: 11px; color: var(--muted-foreground); }
.os-chat__meta > * + *::before { content: " · "; }
.os-chat__name { color: var(--foreground); font-weight: 500; }
.os-chat__flag { color: var(--warn); }
.os-chat__meta time { font-family: inherit; font-weight: inherit; font-size: inherit; letter-spacing: normal; text-transform: none; }
.os-chat__bubble { font-size: var(--text-md); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 12px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border); }
.os-chat__msg.is-mine .os-chat__bubble { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.os-chat__note { margin: 0; font-size: 11px; color: var(--muted-foreground); }
.os-chat__handle { display: flex; gap: 6px; align-items: center; }
.os-chat__handle .os-field { padding: 4px 8px; width: 180px; }
@media (min-width: 768px) and (pointer: fine) { .os-chat__handle .os-field { font-size: var(--text-xs); min-height: 0; } .os-chat__todo form .os-field { font-size: var(--text-sm); } }
.os-chat__todo { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.os-chat__todo summary { list-style: none; cursor: pointer; }
.os-chat__todo summary::-webkit-details-marker { display: none; }
.os-chat__todo.is-suggested summary { border: 1px dashed var(--border); }
.os-chat__todo form { margin-top: 6px; flex-wrap: wrap; }
.os-chat__todo form .os-field { width: min(320px, 100%); }
.os-chat__todo .os-chat__hint { flex-basis: 100%; margin: 4px 0 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-chat__compose { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.os-chat__input { height: 76px; resize: none; }
.os-chat__bar { display: flex; align-items: center; gap: 10px; }
.os-chat__check { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-chat__status { flex: 1; font-size: var(--text-xs); color: var(--muted-foreground); text-align: right; }

/* ---------- scrollbars ---------- */
/* Chip rows and wide tables: a thin bar in the theme's colors, not the
   browser's white one. Touch screens get no bar; the row still swipes. */
.os-chips, .os-scroll-x { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent; }
.os-chips::-webkit-scrollbar, .os-scroll-x::-webkit-scrollbar { height: 8px; }
.os-chips::-webkit-scrollbar-track, .os-scroll-x::-webkit-scrollbar-track { background: transparent; }
@media (hover: none) {
  .os-chips { scrollbar-width: none; }
  .os-chips::-webkit-scrollbar { display: none; }
}
.os-chips::-webkit-scrollbar-thumb, .os-scroll-x::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
/* Thin, theme-colored, thumb shown on hover/focus: the sidebar nav, the chat,
   sheets and the Cmd K list. */
.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list { scrollbar-width: thin; scrollbar-color: transparent transparent; }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list):is(:hover, :focus-within) { scrollbar-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent; }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list)::-webkit-scrollbar { width: 8px; }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list)::-webkit-scrollbar-track { background: transparent; }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list)::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list):hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent); }
:is(.os-sidebar__nav, .os-chat__scroll, .os-sheet, .os-palette__list)::-webkit-scrollbar-thumb:hover { background-color: var(--muted-foreground); }

/* ---- Get set up ---- */
.os-setup-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.os-ring { flex: none; }
.os-ring circle { fill: none; stroke-width: 10; }
.os-ring__track { stroke: var(--muted); }
.os-ring__fill { stroke: var(--primary); stroke-linecap: round; }
.os-ring text { fill: var(--foreground); font: 600 20px var(--font-sans); }
.os-dotstrip { position: relative; height: 28px; margin: 18px 6px 0; }
.os-dotstrip__line { position: absolute; left: 0; right: 0; top: 13px; height: 2px; background: var(--border); }
.os-dotstrip__dot { position: absolute; top: 9px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--muted-foreground); opacity: 0.45; }
.os-dotstrip__dot--done { background: var(--primary); opacity: 1; }
.os-dotstrip__you { position: absolute; top: 3px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--primary); }
.os-dotstrip__label { position: absolute; top: -16px; transform: translateX(-50%); font: 600 10px var(--font-mono); letter-spacing: 0.08em; color: var(--primary); }
.os-setup-step { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.os-setup-step:last-child { border-bottom: 0; }
.os-setup-step .os-mark { margin-top: 1px; }
.os-setup-fill { background: var(--primary); }
.os-namechips { display: flex; flex-wrap: wrap; gap: 8px; }
.os-namechip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 999px; font-size: var(--text-sm); }
.os-namechip--me { border-color: var(--primary); }
.os-namechip--spot { padding-left: 10px; border-style: dashed; color: var(--muted-foreground); }
.os-mark--open { color: var(--muted-foreground); }

/* Manual (docs/os-manual rendered) */
.os-manual { font-size: var(--text-lg); line-height: 1.6; }
.os-manual > :first-child { margin-top: 0; }
.os-manual > :last-child { margin-bottom: 0; }
.os-manual__title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.os-manual h2 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 28px 0 8px; }
.os-manual h3 { font-size: var(--text-lg); font-weight: 600; margin: 20px 0 6px; }
.os-manual p { margin: 0 0 12px; }
.os-manual ul, .os-manual ol { margin: 0 0 12px; padding-left: 20px; }
.os-manual li + li { margin-top: 4px; }
.os-manual code { font-family: var(--font-mono); font-size: var(--text-sm); background: var(--secondary); padding: 1px 4px; border-radius: 4px; }
.os-manual table { width: 100%; border-collapse: collapse; margin: 0 0 10px; display: block; overflow-x: auto; }
.os-manual th { text-align: left; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.os-manual td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.os-manual-mod { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.os-manual-mod__icon { flex-shrink: 0; padding-top: 1px; }
.os-manual-mod__main { flex: 1; min-width: 0; }
.os-manual-mod__title { margin: 0; font-size: var(--text-md); font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.os-manual-mod__title a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.os-manual-open { font-size: var(--text-xs); flex-shrink: 0; padding-top: 2px; }

/* =====================================================================
   Usability pass: shared layer. Phone first (390px), then speed.
   Display only: no markup here changes what a page does.
   ===================================================================== */

/* ---- touch targets: keep the look, grow the hit area on touch ---- */
@media (pointer: coarse) {
  .os-btn { min-height: 40px; }
  .os-btn--sm, .os-iconbtn, .os-dropids, .os-linkbtn { position: relative; }
  /* 4px each way: neighbours 8px apart never overlap. */
  .os-btn--sm::after, .os-iconbtn::after, .os-dropids::after, .os-linkbtn::after { content: ""; position: absolute; inset: -4px; }
  .os-chip { min-height: 40px; }
  .os-sublinks a { display: inline-flex; align-items: center; min-height: var(--tap); }
  .os-sublinks { padding-bottom: 0; }
  .os-menu__item { min-height: var(--tap); padding: 10px 12px; }
}
.os-btn--danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.os-btn--danger:hover { background: var(--accent); }

/* ---- badge: one style for status, source, private, locked, yes/no ---- */
.os-badge { display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; white-space: nowrap; border: 1px solid currentColor; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); }
.os-badge svg { width: 12px; height: 12px; }
.os-badge--ok { color: var(--ok); } .os-badge--bad { color: var(--bad); } .os-badge--warn { color: var(--warn); }
.os-badge--muted { color: var(--muted-foreground); } .os-badge--neutral { color: var(--foreground); }

/* ---- KPI tile: mono label, big tabular value, tone as a left edge only ---- */
.os-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .os-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } .os-kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.os-kpi { min-width: 0; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.os-kpi--ok { border-left: 2px solid var(--brand-accent); } .os-kpi--warn { border-left: 2px solid var(--warn); }
.os-kpi--bad { border-left: 2px solid var(--bad); } .os-kpi--muted { border-left: 2px solid var(--muted-foreground); }
.os-kpi__label { margin: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground); overflow-wrap: anywhere; }
.os-kpi__value { margin: 8px 0 0; font-family: var(--font-mono); font-size: 22px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) { .os-kpi__value { font-size: 26px; } }
.os-kpi__sub { margin: 8px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--muted-foreground); }

/* ---- stepper: numbered steps; phones show "Step 2 of 3 · name" ---- */
.os-stepper { display: none; list-style: none; margin: 0; padding: 0; align-items: center; gap: 12px; }
.os-stepper__step { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-stepper__num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 600 12px var(--font-mono); }
.os-stepper__step.is-current { color: var(--brand-accent); }
.os-stepper__step.is-current .os-stepper__num { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.os-stepper__step.is-done { color: var(--foreground); }
.os-stepper__step.is-done .os-stepper__num { color: var(--ok); border-color: var(--ok); }
.os-stepper__step + .os-stepper__step::before { content: ""; width: 24px; height: 1px; background: var(--border); }
.os-stepper__compact { margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-accent); }
@media (min-width: 768px) { .os-stepper { display: flex; } .os-stepper__compact { display: none; } }

/* ---- file field: Choose file + name + Remove; drop zone on desktop ---- */
.os-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: var(--tap); }
.os-file__name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: var(--text-md); }
.os-file__name.is-empty { color: var(--muted-foreground); }
.os-file__hint { display: none; flex-basis: 100%; margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
@media (min-width: 768px) {
  .os-file--drop { padding: 16px; border: 1px dashed var(--input); border-radius: 10px; }
  .os-file--drop.is-dragover { border-color: var(--ring); }
  .os-file--drop .os-file__hint { display: block; }
}

/* ---- segmented tabs: switch views within one page ---- */
.os-seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--secondary); }
.os-seg__item { flex-shrink: 0; display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; color: var(--muted-foreground); background: none; cursor: pointer; }
.os-seg__item:hover { color: var(--foreground); }
.os-seg__item.is-active { background: var(--card); border-color: var(--border); color: var(--foreground); }
@media (pointer: coarse) { .os-seg__item { height: 40px; } }

/* ---- chips that turn into a select on phones (long team or list sets) ---- */
.os-chips--select > select { display: none; }
@media (max-width: 767px) {
  .os-chips--select > .os-chips { display: none; }
  .os-chips--select > select { display: block; margin-bottom: 16px; }
}

/* ---- jump bar: sticky section chips on long pages ---- */
.os-jumpbar { position: sticky; top: var(--header-h); z-index: 30; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 8px 16px; background: color-mix(in srgb, var(--background) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.os-jumpbar .os-chip { text-decoration: none; display: inline-flex; align-items: center; }
@media (min-width: 768px) { .os-jumpbar { margin: 0 -32px 16px; padding: 8px 32px; } }
[data-os-jumpbar-section] { scroll-margin-top: calc(var(--header-h) + 56px); }

/* ---- tables on phones ---- */
.os-row--muted { opacity: .55; }
/* sticky: first column pinned, the rest scroll sideways */
.os-table--sticky :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--card); border-right: 1px solid var(--border); }
@media (max-width: 767px) { .os-table--sticky :is(th, td):first-child { max-width: 160px; } }
/* stack: each row a card of labeled lines */
@media (max-width: 767px) {
  .os-table--stack thead { display: none; }
  .os-table--stack, .os-table--stack tbody, .os-table--stack tr, .os-table--stack td { display: block; width: 100%; }
  .os-table--stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .os-table--stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .os-table--stack td::before { content: attr(data-label); flex-shrink: 0; text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-foreground); }
  .os-table--stack td:first-child { display: block; padding-bottom: 6px; text-align: left; font-size: var(--text-lg); font-weight: 500; }
  .os-table--stack td:first-child::before, .os-table--stack td[colspan]::before, .os-table--stack td:not([data-label])::before { content: none; }
  .os-table--stack td[colspan] { display: block; text-align: left; }
}
.os-sortrow { display: none; }
@media (max-width: 767px) {
  .os-sortrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .os-sortrow select { flex: 1; }
}

/* ---- popover for detail that used to live in a hover title ---- */
.os-pop { margin: auto; max-width: min(320px, calc(100vw - 32px)); padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--popover); color: var(--foreground); font-size: var(--text-sm); }
.os-pop::backdrop { background: transparent; }
button.os-mark { padding: 0; background: none; cursor: pointer; position: relative; }
button.os-mark::after { content: ""; position: absolute; inset: -12px; }

/* ---- banners: one more tone for errors, buttons wrap on phones ---- */
.os-banner--bad { border-color: var(--bad); background: transparent; color: var(--bad); }
@media (max-width: 639px) { .os-banner { flex-wrap: wrap; } }

/* ---- confirm sheet (replaces the browser confirm dialog) ---- */
.os-sheet--confirm .os-sheet__title { margin: 0 0 16px; color: var(--foreground); }
.os-sheet--confirm .os-sheet__actions { display: flex; flex-direction: column-reverse; gap: 8px; }
.os-sheet--confirm .os-sheet__actions .os-btn { min-height: var(--tap); }
@media (min-width: 768px) { .os-sheet--confirm .os-sheet__actions { flex-direction: row; justify-content: flex-end; } }

/* ---- disclosure: one style for folded sections ---- */
.os-disclosure > summary { display: flex; width: 100%; min-height: var(--tap); align-items: center; justify-content: space-between; gap: 12px; font-size: var(--text-md); font-weight: 500; cursor: pointer; }
.os-disclosure > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 1.5px solid var(--muted-foreground); border-bottom: 1.5px solid var(--muted-foreground); transform: rotate(45deg); }
.os-disclosure[open] > summary::after { transform: rotate(-135deg); }

/* ---- vote / react ---- */
.os-vote { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--input); border-radius: 8px; background: transparent; color: var(--foreground); font: 500 13px var(--font-mono); cursor: pointer; }
.os-vote[aria-pressed="true"] { border-color: var(--primary); color: var(--brand-accent); }
@media (pointer: coarse) { .os-vote { height: 40px; } }

/* ---- rating chips 1-10 ---- */
.os-rating { display: flex; flex-wrap: wrap; gap: 6px; }
.os-rating label { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--input); border-radius: 8px; font: 500 13px var(--font-mono); cursor: pointer; }
.os-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.os-rating label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.os-rating label:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--ring); }
@media (pointer: coarse) { .os-rating label { width: 40px; height: 40px; } }

/* ---- timeline: time, dot, text ---- */
.os-timeline { list-style: none; margin: 0; padding: 0; }
.os-timeline > li { position: relative; display: grid; grid-template-columns: 64px 12px minmax(0, 1fr); gap: 8px; padding: 6px 0; font-size: var(--text-md); }
.os-timeline__time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted-foreground); }
.os-timeline__dot { position: relative; }
.os-timeline__dot::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-foreground); }
.os-timeline > li:not(:last-child) .os-timeline__dot::after { content: ""; position: absolute; left: 5.5px; top: 16px; bottom: -14px; width: 1px; background: var(--border); }

/* ---- prose: reading pages (manual, legal, job descriptions) ---- */
.os-prose { font-size: var(--text-lg); line-height: 1.6; max-width: 68ch; }
.os-prose > :first-child { margin-top: 0; }
.os-prose h2 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 28px 0 8px; }
.os-prose h3 { font-size: var(--text-lg); font-weight: 600; margin: 20px 0 6px; }
.os-prose :is(p, ul, ol) { margin: 0 0 12px; }
.os-prose :is(ul, ol) { padding-left: 20px; }
.os-prose li + li { margin-top: 4px; }
.os-prose a, .os-manual a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.os-prose code { font-family: var(--font-mono); font-size: var(--text-sm); background: var(--secondary); padding: 1px 4px; border-radius: 4px; }
.os-prose blockquote, .os-manual blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 2px solid var(--border); color: var(--muted-foreground); }

/* ---- shell on phones ---- */
@media (max-width: 767px) {
  dialog.os-palette { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .os-palette__search { padding-top: calc(12px + env(safe-area-inset-top)); }
}

/* === port: A1 === */
/* Home, What I owe, Scorecard, Rocks, To-dos, Approvals, Notifications, Setup, More, Capture. */

/* ---- list row: icon, label, detail (under on phones, beside from 640), chevron when linked ---- */
.os-listrow { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 12px 16px; color: inherit; }
a.os-listrow:hover { background: var(--muted); }
.os-listrow__icon { display: inline-flex; flex: none; margin-top: 2px; color: var(--muted-foreground); }
.os-listrow__main { flex: 1; min-width: 0; }
.os-listrow__label { display: block; font-size: var(--text-lg); line-height: 1.35; overflow-wrap: anywhere; }
.os-listrow__detail { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: var(--text-sm); line-height: 1.35; color: var(--muted-foreground); }
.os-listrow > .lucide, .os-listrow > [data-lucide] { align-self: center; color: var(--muted-foreground); }
.os-listrow > .os-badge { margin-top: 2px; }
@media (min-width: 640px) {
  .os-listrow--side .os-listrow__main { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
  .os-listrow--side .os-listrow__detail { margin-top: 0; max-width: 45%; flex-shrink: 0; text-align: right; }
}
.os-listrow--compact { min-height: 44px; padding-block: 10px; align-items: center; }
.os-listrow--muted .os-listrow__label { color: var(--muted-foreground); }

/* ---- small banner row with an icon (info tone) ---- */
.os-banner--row { min-height: var(--tap); padding: 10px 16px; font-weight: 400; color: var(--foreground); }
.os-banner--row > .lucide:first-child, .os-banner--row > [data-lucide]:first-child { color: var(--muted-foreground); }
a.os-banner:hover { background: var(--muted); }
.os-banner__text { flex: 1; min-width: 0; }

/* ---- small text: one muted help line, one empty line ---- */
.os-help { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-emptyline { margin: 0; font-size: var(--text-md); color: var(--muted-foreground); }
.os-section-head__extra { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }

/* ---- home: compact profile row under the greeting ---- */
.os-greeting .os-page-title { margin-top: 2px; }
.os-profilerow { margin-top: 12px; }

/* ---- scorecard rows ---- */
.os-scorerow__name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.os-scorerow__name strong { min-width: 0; font-size: var(--text-md); overflow-wrap: anywhere; }
.os-scorerow__name .os-muted { display: inline-flex; }
.os-scorerow__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 8px; }
.os-scorerow__target { min-width: 0; }
.os-scorerow__goal { font-size: var(--text-md); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 639px) {
  .os-scorerow__foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .os-scorerow .os-weeks { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .os-scorerow .os-weeks .os-scorecell { overflow: hidden; text-overflow: ellipsis; }
}
.os-legend { flex-wrap: wrap; }

/* ---- number page ---- */
.os-numhead { display: flex; align-items: flex-start; gap: 12px; }
.os-numhead__main { flex: 1; min-width: 0; }
.os-numhead .os-page-title { overflow-wrap: anywhere; }
.os-numactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 767px) { .os-numactions .os-btn { min-height: var(--tap); } }
.os-hist { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; }
.os-hist__week { font-size: var(--text-xs); color: var(--muted-foreground); }
.os-hist__value { display: inline-flex; align-items: center; gap: 8px; }
.os-agebars { display: flex; flex-direction: column; gap: 8px; }
.os-agebar__head { display: flex; justify-content: space-between; font-size: var(--text-xs); }
.os-agebar__fill { height: 100%; background: var(--primary); }
.os-agebar__fill--warn { background: var(--warn); } .os-agebar__fill--bad { background: var(--bad); }
.os-bigvalue { margin: 0; font-family: var(--font-mono); font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.os-sheet__hint { margin: 0; text-align: center; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-sheet__hint--lg { font-size: var(--text-md); }
.os-sheet__autobox { background: var(--muted); }
.os-sheet__actions-row { display: flex; gap: 8px; }
.os-sheet__actions-row > * { flex: 1; min-height: var(--tap); }

/* ---- quarter switcher: prev / quarter / next ---- */
.os-qswitch { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 2px; border: 1px solid var(--border); border-radius: 8px; }
.os-qswitch .os-iconbtn { border-color: transparent; background: transparent; }
.os-qswitch__label { min-width: 112px; text-align: center; font: 600 var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
.os-qswitch__now { color: var(--brand-accent); }
.os-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.os-toolbar .os-chips { margin-bottom: 0; }

/* ---- rock card, relations, tree, history ---- */
.os-rockcard { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.os-rockcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.os-rockcard__title { font-size: var(--text-md); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.os-rockcard__done { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.os-rockcard__done strong { color: var(--foreground); }
.os-rockcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-rockcard__due { margin-left: auto; }
@media (max-width: 639px) { .os-rockcard__due { flex-basis: 100%; text-align: right; } }
.os-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.os-titlerow .os-page-title { min-width: 0; overflow-wrap: anywhere; }
.os-metaline { margin: 4px 0 0; font-size: var(--text-md); color: var(--muted-foreground); }
.os-metaline--owner { display: flex; align-items: center; gap: 8px; }
.os-relations { padding: 16px 0; }
.os-relation { margin: 0; font-size: var(--text-md); }
.os-tree { list-style: none; margin: 0; padding-left: 8px; border-left: 1px solid var(--border); }
.os-tree > li + li { margin-top: 8px; }
.os-tree > li > .os-tree { margin-top: 8px; }
.os-tree__item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; color: inherit; }
.os-tree__title { font-size: var(--text-md); overflow-wrap: anywhere; }
.os-tree__sub { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-histrow { display: grid; grid-template-columns: minmax(56px, auto) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 16px; }
.os-histrow__week { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.os-histrow__note { font-size: var(--text-xs); color: var(--muted-foreground); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 519px) {
  .os-histrow { grid-template-columns: minmax(0, 1fr) auto; }
  .os-histrow__note { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- forms in this group: one column on phones, folded extras ---- */
.os-form .os-disclosure { border-top: 1px solid var(--border); }
.os-form .os-disclosure > .os-form__fold { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.os-readonly { margin-top: 4px; min-height: 40px; display: flex; align-items: center; font-size: var(--text-md); font-weight: 400; color: var(--muted-foreground); }

/* ---- to-dos ---- */
.os-todocard { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.os-todocard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.os-todocard__title { min-width: 0; font-size: var(--text-md); font-weight: 600; overflow-wrap: anywhere; }
.os-todocard__title a { color: inherit; }
.os-todocard__line { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-todocard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-todocard__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-todocard__actions .os-menu__panel { min-width: 200px; }
.os-todo-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.os-todo-sub { margin-top: 2px; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-todo-title { font-weight: 600; }
@media (min-width: 768px) {
  .os-todo-meta { display: none; }
  .os-table td.os-todo-titlecell { min-width: 220px; }
}
@media (max-width: 767px) {
  .os-table--stack td.os-hide-phone, .os-table--stack td.os-hide-phone-empty:has(> .os-muted:only-child) { display: none; }
  .os-table--stack td.os-todo-actions { justify-content: flex-start; padding-top: 8px; }
  .os-table--stack td.os-todo-actions::before { content: none; }
  .os-table--stack td.os-todo-actions .os-btn { min-height: var(--tap); }
}
.os-todo-actions { white-space: nowrap; text-align: right; }
@media (max-width: 519px) { .os-stack-phone { flex-direction: column; align-items: stretch; } }
.os-note-list { list-style: none; margin: 0; padding: 0; }
.os-note-list > li { border-left: 2px solid var(--border); padding-left: 10px; }
.os-note-list > li + li { margin-top: 8px; }
.os-note-list__body { margin: 2px 0 0; font-size: var(--text-sm); white-space: pre-line; }
.os-artifact-list { list-style: none; margin: 0; padding: 0; }
.os-artifact-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--text-sm); }
.os-artifact-list > li + li { margin-top: 8px; }

/* to-do add form, detail page sections, people picker, artifact search (were page-local <style> blocks) */
.todo-add { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.todo-add__line { display: flex; gap: 8px; }
.todo-add__line .os-field { flex: 1; min-width: 0; }
.todo-add__more > summary { list-style: none; cursor: pointer; align-self: flex-start; width: fit-content; }
.todo-add__more > summary::-webkit-details-marker { display: none; }
.todo-add__fields { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
/* Type, List, Due share a row where they fit; Owner and Rock pair from 520px. */
.todo-add__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 10px 8px; align-items: end; }
.todo-add__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.todo-add__row > * { min-width: 0; }
@media (max-width: 519px) { .todo-add__row, .todo-add__grid { grid-template-columns: 1fr; } }
.todo-add__type { border: 0; padding: 0; margin: 0; min-width: 0; }
.todo-add__type legend { padding: 0; margin-bottom: 4px; }
.todo-add__chips { display: flex; gap: 6px; }
.todo-add__chips .os-chip { height: 38px; }
.todo-add__row[hidden], .todo-add [data-todo-l10-only][hidden] { display: none; }
.todo-section { display: flex; flex-direction: column; gap: 10px; }
.todo-section .os-section-head { margin-bottom: 0; }
.todo-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: var(--text-md); }
.todo-dl dt { color: var(--muted-foreground); }
.todo-dl dd { margin: 0; overflow-wrap: anywhere; }
.todo-page form[hidden], .todo-page [data-todo-view][hidden], .todo-page [data-todo-edit][hidden] { display: none; }
.todo-people { display: flex; flex-direction: column; gap: 6px; }
.todo-people__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.todo-people__chips:not(:has(.todo-people__chip)) { display: none; }
.todo-people__chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--secondary); font-size: var(--text-sm); }
.todo-people__x { min-width: 32px; min-height: 32px; border: 0; background: transparent; color: var(--muted-foreground); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 999px; }
@media (pointer: coarse) { .todo-people__x { min-width: 40px; min-height: 40px; } }
.todo-people__x:hover, .todo-people__x:focus-visible { color: var(--foreground); }
.todo-people__box { position: relative; }
.todo-people__results { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); max-height: 16rem; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.todo-people__results[hidden] { display: none; }
.todo-people__results { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent; }
.todo-people__opt { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--foreground); font: inherit; font-size: var(--text-md); cursor: pointer; }
.todo-people__opt:last-child { border-bottom: 0; }
.todo-people__opt[aria-selected="true"], .todo-people__opt:hover { background: var(--secondary); }
.todo-people__none { padding: 10px 14px; font-size: var(--text-sm); color: var(--muted-foreground); }
.todo-attach { position: relative; }
.todo-attach__results { position: absolute; left: 0; right: 0; top: calc(100% - 4px); z-index: 40; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); max-height: 18rem; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.todo-attach__results[hidden], .todo-attach__picked[hidden] { display: none; }
.todo-attach__opt { display: block; width: 100%; min-height: 44px; padding: 10px 14px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--foreground); font: inherit; font-size: var(--text-md); cursor: pointer; overflow-wrap: anywhere; }
.todo-attach__opt:last-child { border-bottom: 0; }
.todo-attach__opt:hover, .todo-attach__opt[aria-selected="true"] { background: var(--muted); }
.todo-attach__opt small, .todo-attach__msg { display: block; color: var(--muted-foreground); font-size: var(--text-xs); }
.todo-attach__msg { padding: 10px 14px; }
.todo-attach__picked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--text-md); border: 1px solid var(--brand-accent); border-radius: var(--radius); padding: 6px 6px 6px 12px; }

/* ---- approvals ---- */
.os-approval__goal { flex: none; text-align: right; }
.os-approval__value { font-size: var(--text-md); font-weight: 600; }
.os-approval__by { font-size: var(--text-sm); color: var(--muted-foreground); }
.os-approval__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.os-approval__actions .os-btn, .os-approval__actions form { width: 100%; }
.os-approval__actions .os-btn { min-height: var(--tap); }

/* ---- switch: a checkbox drawn as an on/off toggle, 44px row ---- */
.os-switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-size: var(--text-md); cursor: pointer; }
.os-switch input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 40px; height: 24px; margin: 0; border: 1px solid var(--input); border-radius: 999px; background: var(--secondary); cursor: pointer; transition: background var(--motion, .15s) ease; }
.os-switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted-foreground); transition: transform var(--motion, .15s) ease; }
.os-switch input:checked { background: var(--primary); border-color: var(--primary); }
.os-switch input:checked::before { transform: translateX(16px); background: var(--primary-foreground); }
.os-switch input:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.os-switch + .os-help { margin: -6px 0 0 52px; }
@media (prefers-reduced-motion: reduce) { .os-switch input, .os-switch input::before { transition: none; } }
@media (max-width: 767px) {
  .os-fill-phone { flex: 1; display: flex; }
  .os-fill-phone > .os-btn, .os-btn.os-fill-phone { flex: 1; min-height: var(--tap); }
}
.os-notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; color: inherit; }
.os-notif:hover { background: var(--muted); }
.os-notif__main { flex: 1; min-width: 0; }
.os-notif__kind { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.os-notif__title { display: block; font-size: var(--text-md); font-weight: 400; overflow-wrap: anywhere; }
.os-notif--unread .os-notif__title { font-weight: 600; }
.os-notif__body { display: block; font-size: var(--text-xs); color: var(--muted-foreground); overflow-wrap: anywhere; }
.os-notif__end { display: inline-flex; align-items: center; gap: 8px; align-self: center; color: var(--muted-foreground); }
.os-device { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 0; }
.os-device__name { font-size: var(--text-sm); min-width: 0; }

/* ---- setup ---- */
.os-setup-cutoff { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-setup-cutoff strong { display: block; color: var(--foreground); }
.os-setup-hero__main { flex: 1; min-width: 0; }
.os-setup-hero__title { margin: 0; font-size: 18px; font-weight: 600; }
.os-setup-hero__sub { margin: 4px 0 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-setup-hero__next { margin-top: 16px; }
@media (max-width: 639px) { .os-setup-hero { flex-direction: column; align-items: flex-start; } .os-setup-hero__main { width: 100%; } }
.os-setup-scale { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.os-setup-track { margin: 14px 0 4px; }
.os-setup-step__main { flex: 1; min-width: 0; }
.os-setup-step__label { margin: 0; font-size: var(--text-md); }
.os-setup-step--done .os-setup-step__label { color: var(--muted-foreground); }
.os-setup-step__hint { margin: 2px 0 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-setup-step__end { font-size: var(--text-xs); color: var(--muted-foreground); text-align: right; }
.os-setup-steps { padding: 4px 16px; }
.os-race { display: flex; flex-direction: column; gap: 8px; }
.os-race__row { display: grid; grid-template-columns: minmax(72px, max-content) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: var(--text-sm); }
.os-race__name { min-width: 0; overflow-wrap: anywhere; }
.os-race__pct { color: var(--muted-foreground); text-align: right; font-variant-numeric: tabular-nums; }

/* ---- more: one 48px nav row ---- */
.os-navrow { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; font-size: var(--text-lg); font-weight: 500; color: inherit; }
.os-navrow:hover { background: var(--muted); }
.os-navrow__icon { display: inline-flex; color: var(--muted-foreground); }
.os-navrow__label { flex: 1; min-width: 0; }
.os-navrow > .lucide:last-child, .os-navrow > [data-lucide]:last-child { color: var(--muted-foreground); }

/* ---- capture ---- */
.os-btn--tap { min-height: var(--tap); }

/* ---- home: my numbers ---- */
.os-numcard { padding: 16px; }
.os-split--end { align-items: flex-end; }
.os-numcard__target { font-size: var(--text-xs); color: var(--muted-foreground); }
.os-locked-numbers__list { margin: 8px 0 0; padding-left: 18px; font-size: var(--text-sm); }
.os-scorerow { display: block; }

/* ---- number forms: source settings show only for the source that reads them (CSS only, fields still post) ---- */
@supports selector(:has(*)) {
  .os-srcform .os-srcfield { display: none; }
  .os-srcform:has(select[name$="[source_key]"] :is(option[value="rcc_open_deals"], option[value="rcc_won_deals"], option[value="rcc_won_value"]):checked) .os-srcfield--product,
  .os-srcform:has(select[name$="[source_key]"] option[value="rcc_open_deals"]:checked) .os-srcfield--pipeline,
  .os-srcform:has(select[name$="[source_key]"] option[value^="pipedrive_"]:checked) .os-srcfield--pipeline-id,
  .os-srcform:has(select[name$="[source_key]"] option[value^="bookings_"]:checked) .os-srcfield--kind,
  .os-srcform:has(select[name$="[source_key]"] option[value="discoveries_pushed"]:checked) .os-srcfield--advisor,
  .os-srcform:has(select[name$="[source_key]"] option[value^="helpscout_"]:checked) .os-srcfield--helpscout,
  .os-srcform:has(select[name$="[source_key]"] option[value^="uptimerobot_"]:checked) .os-srcfield--monitor,
  /* A setting that already holds a value stays visible, so nothing hidden posts a value you can't see. */
  .os-srcform .os-srcfield:has(input[value]:not([value=""])),
  .os-srcform .os-srcfield:has(option[selected]:not([value=""])) { display: block; }
}
.os-prewrap { white-space: pre-line; }
.os-rocktoggle--ok { --tone: var(--ok); } .os-rocktoggle--bad { --tone: var(--bad); }
.os-nowrap { white-space: nowrap; }
.os-label__hint { font-weight: 400; color: var(--muted-foreground); }
.todo-add__line > .os-btn { height: auto; align-self: stretch; }
.todo-page .os-page-title { overflow-wrap: anywhere; }
.os-grow { flex: 1; min-width: 0; max-width: 520px; }
.os-fullrow { flex-basis: 100%; }
.os-selfstart { align-self: flex-start; }
.os-notif-settings__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.os-notif-settings__label { font-weight: 500; }
.os-notif-settings__state { flex-basis: 100%; }
@media (min-width: 640px) { .os-notif-settings__state { flex-basis: auto; } }
.os-notif-settings__body { margin-top: 14px; }
.os-notif-settings__status { margin: 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-switch-form { display: flex; flex-direction: column; gap: 2px; }

/* === port: A2 === */
/* Tap target that opens a small popover (detail that used to be a hover title). */
.os-tapdetail { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.os-tapdetail--icon { text-decoration: none; color: var(--muted-foreground); }
.os-tapdetail::after { content: ""; position: absolute; inset: -12px -8px; }
/* 44px hit area for small icon buttons and back arrows on touch */
@media (pointer: coarse) {
  .os-hit { position: relative; }
  .os-hit::after { content: ""; position: absolute; inset: -8px; }
}

/* Plain list in a card: rows divided, 56px when linked */
.os-list { list-style: none; margin: 0; padding: 0 16px; }
.os-list > li + li { border-top: 1px solid var(--border); }
.os-list > li > .os-listcard, .os-list > li > .os-split { min-height: 56px; padding: 10px 0; }
.os-list--flush { padding: 0; }
.os-listcard__title.is-unread { font-weight: 700; }
.os-listcard__trail { flex-shrink: 0; color: var(--muted-foreground); }
.os-listcard__sub .os-badge { vertical-align: 1px; }

/* Toolbar: chips on the left, one action on the right; the action drops under on phones */
.os-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.os-toolbar > .os-chips { margin-bottom: 0; min-width: 0; }
@media (max-width: 639px) { .os-toolbar > .os-chips { flex-basis: 100%; } }

/* Section head that wraps its summary under the title on phones */
.os-section-head--wrap { flex-wrap: wrap; gap: 4px 12px; }
.os-section-head__note { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted-foreground); }

/* Item card (issue, suggestion, win, message): head, meta, body, actions */
.os-itemcard { display: flex; flex-direction: column; gap: 8px; }
.os-itemcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.os-itemcard__head > :first-child { min-width: 0; flex: 1; }
.os-itemcard__title { margin: 0; font-size: var(--text-md); font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.os-itemcard__meta { margin: 2px 0 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-itemcard__meta a { font-size: inherit; }
.os-itemcard__text { margin: 0; font-size: var(--text-sm); white-space: pre-line; }
.os-itemcard__quote { margin: 0; padding-left: 8px; border-left: 2px solid var(--border); font-size: var(--text-sm); }
.os-itemcard__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-itemcard__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.os-itemcard__eyebrow { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-itemcard--media { flex-direction: row; align-items: flex-start; gap: 12px; }
.os-itemcard--media > .os-itemcard__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
/* An inline form (field + button) that stacks full width on phones */
.os-inlineform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-inlineform > .os-field { flex: 1 1 200px; min-width: 0; }
@media (max-width: 639px) { .os-inlineform > * { flex-basis: 100%; } .os-inlineform > .os-btn { width: 100%; } }
/* Add-item form: title, owner, button; one column on phones */
.os-addform { display: flex; flex-wrap: wrap; gap: 8px; }
.os-addform > .os-field:first-of-type { flex: 2 1 220px; }
.os-addform > select.os-field { flex: 1 1 140px; }
@media (max-width: 639px) { .os-addform > * { flex-basis: 100%; } .os-addform > .os-btn { width: 100%; min-height: var(--tap); } }

/* Sheet bits: a cancel + submit row and a short intro line */
.os-sheet__intro { margin: -8px 0 16px; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-sheet__actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 767px) { .os-sheet__actions .os-btn { flex: 1; min-height: var(--tap); } }

/* Scorecard: "Drop to IDS" as a chip with a 44px hit area */
.os-dropids.os-chip { display: inline-flex; min-height: 28px; margin: 6px auto 0; padding: 2px 8px; font-size: var(--text-xs); border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--card); color: var(--muted-foreground); text-decoration: none; }
.os-dropids.os-chip[aria-disabled="true"] { cursor: default; color: var(--ok); border-color: currentColor; }
.os-dropids.os-chip::after { content: ""; position: absolute; inset: -8px -4px; }
.os-scoregrid .os-dropcell { text-align: center; }
.os-scoregrid.os-table--sticky td:first-child a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* L10 headline blocks */
.os-headline__list { margin: 0; padding-left: 18px; font-size: var(--text-sm); }
.os-headline__list li + li { margin-top: 2px; }

/* Rating chips per attendee */
.os-ratingrows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.os-ratingrow { border: 0; margin: 0; padding: 0; min-width: 0; }
.os-ratingrow > legend { display: flex; align-items: center; gap: 8px; padding: 0; margin-bottom: 6px; font-size: var(--text-md); }

/* KPI row that stays three across */
.os-kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.os-kpis--3 .os-kpi { padding: 12px; }

/* Segmented tabs with no script: radios pick which panel shows */
.os-segtabs > .os-seg { margin-bottom: 16px; }
.os-seg__item:has(> input:checked) { background: var(--card); border-color: var(--border); color: var(--foreground); }
.os-seg__item:has(> input:focus-visible) { box-shadow: 0 0 0 2px var(--ring); }
.os-seg__item { cursor: pointer; }
.os-segtabs:has(.os-seg__item:nth-child(1) > input:checked) > [data-seg]:not([data-seg="1"]),
.os-segtabs:has(.os-seg__item:nth-child(2) > input:checked) > [data-seg]:not([data-seg="2"]),
.os-segtabs:has(.os-seg__item:nth-child(3) > input:checked) > [data-seg]:not([data-seg="3"]) { display: none; }

/* Code shown once, with a copy button beside it */
.os-copyfield { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.os-copyfield__value { margin: 0; font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: .12em; user-select: all; overflow-wrap: anywhere; }
.os-copyfield--block { flex-direction: column; align-items: stretch; }
.os-copyfield--block > .os-btn { align-self: flex-start; }

/* Quarter switcher: previous, this one, next */
.os-qswitch { display: inline-flex; align-items: center; gap: 4px; }
.os-qswitch__current { padding: 0 8px; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; }

/* Label over detail rows (checklists); detail drops under the label on phones */
.os-steprow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: var(--text-sm); }
.os-steprow__label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.os-steprow__detail { font-size: var(--text-xs); color: var(--muted-foreground); text-align: right; }
@media (max-width: 639px) { .os-steprow { flex-direction: column; align-items: flex-start; gap: 2px; } .os-steprow__detail { padding-left: 28px; text-align: left; } }

/* Totals list: label left, count right */
.os-totals { list-style: none; margin: 0; padding: 0 16px; }
.os-totals > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 0; font-size: var(--text-md); }
.os-totals > li + li { border-top: 1px solid var(--border); }
.os-totals__count { font-family: var(--font-mono); font-size: var(--text-sm); }

/* Person x check matrix: small mono headers, centered marks */
.os-matrix th:not(:first-child) { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-align: center; }
.os-matrix td:not(:first-child) { text-align: center; }
.os-matrix td:first-child { min-width: 96px; }

/* Message bubble: secondary bits folded behind one row */
.os-chat__more > summary { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; list-style: none; cursor: pointer; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-chat__more > summary::-webkit-details-marker { display: none; }
.os-chat__more[open] > summary { color: var(--foreground); }
.os-chat__more > :not(summary) { margin-top: 4px; }
.os-chat__more { display: flex; flex-direction: column; }
.os-chat__msg.is-mine .os-chat__more { align-items: flex-end; }
.os-chat__note { font-size: var(--text-xs); }
@media (max-width: 639px) {
  .os-chat__handle { flex-wrap: wrap; width: 100%; }
  .os-chat__handle .os-field, .os-chat__todo form .os-field { width: 100%; flex-basis: 100%; }
  .os-chat__handle .os-btn { flex: 1; }
}
.os-chat__compose { padding-bottom: env(safe-area-inset-bottom); }

/* Artifact viewer header: back + title on row one, actions on row two on phones */
@media (max-width: 640px) {
  .os-artifact .os-chat__head > .os-chat__title { flex: 1 1 0; }
  .os-artifact .os-chat__head > .os-artifact__actions { flex-basis: 100%; margin-left: 0; }
  .os-artifact .os-chat__title h1 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
.os-artifact__vis { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }

/* Textarea that grows with what you type */
.os-field--autosize { field-sizing: content; min-height: 6lh; }

/* Manual: Open link as a 44px target */
.os-manual-open { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 4px; margin: -12px -4px -12px 0; }
.os-manual__role > summary { padding: 4px 0; }
.os-manual__role > summary .os-manual__title { margin: 0; }
.os-manual__role[open] > summary { margin-bottom: 8px; }

/* Form sections inside one card */
.os-form__section { display: flex; flex-direction: column; gap: 16px; }
.os-form__section + .os-form__section { padding-top: 16px; border-top: 1px solid var(--border); }
/* L10: the open issues summary hides while IDS is the section on screen */
.os-stack:has(> [data-section="ids"]:not([hidden])) .os-l10-issuesum { display: none; }
.os-rating label { position: relative; }

/* === port: B === */
/* Small shared pieces for the people, access, inventory, incidents, on-call,
   budget and public views. Display only. */

/* help text under a label or field; muted 12px */
.os-help { display: block; margin: 4px 0 0; font-size: var(--text-xs); font-weight: 400; color: var(--muted-foreground); }
/* meta line: short facts that wrap, separated by gap not dots */
.os-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 4px 0 0; font-size: var(--text-xs); color: var(--muted-foreground); }
/* fieldset with no browser chrome; legend reads as a section head */
.os-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.os-fieldset > legend { padding: 0; margin-bottom: 8px; }
/* inline form row: fields and a button on one line that wraps on phones */
.os-formrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.os-formrow > .os-field, .os-formrow > .os-label { flex: 1 1 180px; min-width: 0; }
.os-formrow > :is(.os-btn, input[type="submit"], button) { flex-shrink: 0; }
@media (max-width: 639px) { .os-formrow--stack > * { flex-basis: 100%; } }
/* indent for child lines in a grouped table */
.os-indent { padding-left: 24px; }
/* comment block: a quiet left rule instead of a box */
.os-comment { padding: 4px 0 4px 12px; border-left: 2px solid var(--border); }
.os-comment + .os-comment { margin-top: 12px; }
.os-comment .os-comment { margin-top: 8px; }
/* section spacing: 24px between in-page sections */
.os-sections > * + * { margin-top: 24px; }
/* a person row's trailing badge or count */
.os-listcard__end { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.os-listcard__chev { flex-shrink: 0; color: var(--muted-foreground); width: 16px; height: 16px; }
a.os-listcard { min-height: 56px; }

/* badge with detail: a tap opens a small popover (native popover attribute) */
.os-badgepop { position: relative; display: inline-flex; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.os-badgepop::after { content: ""; position: absolute; inset: -8px -4px; }
.os-pop { white-space: pre-line; }
/* matrix cell with a reason: same badge-pop trigger, marked by a ring */
.os-cell--override { outline: 1px solid var(--warn); outline-offset: -3px; }

/* shown only on phones (pairs with .os-hide-mobile) */
.os-only-mobile { display: none; }
@media (max-width: 767px) { .os-only-mobile { display: block; } }

/* org chart: each subtree folds; one 12px step per level */
.os-org details > summary { list-style: none; cursor: pointer; }
.os-org details > summary::-webkit-details-marker { display: none; }
.os-org__node { display: flex; align-items: center; gap: 8px; }
.os-org__node > .os-card { flex: 1; min-width: 0; }
.os-org__toggle { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin-right: -8px; color: var(--muted-foreground); }
.os-org__toggle svg { width: 16px; height: 16px; transition: transform .15s; transform: rotate(-90deg); }
.os-org details[open] > summary .os-org__toggle svg { transform: none; }

/* sticky action bar: the one main action pinned above the tab bar on phones */
@media (max-width: 767px) {
  .os-actionbar { position: sticky; bottom: var(--tabbar-h); z-index: 20; margin: 0 -16px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--border); }
  .os-actionbar > form, .os-actionbar .os-btn { width: 100%; min-height: var(--tap); }
}

/* bare public pages: legal reads as prose in its 680px column */
.os-legal.os-prose { max-width: 680px; }
.os-legal h1 { margin: 8px 0 0; }
.os-legal .os-back { margin: 16px 0 0; }
.os-prose a.os-back { color: var(--muted-foreground); text-decoration: none; }

/* === port: C === */
/* Revenue and billing views. The page-scoped <style> partials
   (command_center, invoices, accounts, discoveries) moved here; wide
   layouts switch at 768px like the rest of the OS. */

/* ---- shared pieces this group added ---- */
.os-help { margin: 0 0 8px; font-size: var(--text-sm); color: var(--muted-foreground); }
.os-help--tight { margin: 0; }
.os-nowrap { white-space: nowrap; }
.os-mt0 { margin-top: 0; }
.os-m0 { margin: 0; }
.os-badges { display: flex; flex-wrap: wrap; gap: 4px; }
/* key/value pairs inline: "Score 12 · Owner Ann" that wrap as units */
.os-kvs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.os-kvs > div { display: inline-flex; gap: 4px; }
.os-kvs dt { margin: 0; }
.os-kvs dd { margin: 0; font-weight: 500; color: var(--foreground); }
/* label over value, two columns from 768px */
.os-kvlist { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 16px; }
.os-kvlist dt { margin-top: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.os-kvlist dt:first-child { margin-top: 0; }
.os-kvlist dd { margin: 0; font-size: var(--text-md); overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .os-kvlist { grid-template-columns: 180px minmax(0, 1fr); align-items: baseline; gap: 10px 16px; }
  .os-kvlist dt { margin-top: 0; }
}
/* link rows: whole row is the target, chevron or icon at the end */
.os-rowlist { list-style: none; margin: 0; padding: 0; }
.os-rowlist > li + li { border-top: 1px solid var(--border); }
.os-rowlist__link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 16px; color: var(--foreground); text-decoration: none; }
.os-rowlist__link:hover { background: var(--secondary); }
.os-rowlist__link > svg { flex-shrink: 0; color: var(--muted-foreground); }
/* copy field: value in mono + Copy button */
.os-copyfield { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-copyfield code { min-width: 0; font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }
/* checkbox drawn as a switch, 44px tap row */
.os-switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-size: var(--text-md); cursor: pointer; }
.os-switch input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 40px; height: 24px; margin: 0; border: 1px solid var(--input); border-radius: 999px; background: var(--secondary); cursor: pointer; transition: background .1s; }
.os-switch input[type=checkbox]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted-foreground); transition: transform .1s; }
.os-switch input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
.os-switch input[type=checkbox]:checked::before { transform: translateX(16px); background: var(--primary-foreground); }
.os-switch input[type=checkbox]:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
/* one section gap between in-page sections */
.os-section { margin-top: 24px; }
.os-section > .os-section-head { margin-bottom: 8px; }
/* disclosure inside a card or a page, with the headline number in the summary */
.os-disclosure > summary { list-style: none; }
.os-disclosure > summary::-webkit-details-marker { display: none; }
.os-disclosure__meta { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); }
.os-disclosure--quiet > summary { min-height: 32px; font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); }
.os-disclosure--quiet[open] > summary { color: var(--foreground); }
.os-disclosure__body { padding-top: 4px; }
/* period / filter select with its label, applies on change */
.os-filterfield { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.os-filterfield > .os-label { margin: 0; }
.os-filterfield select.os-field { width: auto; min-width: 180px; max-width: 100%; }
@media (max-width: 767px) { .os-filterfield, .os-filterfield select.os-field { width: 100%; } }

/* ---- revenue pages (was command_center/_styles) ---- */
.rcc-section { font-size: var(--text-lg); font-weight: 600; margin: 24px 0 8px; }
.rcc-subhead { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground); margin: 16px 0 6px; }
.rcc-help { color: var(--muted-foreground); font-size: var(--text-sm); margin: 0 0 8px; }
.rcc-headactions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rcc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rcc-tiles + .rcc-tiles, .os-kpis + .os-kpis, .os-empty + .os-kpis { margin-top: 8px; }
@media (min-width: 768px) { .rcc-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } .rcc-tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rcc-tiles--auto, .os-kpis--auto { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 768px) { .rcc-tiles--auto, .os-kpis--auto { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.rcc-tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 0; }
.rcc-tile--wide { grid-column: 1 / -1; }
/* an odd last tile spans the row on phones */
@media (max-width: 767px) { .os-kpis > .os-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 768px) { .rcc-tile--wide-lg-auto { grid-column: auto; } }
.rcc-lbl { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground); overflow-wrap: anywhere; }
.rcc-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; line-height: 1; font-weight: 600; margin-top: 8px; overflow-wrap: anywhere; }
@media (min-width: 768px) { .rcc-val { font-size: 26px; } }
.rcc-note { color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 8px; overflow-wrap: anywhere; }
.rcc-tile.is-good { border-left: 2px solid var(--brand-accent); }
.rcc-cov { border-left-width: 2px; }
.rcc-cov.green, .rcc-cov.met { border-left-color: var(--ok); }
.rcc-cov.yellow { border-left-color: var(--warn); }
.rcc-cov.red { border-left-color: var(--bad); }
.rcc-cov.na { border-left-color: var(--muted-foreground); }
.rcc-cov.na .rcc-val { color: var(--muted-foreground); font-size: 18px; }
.rcc-band.green, .rcc-band.met { color: var(--ok); }
.rcc-band.yellow { color: var(--warn); }
.rcc-band.red { color: var(--bad); }
.rcc-band.na { color: var(--muted-foreground); }
.rcc-ends { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--muted-foreground); font-size: var(--text-xs); }
.rcc-ramp { margin: 10px 0 6px; }
.rcc-ramp .os-bar__fill { background: var(--ok); }
/* tables: text wraps, numbers and dates stay on one line */
.rcc-table th { white-space: nowrap; }
.rcc-table .rcc-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rcc-table .rcc-wrap { white-space: normal; min-width: 160px; }
.rcc-table tr.rcc-other td { color: var(--muted-foreground); }
.rcc-table a { text-decoration: underline; text-decoration-color: var(--border); }
.rcc-table small, .rcc-small { color: var(--muted-foreground); font-size: var(--text-xs); }
@media (max-width: 767px) { .rcc-table.os-table--stack .rcc-r { text-align: right; } }
.rcc-split2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; }
@media (min-width: 768px) { .rcc-split2 { grid-template-columns: 1fr 1fr; } }
.rcc-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.rcc-filters .os-chips { margin-bottom: 0; }
.rcc-filters select.os-field { max-width: 260px; }
@media (max-width: 767px) { .rcc-filters select.os-field { max-width: none; } }
.rcc-stage { display: block; position: relative; text-decoration: none; color: inherit; }
.rcc-stage.team { background: var(--muted); }
a.rcc-stage:hover, a.rcc-stage.active { border-color: var(--brand-accent); }
.rcc-stage .conv { color: var(--brand-accent); font-weight: 600; }
.rcc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rcc-actions form { display: inline; }
@media (max-width: 767px) {
  .rcc-actions { width: 100%; }
  .rcc-actions form { display: block; flex: 1; }
  .rcc-actions .os-btn { width: 100%; min-height: var(--tap); }
}
.rcc-chart { position: relative; height: 240px; }
.rcc-form .os-label { font-size: var(--text-sm); font-weight: 500; }
.rcc-form textarea.os-field { font-family: var(--font-mono); font-size: var(--field-font); min-height: 0; height: 6.5em; transition: height .1s; }
.rcc-form textarea.os-field:focus { height: 16em; }
.rcc-form .rcc-hint { display: block; color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 4px; font-weight: 400; overflow-wrap: anywhere; }
.rcc-form code { font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }

/* ---- billing pages (was invoices/_styles) ---- */
.bil-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bil-actions form { display: inline; }
.bil-danger { color: var(--bad); }
.bil-warn { color: var(--warn); }
.bil-ok { color: var(--ok); }
.bil-small { color: var(--muted-foreground); font-size: var(--text-xs); }
.bil-link { text-decoration: underline; text-decoration-color: var(--border); }
.bil-inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.bil-inline-form .os-field { width: 22em; max-width: 100%; }
@media (max-width: 767px) { .bil-inline-form .os-field, .bil-inline-form .os-btn { width: 100%; } }
.bil-add { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: end; }
@media (min-width: 768px) { .bil-add { grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 2fr) auto; } }
.bil-banners > * + * { margin-top: 8px; }
.bil-rows > div + div { margin-top: 4px; }

/* ---- accounts pages (was accounts/_styles) ---- */
.acct-search { position: relative; max-width: 640px; }
.acct-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--card); border: 1px solid var(--border); border-radius: 10px; max-height: 22rem; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.acct-results[hidden] { display: none; }
.acct-result { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.acct-result:last-child { border-bottom: 0; }
.acct-result:hover, .acct-result.is-active { background: var(--secondary); }
.acct-result__main { flex: 1; min-width: 0; }
.acct-result__name { font-weight: 500; }
.acct-result__name a { color: inherit; text-decoration: none; }
.acct-result__name a::after { content: ""; position: absolute; inset: 0; }
.acct-result__loc { color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 2px; }
.acct-result__actions { position: relative; z-index: 1; display: flex; gap: 4px; }
.acct-result--msg { color: var(--muted-foreground); font-size: var(--text-md); justify-content: center; text-align: center; }
.acct-result--bad { color: var(--bad); }
.acct-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.acct-token { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acct-token code { font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }
.acct-chart { position: relative; height: 22rem; }
.acct-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.acct-chart-summary { text-align: right; font-size: var(--text-xs); color: var(--muted-foreground); }
.acct-chart-summary strong { display: block; font-family: var(--font-mono); font-size: 18px; color: var(--foreground); }
.acct-override { display: flex; align-items: center; gap: 6px; }
.acct-override .os-field { width: 7.5em; padding: 4px 8px; }
@media (max-width: 767px) {
  .acct-override { flex-wrap: wrap; width: 100%; }
  .acct-override .os-field { flex: 1; width: auto; padding: 8px 12px; }
  .acct-override .os-btn { min-height: var(--tap); }
}
.acct-saved { color: var(--ok); font-size: var(--text-xs); }
.acct-error { color: var(--bad); font-size: var(--text-xs); }
.acct-danger { border-color: var(--bad); }
.acct-danger .os-field { max-width: 28em; }
.acct-notes { white-space: pre-line; }

/* ---- discovery pages (was discoveries/_styles) ---- */
.ds-section { font-size: var(--text-lg); font-weight: 600; margin: 20px 0 6px; display: flex; align-items: center; }
.ds-section.ds-first { margin-top: 0; }
.ds-help { color: var(--muted-foreground); font-size: var(--text-sm); margin: 0 0 8px; }
.ds-help.ds-tight { margin-bottom: 0; }
.ds-card { margin-bottom: 12px; }
.ds-score { font-family: var(--font-mono); font-size: 30px; line-height: 36px; font-weight: 600; }
.ds-score--empty { font-family: var(--font-sans); font-size: 20px; line-height: 28px; }
.ds-scoreline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ds-q { border-bottom: 1px solid var(--border); padding: 12px 0; }
.ds-qcard .ds-q:last-child { border-bottom: 0; }
.ds-qtext { font-weight: 600; font-size: var(--text-md); display: block; margin-bottom: 8px; }
.ds-must { color: var(--bad); font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .06em; margin-left: 6px; text-transform: uppercase; }
.ds-must.ds-flush { margin-left: 0; }
.ds-link { text-decoration: underline; color: var(--brand-accent); }
.ds-note { color: var(--foreground); font-size: var(--text-sm); background: var(--accent); border-left: 2px solid var(--brand-accent); padding: 6px 10px; margin-top: 8px; border-radius: 0 8px 8px 0; }
.ds-note .ds-dim { color: var(--muted-foreground); }
.ds-bench { color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 6px; font-style: italic; }
.ds-flag { border: 1px solid var(--border); border-left-width: 2px; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: var(--text-sm); background: var(--card); }
.ds-flag.manager { border-left-color: var(--warn); }
.ds-flag.compliance, .ds-flag.warning { border-left-color: var(--bad); }
.ds-flag.warning strong { color: var(--bad); }
.ds-next { border: 1px solid var(--primary); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: var(--text-md); background: var(--accent); }
.ds-next.ds-tight { margin: 8px 0 0; font-size: var(--text-sm); }
.ds-warnbox { border: 1px solid var(--warn); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: var(--text-sm); }
.ds-preview { border: 1px dashed var(--brand-accent); border-radius: 10px; padding: 14px 16px; margin-top: 12px; overflow-wrap: anywhere; scroll-margin-top: calc(var(--header-h) + 16px); }
.ds-preview h4 { font-size: var(--text-md); font-weight: 600; margin: 12px 0 4px; }
.ds-preview #ds-preview-note { font-size: var(--text-sm); }
.ds-how { font-size: var(--text-xs); color: var(--muted-foreground); margin-top: 10px; }
.ds-how summary { cursor: pointer; color: var(--brand-accent); text-decoration: underline; }
.ds-how > div { margin-top: 4px; }
.ds-block { margin-bottom: 20px; }
.ds-qhead { font-size: 20px; font-weight: 700; margin: 24px 0 6px; }
.ds-qcard { padding: 4px 16px 8px; margin-top: 12px; }
.ds-settings { background: var(--muted); border-radius: 10px; padding: 10px 14px; }
.ds-group { margin: 18px 0 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.ds-qcard > .ds-group { border-top: 0; margin-top: 8px; padding-top: 4px; }
.ds-eyebrow { margin-bottom: 4px; }
.ds-list { margin: 4px 0 0; padding-left: 18px; font-size: var(--text-sm); }
.ds-list li { margin-bottom: 2px; }
.ds-mt { margin-top: 10px; }
.ds-mt-lg { margin-top: 16px; }
.ds-mt-xs { margin-top: 4px; }
.ds-sep { margin: 0 6px; color: var(--muted-foreground); }
.ds-sub a { text-decoration: underline; }
.ds-choice { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: var(--text-md); cursor: pointer; }
.ds-choice input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--primary); }
.ds-choices { display: flex; flex-wrap: wrap; column-gap: 20px; }
.ds-product-picks { display: flex; flex-wrap: wrap; column-gap: 20px; }
@media (max-width: 575px) {
  .ds-product-picks { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .ds-product-picks .ds-choice { font-size: var(--text-sm); line-height: 1.2; }
  .ds-btnrow .os-btn { min-height: var(--tap); }
}
.ds-shortcuts { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 575px) { .ds-shortcuts { display: grid; grid-template-columns: 1fr 1fr; } .ds-shortcuts .os-btn { height: auto; min-height: var(--tap); white-space: normal; } }
.ds-btnrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ds-btnrow form { display: inline; }
.ds-sends { margin: 4px 0 12px; padding-left: 18px; font-size: var(--text-md); }
.ds-sends li { margin-bottom: 4px; }
.ds-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .ds-grid2 { grid-template-columns: 1fr 1fr; } .ds-grid2--wide { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
.ds-results { position: relative; }
.ds-list-group { position: absolute; z-index: 30; left: 0; right: 0; margin-top: 4px; max-height: 22rem; overflow-y: auto; background: var(--popover); border: 1px solid var(--border); border-radius: 8px; }
.ds-list-item { display: block; width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: var(--text-md); text-align: left; color: var(--foreground); background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; overflow-wrap: anywhere; }
.ds-list-item:last-child { border-bottom: 0; }
a.ds-list-item:hover, button.ds-list-item:hover, .ds-list-item:focus-visible { background: var(--muted); outline: none; }
.ds-list-item small { color: var(--muted-foreground); font-size: var(--text-xs); }
.ds-list-item.ds-strong { font-weight: 600; }
.ds-list-item.ds-dim { color: var(--muted-foreground); cursor: default; }
.ds-picked { border: 1px solid var(--brand-accent); border-radius: 8px; padding: 6px 12px; margin-top: 8px; font-size: var(--text-md); }
.ds-rows { list-style: none; margin: 0; padding: 0; }
.ds-rows > li { position: relative; padding: 12px 16px; }
.ds-rows > li:hover { background: var(--secondary); }
.ds-rowtitle { font-size: var(--text-md); font-weight: 500; color: var(--foreground); text-decoration: none; }
.ds-rowtitle::after { content: ""; position: absolute; inset: 0; }
.ds-prodline { font-size: var(--text-sm); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ds-rows .os-kvs { margin-top: 6px; }
.ds-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; }
.ds-layout__form { order: 1; }
.ds-layout__score { order: 2; margin-top: 16px; }
.ds-layout__finish { order: 3; }
.ds-mini { position: sticky; top: var(--header-h); z-index: 20; background: var(--background); border-bottom: 1px solid var(--border); padding: 8px 0; margin-bottom: 8px; font-size: var(--text-sm); }
.ds-mini-item { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-right: 14px; }
.ds-wide-only { display: none; }
@media (min-width: 768px) {
  .ds-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .ds-layout__form { grid-column: 1; grid-row: 1; }
  .ds-layout__finish { grid-column: 1; grid-row: 2; }
  .ds-layout__score { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
  .ds-sticky { position: sticky; top: calc(var(--header-h) + 16px); }
  .ds-mini { display: none; }
  .ds-wide-only { display: block; }
}
/* badges that sit under a page title (status, flags) */
.os-titlebadges { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 16px; }
/* menu panel: forms inside act as items */
.os-menu__panel form { display: block; }
/* on/off button drawn as a switch (posts like any button) */
.os-switchbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 4px 0 0; border: 0; background: none; color: var(--foreground); font: inherit; font-size: var(--text-sm); cursor: pointer; white-space: nowrap; }
.os-switchbtn::before { content: ""; flex: none; width: 36px; height: 22px; border: 1px solid var(--input); border-radius: 999px; background: var(--secondary) radial-gradient(circle at 11px 50%, var(--muted-foreground) 7px, transparent 7.5px); }
.os-switchbtn[aria-checked="true"]::before { background: var(--primary) radial-gradient(circle at 25px 50%, var(--primary-foreground) 7px, transparent 7.5px); border-color: var(--primary); }
.os-switchbtn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
@media (pointer: coarse) { .os-switchbtn { min-height: var(--tap); } }
.os-section > .os-banner + * { margin-top: 8px; }
/* roll-up filters and paired tables (was an inline <style>) */
.rr-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
@media (min-width: 768px) { .rr-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rr-filter { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: end; }
@media (min-width: 768px) { .rr-filter { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; } }
/* discoveries, hygiene, settings (fork A) */
.ds-mb { margin-bottom: 8px; }
.ds-mb-xs { margin-bottom: 4px; }
.ds-strongline { font-weight: 600; }
.ds-stephead { gap: 8px; }
.ds-banner { margin-bottom: 16px; }
.ds-callout { margin-bottom: 8px; font-weight: 400; font-size: var(--text-sm); }
.ds-callout.os-banner--bad strong { color: var(--bad); }
.ds-tiers > summary { font-size: var(--text-sm); font-weight: 600; min-height: 36px; }
.ds-wide-actions { display: contents; }
.ds-phone-menu { display: none; }
@media (max-width: 767px) {
  .ds-wide-actions { display: none; }
  .ds-phone-menu { display: block; }
}
/* accounts, deals, billing settings (fork B) */
.acct-subseg { margin-bottom: 16px; }
.acct-dealsection > summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.acct-dangerzone > summary { color: var(--bad); }
.acct-notecell { white-space: pre-line; min-width: 200px; overflow-wrap: anywhere; }
.acct-tokencell code { overflow-wrap: anywhere; }
.acct-secret { min-width: 0; }
.acct-secret > summary { cursor: pointer; }
.acct-secret code { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .acct-notecell { min-width: 0; text-align: left; }
  .os-table--stack td.acct-rowaction { display: block; padding-top: 8px; text-align: left; }
  .os-table--stack td.acct-rowaction .os-btn { width: 100%; min-height: var(--tap); }
  .os-table--stack td.acct-overridecell { display: block; text-align: left; }
  .os-table--stack td.acct-overridecell::before { display: block; margin-bottom: 4px; }
}

/* === in place: todos-numbers-approvals === */
/* To-do list keeps its table for in-place Add; hidden while it has no rows. */
.os-todos-tablecard:not(:has(#todos-rows > tr)) { display: none; }
/* Done in flight: the row or card dims and strikes until the page morphs it away. */
#todos-rows tr:has(form[action$="/complete"][aria-busy]),
.os-todocard:has(form[action$="/complete"][aria-busy]) { opacity: .55; transition: opacity 150ms ease; }
#todos-rows tr:has(form[action$="/complete"][aria-busy]) .os-todo-title,
.os-todocard:has(form[action$="/complete"][aria-busy]) .os-todocard__title { text-decoration: line-through; }
/* Just added in place (to-do row, capture item). */
@keyframes os-inplace-new { from { background: var(--accent); } to { background: transparent; } }
#todos-rows tr.is-new, .os-listrow.is-new { animation: os-inplace-new 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #todos-rows tr.is-new, .os-listrow.is-new { animation: none; }
}

/* === in place: budget === */
/* A row just added in place stays marked until the next page render. */
.os-row--fresh td { background: var(--secondary); }
