/* Rise Therapy Partners Workspace — application stylesheet.

   Register: editorial zinc (see docs/DESIGN.md). A neutral gray scale carries
   the whole interface; one warm accent is used as punctuation, never as paint.
   Elevation is a 1px hairline, not a shadow. Corners are generous: 24px on
   surfaces, 14px on controls, pills on chips. Motion is short (160–240ms),
   eased, and honours prefers-reduced-motion.

   Custom-property NAMES are a hard dependency: templates/tools/zaya835.html
   carries its own inline <style> that reads --surface, --border,
   --surface-sunken, --radius-lg, --shadow-shell, --primary and --muted.
   Retune values here; never rename. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;

  /* --- zinc scale ------------------------------------------------------- */
  --z-950: #18181b;   /* graphite: deepest ink in the app (no pure black) */
  --z-900: #27272a;   /* slate: dark surfaces, hover on dark */
  --z-800: #3f3f46;   /* iron: secondary text, ghost-button text */
  --z-700: #52525b;   /* steel: muted labels */
  --z-500: #71717a;   /* fog: helper text */
  --z-400: #a1a1aa;   /* ash: placeholders, faint text */
  --z-300: #d4d4d8;   /* mist: strong borders */
  --z-200: #e4e4e7;   /* rules inside dark-on-light components */
  --z-100: #ececee;   /* cloud: the hairline */
  --z-50:  #f4f4f5;   /* paper: canvas */
  --z-25:  #fafafa;   /* subtle card */
  --white: #ffffff;

  --accent: #ff5a00;          /* ember: punctuation only */
  --accent-soft: #fff1ea;
  --accent-ink: #c2410c;

  /* --- semantic names (kept stable) -------------------------------------- */
  --bg: var(--z-50);
  --surface: var(--white);
  --surface-subtle: var(--z-25);
  --surface-sunken: var(--z-50);
  --border: var(--z-100);
  --border-strong: var(--z-300);

  --text: var(--z-950);
  --text-soft: var(--z-800);
  --muted: var(--z-700);
  --faint: var(--z-400);

  --primary: var(--z-950);          /* primary action = dark graphite fill */
  --primary-hover: var(--z-900);
  --primary-soft: var(--z-50);

  --success-bg: #ecfdf3; --success-border: #bfe8cf; --success-text: #15803d;
  --warn-bg:    #fff7ed; --warn-border:    #fed7aa; --warn-text:    #b45309;
  --danger-bg:  #fef2f2; --danger-border:  #fecaca; --danger-text:  #b91c1c;

  /* --- geometry ----------------------------------------------------------- */
  --radius-lg: 24px;   /* surfaces: panels, cards, tables */
  --radius-md: 20px;   /* nested containers, tool rows */
  --radius-sm: 14px;   /* controls: buttons, inputs, chips */
  --radius-xs: 12px;   /* badges, tags */
  --radius-pill: 999px;

  /* Hairlines are the elevation. The two shadows that remain are for things
     that float over the page (overlay box, drawer). */
  --shadow-shell: 0 24px 48px -12px rgba(24, 24, 27, 0.18);
  --shadow-card: none;
  --shadow-pop: none;

  /* --- rhythm (4px base) -------------------------------------------------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 28px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  --page-x: var(--s-8);
  --panel-pad: var(--s-6);
  --gap: var(--s-4);

  /* --- motion ---------------------------------------------------------------- */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 160ms;
  --t-base: 240ms;

  --font: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01' on, 'cv11' on;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--z-300); text-underline-offset: 3px; transition: text-decoration-color var(--t-fast) var(--ease); }
a:hover { text-decoration-color: var(--z-800); }

:focus-visible { outline: 2px solid var(--z-950); outline-offset: 3px; border-radius: 6px; }

::selection { background: var(--accent-soft); }

.skip {
  position: absolute; left: -9999px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; font-weight: 600;
}
.skip:focus { left: 8px; top: 8px; z-index: 60; }

