/* Scientari Stage Map
   Layout: a lab-wall map. Four stage groups band the top, the 11 stage columns
   are the backbone, function swimlanes run beneath, and a detail rail sits at
   the right (below the map on phones). Hosts restyle through these variables. */
:root {
  /* ---- Tag colours: the same in every Scientari tool (DrugHelm palette, 3.0.0-preview14).
     Stage groups, function families, product types, decision points, AI levers, your own
     items and review flags keep their meaning across tools, so hosts should not restyle them. */
  --sm-g-research: #4a3d6b;
  --sm-g-to_ind: #2f74bd;
  --sm-g-clinical: #b25a1e;
  --sm-g-market: #566065;
  --sm-f-science: #ece8f4;   --sm-f-science-ink: #4a3d6b;
  --sm-f-make: #fbf0d9;      --sm-f-make-ink: #7c5410;
  --sm-f-clinic: #fbeee2;    --sm-f-clinic-ink: #8f3d14;
  --sm-f-market: #e4f0fc;    --sm-f-market-ink: #1f5a96;
  --sm-f-business: #e8edee;  --sm-f-business-ink: #2d3538;
  --sm-pt-small_molecule: #2f74bd;
  --sm-pt-biologic: #4a3d6b;
  --sm-pt-cell_therapy: #b25a1e;
  --sm-pt-gene_therapy: #a3317f;
  --sm-pt-lbp: #1e7a46;
  --sm-pt-combination: #566065;
  --sm-decide: #c0392b;
  --sm-decide-soft: #f8e4e1;
  --sm-ai: #6b5a8e;
  --sm-ai-soft: #ece8f4;
  --sm-you: #b25a1e;
  --sm-you-soft: #fbeee2;
  --sm-review: #9a6400;
  --sm-review-soft: #fdf1d6;
  --sm-on-fill: #ffffff;

  /* ---- Page colours and type: hosts may restyle these to fit their page. */
  --sm-ink: #151b1e;
  --sm-muted: #566065;
  --sm-faint: #8a9599;
  --sm-paper: #f5f8f8;
  --sm-panel: #ffffff;
  --sm-line: #e8edee;
  --sm-line-strong: #d0d8da;
  --sm-accent: #2f74bd;
  --sm-accent-soft: #e4f0fc;
  --sm-sel: rgba(61, 143, 224, 0.10);
  --sm-here: rgba(232, 149, 86, 0.10);
  --sm-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sm-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sm-radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sm[data-sm-theme="auto"] {
    --sm-ink: #e6ebee; --sm-muted: #a9b4b8; --sm-faint: #7f8a8e;
    --sm-paper: #10171a; --sm-panel: #182226; --sm-line: #26333a; --sm-line-strong: #34444b;
    --sm-accent: #6aaef0; --sm-accent-soft: #15304a;
    --sm-you: #eb9a5c; --sm-you-soft: #3a2616;
    --sm-decide: #f07d72; --sm-decide-soft: #3b1e1c;
    --sm-review: #e9b44c; --sm-review-soft: #352a12;
    --sm-ai: #b3a5dc; --sm-ai-soft: #2a2440; --sm-on-fill: #10171a;
    --sm-sel: rgba(106, 174, 240, 0.14); --sm-here: rgba(235, 154, 92, 0.10);
    --sm-g-research: #b3a5dc; --sm-g-to_ind: #6aaef0; --sm-g-clinical: #eb9a5c; --sm-g-market: #a9b4b8;
    --sm-f-science: #2a2440; --sm-f-science-ink: #cfc4f0;
    --sm-f-make: #33290f; --sm-f-make-ink: #f0cf86;
    --sm-f-clinic: #3a2418; --sm-f-clinic-ink: #f3b896;
    --sm-f-market: #15304a; --sm-f-market-ink: #a9d0f6;
    --sm-f-business: #232e33; --sm-f-business-ink: #c9d3d6;
    --sm-pt-small_molecule: #6aaef0; --sm-pt-biologic: #b3a5dc; --sm-pt-cell_therapy: #eb9a5c;
    --sm-pt-gene_therapy: #e27bc4; --sm-pt-lbp: #5cc488; --sm-pt-combination: #a9b4b8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .sm[data-sm-theme="auto"], .sm[data-sm-theme="dark"] {
    --sm-ink: #e6ebee; --sm-muted: #a9b4b8; --sm-faint: #7f8a8e;
    --sm-paper: #10171a; --sm-panel: #182226; --sm-line: #26333a; --sm-line-strong: #34444b;
    --sm-accent: #6aaef0; --sm-accent-soft: #15304a;
    --sm-you: #eb9a5c; --sm-you-soft: #3a2616;
    --sm-decide: #f07d72; --sm-decide-soft: #3b1e1c;
    --sm-review: #e9b44c; --sm-review-soft: #352a12;
    --sm-ai: #b3a5dc; --sm-ai-soft: #2a2440; --sm-on-fill: #10171a;
    --sm-sel: rgba(106, 174, 240, 0.14); --sm-here: rgba(235, 154, 92, 0.10);
    --sm-g-research: #b3a5dc; --sm-g-to_ind: #6aaef0; --sm-g-clinical: #eb9a5c; --sm-g-market: #a9b4b8;
    --sm-f-science: #2a2440; --sm-f-science-ink: #cfc4f0;
    --sm-f-make: #33290f; --sm-f-make-ink: #f0cf86;
    --sm-f-clinic: #3a2418; --sm-f-clinic-ink: #f3b896;
    --sm-f-market: #15304a; --sm-f-market-ink: #a9d0f6;
    --sm-f-business: #232e33; --sm-f-business-ink: #c9d3d6;
    --sm-pt-small_molecule: #6aaef0; --sm-pt-biologic: #b3a5dc; --sm-pt-cell_therapy: #eb9a5c;
    --sm-pt-gene_therapy: #e27bc4; --sm-pt-lbp: #5cc488; --sm-pt-combination: #a9b4b8;
    color-scheme: dark;
}

.sm { font-family: var(--sm-font); font-size: 14px; line-height: 1.45; color: var(--sm-ink);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 40px; max-width: 1560px; margin: 0 auto; }
.sm *, .sm *::before, .sm *::after { box-sizing: border-box; }
.sm button, .sm input, .sm select, .sm textarea { font: inherit; color: inherit; }
.sm code, .sm .mono { font-family: var(--sm-mono); font-size: 0.86em; }
.sm :focus-visible { outline: 2px solid var(--sm-accent); outline-offset: 2px; }
.sm a { color: var(--sm-accent); }

/* ---------- header */
.sm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.sm-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-title h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.sm-title p { margin: 0; color: var(--sm-muted); font-size: 0.86rem; }
.sm-ver { font-family: var(--sm-mono); font-size: 0.8rem; color: var(--sm-muted); }
.sm-tabs { display: flex; gap: 2px; padding: 3px; background: var(--sm-panel); border: 1px solid var(--sm-line); border-radius: 8px; }
.sm-tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--sm-muted); }
.sm-tab[aria-selected="true"] { background: var(--sm-ink); color: var(--sm-panel); }

