/* Practice-in-a-Box — app styles
   Lifted from prototype/practice-in-a-box-mockup-v3.html (Stage 1) and carried
   forward unchanged for Stage 2, so the real app looks identical to the
   mockup Jensen already reviewed. Extend here as later stages add screens. */

:root{
  --ink:#1b2430; --ink-soft:#5b6b7c; --paper:#f6f7f9; --card:#ffffff;
  --line:#e3e7ec; --accent:#2f6f5e; --accent-soft:#e7f2ee;
  --amber:#b8792a; --amber-soft:#fbf1e2; --red:#b3413a; --red-soft:#fbeceb;
  --blue:#2b5f8a; --blue-soft:#eaf2f8; --radius:14px;
}
*{box-sizing:border-box;}
body{
  margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--paper); color:var(--ink); -webkit-font-smoothing:antialiased;
}
.phone{
  max-width:430px; margin:0 auto; min-height:100vh; background:var(--paper);
  display:flex; flex-direction:column; position:relative; box-shadow:0 0 40px rgba(0,0,0,0.06);
}
header.topbar{
  padding:18px 20px 12px; background:var(--card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:5;
}
header.topbar .brand{font-size:13px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); font-weight:600;}
header.topbar h1{margin:2px 0 0; font-size:20px; font-weight:700;}
header.topbar .sub{font-size:13px; color:var(--ink-soft); margin-top:2px;}
main{flex:1; padding:16px 16px 90px; overflow-y:auto;}
.screen{display:none;}
.screen.active{display:block; animation:fade .18s ease;}
@keyframes fade{from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;}}

.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px; margin-bottom:12px;}
.card h3{margin:0 0 4px; font-size:14px;}
.card .big{font-size:26px; font-weight:700; margin:4px 0 2px;}
.card .meta{font-size:12px; color:var(--ink-soft);}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:10px;}

.pill{display:inline-block; padding:3px 10px; border-radius:99px; font-size:11px; font-weight:600;}
.pill.green{background:var(--accent-soft); color:var(--accent);}
.pill.amber{background:var(--amber-soft); color:var(--amber);}
.pill.red{background:var(--red-soft); color:var(--red);}
.pill.blue{background:var(--blue-soft); color:var(--blue);}
.pill.grey{background:#eef0f2; color:var(--ink-soft);}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  background:var(--accent); color:#fff; border:none; border-radius:10px;
  padding:12px 16px; font-size:14px; font-weight:600; cursor:pointer; width:100%;
}
.btn.secondary{background:var(--card); color:var(--ink); border:1px solid var(--line);}
.btn.ghost{background:transparent; color:var(--accent); border:1px dashed var(--accent); font-size:13px; padding:9px 12px;}
.btn.danger{background:var(--red-soft); color:var(--red); border:1px solid var(--red);}
.btn-row{display:flex; gap:10px; margin-top:6px;}
.btn-row .btn{width:auto; flex:1;}

.section-title{font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); margin:22px 0 8px;}
.section-title:first-child{margin-top:0;}