@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes progress { 0% { transform: scaleX(0); } 60% { transform: scaleX(0.7); } 100% { transform: scaleX(0.92); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* =========================================================== app frame === */

.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--t-base) var(--ease); }
.col { min-width: 0; display: flex; flex-direction: column; }

/* ================================================================ rail === */

.rail,
.drawer {
  --ink: var(--z-950);
  --ink-2: var(--z-900);
  --ink-line: rgba(255, 255, 255, 0.07);
  --ink-text: rgba(255, 255, 255, 0.72);
  --ink-text-strong: #ffffff;
  --ink-faint: rgba(255, 255, 255, 0.36);
}

.rail {
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; scrollbar-width: thin;
  background: var(--ink);
  display: flex; flex-direction: column;
  padding: var(--s-5) var(--s-3) var(--s-3);
  z-index: 40;
}

.rail :focus-visible { outline-color: #ffffff; }

.rail-brand { padding: var(--s-1) var(--s-3) 0; margin-bottom: var(--s-6); display: block; text-decoration: none; }
.rail-brand img { height: 15px; width: auto; display: block; opacity: 0.95; }
.rail-brand .mark { display: none; height: 22px; margin: 0 auto; }
.rail-brand .sub {
  display: block; margin-top: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
}

.rail-group {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); padding: var(--s-4) var(--s-3) 6px;
}

.rail nav ul { list-style: none; }
.rail nav li { margin-bottom: 2px; }

.rail-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 var(--s-3);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--ink-text); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.rail-item svg { width: 17px; height: 17px; flex: none; opacity: 0.8; transition: opacity var(--t-fast) var(--ease); }
.rail-item:hover { background: var(--ink-2); color: var(--ink-text-strong); }
.rail-item:hover svg { opacity: 1; }
.rail-item:active { transform: scale(0.985); }

.rail-item[aria-current="page"] { background: var(--ink-2); color: var(--ink-text-strong); font-weight: 600; }
.rail-item[aria-current="page"] svg { opacity: 1; }
.rail-item[aria-current="page"]::before {
  content: ''; position: absolute; left: -12px; top: 50%;
  width: 3px; height: 18px; border-radius: 3px;
  background: var(--accent);
  transform: translateY(-50%);
  animation: fade-in var(--t-base) var(--ease);
}