.sm-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 12px; background: var(--sm-panel);
  border: 1px solid var(--sm-line); border-radius: 8px; margin-bottom: 12px; }
.sm-field { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--sm-muted); }
.sm-field select { padding: 5px 8px; border: 1px solid var(--sm-line-strong); border-radius: 6px; background: var(--sm-panel); max-width: 220px; }
.sm-spacer { flex: 1 1 auto; }
.sm-btn { border: 1px solid var(--sm-line-strong); background: var(--sm-panel); padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 0.86rem; white-space: nowrap; }
.sm-btn:hover { border-color: var(--sm-ink); }
.sm-btn.primary { background: var(--sm-accent); border-color: var(--sm-accent); color: var(--sm-panel); font-weight: 600; }
.sm-btn.you { border-color: var(--sm-you); color: var(--sm-you); }
.sm-btn.small { padding: 2px 8px; font-size: 0.78rem; }
.sm-btn.danger { color: var(--sm-decide); border-color: var(--sm-decide); }
.sm-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; cursor: pointer; user-select: none; }
.sm-toggle input { accent-color: var(--sm-accent); }
.sm-count { font-family: var(--sm-mono); font-size: 0.74rem; padding: 0 6px; border-radius: 9px; background: var(--sm-review-soft); color: var(--sm-review); }
.sm-sample { font-size: 0.78rem; color: var(--sm-you); background: var(--sm-you-soft); padding: 2px 8px; border-radius: 10px; }

