/* =============================================================================
   NutraTech — Page layouts (oversight, admin, worklist, review, ask)
   Depends on design-tokens.css + base.css + components.css.
   ============================================================================= */

.page { max-width: var(--content-max); margin: 0 auto; width: 100%; }

/* ---- KPI strip ------------------------------------------------------------ */
.kpi-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-4); }
.kpi-strip--6 { grid-template-columns: repeat(6, 1fr); }
.kpi-strip--4 { grid-template-columns: repeat(4, 1fr); }

.mini-spark { width: 100%; height: 26px; }

/* ---- Two-column dashboard split ------------------------------------------ */
.split { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: var(--space-6); align-items: start; }
.split__rail { position: sticky; top: calc(var(--topbar-h) + var(--space-6)); }

/* ---- Activity feed -------------------------------------------------------- */
.feed { display: flex; flex-direction: column; }
.feed__item { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border-soft); }
.feed__item:last-child { border-bottom: none; }
.feed__dot { width: 30px; height: 30px; border-radius: var(--radius-pill); display: grid; place-items: center; flex: none; margin-top: 1px; }
.feed__dot svg { width: 15px; height: 15px; }
.feed__dot--sign { background: var(--sev-ok-100); color: var(--sev-ok-700); }
.feed__dot--edit { background: var(--sev-mod-100); color: var(--sev-mod-700); }
.feed__dot--accept { background: var(--teal-100); color: var(--teal-700); }
.feed__dot--flag { background: var(--sev-high-100); color: var(--sev-high-700); }
.feed__body { min-width: 0; font-size: var(--text-sm); }
.feed__body b { font-weight: var(--fw-semibold); color: var(--text-primary); }
.feed__body .t { color: var(--text-secondary); }
.feed__time { font-size: var(--text-2xs); color: var(--text-muted); margin-top: 2px; }
.feed__diff { font-size: var(--text-xs); margin-top: var(--space-1); background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 4px 8px; color: var(--text-secondary); }
.feed__diff .del { color: var(--sev-high-700); text-decoration: line-through; }
.feed__diff .ins { color: var(--sev-ok-700); }

/* ---- Facility / worklist table extras ------------------------------------ */
.fac-name { display: flex; align-items: center; gap: var(--space-3); }
.fac-badge { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--teal-100); color: var(--teal-700); display: grid; place-items: center; font-weight: var(--fw-bold); font-size: var(--text-xs); flex: none; }

.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* sortable header affordance */
.th-sort { cursor: pointer; }
.th-sort:hover { color: var(--text-secondary); }

/* ---- Worklist row status -------------------------------------------------- */
/* ---- Worklist row status -------------------------------------------------- */
.wl-summary { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-5); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 120px; }
.wl-summary__n { font-size: var(--text-2xl); font-weight: var(--fw-bold); letter-spacing: -0.03em; line-height: 1; }
.wl-summary__l { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--fw-medium); }
.wl-summary--high { border-left: 3px solid var(--sev-high-600); }
.wl-summary--high .wl-summary__n { color: var(--sev-high-700); }
.wl-summary--mod { border-left: 3px solid var(--sev-mod-600); }
.wl-summary--ok { border-left: 3px solid var(--sev-ok-600); }
.wl-row { cursor: pointer; }
.wl-row--high td:first-child { box-shadow: inset 3px 0 0 var(--sev-high-600); }
.wl-table td { padding-top: var(--space-3); padding-bottom: var(--space-3); }

.wl-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--fw-semibold); }
.wl-status svg { width: 14px; height: 14px; }
.wl-status--ready { color: var(--teal-700); }
.wl-status--progress { color: var(--sev-mod-700); }
.wl-status--signed { color: var(--sev-ok-700); }

/* ---- Admin layout --------------------------------------------------------- */
.admin-grid { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-8); align-items: start; }
.vtabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--space-6)); }
.vtab { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-secondary); background: none; border: none; text-align: left; }
.vtab:hover { background: var(--bg-inset); color: var(--text-primary); }
.vtab.is-active { background: var(--teal-050); color: var(--teal-800); box-shadow: inset 2px 0 0 var(--teal-700); }
.vtab svg { width: 17px; height: 17px; flex: none; }
.vtab .vtab__count { margin-left: auto; font-size: 11px; font-weight: var(--fw-bold); background: var(--ink-100); color: var(--text-secondary); padding: 0 7px; border-radius: var(--radius-pill); }
.vtab.is-active .vtab__count { background: var(--teal-100); color: var(--teal-700); }