.rail-child {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 var(--s-3) 0 39px;
  border-radius: var(--radius-sm);
  font-size: 13px; color: rgba(255, 255, 255, 0.56); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.rail-child:hover { background: var(--ink-2); color: var(--ink-text-strong); }
.rail-child[aria-current="page"] { color: #fff; }
.rail-child[aria-current="page"]::before {
  content: ''; position: absolute; left: 24px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.rail-child .ext { margin-left: auto; opacity: 0.5; width: 12px; height: 12px; }

/* A count on a rail item (new progress shares on Workflows). The rail is
   --z-950, so the pill is the light one: --surface with --z-950 numerals. */
.rail-count,
.rail-item .rail-count {
  /* The second selector outranks `.rail-item span`, which the responsive
     rules below use to hide and restore an item's label. */
  display: inline-block; margin-left: auto; flex: none;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface); color: var(--z-950);
  font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}
/* The icon-only rail has no room beside the icon: the count sits on its corner. */
@media (min-width: 821px) and (max-width: 1080px) {
  .rail-item .rail-count {
    position: absolute; top: 3px; right: 6px;
    min-width: 16px; height: 16px; padding: 0 4px;
    font-size: 10px; line-height: 16px;
  }
}

/* The sidebar collapses to icons on request (html.rail-min: set before first
   paint by rail.js, toggled by shell.js). Same compact form the 1080px
   breakpoint uses; below 820px the rail is a drawer and the button is hidden. */
.rail-collapse {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: var(--s-2) 0 0; padding: 8px var(--s-3);
  background: none; border: none; box-shadow: none; border-radius: var(--radius-sm);
  color: var(--ink-faint); font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.rail-collapse:hover { background: var(--ink-2); color: var(--ink-text-strong); border: none; }
.rail-collapse svg { width: 16px; height: 16px; flex: none; transition: transform var(--t-base) var(--ease); }
html.rail-min .rail-collapse svg { transform: scaleX(-1); }
@media (min-width: 821px) {
  html.rail-min .app { grid-template-columns: 72px minmax(0, 1fr); }
  html.rail-min .rail { padding: var(--s-5) var(--s-2) var(--s-3); }
  html.rail-min .rail-brand { padding: 0; text-align: center; }
  html.rail-min .rail-brand .word, html.rail-min .rail-brand .sub { display: none; }
  html.rail-min .rail-brand .mark { display: block; }
  html.rail-min .rail { overflow-x: hidden; }
  html.rail-min .rail-group, html.rail-min .rail-item span, html.rail-min .rail-child,
  html.rail-min .rail-foot .meta, html.rail-min .rail-collapse span { display: none; }
  html.rail-min .rail-item { justify-content: center; padding: 0; }
  html.rail-min .rail-item[aria-current="page"]::before { left: -8px; }
  html.rail-min .rail-foot { flex-direction: column; gap: 8px; }
  html.rail-min .rail-foot .who { justify-content: center; flex: none; }
  html.rail-min .rail-collapse { justify-content: center; padding: 8px 0; }
  html.rail-min .rail-item .rail-count {
    display: inline-block; position: absolute; top: 3px; right: 6px;
    min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; line-height: 16px;
  }
}
@media (max-width: 1080px) { .rail-collapse { display: none; } }

.rail-rule { margin: var(--s-4) var(--s-3) 0; border-top: 1px solid var(--ink-line); }

.rail-foot {
  margin-top: auto; padding-top: var(--s-3);
  border-top: 1px solid var(--ink-line);
  display: flex; align-items: center; gap: 8px; min-height: 48px;
}
.rail-foot .who {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 6px 8px; border-radius: var(--radius-sm); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
}
.rail-foot .who:hover { background: var(--ink-2); }
.rail-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: var(--z-800); color: #fff;
}
.rail-foot .meta { min-width: 0; line-height: 1.25; }
.rail-foot .name { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .role { display: block; font-size: 11px; color: var(--ink-faint); }
.rail-signout {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border-radius: 10px; color: var(--ink-text);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.rail-signout:hover { background: var(--ink-2); color: #fff; }
.rail-signout svg { width: 15px; height: 15px; }

/* ============================================================== topbar === */

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 60px; display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--page-x);
  background: rgba(244, 244, 245, 0.86);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--border);
}

.crumbs { font-size: 13px; color: var(--muted); min-width: 0; display: flex; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--z-300); margin: 0 8px; }
.crumbs .here { color: var(--text); font-weight: 600; }

.topbar-search { margin-left: auto; position: relative; display: flex; align-items: center; }
.topbar-search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.topbar-search input {
  width: 260px; height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  padding: 0 14px 0 36px; font-size: 13.5px; font-family: inherit; color: var(--text);
  outline: none;
  transition: border-color var(--t-fast) var(--ease), width var(--t-base) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.topbar-search input::placeholder { color: var(--faint); }
.topbar-search input:focus { border-color: var(--z-800); width: 320px; box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.06); }

.search-link, .nav-toggle {
  display: none; width: 40px; height: 40px; place-items: center;
  border-radius: var(--radius-sm); border: none; background: transparent; color: var(--muted); cursor: pointer;
  margin: 0; padding: 0; box-shadow: none;
}
.search-link:hover, .nav-toggle:hover { background: var(--surface); color: var(--text); }
/* Without a size an inline SVG renders at 300x150 and the phone layout scrolls sideways. */
.search-link svg, .nav-toggle svg { width: 20px; height: 20px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Navigation progress: a hairline that grows while the next page loads. */
.nav-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70;
  background: var(--accent); transform-origin: left; transform: scaleX(0);
  opacity: 0; pointer-events: none;
}
body.nav-pending .nav-progress { opacity: 1; animation: progress 1.6s var(--ease) forwards; }
body.nav-pending .content { opacity: 0.55; transition: opacity var(--t-base) var(--ease); }

/* ============================================================= content === */

.content { padding: var(--s-8) var(--page-x) var(--s-12); animation: rise-in var(--t-base) var(--ease); }
.wrap { max-width: 1200px; margin: 0 auto; }

h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 6px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: var(--s-8) 0 var(--s-3); }
h3 { font-size: 15px; font-weight: 600; margin-bottom: var(--s-1); }