.sm-pop { position: relative; }
.sm-popbody { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(330px, 86vw); background: var(--sm-panel);
  border: 1px solid var(--sm-line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(10, 20, 40, 0.18); padding: 12px; display: grid; gap: 10px; }
.sm-popbody h4 { margin: 0; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sm-muted); }
.sm-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.sm-pop.right .sm-popbody { left: auto; right: 0; }

/* ---------- layout */
.sm-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 980px) { .sm-body { grid-template-columns: minmax(0, 1fr); } }
.sm-body.full { grid-template-columns: minmax(0, 1fr); }
.sm-main { min-width: 0; background: var(--sm-panel); border: 1px solid var(--sm-line); border-radius: 8px; }
.sm-scroll { overflow-x: auto; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; border-top: 1px solid var(--sm-line); font-size: 0.84rem; color: var(--sm-ink); }
.sm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sm-sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- horizontal map */
.hz { --lab: 150px; display: grid; grid-template-columns: var(--lab) repeat(11, minmax(112px, 1fr)); min-width: calc(var(--lab) + 11 * 112px); position: relative; }
@media (max-width: 600px) { .hz { --lab: 104px; } }
.hz-group { padding: 7px 8px 5px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sm-panel); }
.hz-corner { grid-column: 1; position: sticky; left: 0; z-index: 4; background: var(--sm-panel); }
.hz-stage { border: 0; border-right: 1px solid var(--sm-line); border-bottom: 1px solid var(--sm-line-strong); background: var(--sm-panel);
  padding: 7px 8px 8px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; position: relative; z-index: 2; }
.hz-stage b { font-size: 0.88rem; line-height: 1.2; }
.hz-stage .mono { color: var(--sm-muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.hz-stage[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--sm-accent); }
.hz-stage .here { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sm-you); }
.hz-lab { grid-column: 1; padding: 8px 10px; border-right: 1px solid var(--sm-line); border-bottom: 1px solid var(--sm-line);
  font-size: 0.82rem; font-weight: 600; color: var(--sm-ink); display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; position: sticky; left: 0; z-index: 4; background: var(--sm-panel); overflow-wrap: anywhere; }
.hz-lab small { font-weight: 400; color: var(--sm-muted); font-family: var(--sm-mono); font-size: 0.7rem; }
.hz-lane { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(11, minmax(112px, 1fr)); grid-auto-flow: row dense;
  gap: 4px 0; padding: 6px 0; border-bottom: 1px solid var(--sm-line); position: relative; z-index: 1;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 11 - 1px), var(--sm-line) calc(100% / 11 - 1px), var(--sm-line) calc(100% / 11)); }
