/* CS Field Mobile prototype — phone frame + task-focused mobile components.
 * Throwaway design mock. Tailwind CDN carries some utilities; this owns the
 * device frame, the semantic-zoom densities, and the field components. */

:root {
  --bg:        #0b1119;
  --surface:   #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #e9edf3;
  --border:    #dce2ec;
  --text:      #131c27;
  --dim:       #61708020;
  --muted:     #647386;
  --primary:   #1f6feb;
  --primary-d: #1856bf;
  --ok:        #18794e;
  --warn:      #b7791f;
  --danger:    #c0392b;
  --cii-fg:    #a02622;
  --cii-bg:    #fdecea;
  --cii-bd:    #e6a39d;
  --tap:       48px;
  --stale:     #8a5a2b;   /* off-color (brown) for stale knowledge-graph values */
}

/* knowledge-graph record links + stale values */
.kglink { color: var(--primary); text-decoration: none; font-weight: 600; border-bottom: 1px dotted var(--primary); }
.kglink.stale, .stale { color: var(--stale); }
.kglink.stale { border-bottom-color: var(--stale); }
.suggest { background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 13px; color: #1a4fa0; }
.histline { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.histline .d { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 78px; }

/* R2-K1/K3: entity typeahead + horse link/register widget */
.ta-wrap { position: relative; flex: 1; }
.ta-wrap input { width: 100%; }
.ta-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 22px rgba(13, 25, 41, .14); overflow: hidden; }
.ta-list:empty { display: none; }
.ta-list.static { position: static; box-shadow: none; margin-top: 6px; }
.ta-row { display: flex; align-items: center; gap: 8px; padding: 9px 11px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--surface-2); }
.ta-row:last-child { border-bottom: 0; }
.ta-row:hover { background: #f3f8ff; }
.ta-row .ta-meta { margin-left: auto; font-size: 11px; color: var(--muted); }
.ta-row .ta-act { font-size: 11px; font-weight: 800; color: var(--primary); }
.ta-row.add { color: var(--primary); font-weight: 700; }
.linkbox { margin-top: 8px; }
.linkbox input { width: 100%; }
.ta-resolve { padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.ta-resolve-h { font-size: 12px; font-weight: 800; color: var(--text); }
.ta-resolve select, .ta-resolve input { width: 100%; }
.ta-resolve-act { display: flex; gap: 8px; }

/* R2-K2: unconfirmed (seen-before) entities — visually distinguished, not hidden */
.trayitem.unconf { opacity: .72; border-left: 3px solid var(--stale); background: #faf7f2; }
/* R2-K5: detail-view title taps back to the head of its domain */
.navtop .ttl.tappable { cursor: pointer; }
.navtop .ttl.tappable:active { color: var(--primary); }
/* R2-K8: my-locations chips on the Me tab */
.locchip { border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); border-radius: 999px;
  min-height: 34px; padding: 0 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.locchip.on { background: #e4eefe; border-color: #b9d2f8; color: var(--primary); }

/* R2-D1: Me dashboard stat tiles · R2-D3: org news feed */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stat .n { font-size: 24px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.feedpost { display: flex; gap: 8px; margin-bottom: 10px; }
.feedpost input { flex: 1; }
.feeditem { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.feeditem .fhead { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.feeditem .fhead .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.feeditem .ftext { font-size: 13px; line-height: 1.45; }

/* B1/B3/B4: card staleness bubble, edit-in-place rows, nav back/forward */
.cardbub { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; margin-left: 4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; vertical-align: middle; }
.frow { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.frow .fl { width: 78px; font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.frow .fv { flex: 1; font-size: 14px; }
.frow .fedit { margin-left: auto; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  border-radius: 8px; min-width: 34px; min-height: 32px; font-size: 13px; cursor: pointer; }
.frow #ed { flex: 1; min-height: 38px; }
.navbtn { border: 1px solid var(--border); background: var(--surface); color: var(--primary); border-radius: 8px;
  min-width: var(--tap); min-height: var(--tap); font-size: 17px; font-weight: 800; cursor: pointer; }
.navbtn:disabled { color: var(--border); cursor: default; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 50% -5%, #1b2a3f 0%, var(--bg) 55%);
  color: var(--text);
}

/* ---- device frame ------------------------------------------------------- */
.stage { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.phone {
  width: 390px; height: 844px; max-height: calc(100vh - 44px);
  background: var(--surface); border-radius: 44px;
  box-shadow: 0 0 0 12px #11161d, 0 0 0 14px #2a313b, 0 30px 80px rgba(0,0,0,.55);
  overflow: hidden; position: relative; display: flex; flex-direction: column;
}
.notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 150px; height: 30px; background: #11161d; border-radius: 0 0 18px 18px; z-index: 50; }

/* Responsive / PWA: on a real phone (or installed standalone) fill the screen
   with no device frame; on desktop keep the centered device preview. */
@media (max-width: 560px) {
  .stage { padding: 0; min-height: 100vh; min-height: 100dvh; }
  .phone { width: 100vw; height: 100vh; height: 100dvh; max-height: none;
    border-radius: 0; box-shadow: none; }
  .notch { display: none; }
}
@media (display-mode: standalone) {
  .stage { padding: 0; }
  .phone { width: 100vw; height: 100vh; height: 100dvh; max-height: none;
    border-radius: 0; box-shadow: none; }
  .notch { display: none; }
}

/* ---- status / connectivity bar ------------------------------------------ */
.statusbar {
  min-height: var(--tap); flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 18px 0 22px; font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--surface);
}
.statusbar .t { font-variant-numeric: tabular-nums; }
.statusbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.conn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; font-weight: 700;
  min-height: var(--tap); padding: 0 12px; border-radius: 999px; cursor: pointer; user-select: none; }
.conn.online  { background: #e7f6ee; color: var(--ok); }
.conn.offline { background: #fff1e6; color: var(--warn); }
.prov-pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); cursor: pointer; }
.prov-pill.dirty { background: #fff1e6; color: var(--warn); }

/* ---- app header --------------------------------------------------------- */
.appbar { flex: none; padding: 6px 18px 12px; background: var(--surface); }
.appbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.appbar h1.tappable { cursor: pointer; }                     /* R2-P9: title tap = jump to today */
.appbar h1 .h1date { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 9px; }   /* R2-P3: sticky date beside the title */
.appbar .who { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- scroll body -------------------------------------------------------- */
.body { flex: 1 1 auto; overflow-y: auto; background: var(--surface-2);
  -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.body.pad { padding: 14px; }

/* ---- bottom tab bar ----------------------------------------------------- */
.tabbar { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-top: 1px solid var(--border); background: var(--surface); padding-bottom: 6px; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px 2px 4px; min-height: 52px; font-size: 10px; font-weight: 600; color: var(--muted);
  text-decoration: none; cursor: pointer; }
.tab .i { font-size: 18px; line-height: 1; }
.tab.active { color: var(--primary); }
.tab .bub { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 15px; height: 15px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 800; border-radius: 999px;
  display: grid; place-items: center; line-height: 1; }

/* ---- zoom control (semantic zoom) --------------------------------------- */
.zoombar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: rgba(243,245,249,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); }
.pivot { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; }
.pivot button { border: 0; background: transparent; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.pivot button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.zoom { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.zoom .seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; }
.zoom .seg button { width: 28px; height: 30px; border: 0; background: transparent; border-radius: 7px;
  font-size: 13px; cursor: pointer; color: var(--muted); font-weight: 800; }
.zoom .seg button.on { background: var(--primary); color: #fff; }

/* ---- day/month nav + calendar ----- */
.daynav { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px 12px 12px; }
.cal .dow { text-align: center; font-size: 10px; color: var(--muted); font-weight: 800; padding-bottom: 2px; }
.cal .cell { min-height: 52px; border: 1px solid var(--border); border-radius: 9px; padding: 5px 6px; background: #fff; cursor: pointer; }
.cal .cell.empty { border: 0; background: transparent; cursor: default; }
.cal .cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(31,111,235,.15); }
.cal .cell.sel { background: #f3f8ff; }
.cal .cell .num { font-weight: 700; font-size: 12px; }
.cal .cell .cnt { display: inline-block; margin-top: 4px; font-size: 10px; background: var(--primary); color: #fff; border-radius: 999px; padding: 0 6px; font-weight: 800; }
.cal .cell .cii { color: var(--cii-fg); font-weight: 900; }

/* R2-P1: bucket/group "+" — shaded background, no border */
.hadd { border: 0; background: #e4eefe; color: var(--primary); border-radius: 7px; min-height: 24px; padding: 0 9px; font-size: 13px; font-weight: 800; cursor: pointer; margin-left: 8px; }
.gh-add { float: right; text-decoration: none; background: #e4eefe; color: var(--primary); border-radius: 7px; min-width: 22px; height: 22px; line-height: 22px; text-align: center; display: inline-block; padding: 0 7px; font-weight: 800; font-size: 14px; }
.hadd:hover { background: #d3e3fb; }

/* ---- multi-day columns grid (P2) — frozen date row + bucket gutter ------ */
.mdgrid { display: grid; overflow-x: auto; background: var(--surface-2); border-top: 1px solid var(--border); }
.mdh-corner { position: sticky; top: 0; left: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.mdh-date { position: sticky; top: 0; z-index: 3; background: var(--surface-2); text-align: center; font-size: 10.5px; font-weight: 800; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.mdh-date.today { color: var(--primary); }
/* R2-P7: shaded (solid) divider lines instead of dashed */
.mdh-bucket { position: sticky; left: 0; z-index: 2; background: var(--surface-2); font-size: 11px; font-weight: 800; color: var(--muted); padding: 8px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid #e6eaf2; display: grid; align-content: start; }
.mdcell { border-bottom: 1px solid #e6eaf2; border-right: 1px solid #e6eaf2; padding: 5px; display: flex; flex-direction: column; gap: 4px; min-height: 54px; }
.mdcard { display: block; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; font-size: 10.5px; font-weight: 700; text-decoration: none; color: inherit; line-height: 1.2; }
.mdcard.cii { border-left: 3px solid var(--cii-fg); }
.mdcard .who { display: block; font-weight: 500; color: var(--muted); font-size: 9.5px; }
/* R2-P7: cell "+" centered in the bucket, shaded, no border */
.mdadd { border: 0; background: #e9eef7; color: var(--muted); border-radius: 7px; font-size: 13px; font-weight: 800; width: 30px; min-height: 22px; cursor: pointer; opacity: .6; margin: auto; }
.mdadd:hover { opacity: 1; background: #dde6f4; }
/* R2-P8: the past stays visible for reference, shaded a step darker */
.mdh-date.past { background: #e6eaf1; color: #8a93a3; }
.mdcell.past { background: #eceff5; border-bottom-color: #dde2ec; border-right-color: #dde2ec; }
.mdcell.past .mdcard { background: #f4f6fa; opacity: .75; }

/* R2-P6: trainer symbol — silks-colored monogram chip on procedure rows/cards */
.tsym { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 2px; border-radius: 6px;
  color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .02em; flex: none; }
.tsym.sm { min-width: 15px; height: 15px; font-size: 8px; border-radius: 5px; margin-right: 4px; vertical-align: -3px; }

/* ---- group headers ------------------------------------------------------ */
.group-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.group-h .count { margin-left: auto; font-size: 11px; background: var(--surface-3); color: var(--muted);
  padding: 1px 8px; border-radius: 999px; }

/* ---- worklist rows (density varies by zoom) ----------------------------- */
.list { display: flex; flex-direction: column; gap: 8px; padding: 6px 14px 16px; }
.proc { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; display: block; text-decoration: none; color: inherit; }
.proc.cii { border-left: 4px solid var(--cii-fg); }
.proc .top { display: flex; align-items: center; gap: 9px; }
.proc .time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px; }
.proc .drug { font-weight: 700; font-size: 15px; }
.proc .horse { color: var(--muted); font-size: 13px; }
.proc .sub { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; }
.proc .props { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12.5px; }
.proc .props .k { color: var(--muted); }
.proc .doc-flags { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

/* semantic-zoom density is JS-driven: each pivot has a property-priority ladder
   (config/worklist-pivots.yaml); zoom = depth into it. Rollups render only at
   zoom 0; rows render the first N ladder properties at zoom 1-3. */
.rollup { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 8px 14px;
  text-decoration: none; color: inherit; }
.rollup.tappable { cursor: pointer; }
.rollup.tappable:active { border-color: var(--primary); }
.rollup .big { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rollup .nm { font-weight: 800; font-size: 15px; }
.rollup .mt { font-size: 12px; color: var(--muted); }
.proc.compact { padding: 9px 14px; border-radius: 11px; }   /* zoom 1 density */

/* ---- badges ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800;
  padding: 2px 7px; border-radius: 999px; }
.b-cii { background: var(--cii-bg); color: var(--cii-fg); border: 1px solid var(--cii-bd); }
.b-sch { background: #eef4ff; color: var(--primary); }
.b-warn { background: #fff4e5; color: var(--warn); }
.b-ok { background: #e7f6ee; color: var(--ok); }
.b-due { background: #eef1f6; color: var(--muted); }
.b-prov { background: #fff1e6; color: var(--warn); }
.b-anc { background: #e7f6ee; color: var(--ok); }
.b-admin { background: #ede9fe; color: #6d28d9; }
.b-invited { background: #fff4e5; color: var(--warn); }
.chip-id { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; padding: 3px 9px; border-radius: 7px; background: var(--surface-3); color: var(--text); }
.chip-id.none { background: transparent; color: var(--muted); font-weight: 600; border: 1px dashed var(--border); }
.b-flag { background: #fdecea; color: var(--cii-fg); border: 1px solid var(--cii-bd); }
.ownpanel { margin-top: 6px; }
.cap-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 11px; margin-bottom: 6px; background: var(--surface); }
.cap-row.flagged { border-color: var(--warn); background: #fffaf2; }
.trayitem.flagged-row { border-color: var(--warn); background: #fffaf2; }
.rowlink { text-decoration: none; color: inherit; display: block; }
.rowlink b { color: var(--text); }
.rowlink.stale b { color: var(--stale, var(--warn)); }
.status-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.st-planned { background: #9aa7b6; } .st-prepared { background: var(--primary); }
.st-administered { background: #6f42c1; } .st-incomplete { background: var(--warn); } .st-closed { background: var(--ok); }

/* ---- big primary action ------------------------------------------------- */
.fab-wrap { padding: 14px; }

/* The note box that replaced the mock microphone. It sits above a form and
   fills it: deliberately quieter than the 64px blue button it replaces, because
   reading a note is a typing aid, not the point of the screen. */
.notebox { padding: 4px 0 14px; }
.notelab { display: block; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 2px 6px; }
.notebox textarea { width: 100%; font: inherit; font-size: 15px; line-height: 1.45; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  resize: vertical; min-height: 74px; }
.notebox textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.noterow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.notemsg { font-size: 12.5px; color: #1c6b40; flex: 1; min-width: 160px; }
.notemsg.bad { color: var(--danger); }

/* ---- generic buttons / forms (touch) ------------------------------------ */
.btn { min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }
.field { margin-bottom: 12px; }
.field label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; min-height: var(--tap); padding: 11px 13px;
  font-size: 15px; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--text); }
.field.low input, .field.low select { border-color: var(--warn); background: #fffaf2; }
.field .lowtag { margin-left: auto; font-size: 10px; font-weight: 800; color: var(--warn); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; }

/* ---- detail screen ------------------------------------------------------ */
.sheet { background: var(--surface); }
.det-head { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.det-head .drug { font-size: 19px; font-weight: 800; }
.det-head .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.section { padding: 14px 16px; }
.section h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv2 { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 14px; }
.kv2 dt { color: var(--muted); } .kv2 dd { margin: 0; }

/* documentation checklist — big tap targets */
.docrow { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px;
  border: 1px dashed var(--border); background: var(--surface-2); margin-bottom: 10px; cursor: pointer; }
.docrow.missing { border-color: var(--warn); background: #fffaf2; }
.docrow.done { border-style: solid; border-color: #b6e0c7; background: #f1faf4; cursor: default; }
.docrow .ic { font-size: 24px; width: 30px; text-align: center; }
.docrow .l { font-weight: 700; font-size: 14px; }
.docrow .s { font-size: 12px; color: var(--muted); }
.docrow .go { margin-left: auto; color: var(--warn); font-weight: 800; }
.docrow.done .go { color: var(--ok); }

/* ---- nav / back --------------------------------------------------------- */
.navtop { display: flex; align-items: center; gap: 4px; padding: 8px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border); }
.navtop a { color: var(--primary); font-weight: 700; font-size: 15px; text-decoration: none; padding: 8px; }
.navtop .ttl { font-weight: 800; font-size: 15px; flex: 1; text-align: center; }
.navundoredo { display: flex; gap: 4px; margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--border); }

/* ---- toast / banners ---------------------------------------------------- */
.toast { position: absolute; left: 14px; right: 14px; bottom: 84px; z-index: 60;
  background: #11161d; color: #fff; border-radius: 14px; padding: 13px 15px; font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,.4); opacity: 0; transform: translateY(12px); transition: .25s; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: #14693d; } .toast.err { background: #97251f; }
.toast .ev { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 11px; opacity: .85; margin-top: 5px; }
.banner { border-radius: 12px; padding: 11px 13px; font-size: 12.5px; margin-bottom: 12px; }
.banner.warn { background: #fff8e6; border: 1px solid #f0d6a8; color: #8a5d12; }
.banner.info { background: #eef4ff; border: 1px solid #cfe0ff; color: #1a4fa0; }
.banner.ok { background: #e7f6ee; border: 1px solid #b6e0c7; color: #1c6b40; }

/* ---- read-only prose block (e.g. a generated email) --------------------- */
.transcript { font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; min-height: 44px; }
.scroll-hint { text-align: center; font-size: 12px; color: var(--muted); padding: 10px; }

/* ---- ledger / chain view ------------------------------------------------ */
.evt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.evt .dot { margin-top: 3px; }
.evt .l { flex: 1; min-width: 0; }
.evt .kind { font-weight: 800; font-size: 13.5px; }
.evt .times { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.evt .hash { font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: #8896a6; }
.chainlink { text-align: center; color: var(--border); font-size: 14px; margin: -2px 0; }
.fork { background: #fdecea; border: 1px solid var(--cii-bd); color: var(--cii-fg); border-radius: 12px;
  padding: 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }

/* inventory fill bar (near-empty, U-04) */
.fillbar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.fillbar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.fillbar.mid > i { background: var(--warn); }   /* <60% */
.fillbar.lo  > i { background: var(--cii-fg); }  /* <20% */

/* attention triage chips (home) */
.attn { display: flex; gap: 8px; padding: 0 14px 4px; }
.attn a { flex: 1; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 11px 8px; text-align: center; }
.attn a.hot { border-color: #f0d6a8; background: #fffaf2; }
.attn a .n { font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.attn a .k { font-size: 10px; color: var(--muted); font-weight: 700; margin-top: 4px; }

/* physical (literal) tray cards */
.ptcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin: 8px 14px;
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.ptcard.ready { border-color: #b6e0c7; }
.ptchip { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 900; font-size: 18px;
  background: var(--primary); color: #fff; flex: none; }
.ptcard.ready .ptchip { background: var(--ok); }
.assign { min-height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); }
.role-seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; width: 100%; }
.role-seg button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--muted); }
.role-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* time-bucket move bar + BOM builder rows */
.movebar { display: flex; align-items: center; gap: 8px; margin: -4px 14px 8px; padding: 8px 12px; font-size: 11.5px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: 11px; }
.movebar select { min-height: 34px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; margin-left: auto; width: auto; }
.bomrow { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.bomrow input, .bomrow select { min-height: 38px; padding: 6px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 9px; }

/* A bill-of-materials row the reader could not put a number on. The quantity
   showing is the form's default, not something anyone said — on a controlled
   drug that is a distinction worth a colour. */
.bomrow.unsaid { background: #fff8e6; border-radius: 10px; }
.bomrow.unsaid .bq { border-color: #f0d6a8; background: #fffdf6; }


/* tray builder */
.trayitem { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.trayitem input[type=checkbox] { width: 24px; height: 24px; flex: none;
  /* enlarge the hit area to >=44px without growing the 24px visual box */
  min-width: var(--tap); min-height: var(--tap); margin: -10px; padding: 10px;
  background-clip: content-box; }
.wastebtn { color: var(--cii-fg); border-color: var(--cii-bd); }
.csflag { background: #fdecea; border: 1px solid var(--cii-bd); color: var(--cii-fg); border-radius: 12px;
  padding: 13px; font-size: 13px; font-weight: 700; margin: 10px 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.csflag.satisfied { background: #f1faf4; border-color: #b6e0c7; color: var(--ok); cursor: default; }

/* --- Table view -----------------------------------------------------------
   A table inside a 390px phone frame scrolls horizontally in its OWN box, so
   the page body never does. The first column and the header row stay put,
   because a wide table whose row labels scroll away is unreadable exactly
   when it is worth reading. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.etable { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12px; }
.etable th, .etable td { padding: 8px 10px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border); }
.etable thead th { position: sticky; top: 0; z-index: 2; cursor: pointer;
  background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; user-select: none; }
.etable thead th.on { color: var(--primary); }
.etable tbody tr { cursor: pointer; }
.etable tbody tr:active { background: var(--surface-3); }
.etable tbody tr.sel { background: #eef4ff; }
.etable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.etable .tsel { width: 34px; padding-left: 10px; padding-right: 0; }
.etable .tsel input { width: 18px; height: 18px; }
/* Sticky first data column. It sits after the checkbox cell, so both are
   pinned and the horizontal scroll starts from the row's identity. */
.etable th.tsel, .etable td.tsel { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.etable thead th.tsel { background: var(--surface-3); }
.etable td.tfirst, .etable thead th:nth-child(2) { position: sticky; left: 34px; z-index: 1;
  background: var(--surface); font-weight: 700; }
.etable thead th:nth-child(2) { z-index: 3; background: var(--surface-3); }
.etable tbody tr.sel td.tfirst, .etable tbody tr.sel td.tsel { background: #eef4ff; }

.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--border); font-size: 13px; }

/* Table narrowing: one search box, and column filters as removable chips. */
.tbar { display: flex; gap: 8px; align-items: center; }
.tsearch { flex: 1; min-height: 36px; min-width: 0; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 10px; }
.fchip .fdel { border: 0; background: none; padding: 0 3px; margin: 0; cursor: pointer;
  font-weight: 800; color: var(--muted); line-height: 1; }