.statusline { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.statusline .light { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.statusline .light--ok { background: var(--sev-ok-500); box-shadow: 0 0 0 3px var(--sev-ok-100); }
.statusline .light--warn { background: var(--sev-mod-500); box-shadow: 0 0 0 3px var(--sev-mod-100); }

.rolepill { font-size: var(--text-2xs); font-weight: var(--fw-semibold); padding: 2px 8px; border-radius: var(--radius-sm); }
.rolepill--rd { background: var(--teal-100); color: var(--teal-700); }
.rolepill--md { background: var(--sev-low-100); color: var(--sev-low-700); }
.rolepill--admin { background: var(--ink-100); color: var(--ink-700); }
.rolepill--mgr { background: var(--sev-mod-100); color: var(--sev-mod-700); }

/* ---- Ask the Chart (chat) ------------------------------------------------- */
.chat { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: var(--space-6); align-items: start; }
.chat__main { display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h) - 200px); }
.chat__stream { display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: var(--space-6); }
.msg { display: grid; grid-template-columns: 34px 1fr; gap: var(--space-3); max-width: 760px; }
.msg--user { display: flex; justify-content: flex-end; align-items: flex-start; max-width: 760px; margin-left: auto; }
.msg--user .msg__bubble.user { max-width: 480px; }
.msg__av { width: 34px; height: 34px; border-radius: var(--radius-md); display: grid; place-items: center; flex: none; }
.msg__av--ai { background: linear-gradient(155deg, var(--teal-500), var(--teal-700)); color: #fff; }
.msg__av--rd { background: var(--ink-200); color: var(--ink-700); font-size: var(--text-xs); font-weight: var(--fw-bold); }
.msg__who { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-muted); margin-bottom: 3px; }
.msg__bubble { font-size: var(--text-md); color: var(--text-primary); line-height: var(--lh-normal); }
.msg__bubble.user { background: var(--teal-050); border: 1px solid var(--teal-100); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); display: inline-block; }
.msg__cites { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.msg__answerblock { background: var(--bg-surface); border: 1px solid var(--border); border-left: 3px solid var(--teal-600); border-radius: var(--radius-md); padding: var(--space-4); }

.composer { display: flex; align-items: flex-end; gap: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-3); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.composer textarea { flex: 1; border: none; outline: none; resize: none; font-size: var(--text-md); min-height: 24px; max-height: 160px; }
.composer .btn { flex: none; }
.suggest-chip { font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-secondary); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 12px; text-align: left; }
.suggest-chip:hover { border-color: var(--teal-400); color: var(--teal-700); background: var(--teal-050); }
.answer-list { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.answer-list li { position: relative; padding-left: 16px; font-size: var(--text-md); color: var(--text-secondary); }
.answer-list li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--teal-500); }
.answer-list b { color: var(--text-primary); }
.ask-tips { display: flex; flex-direction: column; gap: var(--space-3); }
.ask-tips li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.ask-tips svg { width: 16px; height: 16px; color: var(--teal-500); flex: none; }

/* ---- Diff (review screen) ------------------------------------------------- */
.diffline { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.diffcol { font-family: var(--font-doc); font-size: var(--text-sm); line-height: var(--lh-relaxed); }
.diffcol h5 { font-family: var(--font-ui); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-muted); font-weight: var(--fw-semibold); margin: 0 0 var(--space-2); }
.ins-mark { background: var(--sev-ok-100); border-radius: 2px; }
.del-mark { background: var(--sev-high-100); text-decoration: line-through; border-radius: 2px; }
.diff-h { font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--text-primary); margin: 0 0 var(--space-2); }

/* ---- Decision mix bar (oversight) ---------------------------------------- */
.decision-bar { display: flex; height: 28px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.decision-seg { height: 100%; }
.decision-seg + .decision-seg { border-left: 2px solid var(--bg-surface); }
.legend { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.legend b { color: var(--text-primary); font-weight: var(--fw-bold); }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.row-gap-6 { gap: var(--space-6); }

/* QA distribution rows */
.qa-row { display: grid; grid-template-columns: 40px 1fr 42px; gap: var(--space-3); align-items: center; }
.qa-row__label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-secondary); }
.qa-row .meter__track { height: 8px; }
.qa-row__val { font-size: var(--text-xs); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; text-align: right; color: var(--text-primary); }

/* ---- Section heading inside content -------------------------------------- */
.block-head { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-2) 0 var(--space-3); }
.block-head h3 { font-size: var(--text-lg); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.block-head .spacer { flex: 1; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .kpi-strip, .kpi-strip--6 { grid-template-columns: repeat(3, 1fr); }
  .kpi-strip--4 { grid-template-columns: repeat(2, 1fr); }
  .split, .chat { grid-template-columns: 1fr; }
  .split__rail { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
  .vtabs { flex-direction: row; overflow-x: auto; position: static; }
}
@media (max-width: 720px) {
  .kpi-strip, .kpi-strip--6, .kpi-strip--4 { grid-template-columns: repeat(2, 1fr); }
  .diffline { grid-template-columns: 1fr; }
}