.hz-col { pointer-events: none; z-index: 0; }
.hz-col.sel { background: var(--sm-sel); }
.hz-col.here { background: var(--sm-here); }
.hz-ms { grid-column: 2 / -1; border-bottom: 1px solid var(--sm-line); min-height: 60px; position: relative; z-index: 2; }
.hz-mschip { position: absolute; top: 7px; border: 1px solid var(--sm-line-strong); background: var(--sm-panel); border-radius: 12px; font-size: 0.78rem; padding: 1px 8px; cursor: pointer;
  white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.hz-mschip::before { content: ""; width: 7px; height: 7px; transform: rotate(45deg); background: var(--sm-ink); flex: none; }
.hz-mschip.end { transform: translateX(calc(-100% - 2px)); }
.hz-mschip.start { transform: translateX(2px); top: 32px; }
.hz-mschip.within { transform: translateX(-50%); }
.hz-mschip[aria-pressed="true"] { border-color: var(--sm-accent); color: var(--sm-accent); }

.it { margin: 0 3px; min-height: 28px; border-radius: var(--sm-radius); border: 1px solid transparent; padding: 3px 7px; font-size: 0.8rem; line-height: 1.25;
  text-align: left; cursor: pointer; display: flex; align-items: center; gap: 5px; overflow: hidden; position: relative; }
.it .t { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 0; flex: 1; }
.it[aria-pressed="true"] { outline: 2px solid var(--sm-accent); outline-offset: 1px; }
.it.f-science { background: var(--sm-f-science); color: var(--sm-f-science-ink); }
.it.f-make { background: var(--sm-f-make); color: var(--sm-f-make-ink); }
.it.f-clinic { background: var(--sm-f-clinic); color: var(--sm-f-clinic-ink); }
.it.f-market { background: var(--sm-f-market); color: var(--sm-f-market-ink); }
.it.f-business { background: var(--sm-f-business); color: var(--sm-f-business-ink); }
.it.decision { background: var(--sm-decide-soft); color: var(--sm-decide); border-color: var(--sm-decide); border-style: solid; padding-right: 20px; }
.it.decision::after { content: ""; position: absolute; right: 5px; top: 50%; width: 9px; height: 9px; margin-top: -5px; transform: rotate(45deg); background: var(--sm-decide); }
.it.decision.set { opacity: 0.72; }
.it.resource { background: var(--sm-accent-soft); color: var(--sm-accent); border-color: var(--sm-accent); }
.it.ai { background: var(--sm-ai-soft); color: var(--sm-ai); border-color: var(--sm-ai); }
.it.user { background: var(--sm-you-soft); color: var(--sm-you); border: 1px dashed var(--sm-you); }
.it.review { box-shadow: inset 3px 0 0 var(--sm-review); }
.it .pt { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.it .flag { flex: none; font-size: 0.66rem; font-weight: 700; color: var(--sm-review); background: var(--sm-review-soft); padding: 0 4px; border-radius: 3px; }

.prog { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(11, minmax(112px, 1fr)); gap: 4px 0; padding: 7px 0; border-bottom: 1px solid var(--sm-line-strong); position: relative; z-index: 2; }
.sm .prog-bar { color: var(--sm-on-fill); }
.prog-bar { height: 24px; margin-left: 4px; border-radius: 12px 4px 4px 12px; position: relative; cursor: pointer; border: 0; display: flex; align-items: center; padding: 0 10px;
  color: var(--sm-panel); font-size: 0.74rem; font-weight: 600; white-space: nowrap; overflow: visible; }
.prog-bar .tip { position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: inherit; transform: rotate(45deg); }
.prog-next { align-self: center; padding-left: 14px; font-size: 0.8rem; color: var(--sm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-next b { color: var(--sm-ink); font-weight: 600; }
.pill { display: inline-block; font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: var(--sm-line); color: var(--sm-muted); }
.pill.active { background: var(--sm-accent-soft); color: var(--sm-accent); }
.pill.paused, .pill.discontinued { background: var(--sm-decide-soft); color: var(--sm-decide); }
.pill.partnered, .pill.out_licensed { background: var(--sm-f-science); color: var(--sm-f-science-ink); }

/* ---------- side panel */
.sm-side { background: var(--sm-panel); border: 1px solid var(--sm-line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 14px; min-width: 0;
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 10px); max-height: calc(100vh - 20px); overflow: auto; }
@media (max-width: 980px) { .sm-side { position: static; max-height: none; } }
.sm-side h2 { margin: 0; font-size: 1.12rem; line-height: 1.25; text-wrap: balance; }
.sm-side h3 { margin: 0 0 6px; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--sm-muted); }
.sm-side p { margin: 0; }
.sm-eyebrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.74rem; color: var(--sm-muted); }
.sm-kv { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 4px 10px; font-size: 0.84rem; }
.sm-kv dt { color: var(--sm-muted); }
.sm-kv dd { margin: 0; }
.sm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sm-list button { width: 100%; text-align: left; border: 1px solid var(--sm-line); background: var(--sm-panel); border-radius: 6px; padding: 5px 8px;
  cursor: pointer; font-size: 0.82rem; display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.sm-list button:hover { border-color: var(--sm-line-strong); }
.sm-list .lab { font-size: 0.68rem; font-weight: 600; white-space: nowrap; padding: 0 6px; border-radius: 8px; }
.lab.open { background: var(--sm-accent-soft); color: var(--sm-accent); }
.lab.now { background: var(--sm-decide-soft); color: var(--sm-decide); }
.lab.set { background: var(--sm-line); color: var(--sm-muted); }
.sm-reviewbox { border-left: 3px solid var(--sm-review); background: var(--sm-review-soft); padding: 8px 10px; border-radius: 0 6px 6px 0; font-size: 0.82rem; }
.sm-sources { margin: 0; padding-left: 18px; font-size: 0.82rem; }
.sm-note { font-size: 0.86rem; color: var(--sm-muted); line-height: 1.5; }
.sm-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-strip a, .sm-strip button { font-size: 0.78rem; border: 1px solid var(--sm-accent); color: var(--sm-accent); background: var(--sm-accent-soft); border-radius: 12px; padding: 2px 9px; text-decoration: none; cursor: pointer; }
button.ai { border-color: var(--sm-ai) !important; color: var(--sm-ai) !important; background: var(--sm-ai-soft) !important; }
.sm-evidence { border-left: 3px solid var(--sm-ai); background: var(--sm-ai-soft); padding: 8px 10px; border-radius: 0 6px 6px 0; font-size: 0.84rem; }
.sm-evidence h3 { color: var(--sm-ai); }
.mr-table .sm-strip button { font-size: 0.78rem; padding: 1px 7px; }
.mr-stage { cursor: pointer; }
.mr-stage:hover rect { fill: var(--sm-sel); }
.mr-stage:focus-visible { outline: none; }
.mr-stage:focus-visible rect { stroke: var(--sm-accent); stroke-width: 1.5; }
.sm-embed { border: 0; background: transparent; }
.sm-embed-detail:empty { display: none; }
.sm-embed-detail { border: 1px solid var(--sm-line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; background: var(--sm-panel); }
.sm-embed-detail h2 { margin: 0; font-size: 1.05rem; }
.sm-embed-detail h3 { margin: 0 0 4px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--sm-muted); }
details.sm-fn summary { cursor: pointer; font-size: 0.84rem; padding: 3px 0; }
details.sm-fn ul { margin: 4px 0 6px; }

/* ---------- forks */
.fk { padding: 4px 0 8px; }
.fk-panel { border-bottom: 1px solid var(--sm-line); padding: 12px 14px 6px; }
.fk-panel h3 { margin: 0 0 2px; font-size: 0.98rem; }
.fk-panel .sm-note { margin-bottom: 4px; }
.fk svg { display: block; width: 100%; height: auto; min-width: 760px; }
.mr svg { display: block; width: 100%; height: auto; }
.fk-opt { cursor: pointer; }
.fk-opt:focus-visible rect { stroke: var(--sm-accent); stroke-width: 2; }

/* ---------- paths */
.mr { padding: 12px 14px; display: grid; gap: 12px; }
.mr-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.mr-table { border-collapse: collapse; font-size: 0.88rem; width: 100%; min-width: 640px; }
.mr-table th, .mr-table td { border-bottom: 1px solid var(--sm-line); padding: 4px 6px; text-align: left; }
.mr-table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sm-muted); font-weight: 600; }
.mr-table input[type="number"] { width: 64px; padding: 3px 5px; border: 1px solid var(--sm-line-strong); border-radius: 5px; background: var(--sm-panel); font-variant-numeric: tabular-nums; }
.mr-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
.mr-flag { font-size: 0.8rem; color: var(--sm-review); }

.mr-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 0; }
.mr-key { display: inline-flex; align-items: center; gap: 6px; color: var(--sm-ink); font-weight: 600; }
.mr-key i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }
.mr-basis { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sm-review); background: var(--sm-review-soft); padding: 1px 8px; border-radius: 10px; }
.mr-ends { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 0.88rem; }
.mr-ends li { display: flex; gap: 8px; align-items: center; }
.mr-ends i { width: 16px; height: 4px; border-radius: 2px; flex: none; }

