
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #123f45; --navy2: #1d6970;
  --blue-light: #edf7f6; --blue-mid: #b8dcd8;
  --green: #0f5132; --green-light: #d1e7dd;
  --amber: #7a4f00; --amber-light: #fff3cd;
  --red: #842029; --red-light: #f8d7da;
  --purple-light: #f0eaff; --purple: #5b21b6;
  --border: #dce7e5; --text: #172927;
  --text2: #536865; --text3: #788d89;
  --surface: #ffffff; --surface-muted: #f5f9f8;
  --shadow: 0 1px 2px rgba(18,63,69,0.04), 0 10px 28px rgba(18,63,69,0.055);
}
body { font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:#f3f7f6; min-height:100vh; color:var(--text); font-size:14px; line-height:1.5; }

/* HEADER */
#hdr { background:rgba(18,63,69,0.98); height:68px; display:flex; align-items:center; padding:0 32px; justify-content:space-between; position:sticky; top:0; z-index:50; box-shadow:0 8px 24px rgba(12,48,52,0.16); backdrop-filter:blur(12px); }
#logo { font-size:17px; font-weight:800; color:white; letter-spacing:-0.4px; display:flex; align-items:center; gap:10px; }
#logo-icon { width:32px; height:32px; background:#e9f6f3; color:var(--navy); border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:15px; }
#logo span { color:#8fd7ce; }
#hdr-meta { font-size:11px; color:rgba(255,255,255,0.7); display:flex; align-items:center; gap:10px; }

/* MAIN LAYOUT */
#wrap { max-width:1680px; margin:0 auto; padding:24px 26px 72px; display:grid; grid-template-columns:minmax(360px, 430px) minmax(0, 1fr); gap:20px; align-items:start; }

/* LEFT */
#left { display:flex; flex-direction:column; gap:0; position:sticky; top:70px; }
.type-tabs { display:flex; gap:0; }
.ntab { flex:1; padding:11px 10px; border:1px solid var(--border); border-bottom:none; background:#eaf1f0; color:var(--text2); font-size:12px; font-weight:650; cursor:pointer; font-family:inherit; transition:all 0.15s; text-align:center; }
.ntab:first-child { border-radius:10px 0 0 0; }
.ntab:last-child { border-radius:0 10px 0 0; }
.ntab.on { background:white; color:var(--navy); border-bottom-color:white; z-index:2; position:relative; }
#input-card { background:white; border-radius:0 12px 12px 12px; border:1px solid var(--border); box-shadow:var(--shadow); padding:20px; display:flex; flex-direction:column; }
.input-section { display:flex; flex-direction:column; }
.input-section + .input-section { margin-top:14px; }
.inp-label { font-size:10px; font-weight:750; color:var(--text3); text-transform:uppercase; letter-spacing:0.85px; padding:9px 12px; background:var(--surface-muted); border:1px solid var(--border); border-bottom:none; border-radius:8px 8px 0 0; display:flex; align-items:center; gap:7px; }
.lbl-hint { font-size:10px; color:#b0a8a0; font-weight:400; margin-left:auto; font-style:italic; }
.inp-area { width:100%; border:1px solid var(--border); border-top:none; border-radius:0 0 8px 8px; padding:13px 14px; font-family:'SF Mono',ui-monospace,monospace; font-size:12.5px; line-height:1.7; color:var(--text); background:#fbfcfc; resize:vertical; outline:none; transition:border-color 0.15s,background 0.15s,box-shadow 0.15s; min-height:100px; }
.inp-area:focus { border-color:var(--navy2); background:white; }
.inp-area.tall { min-height:160px; }
.connector { width:2px; height:12px; background:var(--border); margin:0 auto; }
#btn-row { margin-top:16px; display:flex; gap:10px; align-items:center; }
#analyze-btn { flex:1; padding:13px 20px; background:var(--navy); color:white; border:none; border-radius:10px; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit; display:flex; align-items:center; justify-content:center; gap:8px; transition:background 0.15s; }
#analyze-btn:hover:not(:disabled) { background:#163d5e; }
#analyze-btn:disabled { background:#9ab0c4; cursor:not-allowed; }
#clear-btn { padding:12px 16px; background:#f4f1ec; color:var(--text2); border:1.5px solid var(--border); border-radius:10px; font-size:13px; cursor:pointer; font-family:inherit; }
#prog { display:none; margin-top:12px; }
#prog.on { display:block; }
#prog-bg { height:3px; background:var(--border); border-radius:3px; overflow:hidden; margin-bottom:5px; }
#prog-fill { height:100%; background:var(--navy2); width:0%; transition:width 0.5s ease; border-radius:3px; }
#prog-txt { font-size:11px; color:var(--text3); }
.assumption-note { margin-top:14px; padding:10px 13px; background:#f4f1ec; border-radius:8px; border:1px solid var(--border); font-size:11.5px; color:var(--text2); line-height:1.6; }

/* RIGHT */
#right { display:flex; flex-direction:column; gap:16px; }
#rev-bar { background:var(--navy); border-radius:14px; padding:16px 22px; display:none; align-items:center; justify-content:space-between; gap:16px; box-shadow:var(--shadow); flex-wrap:wrap; }
#rev-bar.on { display:flex; }
.rev-item { text-align:center; }
.rev-label { font-size:10px; color:rgba(255,255,255,0.45); text-transform:uppercase; letter-spacing:0.7px; margin-bottom:2px; }
.rev-val { font-size:18px; font-weight:800; color:white; }
.rev-val.green { color:#60d090; }
.rev-div { width:1px; height:36px; background:rgba(255,255,255,0.15); }

/* OUTPUT TABS */
.out-tabs { display:flex; gap:0; flex-wrap:wrap; }
.otab { padding:11px 17px; border:1px solid var(--border); border-bottom:none; background:#eaf1f0; color:var(--text2); font-size:12px; font-weight:650; cursor:pointer; font-family:inherit; transition:all 0.15s; white-space:nowrap; }
.otab:first-child { border-radius:10px 0 0 0; }
.otab:last-child { border-radius:0 10px 0 0; }
.otab.on { background:white; color:var(--navy); border-bottom-color:white; z-index:2; position:relative; }
.otab-badge { display:inline-block; background:#c0392b; color:white; border-radius:10px; font-size:9px; font-weight:800; padding:1px 5px; margin-left:4px; vertical-align:middle; }
.out-panel { display:none; }
.out-panel.on { display:flex; flex-direction:column; gap:16px; }

/* CARDS */
.card { background:white; border-radius:14px; border:1px solid var(--border); box-shadow:var(--shadow); overflow:hidden; min-width:0; }
.card-first { border-radius:0 0 14px 14px; }
.card-hdr { padding:14px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:16px; background:#fbfdfc; }
.card-title { font-size:11px; font-weight:750; color:#51616c; text-transform:uppercase; letter-spacing:0.8px; }
.card-body { padding:20px; }

/* SPINNERS / EMPTY */
.empty { text-align:center; padding:42px 20px; color:var(--text3); }
.empty-ico { width:38px; height:38px; margin:0 auto 11px; border-radius:11px; display:flex; align-items:center; justify-content:center; background:var(--blue-light); color:var(--navy2); font-size:11px; font-weight:800; letter-spacing:0.4px; }
.empty-ttl { font-size:13px; font-weight:600; color:var(--text2); margin-bottom:4px; }
.empty-sub { font-size:11.5px; }
.spin-wrap { display:flex; align-items:center; gap:10px; padding:24px 0; color:var(--text3); font-size:13px; }
.spin { width:18px; height:18px; border:2.5px solid var(--border); border-top-color:var(--navy2); border-radius:50%; animation:spin 0.7s linear infinite; flex-shrink:0; }
@keyframes spin { to { transform:rotate(360deg); } }

/* E&M */
.em-level-box { background:var(--navy); border-radius:10px; padding:16px 18px; margin-bottom:14px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.em-code { font-size:28px; font-weight:800; color:white; letter-spacing:-1px; }
.em-desc { font-size:12px; color:rgba(255,255,255,0.7); margin-top:2px; }
.em-cx-label { font-size:10px; color:rgba(255,255,255,0.5); text-transform:uppercase; letter-spacing:0.6px; }
.em-cx-val { font-size:16px; font-weight:700; color:#60d090; }
.em-upgrade { background:#1a5c30; border:1.5px solid #2a8040; border-radius:10px; padding:13px 16px; margin-bottom:14px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.em-upgrade-lbl { font-size:12px; color:#90e8a8; font-weight:600; }
.em-upgrade-val { font-size:20px; font-weight:800; color:#60d090; }
.em-ok { background:var(--green-light); border:1.5px solid #a8d8b8; border-radius:10px; padding:12px 16px; margin-bottom:14px; font-size:13px; color:var(--green); font-weight:600; }
.mdm-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-bottom:14px; }
.mdm-cell { background:#faf8f5; border:1px solid var(--border); border-radius:8px; padding:10px 12px; text-align:center; }
.mdm-lbl { font-size:10px; color:var(--text3); text-transform:uppercase; letter-spacing:0.6px; margin-bottom:4px; font-weight:600; }
.mdm-val { font-size:13px; font-weight:700; }
.hi { color:#c0392b; } .mo { color:#e67e22; } .lo { color:#27ae60; }
.em-act-title { font-size:11px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:0.7px; margin-bottom:8px; }
.em-act-item { display:flex; align-items:flex-start; gap:8px; padding:7px 0; border-bottom:1px solid #f0ede8; font-size:13px; color:var(--text2); line-height:1.5; }
.em-act-item:last-child { border-bottom:none; }
.dot-g { width:7px; height:7px; border-radius:50%; background:#2ecc71; margin-top:5px; flex-shrink:0; }
.dot-a { width:7px; height:7px; border-radius:50%; background:#f39c12; margin-top:5px; flex-shrink:0; }
.dot-r { width:7px; height:7px; border-radius:50%; background:#e74c3c; margin-top:5px; flex-shrink:0; }

/* CDI ALERTS */
.alert-block { border-radius:9px; padding:12px 14px; margin-bottom:8px; font-size:13px; line-height:1.55; }
.alert-block:last-child { margin-bottom:0; }
.alert-title { font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:0.6px; margin-bottom:4px; display:flex; align-items:center; gap:5px; }
.alert-action { font-size:12px; font-weight:600; margin-top:5px; padding-top:5px; border-top:1px solid rgba(0,0,0,0.08); }
.a-red   { background:var(--red-light); border-left:3px solid #c0392b; color:#5a1018; }
.a-amber { background:var(--amber-light); border-left:3px solid #e0a020; color:#5a3800; }
.a-blue  { background:var(--blue-light); border-left:3px solid #2a7abf; color:#0f3060; }
.a-purple { background:var(--purple-light); border-left:3px solid #7c3aed; color:#3b0764; }

/* SEPSIS PANEL */
.sepsis-panel { background:white; border:1.5px solid var(--border); border-radius:12px; overflow:hidden; margin-bottom:8px; }
.sepsis-hdr { background:var(--navy); padding:12px 16px; display:flex; align-items:center; justify-content:space-between; cursor:pointer; }
.sepsis-hdr-title { color:white; font-size:12px; font-weight:700; display:flex; align-items:center; gap:8px; }
.sepsis-hdr-toggle { color:rgba(255,255,255,0.6); font-size:11px; }
.sepsis-body { padding:14px 16px; display:none; }
.sepsis-body.open { display:block; }
.sepsis-cols { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.sepsis-col-title { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:0.8px; color:var(--text3); margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.criteria-row { display:flex; align-items:flex-start; gap:8px; padding:5px 0; font-size:12px; color:var(--text2); line-height:1.4; border-bottom:1px dashed #f0ede8; }
.criteria-row:last-child { border-bottom:none; }
.crit-met { color:#16a34a; font-size:14px; flex-shrink:0; margin-top:1px; }
.crit-miss { color:#d97706; font-size:14px; flex-shrink:0; margin-top:1px; }
.crit-unk { color:#9ca3af; font-size:14px; flex-shrink:0; margin-top:1px; }
.sepsis-verdict { margin-top:10px; padding:10px 12px; border-radius:8px; font-size:12px; font-weight:600; }
.sv-met { background:#dcfce7; border:1px solid #86efac; color:#14532d; }
.sv-partial { background:var(--amber-light); border:1px solid #fcd34d; color:#78350f; }
.sv-unmet { background:#fef2f2; border:1px solid #fca5a5; color:#7f1d1d; }
.sepsis-denial-tip { margin-top:8px; padding:8px 10px; background:var(--blue-light); border-radius:6px; font-size:11.5px; color:var(--navy2); line-height:1.5; }

/* DRG */
.drg-compare { display:grid; grid-template-columns:1fr auto 1fr; gap:10px; align-items:center; margin-bottom:14px; }
.drg-box { border-radius:10px; padding:13px 14px; text-align:center; }
.drg-cur { background:#faf8f5; border:1.5px solid var(--border); }
.drg-opt { background:var(--blue-light); border:1.5px solid var(--blue-mid); }
.drg-num { font-size:22px; font-weight:800; color:var(--navy); }
.drg-desc { font-size:11px; color:var(--text3); margin-top:2px; line-height:1.4; }
.drg-lbl { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.6px; color:var(--text3); margin-bottom:4px; }
.drg-arrow { font-size:20px; color:var(--text3); text-align:center; }
.drg-impact { background:var(--navy); border-radius:10px; padding:13px 16px; display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.drg-impact-lbl { font-size:12px; color:rgba(255,255,255,0.6); }
.drg-impact-val { font-size:22px; font-weight:800; color:#60d090; }
.drg-gmlos { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:14px; }
.gmlos-box { background:#faf8f5; border:1px solid var(--border); border-radius:8px; padding:10px 12px; text-align:center; }
.gmlos-lbl { font-size:10px; color:var(--text3); text-transform:uppercase; letter-spacing:0.6px; margin-bottom:3px; font-weight:600; }
.gmlos-val { font-size:18px; font-weight:800; color:var(--navy); }
.gmlos-sub { font-size:10px; color:var(--text3); margin-top:1px; }
.icd-tbl { width:100%; border-collapse:collapse; font-size:12.5px; }
.icd-tbl th { text-align:left; padding:6px 10px; background:#faf8f5; color:var(--text3); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.6px; border-bottom:1px solid var(--border); }
.icd-tbl td { padding:8px 10px; border-bottom:1px solid #f4f1ec; vertical-align:top; }
.icd-tbl tr:last-child td { border-bottom:none; }
.icd-code { font-family:monospace; font-size:12px; font-weight:700; color:var(--navy2); white-space:nowrap; }
.icd-sub { font-size:11px; color:var(--text3); margin-top:1px; }
.badge { display:inline-block; padding:2px 7px; border-radius:4px; font-size:9.5px; font-weight:800; letter-spacing:0.4px; text-transform:uppercase; }
.b-mcc { background:#fde; color:#8b0000; border:1px solid #f0a0a0; }
.b-cc  { background:var(--amber-light); color:var(--amber); border:1px solid #e8c85a; }
.b-pri { background:var(--blue-light); color:var(--navy2); border:1px solid var(--blue-mid); }
.b-sec { background:#f4f1ec; color:var(--text2); border:1px solid var(--border); }
.gap-row { display:flex; align-items:flex-start; gap:8px; padding:7px 0; border-bottom:1px solid #f4f1ec; font-size:12.5px; color:var(--text2); line-height:1.5; }
.gap-row:last-child { border-bottom:none; }
.gap-dot { width:5px; height:5px; border-radius:50%; background:#e0a020; margin-top:6px; flex-shrink:0; }
.sec-lbl { font-size:10.5px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:0.8px; margin-bottom:10px; }

/* A&P */
#ap-card { background:white; border-radius:0 14px 14px 14px; border:1px solid var(--border); box-shadow:var(--shadow); overflow:hidden; }
#ap-hdr { padding:13px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; background:#faf8f5; }
#ap-hdr-left { display:flex; flex-direction:column; gap:2px; }
#ap-hdr-title { font-size:11px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:0.9px; }
#ap-hdr-sub { font-size:11px; color:var(--text3); }
#copy-btn { padding:8px 16px; background:var(--navy); color:white; border:none; border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; display:flex; align-items:center; gap:6px; transition:background 0.15s; }
#copy-btn:hover { background:#163d5e; }
#copy-btn.copied { background:#0f5132; }
#generate-ap-btn { padding:8px 16px; background:#eef7f6; color:var(--navy); border:1px solid var(--blue-mid); border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; }
#generate-ap-btn:hover:not(:disabled) { background:#dff0ee; }
#generate-ap-btn:disabled { cursor:not-allowed; opacity:.65; }
#ap-body { padding:20px; }
#ap-text { font-family:'SF Mono',ui-monospace,monospace; font-size:13px; line-height:1.8; color:var(--text); white-space:pre-wrap; word-break:break-word; }
.ap-suggested { background:#fff8e8; border-left:3px solid #e0a020; padding:10px 14px; margin-top:10px; border-radius:0 6px 6px 0; font-size:13px; line-height:1.7; color:var(--text); }
.ap-suggested-label { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:0.7px; color:#7a4f00; margin-bottom:4px; }
.meat-warning { background:#fff8e8; border:1px solid #fcd34d; border-radius:8px; padding:10px 13px; margin-top:12px; font-size:12px; color:#78350f; line-height:1.5; }
.meat-warning strong { display:block; margin-bottom:3px; font-size:11px; text-transform:uppercase; letter-spacing:0.5px; }

::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:5px; }

/* COPY BTN SMALL */
.copy-btn-sm { padding:5px 12px; background:var(--bg3,#f4f1ec); border:1.5px solid var(--border); border-radius:6px; font-size:11px; color:var(--text2); cursor:pointer; font-family:inherit; transition:all 0.15s; }
.copy-btn-sm:hover { border-color:var(--navy2); color:var(--navy); }
.copy-btn-sm.copied { background:var(--green-light,#d1e7dd); border-color:#a8d8b8; color:var(--green,#0f5132); }

/* DC SUMMARY */
#dc-course-text { font-size:13.5px; line-height:1.9; color:var(--text); font-style:italic; border-left:3px solid var(--navy2,#1a4a6b); padding-left:16px; white-space:pre-wrap; }
.dc-dx-list { list-style:none; padding:0; }
.dc-dx-item { display:flex; align-items:flex-start; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:13px; }
.dc-dx-item:last-child { border-bottom:none; }
.dc-dx-num { font-size:11px; font-weight:700; color:white; background:var(--navy); border-radius:5px; padding:2px 7px; flex-shrink:0; margin-top:1px; font-family:monospace; }
.dc-dx-num.principal { background:var(--navy2,#1a4a6b); }
.dc-dx-name { font-weight:600; color:var(--text); }
.dc-dx-cc { display:inline-block; font-size:9.5px; font-weight:800; padding:1px 6px; border-radius:4px; margin-left:6px; text-transform:uppercase; vertical-align:middle; }
.dc-dx-note { font-size:11.5px; color:var(--text2,#5a5450); margin-top:2px; }

/* LOGIN OVERLAY */
#login-overlay { position:fixed; inset:0; background:var(--navy); z-index:1000; display:flex; align-items:center; justify-content:center; }
#login-overlay.hidden { display:none; }
#login-box { background:white; border-radius:16px; padding:40px 36px; width:340px; box-shadow:0 20px 60px rgba(0,0,0,0.3); text-align:center; }
#login-logo { font-size:22px; font-weight:800; color:var(--navy); margin-bottom:4px; }
#login-logo span { color:var(--navy2); }
#login-sub { font-size:13px; color:var(--text3); margin-bottom:28px; }
#login-input, #login-user { width:100%; padding:12px 14px; border:1.5px solid var(--border); border-radius:10px; font-size:15px; font-family:inherit; outline:none; text-align:center; letter-spacing:3px; margin-bottom:12px; transition:border-color 0.15s; }
#login-input:focus, #login-user:focus { border-color:var(--navy2); }
#login-user { letter-spacing:0; }
#login-btn { width:100%; padding:13px; background:var(--navy); color:white; border:none; border-radius:10px; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit; transition:background 0.15s; }
#login-btn:hover:not(:disabled) { background:#163d5e; }
#login-btn:disabled { background:#9ab0c4; cursor:not-allowed; }
#login-error { font-size:12px; color:#c0392b; margin-top:10px; min-height:18px; }

/* METRICS DASHBOARD */
.met-grid { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; margin-bottom:14px; }
.met-card { background:white; border:1px solid var(--border); border-radius:10px; padding:14px 16px; box-shadow:var(--shadow); }
.met-card.hero { background:var(--navy); color:white; border:none; }
.met-card.green { background:var(--green-light); border-color:#a3cfb5; }
.met-card.amber { background:var(--amber-light); border-color:#e0c97a; }
.met-card.blue { background:var(--blue-light); border-color:var(--blue-mid); }
.met-lbl { font-size:10px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:0.7px; margin-bottom:5px; }
.met-card.hero .met-lbl { color:rgba(255,255,255,0.55); }
.met-val { font-size:22px; font-weight:800; color:var(--navy); letter-spacing:-0.5px; line-height:1.1; }
.met-card.hero .met-val { color:white; font-size:26px; }
.met-card.green .met-val { color:var(--green); }
.met-card.amber .met-val { color:var(--amber); }
.met-card.blue .met-val { color:var(--navy2); }
.met-sub { font-size:10px; color:var(--text3); margin-top:4px; }
.met-card.hero .met-sub { color:rgba(255,255,255,0.5); }
.met-toolbar { display:flex; align-items:center; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.met-filter { display:flex; gap:0; }
.met-fbtn { padding:6px 12px; border:1.5px solid var(--border); background:white; color:var(--text2); font-size:11px; font-weight:600; cursor:pointer; font-family:inherit; }
.met-fbtn:first-child { border-radius:8px 0 0 8px; }
.met-fbtn:last-child { border-radius:0 8px 8px 0; }
.met-fbtn:not(:first-child) { border-left:none; }
.met-fbtn.on { background:var(--navy); color:white; border-color:var(--navy); }
.met-action { padding:6px 12px; background:white; border:1.5px solid var(--border); border-radius:8px; font-size:11px; font-weight:600; color:var(--text2); cursor:pointer; font-family:inherit; }
.met-action:hover { background:#f4f1ec; }
.met-action.danger { color:#c0392b; border-color:#f0a0a0; }
.met-action.danger:hover { background:#fde; }
.met-action.primary { background:var(--navy); color:white; border-color:var(--navy); }
.met-action.primary:hover { background:#163d5e; }
.met-spacer { flex:1; }
.met-bar-row { display:flex; align-items:center; gap:10px; margin-bottom:7px; font-size:12px; }
.met-bar-lbl { width:180px; flex-shrink:0; color:var(--text); font-weight:600; font-size:12px; }
.met-bar-track { flex:1; height:18px; background:#f4f1ec; border-radius:4px; overflow:hidden; }
.met-bar-fill { height:100%; background:linear-gradient(90deg, var(--navy2), var(--navy)); border-radius:4px; transition:width 0.4s; }
.met-bar-val { width:90px; text-align:right; font-size:11px; color:var(--text2); font-weight:600; flex-shrink:0; }
.met-table { width:100%; border-collapse:collapse; font-size:12px; }
.met-table th { text-align:left; padding:8px 10px; font-size:10px; text-transform:uppercase; letter-spacing:0.5px; color:var(--text3); font-weight:700; background:#faf8f5; border-bottom:1.5px solid var(--border); }
.met-table td { padding:8px 10px; border-bottom:1px solid var(--border); color:var(--text); }
.met-table tr:hover td { background:#faf8f5; }
.met-table .tnum { font-family:'SF Mono',ui-monospace,monospace; font-size:11px; }
.met-table .tg { color:var(--green); font-weight:700; }
.met-empty { text-align:center; padding:48px 20px; color:var(--text3); }
.met-empty-ico { font-size:32px; margin-bottom:10px; }
.met-empty-ttl { font-size:14px; font-weight:700; color:var(--text2); margin-bottom:4px; }
.met-empty-sub { font-size:12px; }
.met-pitch-banner { background:linear-gradient(135deg, var(--navy), var(--navy2)); color:white; border-radius:12px; padding:14px 18px; margin-bottom:14px; display:flex; align-items:center; gap:14px; }
.met-pitch-ico { font-size:22px; }
.met-pitch-text { flex:1; font-size:12px; line-height:1.5; color:rgba(255,255,255,0.92); }
.met-pitch-text strong { color:white; font-weight:800; }
@media (max-width: 1100px) { .met-grid { grid-template-columns:repeat(2, 1fr); } }
@media (max-width: 1050px) {
  #wrap { grid-template-columns:1fr; padding:22px 20px 56px; }
  #left { position:static; }
  #apgen-freeform { min-height:260px !important; }
}
@media (min-width: 1250px) {
  #panel-analysis.on { display:grid; grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr); gap:14px; align-items:start; }
  #panel-analysis .card-first { grid-row:span 2; border-radius:0 0 14px 14px; }
  #panel-analysis .card:not(.card-first) { border-radius:14px; }
}
@media (max-width: 680px) {
  #hdr { height:56px; padding:0 16px; }
  #hdr-meta { display:none; }
  #wrap { padding:16px 12px 40px; gap:16px; }
  #input-card { padding:14px; }
  .type-tabs,.out-tabs { overflow-x:auto; flex-wrap:nowrap; scrollbar-width:none; }
  .type-tabs::-webkit-scrollbar,.out-tabs::-webkit-scrollbar { display:none; }
  .ntab,.otab { flex:0 0 auto; min-width:max-content; }
  .type-tabs .ntab { flex:1 1 50%; }
  .card-hdr { align-items:flex-start; flex-direction:column; gap:3px; }
  .card-body { padding:15px; }
  .mdm-grid,.sepsis-cols,.drg-gmlos { grid-template-columns:1fr; }
  .drg-compare { grid-template-columns:1fr; }
  .drg-arrow { transform:rotate(90deg); }
  #rev-bar { display:none !important; }
  .met-grid { grid-template-columns:1fr; }
  .met-toolbar { align-items:stretch; }
  .met-filter { overflow-x:auto; }
  #login-box { width:calc(100% - 28px); padding:34px 24px; }
}

.ui-icon { width:18px; height:18px; border-radius:5px; display:inline-flex; align-items:center; justify-content:center; background:rgba(36,93,128,0.1); color:var(--navy2); font-size:9px; font-weight:800; letter-spacing:0; flex-shrink:0; }
.ntab.on .ui-icon,.otab.on .ui-icon { background:var(--blue-light); }
.panel-error { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; background:#fff7f7; border:1px solid #efc6ca; border-radius:9px; padding:14px 15px; color:#6f2027; }
.panel-error-title { font-size:12.5px; font-weight:750; margin-bottom:3px; }
.panel-error-msg { font-size:11.5px; color:#885158; line-height:1.5; }
.panel-retry { border:1px solid #d9aeb2; background:white; color:#6f2027; border-radius:7px; padding:7px 11px; font:600 11px inherit; cursor:pointer; white-space:nowrap; }
.panel-retry:hover { background:#fff0f1; }
.evidence-chip { display:inline-flex; align-items:center; gap:5px; max-width:100%; margin:6px 5px 0 0; padding:5px 8px; border-radius:999px; border:1px solid #c9dfdc; background:#f1f8f7; color:#315f5b; font-size:10.5px; font-weight:650; line-height:1.25; }
.evidence-chip::before { content:""; width:5px; height:5px; border-radius:50%; background:#2e8b83; flex:0 0 auto; }

.encounter-picker { margin-bottom:18px; display:grid; gap:7px; }
.encounter-picker label { font-size:12px; font-weight:700; }
.encounter-picker select { width:100%; min-height:42px; border:1px solid var(--border); border-radius:8px; background:white; color:var(--text); padding:9px; font:inherit; }
.encounter-picker small { color:var(--text2); font-size:11px; line-height:1.5; }
.review-card { border:1px solid var(--border); border-radius:10px; margin-bottom:16px; overflow:hidden; }
.review-card[data-state="accepted"] { border-color:#4e9b79; }
.review-card[data-state="rejected"] { opacity:.65; }
.review-head { padding:12px 14px; background:var(--surface-muted); display:flex; flex-wrap:wrap; gap:8px; justify-content:space-between; align-items:center; }
.review-head h3 { font-size:14px; }
.review-actions { display:flex; flex-wrap:wrap; gap:6px; }
.review-actions button { padding:6px 9px; border:1px solid var(--border); background:white; border-radius:6px; color:var(--navy); cursor:pointer; font:inherit; font-size:11px; }
.review-actions button[aria-pressed="true"] { background:var(--navy); color:white; }
.review-columns { display:grid; grid-template-columns:1fr 1fr; }
.review-columns > div { padding:14px; min-width:0; }
.review-columns > div + div { border-left:1px solid var(--border); }
.review-label { color:var(--text2); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; margin-bottom:8px; }
.review-source,.review-proposed { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; line-height:1.65; }
.review-editor { width:100%; min-height:160px; padding:10px; border:1px solid var(--navy2); border-radius:6px; font:inherit; line-height:1.6; }
.review-reason { padding:11px 14px; font-size:11px; color:var(--text2); border-top:1px solid var(--border); }
.review-evidence { margin:9px 0; padding:9px 12px; border-left:3px solid var(--blue-mid); background:var(--surface-muted); color:var(--text2); font-size:12px; white-space:pre-wrap; overflow-wrap:anywhere; }
.review-note { padding:12px 14px; margin-bottom:14px; border:1px solid var(--blue-mid); background:var(--blue-light); border-radius:8px; font-size:12px; }
#copy-btn:disabled { opacity:.5; cursor:not-allowed; }
#ap-hdr { flex-wrap:wrap; gap:12px; }
#ap-hdr > div:last-child { flex-wrap:wrap; }
@media(max-width:700px) { .review-columns { grid-template-columns:1fr; } .review-columns > div + div { border-left:0; border-top:1px solid var(--border); } .lbl-hint { display:none; } .mdm-grid { grid-template-columns:1fr; } }
/* Gray: let columns shrink so the (4-tab) output strip scrolls instead of widening the page */
#left, #right { min-width:0; }
@media (max-width: 1050px) { #wrap { grid-template-columns:minmax(0,1fr); } }
.out-tabs { max-width:100%; }
#encounter-type.needs-choice { border-color:var(--red); box-shadow:0 0 0 3px rgba(132,32,41,0.18); }
#encounter-type.needs-choice:focus, #encounter-type.needs-choice:focus-visible { outline:2px solid var(--red); outline-offset:1px; }
/* Malnutrition card */
.mn-row { display:grid; grid-template-columns:150px 118px minmax(0,1fr); gap:10px; padding:8px 0; border-bottom:1px dashed var(--border); font-size:12.5px; align-items:start; }
.mn-row:last-child { border-bottom:none; }
.mn-name { font-weight:650; color:var(--text); }
.mn-lvl { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; border-radius:5px; padding:2px 7px; justify-self:start; }
.mn-lvl.severe { background:var(--red-light); color:var(--red); }
.mn-lvl.moderate { background:var(--amber-light); color:var(--amber); }
.mn-lvl.none { background:var(--surface-muted); color:var(--text3); }
.mn-ev { color:var(--text2); line-height:1.5; overflow-wrap:anywhere; }
.mn-ev q { font-style:italic; }
.mn-meta { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.mn-chip { font-size:11px; font-weight:650; padding:4px 9px; border-radius:999px; background:var(--blue-light); color:var(--navy2); border:1px solid var(--blue-mid); }
.mn-pes { margin-top:12px; background:var(--surface-muted); border:1px solid var(--border); border-radius:9px; padding:12px 14px; }
.mn-pes-txt { font-family:'SF Mono',ui-monospace,monospace; font-size:12.5px; line-height:1.65; margin:6px 0 8px; white-space:pre-wrap; }
@media (max-width:680px) { .mn-row { grid-template-columns:1fr; gap:4px; } }
/* Signed-in user */
#hdr-user { display:flex; align-items:center; gap:8px; font-size:11.5px; color:#e7f8f5; }
#hdr-user a, #hdr-user button { color:#e7f8f5; text-decoration:none; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.22); border-radius:7px; padding:4px 9px; font:inherit; cursor:pointer; }
@media (max-width:680px) { #hdr-user-name { display:none; } }
/* Feedback → rules */
.btn-primary-sm { padding:9px 16px; background:var(--navy); color:white; border:none; border-radius:9px; font:700 12.5px inherit; font-family:inherit; cursor:pointer; }
.btn-primary-sm:disabled { opacity:.6; cursor:not-allowed; }
.rule-prop { border:1px solid var(--border); border-radius:10px; padding:12px 14px; margin-top:12px; background:var(--surface-muted); }
.rule-prop textarea { width:100%; min-height:58px; border:1px solid var(--border); border-radius:7px; padding:8px 10px; font:inherit; font-size:13px; line-height:1.5; background:white; resize:vertical; }
.rule-prop-row { display:flex; flex-wrap:wrap; gap:10px 16px; align-items:center; margin-top:8px; font-size:12px; color:var(--text2); }
.rule-prop-row select { min-height:32px; border:1px solid var(--border); border-radius:7px; padding:4px 6px; font:inherit; font-size:12px; background:white; }
.rule-prop-row label { display:inline-flex; gap:4px; align-items:center; }
.rule-why { font-size:11.5px; color:var(--text3); margin-top:6px; }
.rule-actions { display:flex; gap:8px; margin-top:10px; }
.rule-saved { font-size:12.5px; padding:9px 12px; border-radius:8px; background:var(--green-light); color:var(--green); margin-top:12px; }
.rule-blocked { font-size:12.5px; padding:9px 12px; border-radius:8px; background:var(--amber-light); color:var(--amber); margin-top:8px; }
#hdr-rules .otab-badge { margin-left:5px; }
/* HPI generator */
#hpi-text { font-size:14px; line-height:1.85; color:var(--text); white-space:pre-wrap; }
.hpi-sources { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:14px; padding-top:12px; border-top:1px solid var(--border); font-size:11px; color:var(--text3); }
.hpi-sources .mn-chip { font-size:10.5px; }
.ntab .ui-icon { margin-right:2px; }
/* Clear boundaries and workflow hierarchy */
:root { --border:#b5c9c6; --text2:#435d59; --text3:#536e69; }
body { background:#eaf0ef; }
.card-hdr,.inp-label { background:#f0f5f4; }
.ntab.on,.otab.on { background:#e0efec; color:#123f45; box-shadow:inset 0 -3px 0 #1d6970; }
.ntab:hover,.otab:hover { background:#e3eeeb; }
.ntab:focus-visible,.otab:focus-visible { outline:2px solid #1d6970; outline-offset:-4px; }
.inp-area { background:#fff; }
.inp-area::placeholder { color:#647773; opacity:1; }
.inp-area:focus { box-shadow:0 0 0 2px rgba(29,105,112,.16); }
select.inp-area { font-family:inherit; font-size:14px; height:48px; min-height:48px; padding:10px 14px; line-height:1.4; }
.lbl-hint { color:#536e69; font-style:normal; }
.out-tabs[hidden],#hpi-tab-btn,#dcsummary-tab-btn,#summary-tab-btn { display:none !important; }
#panel-hpi .card-first,#panel-dcsummary .card-first,#panel-summary .card-first { border-radius:14px; }
