/* RespondaEMS — Classic ePCR look: navy top bar, bright blue tab bar, green highlights, dark tiles. */
:root {
  --navy: #2d3e50;
  --navy-2: #233140;
  --navy-3: #1d2a36;
  --blue: #0b98de;
  --blue-2: #1fb3f3;
  --blue-link: #0a8fd6;
  --green: #2ecc71;
  --green-2: #27b862;
  --green-dark: #1e9a52;
  --red: #e74c3c;
  --yellow: #f2c200;
  --tile: #2c3e50;
  --tile-hover: #34495e;
  --bg: #ffffff;
  --bg-soft: #eef1f3;
  --bg-nav: #f0f2f4;
  --line: #d5dbe0;
  --line-2: #c4ccd3;
  --text: #2f3d4a;
  --text-2: #5d6d7c;
  --muted: #9aa7b2;
  --radius: 4px;
  --shadow: 0 6px 24px rgba(20, 30, 45, .18);
  --font: 'Open Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--blue-link); }
.ico { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.ico svg { width: 100%; height: 100%; }
.small { font-size: 12px; } .muted { color: var(--muted); }
.link { background: none; border: 0; color: var(--blue-link); cursor: pointer; padding: 0; text-decoration: underline; }
h1, h2, h3, h4 { color: var(--navy); margin: 0 0 .5em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 3px; padding: 10px 22px; cursor: pointer; font-weight: 600; font-size: 15px; min-height: 42px; text-decoration: none; transition: background .12s, box-shadow .12s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: var(--green-2); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #0987c5; }
.btn-light { background: #eceff1; color: var(--text); border-color: #d5dbe0; }
.btn-light:hover { background: #e2e6e9; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #d84333; }
.btn-outline { background: #fff; border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 5px 12px; min-height: 30px; font-size: 13px; }
.btn-wide { min-width: 250px; }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 30%, #3a5a78 0, #1c2b3a 60%, #13202c 100%); padding: 24px; }
.login-card { background: #fff; width: min(1700px, 100%); min-height: min(940px, calc(100vh - 48px)); display: grid; grid-template-columns: 1fr 1fr; padding: 40px; gap: 40px; }
.login-left { display: flex; flex-direction: column; }
.login-brand { font-size: 44px; font-weight: 800; color: var(--navy); letter-spacing: -1px; }
.login-form { width: 100%; max-width: 480px; margin: auto; padding: 40px 0; }
.login-form h1 { font-size: 38px; margin: 0; }
.login-step { color: var(--text-2); margin-bottom: 40px; }
.login-org { display: flex; align-items: baseline; gap: 20px; font-size: 22px; color: var(--navy); margin-bottom: 26px; }
.login-form label { display: block; font-size: 17px; margin: 18px 0 8px; color: var(--navy); }
.login-form .input { height: 50px; font-size: 17px; }
.login-form .btn { width: 100%; margin-top: 36px; height: 50px; font-size: 18px; background: #0672b9; color: #fff; }
.login-form .btn:hover { background: #055f9a; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--blue-link); cursor: pointer; font-size: 17px; }
.login-foot { color: var(--text-2); font-size: 13px; margin-top: auto; }
.login-right { background: linear-gradient(160deg, #0b2245 0%, #0b2a55 55%, #0b98de 100%); border-radius: 28px; color: #fff; padding: 44px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.login-right h2 { color: #fff; font-size: 64px; line-height: 1; margin: 18px 0; }
.login-right .kicker { color: #ffc934; font-size: 24px; font-weight: 600; }
.login-right .sub { color: #ffc934; font-size: 22px; font-weight: 600; }
.login-right ul { font-size: 18px; line-height: 1.9; margin-top: 30px; padding-left: 22px; }
.login-right .wave { position: absolute; left: -10%; right: -10%; bottom: -60px; height: 220px; border-radius: 50% 50% 0 0; background: linear-gradient(90deg, #1fb3f3, #4ee6d8); opacity: .85; }
.login-error { color: var(--red); margin-top: 14px; min-height: 20px; }
@media (max-width: 900px) { .login-card { grid-template-columns: 1fr; } .login-right { display: none; } }

/* ---------- inputs ---------- */
.input, .search-input { width: 100%; border: 1px solid var(--line-2); border-radius: 3px; padding: 10px 12px; font: inherit; color: var(--text); background: #fff; }
.input:focus, .search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(11, 152, 222, .2); }
select.input { appearance: auto; }
textarea.input { resize: vertical; }

/* ---------- app chrome ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
.app-header { display: flex; align-items: center; gap: 18px; padding: 0 18px; height: 80px; border-bottom: 1px solid var(--line); background: #fff; }
.top-icon-btn { background: none; border: 0; cursor: pointer; color: var(--navy); padding: 6px; display: inline-flex; position: relative; border-radius: 4px; }
.top-icon-btn .ico { width: 30px; height: 30px; }
.top-icon-btn:hover { background: var(--bg-soft); }
.brand { text-decoration: none; }
.brand-app { font-weight: 800; font-size: 28px; color: var(--navy); letter-spacing: -.5px; }
.brand-sep { width: 2px; height: 46px; background: var(--navy); }
.brand-agency { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 22px; }
.brand-logo { height: 52px; width: auto; }
.header-spacer { flex: 1; }
.header-greet { text-align: left; color: var(--navy); }
.greet-1 { font-size: 17px; } .greet-2 { font-size: 14px; }
.avatar { width: 58px; height: 58px; border: 0; border-radius: 3px; background: var(--navy); color: #fff; font-weight: 700; cursor: pointer; }
.bell-count { position: absolute; top: -2px; right: -4px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
.module-bar { background: var(--navy); display: flex; justify-content: center; gap: 30px; padding: 18px 0 14px; }
.module-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; opacity: .92; }
.module-icon { width: 62px; height: 62px; background: linear-gradient(180deg, #1aa6ec, #0b7fc4); border: 2px solid #9fd8f7; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.module-icon .ico { width: 40px; height: 40px; color: #fff; }
.module-tile.active .module-icon { box-shadow: 0 0 0 3px #fff; }
.module-tile:hover { opacity: 1; }
.app-main { flex: 1; }

/* ---------- dashboard ---------- */
.dash { max-width: 1280px; margin: 0 auto; padding: 48px 24px; display: grid; grid-template-columns: 220px 1fr; gap: 48px; }
.dash-logo { width: 200px; border-top: 1px solid var(--line); padding-top: 8px; }
.dash-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.dash-head h1 { font-size: 30px; margin: 0; }
.dash-section { margin-top: 44px; }
.dash-section h2 { font-size: 30px; border-bottom: 2px solid var(--navy); padding-bottom: 10px; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 20px; }
.card { border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.card-head { background: var(--red); color: #fff; font-weight: 700; font-size: 12px; text-align: center; padding: 5px 0; letter-spacing: .5px; width: 60%; margin: -1px auto 0; }
.card-head.blue { background: var(--blue); } .card-head.navy { background: var(--navy); } .card-head.green { background: var(--green-2); }
.card-body { padding: 16px; }
.stat-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.stat-row:last-child { border: 0; }
.stat-num { font-size: 28px; font-weight: 300; min-width: 40px; }
.stat-label { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .3px; }
.notif-filter { background: var(--bg-soft); display: flex; gap: 20px; padding: 12px; margin-top: 14px; }
.notif-filter label { display: block; font-weight: 600; margin-bottom: 6px; }
.caught-up { display: flex; align-items: center; gap: 10px; margin: 18px 0; font-size: 17px; }
.caught-up .ico { width: 28px; height: 28px; }
.quick-links a { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; text-decoration: none; margin-right: 26px; margin-top: 12px; }
.announcement { background: #fff8e1; border-left: 4px solid var(--yellow); padding: 12px 16px; margin-top: 18px; }
@media (max-width: 800px) { .dash { grid-template-columns: 1fr; } .dash-logo { display: none; } }

/* ---------- records list ---------- */
.records-page { display: flex; flex-direction: column; min-height: calc(100vh - 210px); }
.records-bar { display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 38px; border-bottom: 1px solid var(--line); gap: 16px; flex-wrap: wrap; }
.view-select .small-label { font-size: 12px; color: var(--text-2); }
.view-select button { background: none; border: 0; font-size: 26px; color: var(--navy); cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 0; }
.records-table { width: 100%; border-collapse: collapse; }
.records-table th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.records-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.records-table tr.clickable:hover td { background: #f5fafd; cursor: pointer; }
.records-list { flex: 1; padding: 0 22px; }
.records-foot { border-top: 1px solid var(--line); padding: 16px; display: flex; justify-content: center; gap: 18px; position: sticky; bottom: 0; background: #fff; }
.records-foot .btn { min-width: 250px; }
.filters-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 14px 38px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.filters-panel label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 4px; }
.status-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e0e6eb; color: var(--text-2); letter-spacing: .3px; text-transform: uppercase; }
.status-chip.draft { background: #fff3cd; color: #8a6d00; } .status-chip.locked { background: #dcefe3; color: #1e7a45; }
.status-chip.pending, .status-chip.in_review { background: #e1f1fb; color: #0a6aa1; } .status-chip.returned { background: #fde2df; color: #b03a2e; } .status-chip.approved { background: #dcefe3; color: #1e7a45; }

/* ---------- empty / spinner ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; color: var(--muted); text-align: center; }
.empty-icon { width: 110px; height: 110px; color: #b7c0c7; }
.empty-title { font-size: 36px; color: #a9b3bb; margin-top: 18px; }
.empty-sub { font-size: 24px; color: #a9b3bb; margin-top: 10px; }
.empty-small { color: var(--muted); padding: 16px; text-align: center; }
.spinner-wrap { display: flex; justify-content: center; padding: 80px; }
.spinner { width: 40px; height: 40px; border: 4px solid #dfe5ea; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-error { padding: 40px; color: var(--red); }

/* ---------- PCR shell ---------- */
.pcr { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.pcr-top { height: 62px; background: var(--navy); color: #fff; display: flex; align-items: stretch; flex: none; }
.top-btn { width: 68px; display: flex; align-items: center; justify-content: center; color: #fff; border: 0; background: none; cursor: pointer; border-right: 1px solid rgba(255,255,255,.08); text-decoration: none; }
.top-btn .ico { width: 30px; height: 30px; }
.top-btn:hover { background: rgba(255,255,255,.07); }
.top-logo { display: flex; align-items: center; padding: 0 26px; color: #fff; font-weight: 800; font-size: 26px; text-decoration: none; border-right: 1px solid rgba(255,255,255,.12); letter-spacing: -.5px; }
.pcr-patient { background: none; border: 0; color: #fff; text-align: left; padding: 0 28px; cursor: pointer; border-right: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; justify-content: center; }
.small-label { font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.pcr-patient-row { display: flex; align-items: center; gap: 12px; font-size: 23px; }
.pcr-top-mid { flex: 1; display: flex; align-items: center; gap: 14px; padding: 0 20px; font-size: 13px; color: #c5d1db; }
.save-state { font-style: italic; }
.pcr-top-actions { display: flex; }
.pcr-top-actions .top-btn { border-left: 1px solid rgba(255,255,255,.08); border-right: 0; }
.top-lock { background: var(--red) !important; }
.top-lock:hover { background: #d84333 !important; }
.top-locked { background: var(--navy-3); cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 3px; font-size: 12px; font-weight: 700; }
.badge .ico { width: 14px; height: 14px; }
.badge-locked { background: #f1c40f; color: #3b3100; }
.pcr-tabs { display: flex; background: var(--blue); flex: none; overflow-x: auto; }
.pcr-tab { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px 4px 10px; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.pcr-tab:hover { background: rgba(255,255,255,.08); }
.pcr-tab.active { background: var(--blue-2); }
.tab-icon { width: 36px !important; height: 36px !important; }
.pcr-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.qa-return-banner { background: #fdecea; color: #8e2b20; padding: 10px 20px; display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid #f5c6c0; flex: none; }
.qa-return-banner .ico { width: 22px; height: 22px; }

/* section page */
.section-page { flex: 1; display: grid; grid-template-columns: 225px 1fr; min-height: 0; }
.side-nav { background: var(--bg-nav); padding-top: 38px; overflow-y: auto; border-right: 1px solid var(--line); }
.side-nav-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 20px 31px; font-size: 15px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: #5b6b78; cursor: pointer; }
.side-nav-item:hover { background: #e6eaee; }
.side-nav-item.active { background: var(--green); color: #fff; }
.section-scroll { overflow-y: auto; min-height: 0; scroll-behavior: auto; }
.tab-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.pcr-section { border-bottom: 1px solid var(--line); }
.pcr-section + .pcr-section { margin-top: 0; }
.section-header { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 36px; height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 calc((100% - 812px) / 2) 0 calc((100% - 812px) / 2 - 64px); }
.pcr-section:first-child .section-header { margin-top: 36px; }
.section-title { display: flex; align-items: center; gap: 22px; font-size: 24px; color: var(--navy); }
.section-icon { width: 42px; height: 42px; color: var(--navy); }
.section-header-extra { display: flex; gap: 10px; align-items: center; }
.section-body { max-width: 812px; margin: 0 auto; padding: 30px 0 46px; display: flex; flex-wrap: wrap; column-gap: 40px; }
.section-body > * { flex: 1 1 100%; }
.section-spacer { height: 50vh; }
.uto-note { color: var(--muted); font-size: 20px; text-align: center; padding: 20px; }
@media (max-width: 1100px) { .section-header { padding: 0 20px; } .section-body { padding: 24px 20px 40px; } }
@media (max-width: 760px) { .section-page { grid-template-columns: 1fr; } .side-nav { display: none; } .tab-icon { width: 26px !important; height: 26px !important; } .pcr-tab { font-size: 10px; min-width: 70px; } .top-logo { display: none; } }

/* ---------- fields ---------- */
.f { margin-bottom: 30px; min-width: 0; }
.f.half { flex: 1 1 calc(50% - 20px); }
.f.third { flex: 1 1 calc(33% - 27px); }
.f-row { display: flex; gap: 40px; flex-wrap: wrap; }
.f-row > .f { flex: 1 1 200px; }
.f-label { display: block; font-size: 15px; color: #5c6b77; margin-bottom: 8px; letter-spacing: .3px; }
.req { color: var(--red); }
.f-control { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #b9c3cb; min-height: 46px; position: relative; }
.f-control:focus-within { border-bottom: 2px solid var(--green); }
.f-error { color: var(--red, #c62828); font-size: 13px; margin-top: 4px; }
.f-control:has(.f-input.invalid) { border-bottom-color: var(--red, #c62828); }
.f-input { border: 0; outline: none; background: transparent; font: inherit; font-size: 20px; color: var(--text); padding: 8px 0; width: 100%; min-width: 0; }
.f-input:disabled { color: var(--text); -webkit-text-fill-color: var(--text); }
.f-textarea { border: 1px solid #c4ccd3; border-radius: 3px; padding: 10px 12px; font-size: 17px; min-height: 90px; resize: vertical; }
.f-textarea:focus { border-color: var(--green); }
.f-unit { color: var(--text-2); font-size: 17px; white-space: nowrap; }
.f-icon { width: 28px !important; height: 28px !important; color: var(--blue-link); flex: none; }
.f-icon.muted { color: var(--blue-link); opacity: .9; }
.f-icon-btn { background: none; border: 0; cursor: pointer; color: var(--blue-link); padding: 4px; display: inline-flex; }
.f-icon-btn .ico { width: 22px; height: 22px; }
.f-select { cursor: pointer; justify-content: space-between; }
.f-select:focus { outline: none; border-bottom: 2px solid var(--green); }
.f-value { font-size: 20px; padding: 8px 0; overflow: hidden; text-overflow: ellipsis; }
.f-value.placeholder, .f-readonly.placeholder { color: #a8b3bc; }
.f-readonly { font-size: 20px; min-height: 46px; padding: 8px 0; border-bottom: 2px dashed #c4ccd3; }
.f-with-btn { display: flex; gap: 18px; align-items: flex-end; }
.f-with-btn > .f-control { flex: 1; }
.f-note { background: var(--bg-soft); border-left: 4px solid var(--yellow); padding: 12px 16px; margin-bottom: 26px; font-size: 14px; color: var(--text-2); }
.f-note.note-danger { border-left-color: var(--red); background: #fdecea; color: #8e1b10; font-weight: 600; }
.f-note.note-warning { border-left-color: #f39c12; background: #fff6e5; }
.fc-lot-suggest { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-left-color: var(--green); }
.f-heading { width: 100%; font-size: 18px; margin: 10px 0 18px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.flash { animation: flash 2.4s ease; }
@keyframes flash { 0%, 60% { background: #fff3b0; box-shadow: 0 0 0 8px #fff3b0; } 100% { background: transparent; box-shadow: none; } }

.choices { display: flex; flex-wrap: wrap; gap: 12px; }
.choice { background: #eceff1; border: 1px solid #d7dde2; border-radius: 2px; padding: 0 20px; height: 50px; font-size: 18px; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 14px; max-width: 100%; }
.choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.choice:hover:not(:disabled) { background: #e2e7eb; }
.choice.on, .choice.on:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice .ico { width: 26px; height: 26px; color: var(--blue-link); }
.choice.on .ico { color: #fff; }
.choice:disabled { cursor: default; }
.choice-other { white-space: nowrap; }
.choices .choice:not(.choice-other) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; display: inline-block; line-height: 48px; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 12px; height: 50px; padding: 0 26px 0 12px; min-width: 156px; border: 1px solid #ccd4da; background: #fff; border-radius: 26px; cursor: pointer; font-size: 18px; color: var(--text); }
.pill-dot { width: 28px; height: 28px; border: 1.5px solid #9aa7b2; border-radius: 50%; background: #fff; flex: none; position: relative; }
.pill.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill.on .pill-dot { border-color: #fff; }
.pill.on .pill-dot::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--green); }
.pill-label { flex: 1; text-align: center; }
.pill:disabled { cursor: default; }
.f-pill { margin-bottom: 30px; }
.section-header .pill { height: 48px; min-width: 156px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 40, 50, .45); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadein .15s; padding: 20px; }
.modal-backdrop.out { opacity: 0; transition: opacity .15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { background: #fff; box-shadow: var(--shadow); max-height: calc(100vh - 40px); display: flex; flex-direction: column; width: 100%; }
.modal-sm { max-width: 520px; } .modal-md { max-width: 820px; } .modal-lg { max-width: 1250px; } .modal-full { max-width: none; height: calc(100vh - 40px); }
.modal-header { display: flex; align-items: center; gap: 16px; padding: 18px 36px; border-bottom: 1px solid var(--line); flex: none; }
.modal-title { flex: 1; font-size: 24px; color: var(--navy); }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { min-width: 140px; }
.modal-body { padding: 24px 36px; overflow-y: auto; }
.dialog .modal-body { padding: 30px 32px; }
.dialog-title { font-size: 24px; font-weight: 400; margin-bottom: 10px; }
.dialog-msg { color: var(--muted); font-size: 18px; margin: 0 0 28px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 14px; }
.dialog-buttons .btn { min-width: 120px; }
.field-label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 14px; }

/* ---------- shelf (slide-in) ---------- */
.shelf-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(30, 40, 50, .35); display: flex; justify-content: flex-end; animation: fadein .15s; }
.shelf-backdrop.out { opacity: 0; transition: opacity .2s; }
.shelf { background: #fff; width: min(880px, 100vw); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } }
.shelf-nav { width: 225px; background: var(--bg-nav); padding-top: 38px; height: 100%; animation: slidein .2s ease; }
.shelf-nav-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 20px 31px; font-size: 15px; font-weight: 600; letter-spacing: 1.2px; color: #5b6b78; cursor: pointer; text-transform: uppercase; }
.shelf-nav-item.active { background: var(--green); color: #fff; }
.shelf-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 36px; border-bottom: 1px solid var(--line); gap: 12px; }
.shelf-title { font-size: 22px; color: var(--navy); }
.shelf-actions { display: flex; gap: 10px; }
.shelf-actions .btn { min-width: 125px; }
.shelf-body { flex: 1; overflow-y: auto; }
.search-wrap { position: sticky; top: 0; background: var(--bg-soft); padding: 16px 36px; border-bottom: 1px solid var(--line); display: flex; align-items: center; z-index: 1; }
.search-wrap .ico { position: absolute; left: 52px; width: 22px; height: 22px; color: var(--muted); }
.search-wrap .search-input { border-radius: 24px; padding: 11px 16px 11px 46px; font-size: 18px; }
.pick-list { padding: 0 36px 40px; }
.pick-item { display: flex; align-items: center; gap: 20px; cursor: pointer; padding: 0; }
.pick-item .check { width: 30px; height: 30px; border: 1.5px solid #b3bec7; border-radius: 3px; display: flex; align-items: center; justify-content: center; flex: none; background: #fff; }
.pick-item.on .check { background: var(--green); border-color: var(--green); color: #fff; }
.pick-item .check .ico { width: 22px; height: 22px; }
.pick-label { flex: 1; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 19px; color: var(--navy); }
.pick-sub { display: block; font-size: 13px; color: var(--muted); }
.pick-item:hover .pick-label { color: var(--blue-link); }

/* ---------- tiles ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 25px; padding: 36px 64px; }
.tile { background: var(--tile); color: #fff; border: 0; border-radius: 2px; text-align: left; padding: 16px 16px; min-height: 100px; font-size: 18px; font-weight: 600; cursor: pointer; display: flex; align-items: flex-start; position: relative; line-height: 1.25; }
.tile:hover { background: var(--tile-hover); }
.tile.marked::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 26px 26px 0; border-color: transparent var(--green) transparent transparent; }
.tile.small { min-height: 70px; font-size: 14px; padding: 12px 14px; }
.tile-section-label { color: #8f9ca7; font-size: 16px; font-weight: 600; margin: 24px 0 12px; }

/* ---------- keypad ---------- */
.keypad { display: grid; grid-template-columns: repeat(3, 90px); gap: 14px 22px; }
.key { width: 90px; height: 90px; border-radius: 50%; border: 1px solid #ccd4da; background: #eceff1; font-size: 34px; color: var(--navy); cursor: pointer; }
.key:hover { background: #e2e7eb; }
.key:active { background: #d4dbe1; }
.key-clear { color: var(--red); }

/* ---------- signatures ---------- */
.sig-modal .modal-body { padding: 0; }
.sig-area { position: relative; height: min(60vh, 480px); margin: 24px 36px; border: 1px solid var(--line); }
.sig-canvas { width: 100%; height: 100%; touch-action: none; cursor: crosshair; display: block; }
.sig-hint { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 30px; color: #b5bfc7; pointer-events: none; }
.sig-line { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 2px dashed #c4ccd3; color: #b5bfc7; font-size: 14px; pointer-events: none; }
.sig-reset { text-align: center; padding-bottom: 24px; }
.sig-box { border: 1px solid var(--blue); min-height: 230px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; background: #fff; margin-bottom: 30px; }
.sig-box.signed { cursor: default; border-color: var(--line); }
.sig-box img { max-width: 92%; max-height: 210px; }
.sig-cta { display: flex; align-items: center; gap: 12px; color: var(--blue-link); font-size: 26px; }
.sig-cta .ico { width: 36px; height: 36px; }
.sig-clear { position: absolute; bottom: 10px; right: 10px; }

/* ---------- pop menu / toasts ---------- */
.pop-menu { position: fixed; z-index: 120; background: #fff; box-shadow: var(--shadow); border-radius: 4px; min-width: 240px; padding: 6px 0; animation: fadein .1s; }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 11px 18px; text-align: left; cursor: pointer; font-size: 15px; color: var(--text); }
.pop-item .ico { width: 20px; height: 20px; color: var(--text-2); }
.pop-item:hover { background: var(--bg-soft); }
.notif-panel { width: 380px; max-height: 70vh; overflow-y: auto; }
.notif-head { display: flex; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.notif { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.notif.unread { background: #f1f9fe; border-left: 3px solid var(--blue); }
.notif-warning.unread { border-left-color: var(--red); background: #fef3f2; }
.notif-success.unread { border-left-color: var(--green); background: #effaf3; }
.notif-time { font-size: 12px; color: var(--muted); margin-top: 4px; }
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 4px; box-shadow: var(--shadow); font-size: 15px; animation: fadein .2s; max-width: 80vw; }
.toast-success { background: var(--green-dark); } .toast-error { background: #c0392b; } .toast-warning { background: #b9770e; }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- validation summary ---------- */
.val-wrap { display: grid; grid-template-columns: 200px 1fr; min-height: 380px; margin: -24px -36px; }
.val-count { border-right: 1px solid var(--line); text-align: center; padding-top: 30px; }
.val-num { font-size: 64px; font-weight: 300; color: var(--navy); }
.val-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--text-2); }
.val-list { padding: 0 0 20px; }
.val-group { background: var(--bg-soft); font-weight: 600; padding: 10px 24px; border-bottom: 1px solid var(--line); }
.val-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px 10px 44px; border-bottom: 1px solid var(--line); cursor: pointer; }
.val-row:hover { background: #fafcfd; }
.val-badge { background: var(--red); color: #fff; min-width: 220px; text-align: center; padding: 6px 10px; font-size: 13px; }
.val-badge.seq { background: #e67e22; }
.val-success { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px; }
.val-success-icon { width: 130px !important; height: 130px !important; color: var(--green); }
.val-success-title { font-size: 20px; }
.val-success-sub { color: var(--muted); margin-bottom: 10px; }

/* ---------- generic content pages (QA/QI/Admin) ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 28px 28px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; margin: 0; }
.tabs-inline { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs-inline a, .tabs-inline button { padding: 10px 18px; text-decoration: none; color: var(--text-2); font-weight: 600; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs-inline .active { color: var(--navy); border-bottom-color: var(--green); }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); padding: 10px 12px; border-bottom: 2px solid var(--line); background: var(--bg-soft); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr.clickable:hover td { background: #f5fafd; cursor: pointer; }
.data-table input.input, .data-table select.input { padding: 6px 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--navy); display: flex; justify-content: space-between; align-items: center; background: var(--bg-soft); }
.panel-body { padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 4px; }
.kpi { border: 1px solid var(--line); border-radius: 4px; padding: 16px; background: #fff; border-top: 4px solid var(--blue); }
.kpi.good { border-top-color: var(--green); } .kpi.bad { border-top-color: var(--red); } .kpi.neutral { border-top-color: #b3bec7; }
.kpi-name { font-weight: 600; color: var(--navy); min-height: 40px; }
.kpi-value { font-size: 34px; font-weight: 300; margin: 6px 0; }
.kpi-sub { font-size: 12px; color: var(--text-2); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.bar { height: 8px; background: #e6eaee; border-radius: 4px; overflow: hidden; margin-top: 8px; position: relative; }
.bar > span { display: block; height: 100%; background: var(--blue); }
.bar .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--navy); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px; background: #e8edf1; font-size: 13px; margin: 0 6px 6px 0; cursor: pointer; border: 1px solid transparent; }
.chip.on { background: var(--blue); color: #fff; }
.chip.flag-bad.on { background: var(--red); } .chip.flag-good.on { background: var(--green-2); }
.check-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 14px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on.pass { background: var(--green); color: #fff; } .seg button.on.fail { background: var(--red); color: #fff; } .seg button.on.na { background: #8a99a6; color: #fff; }
.chart-svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; }
.review-layout { display: grid; grid-template-columns: 1fr 440px; gap: 20px; align-items: start; }
.review-layout .sticky { position: sticky; top: 16px; }
@media (max-width: 1100px) { .review-layout { grid-template-columns: 1fr; } }

/* ---------- print / report view ---------- */
.report { max-width: 980px; margin: 0 auto; padding: 30px; font-size: 13px; color: #111; }
.report h1 { font-size: 22px; margin: 0; color: #111; }
.report h2 { font-size: 14px; background: #2d3e50; color: #fff; padding: 5px 8px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.report table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.report td, .report th { border: 1px solid #c9d0d6; padding: 4px 6px; text-align: left; vertical-align: top; }
.report th { background: #eef1f3; font-weight: 600; }
.report .kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; }
.report .kv div b { display: block; font-size: 10px; color: #666; text-transform: uppercase; font-weight: 600; }
.report .sig-img { max-height: 70px; }
.report-toolbar { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 30px; background: var(--bg-soft); }
@media print { .report-toolbar { display: none; } .report { padding: 0; } body { font-size: 11px; } .report h2 { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- CAD import ---------- */
.cad-head-tools { display: flex; align-items: center; gap: 10px; }
.cad-unit { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; border-radius: 22px; padding: 8px 16px; cursor: pointer; font-size: 17px; }
.cad-unit .ico { width: 24px; height: 24px; color: var(--blue-link); }
.cad-table td { font-size: 17px; }
.cad-table tr.selected td { background: #eef1f3; }
.cad-arrow { width: 24px; color: var(--green); }
.ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cad-status { font-size: 12px; color: var(--text-2); margin-top: 12px; }

/* ---------- incident tab ---------- */
.crew-list { border-top: 1px solid var(--line); }
.crew-card { display: flex; align-items: center; gap: 18px; padding: 16px 6px; border-bottom: 1px solid var(--line); }
.crew-avatar { width: 64px; height: 64px; border-radius: 50%; background: #c9d0d6; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; color: #8b979f; }
.crew-avatar .ico { width: 56px; height: 56px; margin-bottom: -6px; }
.crew-info { flex: 1; }
.crew-name { font-size: 20px; color: var(--navy); font-weight: 600; }
.crew-sub { color: var(--text-2); font-size: 17px; }
.crew-menu .ico { width: 22px; height: 22px; }
.empty-inline { text-align: center; color: #a9b3bb; padding: 10px 0 40px; font-size: 22px; }
.empty-inline .big { font-size: 32px; }
.times-box { border-left: 4px solid var(--yellow); background: var(--bg-soft); padding: 12px; margin-bottom: 30px; }
.times-top { background: #fff; display: flex; justify-content: space-around; align-items: center; padding: 18px; margin-bottom: 12px; text-align: center; color: var(--text-2); }
.times-top b { color: var(--text); font-size: 18px; }
.times-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.times-list { background: #fff; padding: 22px 40px; }
.time-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 18px; color: var(--text-2); }
.times-calc { background: #fff; padding: 22px 40px; text-align: center; }
.times-calc .time-row { text-align: left; }
.times-calc-head { font-size: 18px; color: var(--text-2); }
.times-calc-big { font-size: 22px; margin: 4px 0 12px; }
.set-times-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.set-time label { font-size: 13px; color: var(--text-2); }
.set-time-ctl { display: flex; gap: 6px; }
.set-time-ctl .btn { min-height: 38px; padding: 0 10px; }
.defs dt { font-weight: 700; margin-top: 10px; } .defs dd { margin: 2px 0 0; color: var(--text-2); }
.mileage-box { display: grid; grid-template-columns: 1fr 230px; gap: 30px; }
.mileage-map { min-height: 300px; background: repeating-linear-gradient(35deg, #eef0ec 0 22px, #e6e9e3 22px 24px), #eef0ec; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; position: relative; overflow: hidden; }
.mileage-map::before { content: ''; position: absolute; left: -10%; right: -10%; top: 55%; height: 26px; background: #f4d38a; transform: rotate(-12deg); opacity: .8; }
.mileage-map::after { content: ''; position: absolute; top: -10%; bottom: -10%; left: 70%; width: 24px; background: #f4d38a; transform: rotate(12deg); opacity: .8; }
.mileage-map > * { position: relative; z-index: 1; }
.mileage-map-text { font-size: 22px; color: var(--navy); background: rgba(255,255,255,.6); padding: 4px 10px; }
.mileage-powered { color: var(--text-2); font-size: 14px; }
.mileage-side { background: var(--bg-soft); border-left: 4px solid var(--yellow); border-radius: 0 8px 8px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.mileage-value { background: #fff; padding: 18px 30px; font-size: 26px; min-width: 100px; margin-bottom: 14px; }
@media (max-width: 900px) { .times-grid, .mileage-box, .set-times-grid { grid-template-columns: 1fr; } }

/* ---------- patient / narrative tabs ---------- */
.pt-demo { display: grid; grid-template-columns: 1fr 312px; gap: 40px; width: 100%; }
.pt-demo-left { display: flex; flex-wrap: wrap; column-gap: 40px; }
.pt-demo-left > * { flex: 1 1 100%; }
.pt-longitudinal { background: var(--bg-soft); border-left: 4px solid var(--yellow); border-radius: 0 8px 8px 0; padding: 22px 24px; position: sticky; top: 20px; }
.pt-longitudinal h3 { font-size: 26px; font-weight: 400; line-height: 1.15; }
.pt-longitudinal p { font-size: 15px; line-height: 1.5; }
.pt-phones { width: 100%; }
.pt-phones-head { display: flex; align-items: center; justify-content: space-between; background: var(--bg-soft); border-radius: 30px; padding: 8px 8px 8px 26px; margin-bottom: 20px; font-size: 20px; color: var(--navy); }
.pt-phones-head .f { margin: 0; }
.pt-phone-row { align-items: center; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.pt-chip { display: inline-flex; align-items: center; gap: 8px; background: #e7f4fc; border: 1px solid #bfe2f6; color: var(--navy); padding: 8px 8px 8px 14px; border-radius: 3px; font-size: 16px; }
.pt-chip.none { background: #effaf3; border-color: #bfe8cf; }
.pt-chip button { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-2); padding: 0 4px; }
.nar-time-row { align-items: flex-end; width: 100%; }
.nar-time-row > .f { flex: 1 1 260px; }
.nar-time-pills { display: flex; gap: 10px; margin-bottom: 30px; }
.nar-time-pills .f { margin: 0; }
.nar-list { width: 100%; }
.nar-entry { margin-bottom: 24px; }
.nar-meta { display: flex; align-items: center; gap: 14px; color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.nar-meta span:last-of-type { margin-right: auto; }
.nar-text { width: 100%; font-size: 16px; line-height: 1.55; }
.nar-actions { display: flex; justify-content: center; gap: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px; }
.nar-add { background: none; border: 0; color: var(--blue-link); font-size: 17px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.nar-add .ico { width: 24px; height: 24px; }
@media (max-width: 1000px) { .pt-demo { grid-template-columns: 1fr; } }

/* stacking: pickers/dialogs opened from inside other modals stay on top */
.modal-backdrop ~ .shelf-backdrop ~ .modal-backdrop, .shelf-backdrop ~ .modal-backdrop { z-index: 120; }

/* ---------- attachments ---------- */
.top-attach { position: relative; }
.attach-count { position: absolute; top: 10px; right: 12px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 17px; }
.att-actions { display: flex; align-items: center; gap: 12px; padding: 18px 36px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.att-grid { padding: 20px 36px 40px; display: flex; flex-direction: column; gap: 14px; }
.att-card { display: grid; grid-template-columns: 150px 1fr; gap: 16px; border: 1px solid var(--line); border-radius: 4px; padding: 10px; }
.att-thumb { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); height: 110px; overflow: hidden; border-radius: 3px; text-decoration: none; }
.att-thumb img { max-width: 100%; max-height: 100%; object-fit: cover; }
.att-pdf { display: flex; flex-direction: column; align-items: center; color: var(--red); font-weight: 700; gap: 4px; }
.att-pdf .ico { width: 40px; height: 40px; }
.att-name { font-weight: 600; color: var(--navy); word-break: break-all; }
.att-caption { margin: 4px 0; }
.att-meta { font-size: 12px; color: var(--text-2); }
.att-btns { display: flex; gap: 8px; margin-top: 8px; }
.att-drag { outline: 3px dashed var(--blue); outline-offset: -10px; background: #f3fafe; }

/* ---------- phones / small tablets ---------- */
@media (max-width: 760px) {
  .app-header { height: 60px; gap: 10px; padding: 0 10px; }
  .brand-app { font-size: 20px; }
  .brand-sep, .header-greet, .brand-agency span { display: none; }
  .brand-logo { height: 38px; }
  .avatar { width: 42px; height: 42px; }
  .module-bar { gap: 14px; padding: 12px 0 10px; overflow-x: auto; justify-content: flex-start; padding-left: 12px; padding-right: 12px; }
  .module-icon { width: 48px; height: 48px; }
  .module-icon .ico { width: 30px; height: 30px; }
  .module-label { font-size: 12px; white-space: nowrap; }
  .records-bar { padding: 12px 16px; }
  .view-select button { font-size: 20px; }
  .records-list { overflow-x: auto; padding: 0 8px; }
  .records-foot { gap: 10px; padding: 10px; }
  .records-foot .btn { min-width: 0; flex: 1; }
  .filters-panel { padding: 12px 16px; }
  .pcr-top { height: 54px; }
  .top-btn { width: 46px; }
  .top-btn .ico { width: 24px; height: 24px; }
  .pcr-patient { padding: 0 10px; min-width: 0; flex: 1; }
  .pcr-patient-row { font-size: 16px; min-width: 0; }
  .pcr-patient-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pcr-top-mid { display: none; }
  .attach-count { top: 6px; right: 4px; }
  .pcr-tab { padding: 8px 2px 6px; letter-spacing: 0; }
  .section-header { height: auto; min-height: 54px; padding: 8px 14px; margin-top: 20px; flex-wrap: wrap; gap: 8px; }
  .section-title { font-size: 20px; gap: 12px; }
  .section-icon { width: 30px; height: 30px; }
  .section-body { padding: 18px 16px 30px; }
  .f.half, .f.third { flex: 1 1 100%; }
  .f-input, .f-value, .f-readonly { font-size: 18px; }
  .choice { height: 44px; font-size: 16px; padding: 0 14px; }
  .pill { height: 44px; min-width: 120px; font-size: 16px; }
  .btn-wide { min-width: 0; width: 100%; }
  .tile-grid { padding: 16px; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tile { min-height: 76px; font-size: 15px; }
  .modal-backdrop { padding: 0; }
  .modal { max-height: 100vh; height: 100%; }
  .modal-header { padding: 12px 16px; flex-wrap: wrap; }
  .modal-title { font-size: 19px; }
  .modal-actions .btn { min-width: 0; }
  .modal-body { padding: 16px; }
  .shelf-nav { display: none; }
  .shelf-header, .search-wrap, .att-actions { padding-left: 16px; padding-right: 16px; }
  .search-wrap .ico { left: 30px; }
  .pick-list, .att-grid { padding-left: 16px; padding-right: 16px; }
  .att-card { grid-template-columns: 100px 1fr; }
  .page { padding: 18px 12px 60px; }
  .data-table { display: block; overflow-x: auto; }
  .val-wrap { grid-template-columns: 1fr; margin: -16px; }
  .val-count { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .val-row { padding-left: 16px; }
  .val-badge { min-width: 110px; }
  .keypad { grid-template-columns: repeat(3, 64px); gap: 10px 14px; }
  .key { width: 64px; height: 64px; font-size: 26px; }
  .dash { padding: 24px 16px; }
}

/* ---------- guided tour ---------- */
.tour-layer { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.tour-shade { position: fixed; inset: 0; background: rgba(20, 30, 45, .55); pointer-events: auto; }
.tour-spot { position: fixed; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(20, 30, 45, .55), 0 0 0 3px var(--yellow); transition: all .25s ease; pointer-events: none; }
.tour-bubble { position: fixed; width: min(380px, calc(100vw - 20px)); background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 16px 18px; pointer-events: auto; border-top: 4px solid var(--green); }
.tour-count { font-size: 11px; font-weight: 700; color: var(--text-2); letter-spacing: .5px; }
.tour-title { font-size: 18px; font-weight: 700; color: var(--navy); margin: 4px 0 6px; }
.tour-text { font-size: 15px; line-height: 1.5; color: var(--text); }
.tour-missing { margin-top: 8px; font-size: 13px; color: #b9770e; }
.tour-doit { margin-top: 8px; font-size: 13px; color: var(--green-dark); font-weight: 600; }
.tour-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.tour-spacer { flex: 1; }
.tour-loading { color: var(--muted); }

/* ---------- roleplay-only notice (footer on every page, dashboard banner, acknowledgement) ---------- */
/* The footer is always visible: page layouts, modals and shelves stop above it. */
:root { --rp-foot: 28px; }
body { padding-bottom: var(--rp-foot); }
.pcr { height: calc(100vh - var(--rp-foot)); }
.app-shell, .login-page { min-height: calc(100vh - var(--rp-foot)); }
.modal-backdrop, .shelf-backdrop { bottom: var(--rp-foot); }
.modal-backdrop .modal { max-height: calc(100vh - var(--rp-foot) - 40px); }
.modal-backdrop .modal-full { height: calc(100vh - var(--rp-foot) - 40px); }
#toasts { bottom: calc(var(--rp-foot) + 16px); }
.records-foot { bottom: var(--rp-foot); } /* sticky footer sits above the fixed roleplay notice instead of under it */
.rp-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; height: var(--rp-foot); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 28px; padding: 4px 12px; background: #3b2a00; color: #ffe08a; font-size: 12px; line-height: 1.3; text-align: center; pointer-events: none; }
.rp-footer b { font-weight: 700; }
.rp-footer-extra { opacity: .9; }
.rp-banner { display: flex; gap: 14px; align-items: flex-start; background: #fff4d6; border: 2px solid #f0b429; border-radius: 6px; padding: 14px 16px; margin: 10px 0 14px; color: #5c3d00; }
.rp-banner-icon { font-size: 28px; line-height: 1; }
.rp-banner-title { font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.rp-banner-extra { margin-top: 6px; font-style: italic; }
.rp-ack { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin-top: 10px; cursor: pointer; }
.rp-ack input { width: 20px; height: 20px; flex: none; }
.login-rp-note { margin-top: 16px; padding: 8px 10px; border-radius: 4px; background: rgba(255, 224, 138, .18); border: 1px solid rgba(255, 224, 138, .6); font-size: 13px; font-weight: 600; }
@media print { body { padding-bottom: 0; } .rp-footer { position: static; background: none; color: #000; border-top: 1px solid #999; } }

/* ---------- Login with Discord ---------- */
.dc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #5865f2 !important; color: #fff !important; text-decoration: none; }
.dc-btn:hover { background: #4752c4 !important; }
.dc-login-slot .dc-btn { width: 100%; }
.dc-or { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; margin: 14px 0 10px; }
.dc-or::before, .dc-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.dc-logo { display: inline-flex; vertical-align: middle; }
.dc-field { margin: 12px 0; }
.dc-map { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dc-map-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; }

/* ---------- What's New (changelog) ---------- */
.whats-new-body { padding: 4px 8px 16px; line-height: 1.55; }
.whats-new-body h2 { margin: 22px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); font-size: 20px; }
.whats-new-body h3 { margin: 14px 0 4px; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); }
.whats-new-body ul { margin: 4px 0 8px 20px; }
.whats-new-body li { margin: 3px 0; }
.whats-new-body code { background: var(--bg-soft); padding: 1px 4px; border-radius: 3px; }

/* ---------- RespondaEMS brand (logo mark + two-tone wordmark) ---------- */
:root { --brand-navy: #173a66; --brand-teal: #1b8aa8; --brand-red: #d63a3a; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { height: 1.45em; width: auto; flex: none; }
.wordmark { font-family: Montserrat, 'Open Sans', Arial, sans-serif; font-weight: 800; letter-spacing: -.5px; white-space: nowrap; }
.wm-a { color: var(--brand-navy); }
.wm-b { color: var(--brand-teal); }
.top-logo .brand-lockup { gap: 8px; }
/* On dark bars the navy R needs a light chip behind it. */
.top-logo .brand-mark, [data-theme="dark"] .brand-mark { background: #fff; border-radius: 7px; padding: 2px; box-sizing: content-box; }
.top-logo .wm-a, .top-logo .wm-b { color: #fff; }
.top-logo .wm-b { color: #7fd3ea; }
.bl-lg .brand-mark { height: 1.3em; }
.login-right h2 .wm-a { color: #fff; }
.login-right h2 .wm-b { color: #7fd3ea; }
[data-theme="dark"] .wm-a { color: #e6eef8; }
[data-theme="dark"] .wm-b { color: #5cc8e6; }

/* User avatar photo (Discord profile picture, public/js/avatar.js) — falls back to initials. */
.avatar, .adm-avatar, .user-avatar { overflow: hidden; padding: 0; }
.user-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; flex: none; vertical-align: middle; }

/* ---------- Patient player sign-in (Roleplay Sim, no account) ---------- */
.login-patient-btn { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 10px; background: #fff4f0 !important; color: #8e1b10 !important; border: 1px solid #f1b8ad !important; text-align: left; padding: 10px 14px; height: auto; }
.login-patient-btn small { display: block; font-weight: 400; color: #7a4a42; font-size: 12px; }
.login-patient-btn .lp-ico { font-size: 24px; }
.lp-help { color: var(--text-2); margin: 6px 0 12px; }
.lp-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.lp-item { position: relative; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px 70px 12px 14px; cursor: pointer; }
.lp-item:hover { border-color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.lp-name { font-weight: 700; font-size: 18px; }
.lp-name span { font-weight: 400; color: var(--text-2); font-size: 15px; }
.lp-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.lp-code { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-family: monospace; font-weight: 700; color: var(--text-2); letter-spacing: 1px; }
.lp-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--text-2); text-align: center; }
.lp-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.lp-ended { max-width: 520px; margin: 18vh auto 0; text-align: center; padding: 24px; }

/* ---------- Phone layout: sign-in page + roleplay footer ---------- */
@media (max-width: 760px) {
  .login-page { padding: 0; align-items: stretch; }
  .login-card { grid-template-columns: 1fr; padding: 22px 18px; gap: 0; min-height: calc(100vh - var(--rp-foot)); }
  .login-right { display: none; }
  .login-brand { font-size: 30px; }
  .login-brand .brand-mark { height: 1.2em; }
  .rp-footer { justify-content: flex-start; font-size: 10.5px; padding: 0 8px; }
  .rp-footer b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .rp-footer-extra { display: none; }
}

/* ---------- ECG tracings attached to vitals ---------- */
.ecg-thumb { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #fff; margin: 8px 0; }
.ecg-thumb-btn { border: 0; padding: 0; background: none; cursor: zoom-in; flex: none; }
.ecg-thumb-img { width: 220px; height: 82px; object-fit: cover; object-position: left center; border: 1px solid #f1c3c3; border-radius: 3px; background: #fff7f7; display: block; }
.ecg-thumb-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.ecg-thumb-meta b { color: var(--text); font-size: 14px; }
.ecg-full { width: 100%; height: auto; border: 1px solid #e5b8b8; background: #fff; }
.ecg-interp { white-space: pre-wrap; background: var(--bg-soft); padding: 10px 12px; border-radius: 4px; margin: 0 0 10px; font-size: 14px; }
.ecg-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.ecg-note { color: var(--text-2); font-size: 12px; margin: 6px 0 0; }
.vit-ecg-btn { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 13px; }
.prt-ecg { margin: 6px 0 10px; break-inside: avoid; }
.prt-ecg img { width: 100%; max-width: 900px; border: 1px solid #ccc; }
.prt-ecg-cap { font-size: 11px; color: #444; }
.save-state.save-retry { color: #f0b429; font-weight: 700; }
.login-dev-link { color: var(--text-2); opacity: .7; white-space: nowrap; } .login-dev-link:hover { opacity: 1; }

/* ---------- Patient player: create a patient / character form ---------- */
.lp-create { width: 100%; margin-top: 12px; }
.cf { display: flex; flex-direction: column; gap: 10px; }
.cf-note { background: #fff4d6; border: 1px solid #f0b429; color: #5c3d00; padding: 8px 10px; border-radius: 4px; font-size: 13px; font-weight: 600; margin: 0; }
.cf-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.cf-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-field { display: flex; flex-direction: column; gap: 3px; }
.cf-label { font-size: 13px; font-weight: 600; }
.cf-hint { font-size: 12px; color: var(--text-2); }
.cf-sev { display: flex; gap: 6px; }
.cf-sev-btn { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-weight: 700; cursor: pointer; }
.cf-sev-btn.on.s-stable { background: #2ecc71; color: #fff; border-color: #2ecc71; }
.cf-sev-btn.on.s-sick { background: #f39c12; color: #fff; border-color: #f39c12; }
.cf-sev-btn.on.s-critical { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.lp-character { max-width: 620px; margin: 30px auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 600px) { .cf-grid, .cf-grid2 { grid-template-columns: 1fr; } }
.dev-banner { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: #0f2440; color: #fff; border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; font-weight: 600; }
.dev-banner .btn { background: #1b8aa8; color: #fff; }

/* Narrow phones: the header holds the menu, logo, agency badge and four icon buttons — show the logo mark without the
   wordmark so nothing is pushed off-screen, and keep the help button clear of the records footer. */
@media (max-width: 480px) {
  .app-header { gap: 6px; padding: 0 8px; }
  .app-header .brand .wordmark { display: none; }
  .records-foot .btn { font-size: 14px; padding-left: 6px; padding-right: 6px; white-space: normal; line-height: 1.2; }
  body:has(.records-foot) .help-fab { bottom: calc(var(--rp-foot, 0px) + 74px); }
}