/* ---------- review */
.rv { padding: 14px 16px 18px; display: grid; gap: 18px; }
.rv-head { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: flex-start; justify-content: space-between; }
.rv-head h2 { margin: 0 0 4px; font-size: 1.2rem; }
.rv-head .sm-note { max-width: 70ch; }
.rv-group h3 { margin: 0 0 2px; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 760px; margin-top: 8px; }
.rv-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sm-muted); padding: 6px 8px; border-bottom: 1px solid var(--sm-line-strong); }
.rv-table td { padding: 8px; border-bottom: 1px solid var(--sm-line); vertical-align: top; }
.rv-table td:first-child { width: 48px; text-align: center; }
.rv-table td:nth-child(2) { width: 26%; }
.rv-table td:nth-child(4) { width: 26%; }
.rv-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--sm-accent); }
.rv-table textarea { width: 100%; min-height: 44px; padding: 5px 7px; border: 1px solid var(--sm-line-strong); border-radius: 6px; background: var(--sm-panel); color: var(--sm-ink); resize: vertical; font: inherit; font-size: 0.82rem; }
.rv-table tr.is-done td { color: var(--sm-faint); }
.rv-table tr.is-done .rv-open { color: var(--sm-faint); }
.rv-open { border: 0; background: none; padding: 0; text-align: left; font-weight: 700; color: var(--sm-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sm-revbtn { border-color: var(--sm-review); color: var(--sm-review); background: var(--sm-review-soft); font-weight: 600; }

/* ---------- list */
.ls { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 720px; }
.ls th { position: sticky; top: 0; background: var(--sm-panel); text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sm-muted); padding: 8px 10px; border-bottom: 1px solid var(--sm-line-strong); }
.ls td { padding: 7px 10px; border-bottom: 1px solid var(--sm-line); vertical-align: top; }
.ls tr { cursor: pointer; }
.ls tr:hover td { background: var(--sm-sel); }
.ls .k { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ls .k.activity { color: var(--sm-muted); } .ls .k.decision { color: var(--sm-decide); } .ls .k.resource { color: var(--sm-accent); } .ls .k.note, .ls .k.user { color: var(--sm-you); }

/* ---------- dialog */
.sm-dlg { position: fixed; inset: 0; z-index: 50; background: rgba(10, 18, 30, 0.45); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sm-dlg-box { background: var(--sm-panel); color: var(--sm-ink); border-radius: 10px; width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 18px 20px; display: grid; gap: 12px;
  font-family: var(--sm-font); font-size: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.sm-dlg-box h2 { margin: 0; font-size: 1.1rem; }
.sm-form { display: grid; gap: 10px; }
.sm-form label { display: grid; gap: 4px; font-size: 0.82rem; color: var(--sm-muted); }
.sm-form input[type="text"], .sm-form input[type="date"], .sm-form select, .sm-form textarea {
  padding: 6px 8px; border: 1px solid var(--sm-line-strong); border-radius: 6px; background: var(--sm-panel); color: var(--sm-ink); width: 100%; }
.sm-form textarea { min-height: 70px; resize: vertical; }
.sm-form .sm-code, .sm-dlg-box .sm-code { min-height: 170px; }
.sm-form label.sm-toggle { display: flex; flex-direction: row; align-items: center; color: var(--sm-ink); }
.sm-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sm-form .checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px 10px; font-size: 0.8rem; color: var(--sm-ink); }
.sm-form .checks label { display: flex; flex-direction: row; gap: 6px; align-items: center; color: var(--sm-ink); }
.sm-dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sm-code { width: 100%; min-height: 180px; font-family: var(--sm-mono); font-size: 0.76rem; padding: 8px; border: 1px solid var(--sm-line-strong); border-radius: 6px; background: var(--sm-paper); color: var(--sm-ink); }
.sm-toast { position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--sm-ink); color: var(--sm-panel);
  padding: 8px 14px; border-radius: 8px; font-size: 0.86rem; }

.sm-foot { margin-top: 14px; font-size: 0.82rem; color: var(--sm-muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
@media (max-width: 600px) {
  .sm-title h1 { font-size: 1.3rem; }
  .sm-form .row { grid-template-columns: 1fr; }
  .sm-tab { padding: 6px 10px; }
}
@media (prefers-reduced-motion: no-preference) { .it, .sm-btn, .hz-stage { transition: background-color 0.15s, border-color 0.15s; } }