.page-head { margin-bottom: var(--s-6); }
.caption { color: var(--muted); font-size: 14px; max-width: 70ch; }
.section-note { font-size: 13px; color: var(--muted); margin-bottom: var(--s-3); }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.eyebrow a { color: var(--muted); text-decoration: none; }

/* ========================================================== dashboard === */

.greet { margin-bottom: var(--s-6); }
.greet h1 { font-size: 32px; }
.greet .line { font-size: 14px; color: var(--muted); margin-top: 4px; }

.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }  .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--panel-pad);
  animation: rise-in var(--t-base) var(--ease) both;
}
.dash > .panel:nth-child(2) { animation-delay: 40ms; }
.dash > .panel:nth-child(3) { animation-delay: 80ms; }
.dash > .panel:nth-child(4) { animation-delay: 120ms; }
.dash > .panel:nth-child(5) { animation-delay: 160ms; }
.dash > .panel:nth-child(n+6) { animation-delay: 200ms; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-head a { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.panel-head a:hover { color: var(--text); }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-3); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-4); }

.stat .label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.stat .value.warn { color: var(--warn-text); }
.stat .value.danger { color: var(--danger-text); }

.alert-tile { border: 1px solid; border-radius: var(--radius-md); padding: var(--s-4); animation: rise-in var(--t-base) var(--ease); }
.alert-tile .t { font-size: 13.5px; font-weight: 600; }
.alert-tile .b { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.alert-tile a { display: inline-block; margin-top: 8px; font-size: 13px; }
.alert-tile.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.alert-tile.danger .t { color: var(--danger-text); }
.alert-tile.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.alert-tile.warn .t { color: var(--warn-text); }

/* --- chips (verbs) ------------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-6); }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 var(--s-4);
  border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 500; color: var(--text); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--z-300); background: var(--z-25); }
.chip:active { transform: scale(0.98); }
.chip svg { width: 15px; height: 15px; }
.chip.primary { background: var(--z-950); border-color: var(--z-950); color: #fff; }
.chip.primary:hover { background: var(--z-900); }

/* --- area cards ----------------------------------------------------------- */

.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--s-3); }
.area-card {
  display: block; padding: var(--s-5);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  text-decoration: none; color: inherit; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.area-card:hover { border-color: var(--z-300); transform: translateY(-1px); }
.area-card.empty { opacity: 0.6; }
.area-card svg { width: 20px; height: 20px; color: var(--z-800); }
.area-card .n { font-size: 14.5px; font-weight: 600; margin-top: 10px; }
.area-card .blurb { font-size: 13px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.area-card .count { font-size: 12px; color: var(--faint); margin-top: 12px; }

/* =========================================================== tool rows === */

.tool-list { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.tool-row {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 60px; padding: 0 var(--s-4);
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: background-color var(--t-fast) var(--ease);
}
.tool-row:last-child { border-bottom: none; }
.tool-row:hover { background: var(--z-25); }
.tool-row.dead { color: var(--muted); cursor: default; }
.tool-row.dead:hover { background: transparent; }

.tool-mark {
  width: 36px; height: 36px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--z-50); color: var(--z-800); font-size: 12px; font-weight: 600;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tool-row:hover .tool-mark { background: var(--z-950); color: #fff; }
.tool-mark svg { width: 16px; height: 16px; }

.tool-main { min-width: 0; flex: 1; }
.tool-name { font-size: 14.5px; font-weight: 600; display: block; }
.tool-summary { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tool-open { font-size: 13px; color: var(--muted); flex: none; transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.tool-row:hover .tool-open { color: var(--text); transform: translateX(2px); }
.tool-row .ext { width: 13px; height: 13px; color: var(--faint); flex: none; }

.chip-area, .pill {
  flex: none; font-size: 12px; font-weight: 500; padding: 3px 10px;
  border-radius: var(--radius-xs); border: 1px solid var(--border);
  background: transparent; color: var(--text-soft); white-space: nowrap;
}
.pill.beta { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.pill.retired { color: var(--faint); text-decoration: line-through; }
.pill.hidden-row { color: var(--faint); }
.pill.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =========================================================== feed rows === */

.feed { list-style: none; }
.feed li { display: flex; align-items: baseline; gap: var(--s-3); min-height: 38px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: none; }
.feed .what { font-size: 13.5px; color: var(--text); flex: 1; min-width: 0; }
.feed .who { font-size: 12.5px; color: var(--muted); }
.feed .when { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; flex: none; }
.feed .where { display: block; font-size: 12px; color: var(--faint); }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 10px var(--s-4); font-size: 13.5px; align-items: baseline; }
.dl dt { color: var(--muted); }
.dl dd { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.dl dd a { text-decoration: none; }
.dl dd a:hover { text-decoration: underline; }
.dl.sys { font-size: 13px; }
.dl.sys dt { color: var(--faint); }
.dl.sys dd { color: var(--text-soft); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: var(--success-text); }
.dot.bad { background: var(--danger-text); }

/* ================================================== retained components === */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--panel-pad); margin-bottom: var(--gap);
}
.card-tight { padding: var(--s-4) var(--s-5); }

.field { margin-bottom: var(--s-4); }
.field:last-child { margin-bottom: 0; }

label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 11px 14px; font-size: 14.5px; font-family: inherit; outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--z-800); box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.06); }
input:disabled { background: var(--z-25); color: var(--muted); }

input[type=file] {
  width: 100%; background: var(--z-25);
  border: 1px dashed var(--z-300); border-radius: var(--radius-sm);
  color: var(--muted); padding: 14px 16px; font-size: 13.5px; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
input[type=file]:hover { border-color: var(--z-800); color: var(--text); background: var(--surface); }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-pill); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px; cursor: pointer;
}

.checkline { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-soft); }
.checkline input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--z-950); }
.checkline label { margin: 0; font-weight: 500; font-size: 14px; color: var(--text-soft); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--gap); align-items: start; }

