:root {
  --ink:#0f172a; --muted:#64748b; --line:#e2e8f0; --line2:#cbd5e1;
  --teal:#0d9488; --teal-d:#0f766e; --teal-l:#ccfbf1;
  --amber:#b45309; --amber-bg:#fef3c7; --danger:#b91c1c;
  --page:#eef2f6; --stage:#d9e0e8;
  --shadow:0 1px 3px rgba(15,23,42,.08),0 6px 20px rgba(15,23,42,.05);
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; }
body {
  background:var(--page); color:var(--ink);
  font-family:'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  display:flex; flex-direction:column; -webkit-font-smoothing:antialiased;
}
.cond { font-family:'Arial Narrow', Arial, sans-serif; }

/* ============ header ============ */
header.app {
  flex:none; background:linear-gradient(120deg,#0f766e,#0d9488); color:#fff;
  padding:10px 22px; display:flex; align-items:center; gap:16px;
}
.logopill { background:#fff; border-radius:10px; padding:6px 12px; display:inline-flex; align-items:center; box-shadow:0 2px 8px rgba(0,0,0,.18); }
.logopill img { height:34px; display:block; }
.titleblock .centername {
  font-family:"Goudy Old Style","Hoefler Text",Georgia,"Times New Roman",serif;
  font-size:27px; font-weight:600; letter-spacing:.8px; line-height:1.05;
  text-shadow:0 1px 3px rgba(0,0,0,.18);
}
.titleblock .subtitle { font-size:11px; letter-spacing:.32em; text-transform:uppercase; font-weight:600; opacity:.92; margin-top:3px; }
.headactions { margin-left:auto; display:flex; align-items:center; gap:10px; visibility:hidden; min-width:0; }
body.hasday .headactions { visibility:visible; }
#fileinfo {
  background:rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.35); color:#fff;
  border-radius:999px; padding:5px 14px; font-size:12.5px; max-width:360px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
#warnings { display:none; background:var(--amber-bg); color:var(--amber); border-radius:999px; padding:5px 12px; font-size:12px; font-weight:700; cursor:help; }

/* ============ buttons ============ */
.btn {
  font:inherit; font-size:13px; font-weight:700; color:#334155; background:#fff;
  border:1px solid var(--line2); border-radius:8px; padding:7px 14px; cursor:pointer; transition:.12s;
  white-space:nowrap;
}
.btn:hover { border-color:var(--teal); background:var(--teal-l); color:var(--teal-d); }
.btn.primary { background:var(--teal); border-color:var(--teal-d); color:#fff; }
.btn.primary:hover { background:var(--teal-d); color:#fff; }
.btn.nav { padding:5px 11px; }
.btn.light { background:rgba(255,255,255,.14); border-color:rgba(255,255,255,.45); color:#fff; }
.btn.light:hover { background:rgba(255,255,255,.28); color:#fff; border-color:#fff; }

/* ============ landing ============ */
#screen-drop { flex:1; min-height:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; padding:28px; }
.dropcard {
  background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow);
  padding:30px 34px 26px; width:min(640px, 94vw); text-align:center;
}
#dropzone { border:3px dashed var(--line2); border-radius:14px; padding:42px 26px 38px; cursor:pointer; transition:.15s; }
#dropzone:hover, #dropzone.over { border-color:var(--teal); background:#f0fdfa; }
#dropzone .big { font-size:21px; font-weight:800; margin-top:12px; }
#dropzone .small { font-size:13.5px; color:var(--muted); margin-top:8px; line-height:1.55; }
#btndrive { display:none; margin-top:16px; font-size:14px; padding:9px 20px; }
#privacy {
  background:#dcfce7; color:#166534; border-radius:12px; padding:9px 20px;
  font-size:12.5px; line-height:1.55; text-align:center;
}
#droperr { display:none; background:#fee2e2; color:#b91c1c; border:1px solid #fecaca; padding:10px 18px; border-radius:10px; font-size:13.5px; max-width:640px; font-weight:600; }
#fileinput { display:none; }

/* ============ viewer ============ */
#screen-preview { flex:1; min-height:0; display:none; flex-direction:column; }
#mainrow { flex:1; min-height:0; display:flex; }

#sidebar { flex:none; width:300px; background:#fff; border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:0; }
.sidehead {
  flex:none; padding:10px 16px; font-size:11px; letter-spacing:.14em; font-weight:800;
  color:var(--teal-d); text-transform:uppercase; border-bottom:1px solid var(--line);
  background:linear-gradient(90deg,var(--teal-l),transparent);
}
#patientlist { flex:1; overflow-y:auto; min-height:0; }
.plitem {
  display:flex; align-items:center; gap:8px; padding:8px 10px 8px 12px;
  border-bottom:1px solid #f1f5f9; border-left:4px solid transparent; cursor:pointer;
}
.plitem:hover { background:#f1f5f9; }
.plitem.active { background:var(--teal-l); border-left-color:var(--teal); }
.pl-time { flex:none; width:48px; font-size:12.5px; font-weight:800; color:var(--teal-d); }
.pl-name { flex:1; min-width:0; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pl-name b { font-weight:800; }
.pl-badges { flex:none; display:flex; align-items:center; gap:4px; }
.plb { font-size:9.5px; font-weight:800; border:1px solid var(--line2); border-radius:5px; padding:1px 5px; color:#475569; }
.plb.ord2 { background:#0f172a; border-color:#0f172a; color:#fff; }
.plb.alert { background:var(--amber-bg); border-color:var(--amber); color:var(--amber); }
.plb.flagdot { width:9px; height:9px; border-radius:50%; background:var(--danger); border:none; padding:0; }
.plb.surg { background:var(--teal-l); border-color:var(--teal); color:var(--teal-d); max-width:112px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidetip { flex:none; padding:8px 16px; font-size:10.5px; color:var(--muted); border-top:1px solid var(--line); line-height:1.5; }

#stageside { flex:1; min-width:0; display:flex; flex-direction:column; min-height:0; }
#stagehead { flex:none; display:flex; align-items:center; gap:10px; padding:8px 16px; background:#fff; border-bottom:1px solid var(--line); }
#navpos { color:var(--muted); font-size:13px; min-width:52px; text-align:center; font-weight:700; }
#navname { font-weight:800; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.edithint { margin-left:auto; font-size:11.5px; color:var(--muted); padding-right:4px; }

#stage { flex:1; min-height:0; overflow:auto; display:flex; align-items:flex-start; justify-content:center; background:var(--stage); }
#sheets { transform-origin:top center; margin:16px 0; }
#sheets.measuring .sheet { display:flex !important; position:absolute; top:0; left:0; visibility:hidden; }

/* ============ the printed sheet (Mockup A2 v2 — layout locked) ============ */
.sheet {
  width:10.45in; height:7.96in; background:#fff; padding:0.22in;
  display:none; flex-direction:column; overflow:hidden;
  box-shadow:0 4px 20px rgba(15,23,42,.28);
}
.sheet.current { display:flex; }
.sheet[contenteditable]:focus { outline:3px dashed rgba(13,148,136,.55); outline-offset:4px; }

.cell { border:2.5px solid #000; min-width:0; display:flex; flex-direction:column; }
.hd {
  background:#d6d6d6; color:#000; font-weight:800; font-size:13px; letter-spacing:2px;
  padding:2px 10px; -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.bd { padding:4px 12px 6px; flex:1; min-height:0; }

.toprow { flex:none; display:flex; align-items:stretch; gap:12px; }
.timebox .bd { text-align:center; padding:3px 12px 5px; }
.timeval { font-size:46px; font-weight:800; letter-spacing:-1px; line-height:1.0; white-space:nowrap; }
.ampm { font-size:24px; font-weight:800; letter-spacing:2px; margin-top:1px; }
.pname { flex:1; align-self:center; font-size:66px; line-height:1.02; font-weight:800; letter-spacing:-1px; white-space:nowrap; overflow:hidden; }
.pname .first { font-weight:400; }
.dobbox .bd {
  text-align:center; padding:3px 14px 5px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
}
.dobval { font-size:34px; font-weight:800; line-height:1.05; white-space:nowrap; }
.ageval { font-size:26px; font-weight:800; margin-top:2px; }

.alertbar {
  flex:none; margin-top:7px; padding:5px 12px; text-align:center;
  border:4px dashed #000; font-size:20px; font-weight:800; white-space:nowrap; overflow:hidden;
}
.alertbar .who { font-weight:400; }

.eyebanner {
  flex:none; margin-top:7px; background:#000; color:#fff; display:flex; align-items:center;
  padding:6px 16px; -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.eyename { flex:1; font-size:47px; font-weight:800; letter-spacing:2px; line-height:1.0; }
.order { flex:none; font-size:28px; font-weight:800; white-space:nowrap; }
.order.second { background:#fff; color:#000; padding:3px 15px; }

.strip { flex:none; display:flex; gap:10px; margin-top:7px; }
.strip .cell { flex:1; }
.surgrow { display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; }
.surgval { font-size:42px; font-weight:800; line-height:1.06; }
.chip { font-size:17px; font-weight:800; border:2.5px solid #000; padding:2px 9px; white-space:nowrap; }
.lensval { font-size:47px; font-weight:800; letter-spacing:-1px; white-space:nowrap; line-height:1.02; }
.lenssub { display:inline-block; font-size:17px; margin-left:2px; }

.arow { display:flex; align-items:baseline; flex-wrap:wrap; gap:6px 14px; }
.aflag { font-size:30px; font-weight:800; border:3.5px solid #000; padding:2px 12px; }
.aflag::before { content:"⚠ "; }
.aother { font-size:20px; }
.nkda { font-size:30px; }
.nkda small { font-size:16px; color:#222; }

.dropscell { flex:1.15; }
.dropsval { font-size:30px; font-weight:800; white-space:nowrap; }
.sub { font-size:14px; color:#222; margin-top:1px; }
.mchips { display:flex; flex-wrap:wrap; gap:6px; }
.mchip { font-size:21px; font-weight:800; border:2.5px solid #000; padding:2px 10px; }
.mchip.inv { background:#000; color:#fff; -webkit-print-color-adjust:exact; print-color-adjust:exact; }

.poline { white-space:nowrap; }
.poline .office { font-size:34px; font-weight:800; }
.poline .dt { font-size:32px; font-weight:800; }
.poline .posub { font-size:15px; color:#222; }

.plancell { flex:1 1 auto; min-height:0; margin-top:7px; overflow:hidden; }
.bd.plansplit { padding:0; display:flex; align-items:stretch; }
.plansplit .planmain { flex:1; min-width:0; padding:4px 12px 6px; }
.plantext { font-size:22px; line-height:1.42; }
.plantext .lead { font-weight:800; font-size:24px; }
.plantext .sep { font-weight:800; padding:0 5px; }
.plantext .poss { font-style:italic; }
.plantext .warnseg { font-weight:800; }
.plantext .flagchip { font-weight:800; background:#000; color:#fff; padding:1px 9px; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
.plantext .goal { font-weight:800; border:2.5px solid #000; padding:1px 9px; white-space:nowrap; }
.lensxcol { flex:none; width:3.1in; border-left:2.5px solid #000; display:flex; flex-direction:column; }
.lensxcol .lhd {
  background:#d6d6d6; color:#000; font-weight:800; font-size:13px; letter-spacing:2px;
  padding:2px 10px; -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.lensxcol .lbd { padding:3px 10px 5px; flex:1; min-height:0; overflow:hidden; }
.lensxcol .arcs { font-size:22px; font-weight:800; }
.lensxcol .d { font-size:15px; margin-top:1px; }
.lensxcol .smart { display:inline-block; margin-top:2px; font-size:11px; font-weight:800; border:2px solid #000; padding:1px 6px; letter-spacing:1px; }

/* ============ vertical compaction tiers (added by fitSheet when needed) ============ */
.sheet.compact1 .plantext { font-size:19px; line-height:1.35; }
.sheet.compact1 .plantext .lead { font-size:21px; }
.sheet.compact1 .aflag { font-size:26px; }
.sheet.compact1 .aother { font-size:17px; }
.sheet.compact1 .nkda { font-size:26px; }
.sheet.compact1 .surgval { font-size:38px; }
.sheet.compact1 .lensval { font-size:42px; }
.sheet.compact1 .dropsval { font-size:26px; }
.sheet.compact1 .eyename { font-size:42px; }
.sheet.compact1 .alertbar { font-size:17px; }
.sheet.compact1 .poline .dt { font-size:28px; }
.sheet.compact1 .poline .office { font-size:30px; }
.sheet.compact1 .mchip { font-size:18px; }
.sheet.compact1 .chip { font-size:15px; }

.sheet.compact2 .plantext { font-size:16px; line-height:1.3; }
.sheet.compact2 .plantext .lead { font-size:18px; }
.sheet.compact2 .aflag { font-size:22px; border-width:2.5px; }
.sheet.compact2 .aother { font-size:15px; }
.sheet.compact2 .nkda { font-size:22px; }
.sheet.compact2 .timeval { font-size:40px; }
.sheet.compact2 .dobval { font-size:29px; }
.sheet.compact2 .ageval { font-size:22px; }
.sheet.compact2 .eyename { font-size:38px; }
.sheet.compact2 .eyebanner { padding:4px 16px; }
.sheet.compact2 .bd { padding:3px 10px 4px; }
.sheet.compact2 .hd { font-size:11px; padding:1px 10px; }
.sheet.compact2 .surgval { font-size:32px; }
.sheet.compact2 .lensval { font-size:36px; }
.sheet.compact2 .lensxcol .arcs { font-size:19px; }
.sheet.compact2 .lensxcol .d { font-size:13px; }
.sheet.compact3 .lensxcol .arcs { font-size:16px; }
.sheet.compact3 .lensxcol { width:2.7in; }

.sheet.compact3 .plantext { font-size:14px; line-height:1.25; }
.sheet.compact3 .plantext .lead { font-size:15px; }
.sheet.compact3 .aflag { font-size:18px; padding:1px 8px; }
.sheet.compact3 .aother { font-size:13px; }
.sheet.compact3 .eyename { font-size:32px; }
.sheet.compact3 .surgval { font-size:26px; }
.sheet.compact3 .lensval { font-size:30px; }
.sheet.compact3 .dropsval { font-size:21px; }
.sheet.compact3 .poline .dt { font-size:23px; }
.sheet.compact3 .poline .office { font-size:25px; }
.sheet.compact3 .strip { margin-top:5px; }
.sheet.compact3 .toprow { gap:8px; }
.sheet.compact3 .timeval { font-size:34px; }
.sheet.compact3 .ampm { font-size:18px; }

/* ============ print ============ */
@page { size: letter landscape; margin:0.24in; }
@media print {
  html, body { height:auto; background:#fff; display:block; }
  header.app, #screen-drop, #sidebar, #stagehead { display:none !important; }
  #screen-preview { display:block !important; height:auto; }
  #mainrow, #stageside { display:block !important; height:auto; min-height:0; }
  #stage { overflow:visible; display:block; background:#fff; }
  #sheets { transform:none !important; margin:0; }
  .sheet { display:flex !important; box-shadow:none; break-after:page; outline:none !important; }
  .sheet:last-child { break-after:auto; }
  body.print-one .sheet:not(.current) { display:none !important; }
}