.list-item{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  background:var(--card); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:8px; cursor:pointer;
}
.list-item .l{min-width:0;}
.list-item .l .name{font-weight:600; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.list-item .l .sub{font-size:12px; color:var(--ink-soft); margin-top:2px;}
.list-item .r{text-align:right; flex-shrink:0;}
.list-item .r .amt{font-weight:700; font-size:14px;}
.list-item.empty{cursor:default; color:var(--ink-soft); font-size:13px; justify-content:center;}

/* Ledger redesign (2026-07-07): initials badge on cards, plain search input,
   and the read-only detail-view field dump inside caseDetailModal. */
.initials-badge{
  flex-shrink:0; width:34px; height:34px; border-radius:50%; background:var(--accent-soft); color:var(--accent);
  display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; margin-right:10px;
}
.list-item.with-badge{ }
.list-item .l-row{display:flex; align-items:center; min-width:0;}
.search-input{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:9px; font-size:14px; background:#fff; color:var(--ink); font-family:inherit;
}
.detail-field{padding:7px 0; border-bottom:1px dashed var(--line); font-size:13.5px;}
.detail-field:last-child{border-bottom:none;}
.detail-field .k{font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.03em; color:var(--ink-soft); margin-bottom:2px;}
.detail-field .v{color:var(--ink);}

.tabs{display:flex; gap:6px; margin-bottom:14px; background:#eef0f2; padding:4px; border-radius:11px;}
.tabs button{flex:1; border:none; background:transparent; padding:9px 4px; border-radius:8px; font-size:13px; font-weight:600; color:var(--ink-soft); cursor:pointer;}
.tabs button.active{background:var(--card); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,0.08);}

form .field{margin-bottom:14px; position:relative;}
form label{display:flex; align-items:center; gap:6px; font-size:14px; font-weight:600; color:var(--ink-soft); margin-bottom:5px;}
form label .req{color:var(--red);}
form label .opt{font-weight:500; color:#8a97a4; text-transform:none; letter-spacing:0;}
form input[type=text], form input[type=number], form select, form input[type=date], form input[type=time], form textarea,
.field input[type=text], .field input[type=password], .field input[type=number], .field select{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:9px; font-size:14px; background:#fff; color:var(--ink); font-family:inherit;
  box-sizing:border-box;
}
form textarea{resize:vertical; min-height:64px;}
/* 2026-07-08 fix: input[type=password] (Security panel's PIN/recovery-code
   fields) was never styled at all before — those live inside .field divs in
   #securityPanelBody, which sits in a modal, NOT inside a <form> element, so
   the rule above (scoped to "form ...") never matched it. It rendered as a
   tiny, unstyled native browser password box, easy to miss next to every
   other input in the app. The .field input[type=password] selector above
   fixes this without touching the form-scoped rule anything else relies on. */

/* Time-picker trigger button — styled to look like the input fields above,
   since it stands in for <input type="time"> (see time-picker.js header). */
.time-picker-trigger{
  flex:1; padding:10px 12px; border:1px solid var(--line); border-radius:9px; font-size:14px;
  background:#fff; color:var(--ink-soft); font-family:inherit; text-align:left; cursor:pointer;
}
.time-picker-trigger.is-set{color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums;}

.time-picker-modal{text-align:center;}
.time-picker-wheels-wrap{position:relative; margin:10px 0 18px;}
.wheel-highlight-band{
  position:absolute; top:50%; left:0; right:0; height:40px; transform:translateY(-50%);
  background:var(--blue-soft); border-radius:8px; pointer-events:none; z-index:0;
}
.time-picker-wheels{position:relative; z-index:1; display:flex; align-items:center; justify-content:center; gap:10px;}
.wheel-col{
  height:160px; width:72px; overflow-y:scroll; scroll-snap-type:y mandatory; scrollbar-width:none;
}
.wheel-col::-webkit-scrollbar{display:none;}
.wheel-item{
  height:40px; line-height:40px; text-align:center; scroll-snap-align:center;
  font-size:20px; font-variant-numeric:tabular-nums; color:var(--ink-soft); cursor:pointer;
}
.wheel-item.selected{color:var(--ink); font-weight:700;}
.wheel-spacer{height:60px;}
.wheel-sep{font-size:20px; font-weight:700; color:var(--ink-soft); position:relative; z-index:1;}
.helper{font-size:13px; color:var(--ink-soft); margin-top:5px;}
.helper.flag{color:var(--amber); font-weight:600;}
.helper.error{color:var(--red); font-weight:600;}
.field.has-error input, .field.has-error select{border-color:var(--red);}

.autocomplete-list{
  position:absolute; left:0; right:0; top:100%; margin-top:4px; background:#fff; border:1px solid var(--line);
  border-radius:10px; box-shadow:0 6px 18px rgba(20,25,30,.1); z-index:8; max-height:180px; overflow-y:auto; display:none;
}
.autocomplete-list.open{display:block;}
.autocomplete-list .opt{padding:9px 12px; font-size:14px; cursor:pointer; border-bottom:1px solid var(--line);}
.autocomplete-list .opt:last-child{border-bottom:none;}
.autocomplete-list .opt:hover, .autocomplete-list .opt.hi{background:var(--accent-soft);}
.autocomplete-list .opt .code{color:var(--ink-soft); font-size:12.5px;}

.radio-row{display:flex; flex-direction:column; gap:8px;}
.radio-opt{
  border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-size:14px; cursor:pointer;
  display:flex; align-items:flex-start; gap:8px;
}
.radio-opt input{margin-top:3px;}
.radio-opt .t{font-weight:600;}
.radio-opt .d{font-size:13px; color:var(--ink-soft); margin-top:1px;}
.radio-opt.selected{border-color:var(--accent); background:var(--accent-soft);}

.scan-box{
  border:2px dashed var(--line); border-radius:14px; padding:26px 16px; text-align:center; margin-bottom:16px; background:#fbfbfc;
}
.scan-box .icon{font-size:30px; margin-bottom:6px;}
.scan-box .t{font-weight:700; font-size:14px;}
.scan-box .d{font-size:13px; color:var(--ink-soft); margin-top:3px;}

.id-note{background:var(--blue-soft); border-radius:10px; padding:10px 12px; font-size:13px; color:#2b5f8a; margin-bottom:14px;}

.procedure-block{border:1px solid var(--line); border-radius:12px; padding:12px; margin-bottom:10px; background:#fbfbfc; position:relative;}
.procedure-block .rm{position:absolute; top:8px; right:8px; border:none; background:#eef0f2; width:22px; height:22px; border-radius:50%; font-size:11px; cursor:pointer;}
.procedure-block .rowlabel{font-size:13px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; margin-bottom:8px;}
.procedure-block.has-error{border-color:var(--red);}

.disclosure{border:1px solid var(--line); border-radius:12px; margin-bottom:12px; overflow:hidden;}
.disclosure > summary{list-style:none; padding:12px 14px; font-weight:600; font-size:14px; cursor:pointer; display:flex; justify-content:space-between; align-items:center; background:#fafbfc;}
.disclosure > summary::-webkit-details-marker{display:none;}
.disclosure[open] > summary{border-bottom:1px solid var(--line);}
.disclosure .inner{padding:12px 14px;}
.opt-field{padding:9px 0; border-bottom:1px dashed var(--line);}
.opt-field:last-child{border-bottom:none;}
.opt-field .row{display:flex; justify-content:space-between; align-items:center;}
.opt-field .t{font-size:14px; font-weight:600;}
.opt-field .unlock{font-size:13px; color:var(--accent);}
.opt-field .sub-input{margin-top:8px;}
.toggle{width:38px; height:22px; border-radius:99px; background:#dbe0e4; position:relative; flex-shrink:0; cursor:pointer;}
.toggle::after{content:""; position:absolute; width:18px; height:18px; border-radius:50%; background:#fff; top:2px; left:2px; transition:.15s;}
.toggle.on{background:var(--accent);}
.toggle.on::after{left:18px;}

.cons-group-heading{font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--ink-soft); margin:14px 0 4px;}
.cons-group-heading:first-child{margin-top:0;}
.cons-row{display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed var(--line);}
.cons-row:last-child{border-bottom:none;}
.cons-row .t{font-size:14px; font-weight:600;}
.checkbox{width:22px; height:22px; border-radius:6px; border:1.5px solid var(--line); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:13px; color:#fff; background:#fff;}
.checkbox.checked{background:var(--accent); border-color:var(--accent);}
.stepper{display:flex; align-items:center; gap:10px;}
.stepper button{width:26px; height:26px; border-radius:7px; border:1px solid var(--line); background:#fff; font-size:15px; cursor:pointer; line-height:1;}
.stepper .qty{min-width:18px; text-align:center; font-weight:700; font-size:13.5px;}

.fee-row{display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px dashed var(--line); font-size:14px;}
.fee-row input{width:110px; text-align:right;}
.fee-row.readonly{color:var(--ink-soft);}
.fee-row.readonly .val{font-weight:700; color:var(--ink); width:110px; text-align:right; display:inline-block;}
.fee-total{display:flex; justify-content:space-between; padding:10px 0 0; font-weight:700; font-size:15px;}

.exception-item{border-left:3px solid var(--red); background:var(--card); border-radius:0 12px 12px 0; padding:12px 14px; margin-bottom:10px; border-top:1px solid var(--line); border-right:1px solid var(--line); border-bottom:1px solid var(--line);}
.exception-item.amber{border-left-color:var(--amber);}
.exception-item .t{font-weight:600; font-size:13.5px;}
.exception-item .d{font-size:12.5px; color:var(--ink-soft); margin-top:3px;}
.exception-item .actions{margin-top:8px; display:flex; gap:8px;}
.exception-item .actions button{font-size:12px; padding:6px 10px; border-radius:7px; border:1px solid var(--line); background:#fff; cursor:pointer;}

.lockcard{position:relative; opacity:.55;}
.lockcard .badge{position:absolute; top:12px; right:12px; font-size:11px; background:#eef0f2; color:var(--ink-soft); padding:3px 8px; border-radius:99px;}

.qr-mock{width:110px; height:110px; margin:10px auto; background:
   repeating-linear-gradient(0deg, #1b2430 0 6px, #fff 6px 12px),
   repeating-linear-gradient(90deg, #1b2430 0 6px, transparent 6px 12px);
   background-blend-mode:multiply; border-radius:8px; border:1px solid var(--line);}

.bank-box{background:var(--blue-soft); border-radius:10px; padding:12px 14px; font-size:13px; margin-top:8px;}
.bank-box .row{display:flex; justify-content:space-between; padding:3px 0;}
.bank-box .row .k{color:var(--ink-soft);}

nav.tabbar{
  position:sticky; bottom:0; background:var(--card); border-top:1px solid var(--line);
  display:flex; padding:8px 6px calc(8px + env(safe-area-inset-bottom));
}
nav.tabbar button{
  flex:1; background:none; border:none; display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:6px 2px; font-size:11px; color:var(--ink-soft); cursor:pointer; border-radius:10px;
}
nav.tabbar button .ic{font-size:19px;}
nav.tabbar button.active{color:var(--accent); font-weight:700;}

.roadmap{margin-top:26px; padding:12px 14px; border:1px dashed var(--line); border-radius:12px; font-size:12px; color:var(--ink-soft);}
.roadmap b{color:var(--ink);}

.modal-backdrop{
  position:fixed; inset:0; background:rgba(20,25,30,.45); display:none; align-items:flex-end; justify-content:center; z-index:20;
}
.modal-backdrop.open{display:flex;}
.modal{
  background:#fff; width:100%; max-width:430px; border-radius:18px 18px 0 0; padding:20px 20px calc(20px + env(safe-area-inset-bottom));
  max-height:85vh; overflow-y:auto;
}
.modal .close{float:right; border:none; background:#eef0f2; width:28px; height:28px; border-radius:50%; font-size:14px; cursor:pointer;}
.modal h2{margin:0 0 2px; font-size:17px;}
.modal .sub{font-size:12.5px; color:var(--ink-soft); margin-bottom:14px;}
.invoice-line{display:flex; justify-content:space-between; padding:6px 0; font-size:13.5px; border-bottom:1px dashed var(--line);}
.invoice-total{display:flex; justify-content:space-between; padding:10px 0 0; font-size:15px; font-weight:700;}

/* Dev-tools bar (2026-07-08) — replaces the old position:fixed mock-flag/
   devTools/googleSyncWidget trio, which overlapped the header/form on a
   real phone viewport (no spare desktop-mockup margin to float in). Now
   sits in normal flow above the header, wrapping instead of overlapping. */
.dev-bar{
  display:flex; flex-direction:column; gap:6px; padding:8px 10px;
  background:#eef0f3; border-bottom:1px solid var(--line);
}
.mock-flag{
  align-self:flex-start; background:#1b2430; color:#fff; font-size:10.5px;
  padding:4px 9px; border-radius:99px; opacity:.85; letter-spacing:.03em;
}
.dev-bar-row{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.dev-pill{
  font-size:10.5px; padding:4px 9px; border-radius:99px; border:1px solid #1b2430;
  background:#fff; color:#1b2430; cursor:pointer; opacity:.85; white-space:nowrap;
}
.dev-pill-danger{ border-color:#b3413a; color:#b3413a; }

/* Stage 2.3 additions: save-confirmation toast, inline field errors, and the
   Manage-consumables catalog rows. */

.toast{
  position:fixed; left:50%; bottom:90px; transform:translate(-50%, 12px);
  background:var(--ink); color:#fff; padding:10px 18px; border-radius:99px;
  font-size:13px; font-weight:600; opacity:0; pointer-events:none;
  transition:opacity .2s ease, transform .2s ease; z-index:40; max-width:88%; text-align:center;
}
.toast.show{opacity:1; transform:translate(-50%, 0);}

.field-error-msg{margin-top:6px;}

.catalog-row{border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:8px; background:#fbfbfc;}
.catalog-row.inactive{opacity:.55;}
.catalog-row .top{display:flex; gap:8px; margin-bottom:6px;}
.catalog-row .top input[type=text]{flex:2;}
.catalog-row .top input[type=number]{flex:1; text-align:right;}
.catalog-row .meta-row{font-size:11px; color:var(--ink-soft); margin-bottom:8px;}
.catalog-row .actions{display:flex; gap:8px;}
.catalog-row .actions button{flex:1; font-size:12px; padding:7px 10px; border-radius:7px; border:1px solid var(--line); background:#fff; cursor:pointer;}
.catalog-row .actions button.retire{color:var(--red); border-color:var(--red);}
.catalog-row .actions button.reactivate{color:var(--accent); border-color:var(--accent);}

/* Ledger date-range controls (2026-07-05) — these inputs sit outside the
   Capture <form>, so they need their own rule rather than relying on the
   "form input[type=date]" selector above. */
#ledgerCustomRange input[type=date]{
  padding:10px 12px; border:1px solid var(--line); border-radius:9px; font-size:14px; background:#fff; color:var(--ink); font-family:inherit; flex:1;
}

/* One-tap chip select (Delay cause, 2026-07-05) */
.chip-row{display:flex; gap:8px; flex-wrap:wrap;}
.chip{padding:8px 14px; border-radius:99px; border:1px solid var(--line); background:#fff; font-size:14px; font-weight:600; cursor:pointer; color:var(--ink-soft); font-family:inherit;}
.chip.selected{background:var(--accent); border-color:var(--accent); color:#fff;}

/* Stage 8 Analytics (2026-07-08) — generic row/label styles for the
   benchmark/surgeon-profile/time-yield/punctuality cards' list content,
   plus per-bucket trend grouping. */
#screen-analytics .row{display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:12.5px; padding:5px 0; border-bottom:1px solid var(--line);}
#screen-analytics .row:last-child{border-bottom:none;}
#screen-analytics .rowlabel{font-size:11.5px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; margin:10px 0 4px;}
#screen-analytics .trend-bucket{margin-top:10px; padding-top:10px; border-top:1px dashed var(--line);}
#screen-analytics .trend-bucket:first-child{margin-top:0; padding-top:0; border-top:none;}

/* Combined-sitting TOSP group (2026-07-08) — the third autocomplete option
   and the badge shown on a procedure row once picked. */
.opt.opt-combined{font-weight:600; color:var(--accent); border-bottom:1px dashed var(--line);}
.combined-badge{color:var(--accent); margin-top:4px;}