button, .btn {
  display: block; width: 100%;
  background: var(--z-950); color: #fff;
  border: 1px solid var(--z-950); border-radius: var(--radius-sm);
  padding: 11px 20px; font-size: 14.5px; font-family: inherit; font-weight: 600;
  cursor: pointer; text-align: center; text-decoration: none; margin-top: var(--s-4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
button:hover, .btn:hover { background: var(--z-900); border-color: var(--z-900); }
button:active, .btn:active { transform: scale(0.985); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-outline { background: var(--surface); border-color: var(--z-300); color: var(--text); box-shadow: none; }
.btn-outline:hover { background: var(--z-25); border-color: var(--z-800); }
.btn-quiet { background: var(--z-50); border-color: var(--border); color: var(--text-soft); box-shadow: none; }
.btn-quiet:hover { background: var(--z-100); border-color: var(--z-300); color: var(--text); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #e65100; border-color: #e65100; }
.btn-small { width: auto; margin: 0; padding: 6px 14px; font-size: 13px; border-radius: var(--radius-pill); }
.btn-inline { width: auto; margin-top: 0; }

.alert {
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: var(--s-4);
  font-size: 13.5px; border: 1px solid transparent; animation: rise-in var(--t-base) var(--ease);
}
.alert.error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger-text); }
.alert.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert.warning { background: var(--warn-bg);    border-color: var(--warn-border);    color: var(--warn-text); }
.alert.info    { background: var(--z-50); border-color: var(--border); color: var(--text-soft); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin-bottom: var(--s-3); }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--s-4) var(--s-5); }
.metric .label { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.metric .value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .value.ok   { color: var(--success-text); }
.metric .value.warn { color: var(--warn-text); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: var(--radius-xs); font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: transparent; color: var(--text-soft);
}
.badge.ok     { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.badge.warn   { background: var(--warn-bg);    border-color: var(--warn-border);    color: var(--warn-text); }
.badge.danger { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger-text); }
.badge.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 600;
  color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--z-25);
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; height: 46px; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background-color var(--t-fast) var(--ease); }
table.data tbody tr:hover { background: var(--z-25); }

