/* Nurse Staffing FTE Calculator — app styles (on top of /assets/labs.css) */
.app-page .page-title { margin-bottom: 18px; }
.app-block { margin-top: 20px; }
.h-sm { font-size: 22px; margin: 0 0 6px; }
.h-xs { font-size: 17px; margin: 24px 0 10px; }
.jump { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 16px; font-size: 15px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.btn-row.tight { margin-top: 0; }
.field-msg { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.field-msg:empty { min-height: 0; margin: 0; }
.field-msg.err { color: var(--danger); font-weight: 600; }
.field-msg.ok { color: var(--ok); font-weight: 600; }
.danger { color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 45%, var(--line)) !important; }
.inline-label { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.inline-label select { min-height: 42px; padding: 6px 10px; width: auto; max-width: 100%; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent) !important; }
.disclaimer { margin-top: 24px; }
.undo-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; width: min(560px, calc(100% - 32px)); box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--line); font-size: 14px; color: var(--text); }
.undo-bar[hidden] { display: none; }
.file-btn { position: relative; overflow: hidden; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; min-height: 0; }
.file-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.setup-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .setup-grid { grid-template-columns: 1fr; } }

/* Unit inputs: label | input | help */
.unit-grid { display: grid; grid-template-columns: minmax(0, 15rem) 12rem minmax(0, 1fr); gap: 10px 16px; align-items: center; margin-top: 8px; }
.unit-grid label { display: block; }
.unit-grid input, .unit-grid select { min-height: 44px; padding: 8px 12px; font-variant-numeric: tabular-nums; }
.unit-grid .help { margin: 0; }
@media (max-width: 760px) {
  .unit-grid { grid-template-columns: 1fr; gap: 6px; }
  .unit-grid .help { margin-bottom: 12px; }
}
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; min-height: 24px; }
.np-calc { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.np-calc[hidden] { display: none; }
.np-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .np-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.np-grid label { font-size: 14px; }
.np-grid input { min-height: 44px; padding: 8px 12px; }
#np-result { margin: 12px 0 8px; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th { background: var(--surface); font-weight: 650; font-size: 13px; color: var(--text); white-space: nowrap; }
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot th, .tbl tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 700; }
.tbl .num { text-align: right; }
.tbl .center { text-align: center; }
.tbl th.grp { text-align: center; border-left: 1px solid var(--line); }
.tbl th.sub { text-align: center; font-weight: 500; color: var(--muted); }
.th-sub { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.tbl td.bad { color: var(--danger); font-weight: 650; }
.tbl input { min-height: 40px; padding: 6px 8px; border-radius: 8px; }
.tbl input[type="checkbox"] { width: 22px; height: 22px; min-height: 22px; accent-color: var(--accent); }
.tbl .num-in { width: 4.6rem; text-align: right; }
.tbl .num-in.wide { width: 6.4rem; }
.tbl .role-in { width: 11rem; }
.shifts-tbl { max-width: 560px; }
.shifts-tbl input[data-field="name"] { width: 12rem; }
.grid-tbl[hidden] { display: none; }
.tag { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.res-tbl tbody th, .ratio-tbl tbody th, .res-tbl tfoot th { font-weight: 650; white-space: nowrap; }
@media (max-width: 560px) { .app-block { padding: 16px; } .stat strong { font-size: 24px; } }

/* Results */
.verdict { border-radius: var(--radius-sm); padding: 14px 16px; border: 1px solid var(--line); background: var(--bg); margin: 8px 0 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.verdict[hidden] { display: none; }
.verdict strong { font-size: 18px; letter-spacing: -0.01em; }
.verdict span { color: var(--muted); font-size: 15px; }
.verdict.pass { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--bg)); }
.verdict.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--bg)); }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 8px 0 14px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 2px; }
.stat strong { font-size: 28px; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.bad strong { color: var(--danger); }
#res-body[hidden] { display: none; }

.chart-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.chart { width: 100%; height: auto; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .lbl { fill: var(--text); font-size: 13px; }
.chart .val { fill: var(--text); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); }
.chart .bar-cur { fill: var(--surface-2); stroke: var(--muted); stroke-width: 1; }
.field-msg.warn { color: var(--warn); font-weight: 600; }
.restore-choice { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--bg); }
.restore-choice[hidden] { display: none; }
.restore-choice p { margin: 0 0 10px; font-weight: 600; }
#compare-box[hidden], .compare-tbl[hidden] { display: none; }
#gap-note { margin: 10px 0 4px; }
#gap-note:empty { display: none; }
.stat strong { white-space: nowrap; font-size: clamp(20px, 2.3vw, 28px); }
/* Keep the role column visible while the grid scrolls sideways */
.grid-tbl tbody td:first-child, .grid-tbl thead tr:first-child th:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); box-shadow: 1px 0 0 var(--line); }
.grid-tbl thead tr:first-child th:first-child { background: var(--surface); }
@media (max-width: 560px) { .stat strong { font-size: 21px; } .tbl .role-in { width: 8.5rem; } }
html { scroll-padding-top: 84px; scroll-padding-bottom: 80px; }
.app-page { padding-bottom: 104px; }
.table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