.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; font-size: 12.5px; }

.empty-state {
  text-align: center; padding: var(--s-12) var(--s-5);
  border: 1px dashed var(--z-300); border-radius: var(--radius-lg);
  color: var(--muted); background: var(--z-25);
}
.muted-row { padding: 10px 0; font-size: 13.5px; color: var(--muted); }

/* ============================================================ skeleton === */

.skeleton {
  position: relative; overflow: hidden; border-radius: 10px;
  background: linear-gradient(90deg, var(--z-100) 25%, var(--z-50) 50%, var(--z-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
}
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-line.w-40 { width: 40%; } .skeleton-line.w-60 { width: 60%; } .skeleton-line.w-80 { width: 80%; }
.skeleton-block { height: 120px; border-radius: var(--radius-md); }
.skeleton-row { height: 46px; border-radius: 0; }

.spinner-sm {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 8px;
  border: 2px solid var(--z-200); border-top-color: var(--z-800); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.stat .value.words { font-size: 17px; line-height: 1.3; }

/* Attention chips: one phrase each, coloured by how urgent the thing is. */
.chip-attn { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn-text); white-space: nowrap; margin: 2px 4px 2px 0; }

.edit-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.next-day { font-size: 11px; color: var(--faint); vertical-align: super; }
.arrow { color: var(--faint); margin: 0 4px; }
.mono-nums { font-variant-numeric: tabular-nums; }
.quiet-link { font-size: 13px; color: var(--muted); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td { font-weight: 600; border-top: 1px solid var(--border-strong); background: var(--z-25); }
table.data .sub { display: block; font-size: 12px; color: var(--faint); }

.inline-reason { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-reason input { width: 170px; padding: 6px 10px; font-size: 13px; }
.inline-reason button { margin: 0; }
.btn-row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.btn-row .btn-small, .btn-row button, .btn-row .btn { margin: 0; width: auto; }
.btn-row form { margin: 0; }
.page-head.with-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }

.checklist { list-style: none; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.checklist li:last-child { border-bottom: none; }
.checklist .mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.checklist .ok .mark { background: var(--success-bg); color: var(--success-text); }
.checklist .bad .mark { background: var(--danger-bg); color: var(--danger-text); }
.checklist .fact .mark { background: var(--z-50); color: var(--muted); }

.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; margin-bottom: var(--s-4); }
.filter-bar .field { margin: 0; min-width: 150px; }
.filter-bar button { margin: 0; width: auto; }
.radio-list { display: grid; gap: 8px; }
.radio-list .checkline input[type=radio] { accent-color: var(--z-950); width: 15px; height: 15px; }
.diff { display: grid; grid-template-columns: auto 1fr 1fr; gap: 4px 12px; font-size: 12.5px; align-items: baseline; }
.diff .k { color: var(--muted); }
.diff .old { color: var(--faint); text-decoration: line-through; }
.diff .new { color: var(--text); }
details.quiet > summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; }
details.quiet > summary::-webkit-details-marker { display: none; }
details.quiet > summary::before { content: '\203A'; display: inline-block; margin-right: 6px; transition: transform var(--t-fast) var(--ease); }
details.quiet[open] > summary::before { transform: rotate(90deg); }

.invoice-doc { max-width: 860px; }
.invoice-head { display: flex; justify-content: space-between; gap: var(--s-4); align-items: flex-start; margin-bottom: var(--s-6); }
.invoice-number { text-align: right; }
.invoice-number .big { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.invoice-facts dd { text-align: left; }
.invoice-foot { margin-top: var(--s-6); font-size: 11px; color: var(--faint); word-break: break-all; }
.appendix summary { cursor: pointer; }

@media print {
  .rail, .topbar, .no-print, .scrim, .nav-progress, .skip, .btn, button, .alert { display: none !important; }
  .app { display: block; }
  .col, .content { padding: 0; margin: 0; }
  .wrap { max-width: none; }
  body { background: #fff; font-size: 12px; }
  .card, .invoice-doc { border: none; box-shadow: none; padding: 0; max-width: none; }
  a { text-decoration: none; }
  .appendix { break-inside: avoid; }
}

/* ========================================================= auth pages === */

.auth-split { display: grid; grid-template-columns: 44% 56%; min-height: 100vh; }
.auth-panel {
  background: var(--z-950); color: #fff; padding: var(--s-10);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-panel img { height: 24px; width: auto; max-width: 100%; display: block; align-self: flex-start; }
.auth-side { display: grid; place-items: center; padding: var(--s-10) var(--s-6); background: var(--bg); }
.auth-form { width: 100%; max-width: 360px; animation: rise-in var(--t-base) var(--ease); }
.auth-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: var(--s-5); }
.auth-sub { font-size: 14px; color: var(--muted); margin: calc(-1 * var(--s-3)) 0 var(--s-5); }
.auth-foot { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); font-size: 13px; color: var(--faint); }

.code-input { width: 100%; text-align: center; font-size: 30px; font-weight: 600; letter-spacing: 0.4em; text-indent: 0.4em; padding: 12px 8px; font-family: var(--font); }
.resend-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); font-size: 13px; color: var(--muted); }
.linkish { background: none; border: none; box-shadow: none; color: var(--text); font-weight: 500; font-size: 13px; cursor: pointer; padding: 0; margin: 0; width: auto; text-decoration: underline; text-decoration-color: var(--z-300); text-underline-offset: 3px; }
.linkish:hover { background: none; text-decoration-color: var(--z-800); }
.linkish:disabled { color: var(--faint); cursor: not-allowed; text-decoration: none; opacity: 1; }

/* ================================================== standalone messages === */

.standalone { min-height: 100vh; display: grid; place-items: center; padding: var(--s-10) var(--s-6); background: var(--bg); }
.standalone .inner { max-width: 520px; text-align: center; animation: rise-in var(--t-base) var(--ease); }
.standalone img { height: 16px; width: auto; margin: 0 auto var(--s-6); display: block; }
.error-code { font-size: 44px; font-weight: 600; color: var(--z-950); letter-spacing: -0.03em; }

/* ============================================================= drawer === */

.scrim { display: none; }

/* ========================================================= responsive === */

@media (max-width: 1180px) {
  .dash { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .span-12, .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 6; }
}

@media (max-width: 1080px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .rail { padding: var(--s-5) var(--s-2) var(--s-3); }
  .rail-brand { padding: 0; text-align: center; }
  .rail-brand .word, .rail-brand .sub { display: none; }
  .rail-brand .mark { display: block; }
  .rail { overflow-x: hidden; }
  .rail-group, .rail-item span, .rail-child, .rail-foot .meta { display: none; }
  .rail-item { justify-content: center; padding: 0; }
  .rail-item[aria-current="page"]::before { left: -8px; }
  .rail-foot { flex-direction: column; gap: 8px; }
  .rail-foot .who { justify-content: center; flex: none; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: -256px; top: 0; width: 256px; padding: var(--s-5) var(--s-3) var(--s-3); transition: left var(--t-base) var(--ease); box-shadow: var(--shadow-shell); }
  .rail-brand .word, .rail-brand .sub { display: block; }
  .rail-brand .mark { display: none; }
  .rail-brand { padding: var(--s-1) var(--s-3) 0; text-align: left; }
  .rail-brand .sub { margin-top: 7px; font-size: 11px; letter-spacing: 0.12em; }
  .rail-group, .rail-item span, .rail-child, .rail-foot .meta { display: revert; }
  .rail-item { justify-content: flex-start; padding: 0 var(--s-3); }
  .rail-item[aria-current="page"]::before { left: -12px; }
  .rail-foot { flex-direction: row; gap: 8px; }
  .rail-foot .who { justify-content: flex-start; flex: 1; }
  body.nav-open .rail { left: 0; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(24, 24, 27, 0.45); z-index: 30; animation: fade-in var(--t-fast) var(--ease); }
  .nav-toggle { display: grid; order: -1; }
  .topbar { padding: 0 var(--s-4); }
  .topbar-search { display: none; }
  .search-link { display: grid; margin-left: auto; }
  .content { padding: var(--s-5) var(--s-4) var(--s-12); }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .span-12, .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 1; }
  h1 { font-size: 26px; }
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .metrics, .split { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-panel { min-height: 96px; padding: var(--s-5) var(--s-6); flex-direction: row; align-items: center; }
  .auth-panel img { align-self: center; }
  .auth-side { min-height: calc(100vh - 96px); }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { text-align: left; margin-bottom: 8px; }
}

/* The finished 835 on the Cigna page. Appears only once a run has landed, so
   it is a quiet block rather than a card: the run card is already the card. */
.cig-edi {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.cig-edi-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* A fold for the things a run says but nobody needs on screen: the log while
   it works, and the warnings after. The summary is the whole point — one line
   that says how much is behind it. */
.cig-more {
  margin-top: var(--s-4);
}
.cig-more > summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: var(--t-sm);
  padding: var(--s-2) 0;
  user-select: none;
}
.cig-more > summary:hover { color: var(--ink); }
.cig-more[open] > summary { margin-bottom: var(--s-3); }

/* The clinic the site is talking about, in the top bar where the tool search
   used to be. It sits in the same slot and reads as one control, not a form. */
.topbar-clinic {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.topbar-clinic svg { width: 1rem; height: 1rem; flex: none; }
.topbar-clinic select {
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-2);
  max-width: 14rem;
}
.topbar-clinic select:hover { background: var(--hover); }
.topbar-clinic.is-only { padding-right: var(--s-2); }

/* Tool grants beside the person they belong to, on the clinic's page. They sit
   on one line with the remove form: reading down the list should answer "who
   is here and what may they do" in one pass. */
.clinic-grants {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-right: var(--s-4);
}
.clinic-grants .checkline { display: inline-flex; gap: var(--s-2); }

/* --- settings tabs -------------------------------------------------------
   The Administration area is one page per thing an administrator sets up, and
   this is how you move between them. An underline rather than a pill: these
   are sections of one screen, not filters over one list, and the difference
   should be legible before the labels are read. */
.subtabs {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  border-bottom: 1px solid var(--border);
  margin: 0 0 var(--s-6);
}
.subtab {
  position: relative; padding: 0 0 10px; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.subtab:hover { color: var(--text); }
.subtab.current { color: var(--text); }
.subtab.current::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--z-950); border-radius: 2px;
}

/* A line under a field saying what it is for, and a row of controls under a
   form. Both exist because the settings forms ask for things whose meaning is
   not obvious from a label — an NPI belongs to a location, a code ends up in
   a filename — and a sentence is cheaper than a support question. */
.hint { display: block; margin-top: 5px; font-size: 12px; color: var(--faint); }
.row-actions { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.row-actions .hint { margin-top: 0; }

/* A row that opens into its own form: locations, clinic details. The list
   stays a list until somebody wants to change one line of it. */
.inline-edit > summary {
  cursor: pointer; list-style: none; color: var(--text); font-weight: 500;
}
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit > summary::after { content: ' ▾'; color: var(--faint); font-size: 11px; }
.inline-edit[open] > summary::after { content: ' ▴'; }
.inline-edit[open] > summary { margin-bottom: var(--s-4); }
.inline-edit form { max-width: 640px; }
.label-like { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
