/* SJH Call Schedule - phone-first styles. Clean and clinical, not flashy. */
:root {
  --navy: #1a3a5c;
  --navy-dark: #122a44;
  --accent: #2b6cb0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --today: #fff7e6;
  --danger: #b91c1c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 132px; /* room for footer + tab bar */
}

/* Header */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.topbar .sub { font-size: 12px; color: #b9c8da; margin-top: 2px; }

/* Generic content */
.page { padding: 14px 10px 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 15px; margin: 0 0 8px; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Home */
.banner {
  background: #fffbeb;
  border: 1px solid #f3d38a;
  color: #7c5b12;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.today-card { text-align: center; padding: 22px 14px; }
.today-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.today-card .name { font-size: 42px; font-weight: 700; color: var(--navy); margin: 8px 0 2px; line-height: 1.1; }
.today-card .shift { font-size: 14px; color: var(--muted); }
.today-card .date-line { font-size: 14px; color: var(--muted); margin-top: 8px; }
.row-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.row-line:last-child { border-bottom: none; }
.row-line .d { font-weight: 600; }
.row-line .who { color: var(--navy); font-weight: 600; }
button.link {
  background: none; border: none; color: var(--accent);
  font-size: 14px; padding: 4px 0; cursor: pointer; text-align: left;
}

/* Month grid */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { margin: 0; font-size: 18px; color: var(--navy); }
.cal-nav { display: flex; gap: 8px; }
.cal-nav button {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 20px; color: var(--navy); cursor: pointer;
}
.dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.dow span { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  min-height: 62px; padding: 4px 2px; cursor: pointer; position: relative;
  min-width: 0; overflow: hidden;
}
.cell .num { font-size: 12px; font-weight: 600; color: var(--muted); }
.cell .nm { font-size: 9px; line-height: 1.3; color: var(--navy); font-weight: 600;
  margin: 1px 0 0; hyphens: auto;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word; margin-top: 1px; }
.cell.blank { background: transparent; border: none; cursor: default; }
.cell.is-today { background: var(--today); border-color: #e8c86a; min-height: 92px; }
.cell.is-today .num { color: #8a6d1f; font-size: 20px; font-weight: 800; }
.cell .mw-line, .cell .cb-line { font-size: 8px; line-height: 1.3; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v3 coverage cell lines, in strict order: physician, clinic, midwife */
.cell .cov-phys { font-size: 9px; line-height: 1.3; font-weight: 600; margin: 1px 0 0;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word; }
.cell .cov-clinic, .cell .cov-mw { font-size: 8px; line-height: 1.3; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* coverage toggles: display only, never change data */
.cell.dim { opacity: 0.32; }
.filter-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--today); border: 1px solid #e8c86a; border-radius: 10px;
  padding: 8px 12px; margin: 8px 0; font-size: 14px; }
/* home calendar: month box with arrows inside it, larger cells */
.cal-card { padding: 12px 10px; }
.cal-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-box-title { font-size: 17px; font-weight: 700; }
.cal-arrow {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 24px; line-height: 1; color: var(--navy); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 0 3px;
}
.cal-arrow:active { background: var(--line); }
.grid.cal-big .cell { min-height: 88px; padding: 6px 3px; }
.grid.cal-big .cell .num { font-size: 14px; }
.grid.cal-big .cell .cov-phys { font-size: 11px; }
.grid.cal-big .cell .cov-clinic, .grid.cal-big .cell .cov-mw { font-size: 10px; }
.tgl-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tgl-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; }
.tgl-chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
/* calendar toolbar: prev/next/today + month/year selectors */
.cal-tools { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; flex-wrap: wrap; }
.cal-tools select { font-size: 14px; padding: 8px 6px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); min-width: 0; }
.cal-tools .cal-mon { flex: 1 1 0; }
.cal-tools .cal-yr { flex: 0 1 auto; max-width: 100px; }
.cal-who { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; margin-top: 2px; }
.cal-who select { flex: 1 1 auto; min-width: 0; }
.cal-tools .btn { width: auto; margin-top: 0; display: inline-block; padding: 8px 14px; font-size: 14px; }
.filter-banner .btn { width: auto; margin-top: 0; flex: 0 0 auto; }
.view-switch { display: flex; gap: 0; margin: 0 0 10px; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; width: max-content; }
.view-switch button { border: none; background: var(--card); padding: 8px 14px; font-size: 13px;
  font-weight: 600; color: var(--muted); }
.view-switch button.on { background: var(--navy); color: #fff; }
/* multi-month and year views */
.mini-month { margin-bottom: 16px; }
.mini-title { font-size: 15px; font-weight: 700; margin: 4px 0 6px; color: var(--navy);
  cursor: pointer; }
.grid[data-mini] .cell { min-height: 40px; }
.grid[data-mini] .cov-phys, .grid[data-mini] .cov-clinic, .grid[data-mini] .cov-mw { font-size: 7px; }
/* day editor: one row per coverage record */
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line); }
.seg-row:last-of-type { border-bottom: none; }
.seg-main .nm { font-weight: 700; }
.add-seg { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px;
  vertical-align: baseline; }
.print-clinic { font-size: 9px; }
.cell.is-mine .nm, .cell.is-mine .num { color: #1a1a1a; }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.color-row label { font-size: 13px; font-weight: 600; }
.color-row input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--card); }
.print-mw { font-size: 9px; font-weight: 700; }
.cell .hol { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: #c08497; }
.cell.has-warn { border-color: #d97706; }
.cell.has-warn .num { color: #b45309; }
.cell .warn-dot { position: absolute; top: 3px; right: 4px; font-size: 11px; line-height: 1; }
.cell .time-flag { display: block; font-size: 8px; color: #6b7280; font-weight: 700; }
.warn-card.tappable { cursor: pointer; }
.warn-card .tap-hint { display: block; margin-top: 4px; font-size: 12px; color: #b45309; font-weight: 700; }

/* Day detail */
.day-head { font-size: 24px; font-weight: 700; color: var(--navy); margin: 0 0 2px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
select, input[type="text"], input[type="number"], input[type="month"], textarea {
  width: 100%; padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 76px; resize: vertical; }
.btn {
  display: block; width: 100%; padding: 13px; font-size: 16px; font-weight: 600;
  border-radius: 12px; border: none; cursor: pointer; margin-top: 14px;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:active { background: var(--navy-dark); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f0caca; }
.btn.small-btn { width: auto; display: inline-block; padding: 8px 14px; font-size: 14px; margin-top: 8px; }
.back-btn {
  background: none; border: none; color: var(--accent); font-size: 15px;
  padding: 8px 0; cursor: pointer; margin-bottom: 4px;
}

/* Change log entries */
.log-entry { padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-entry:last-child { border-bottom: none; }
.log-entry .when { color: var(--muted); font-size: 12px; }
.log-entry .device { color: var(--muted); font-size: 12px; }

/* Roster */
.doc-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.doc-row:last-child { border-bottom: none; }
.doc-row .nm { font-weight: 600; color: var(--navy); }
.doc-row .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #e6f0e6; color: #2f6b2f; font-weight: 600; }
.pill.off { background: #f1f1f1; color: var(--muted); }
.alias-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.alias-row:last-child { border-bottom: none; }
.alias-row button { background: none; border: none; color: var(--danger); font-size: 13px; cursor: pointer; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1; }
.inline-form button {
  padding: 10px 14px; border-radius: 10px; border: none;
  background: var(--navy); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.hist { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 560px; }
table.hist th, table.hist td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.hist th:first-child, table.hist td:first-child { text-align: left; }
table.hist th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
table.hist td.nm { font-weight: 600; color: var(--navy); }

/* Picker list (which doctor) */
.pick-row {
  display: block; width: 100%; text-align: left; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 17px; font-weight: 600; color: var(--navy); margin-bottom: 8px; cursor: pointer;
}
.pick-row .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }

/* Sections in More */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; margin: 22px 2px 8px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 24px;
  font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50;
}
#toast.show { opacity: 1; }

/* Multi-user sync: "schedule changed" banner (shown while editing so the
   form is never destroyed) and the version-conflict dialog. */
#sync-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: none; align-items: center; justify-content: center; gap: 12px;
  background: #92400e; color: #fff; padding: 10px 14px; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#sync-banner.show { display: flex; }
#sync-banner .btn { padding: 6px 14px; font-size: 13px; }
#conflict-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#conflict-overlay .conflict-card {
  background: #fff; border-radius: 14px; max-width: 420px; width: 100%;
  padding: 22px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
#conflict-overlay .conflict-card h3 { margin: 0 0 10px; font-size: 17px; }
#conflict-overlay .conflict-card p { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: var(--ink); }
#conflict-overlay .conflict-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Footer + tab bar */
.footer-note {
  text-align: center; color: var(--muted); font-size: 11.5px; padding: 18px 14px 6px;
}
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 480px; margin: 0 auto; }
.tabbar button {
  flex: 1; background: none; border: none; padding: 10px 0 12px; cursor: pointer;
  font-size: 11px; color: var(--muted); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button .ico { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--navy); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }

/* ---------- Import flow ---------- */
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  font-size: 15px;
  color: var(--ink);
}
.btn:disabled { opacity: .45; cursor: default; }
.imp-thumb {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.rev-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; gap: 10px;
}
.rev-row .d { font-weight: 600; }
.rev-row .who { color: var(--navy); font-weight: 600; }
.rev-edit { padding: 4px 2px 12px; border-bottom: 1px solid var(--line); }
.unknown-pill {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  color: #92400e; background: #fef3c7; border: 1px solid #f3d38a;
  padding: 3px 10px; border-radius: 20px;
}
.badge {
  display: inline-block; font-size: 11px; color: var(--muted);
  background: #eef2f7; border: 1px solid var(--line);
  padding: 1px 8px; border-radius: 20px; margin: 3px 3px 0 0;
}
.badge.warn { color: #92400e; background: #fef3c7; border-color: #f3d38a; }
details.card summary { list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
.overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(10, 20, 35, .92);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Phase 2: scheduling rounds */
.st-pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px; background: #e8eef5; color: #1a3a5c;
  text-transform: capitalize; white-space: nowrap;
}
.st-collecting { background: #fef3c7; color: #92400e; }
.st-draft { background: #e0e7ff; color: #3730a3; }
.st-published { background: #e6f0e6; color: #166534; }
.lvl-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.lvl-unavailable { background: #b91c1c; }
.lvl-prefer_not { background: #d97706; }
.lvl-prefer { background: #16a34a; }
.cell.req { cursor: pointer; }
.warn-card { border-left: 4px solid #d97706; }
.err-card { border-left: 4px solid #b91c1c; }
.info-card { border-left: 4px solid #2b6cb0; }

/* Print calendar: who is on call and who is out, per date. */
.print-sheet { background: #fff; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.print-head h2 { margin: 0 0 2px; font-size: 20px; }
.print-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.print-dow { font-size: 10px; font-weight: 700; color: #555; text-transform: uppercase; margin-bottom: 2px; }
.print-cell { border: 1px solid #bbb; border-radius: 6px; min-height: 74px; padding: 4px 5px; background: #fff; }
.print-cell.blank { border: none; background: none; }
.print-num { font-size: 11px; font-weight: 700; color: #333; }
.print-who { font-size: 12px; font-weight: 700; margin-top: 2px; }
.print-out { font-size: 10px; color: #b91c1c; margin-top: 2px; line-height: 1.3; }
.print-want { font-size: 10px; color: #15803d; margin-top: 2px; line-height: 1.3; }
.print-avoid { font-size: 10px; color: #a16207; margin-top: 2px; line-height: 1.3; }
.print-note { margin-top: 8px; }
.print-late { font-size: 10px; color: #7f1d1d; font-weight: 700; margin-top: 2px; line-height: 1.3; }

@media print {
  body { background: #fff; }
  .tabbar, .topbar, .footer-note, .print-hide,
  .print-nav, button, input, select, textarea, .toast { display: none !important; }
  .page { padding: 0; }
  .print-cell { break-inside: avoid; }
  .print-doc { display: block !important; }
}

/* ---------- Print Center (v3d) ---------- */
@page { size: letter landscape; margin: 0.35in; }

.pc-controls .pc-sec { margin: 12px 0; }
.pc-controls .pc-sec h3 { margin: 0 0 6px; font-size: 14px; }
.pc-radio, .pc-check { display: inline-block; margin: 4px 10px 4px 0; }
.pc-btnrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pc-out { margin-bottom: 8px; }
.pc-out .btn.pc-btn { display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px; width: 100%; text-align: left; }
.pc-out .btn.pc-btn .sub { font-size: 12px; opacity: 0.75; }
.pc-out label.small { display: block; margin-bottom: 4px; }
.pc-warnlist { margin: 8px 0; padding-left: 20px; }
.pc-warnlist li { margin-bottom: 4px; }

.print-doc { background: #fff; color: #000; font-size: 12px; line-height: 1.35; }
.pc-dochead { border-bottom: 2px solid #000; margin-bottom: 10px; padding-bottom: 6px; }
.pc-doctitle { font-size: 20px; font-weight: 800; }
.pc-badge { display: inline-block; border: 2px solid #000; padding: 1px 10px;
  font-size: 13px; font-weight: 800; letter-spacing: 2px; vertical-align: middle; }
.pc-docsub { font-size: 13px; font-weight: 600; margin-top: 2px; }
.pc-docsub2 { font-size: 12px; font-weight: 600; margin: 8px 0; }
.pc-docgen { font-size: 11px; margin-top: 2px; }
.pc-docfoot { margin-top: 12px; padding-top: 6px; border-top: 1px solid #000;
  font-size: 10px; }
.pc-monthtitle { font-size: 15px; font-weight: 800; margin: 10px 0 4px; }
.pc-month:first-child .pc-monthtitle { margin-top: 0; }
.pc-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.pc-dow { font-size: 10px; font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.pc-cell { border: 1px solid #999; padding: 3px 4px; min-height: 62px;
  font-size: 10px; break-inside: avoid; background: #fff; }
.pc-cell.blank { border: none; background: none; }
.pc-num { font-size: 11px; font-weight: 700; }
.pc-hol { font-size: 9px; font-weight: 700; }
.pc-phys { font-size: 11px; font-weight: 700; margin-top: 2px; }
.pc-open { font-size: 10px; font-style: italic; margin-top: 2px; }
.pc-line { font-size: 10px; margin-top: 2px; }
.pc-tag { display: inline-block; border: 1px solid #000; padding: 0 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px; }
.pc-legend { font-size: 10px; margin-top: 10px; }
.pc-dayblock { margin: 8px 0; break-inside: avoid; }
.pc-dayhead { font-size: 13px; font-weight: 800; border-bottom: 1px solid #000;
  margin-bottom: 3px; padding-bottom: 2px; }
.pc-groupline { font-size: 11px; margin: 2px 0; }
.pc-row { display: flex; gap: 12px; padding: 3px 0; border-bottom: 1px dotted #999;
  font-size: 11px; break-inside: avoid; }
.pc-rowdate { flex: 0 0 190px; font-weight: 600; }
.pc-rowwho { flex: 1; }
table.pc-table { border-collapse: collapse; width: 100%; font-size: 11px; margin-top: 6px; }
table.pc-table th, table.pc-table td { border: 1px solid #666; padding: 3px 6px;
  text-align: left; }
table.pc-table th { font-weight: 800; }

@media print {
  .pc-month + .pc-month { break-before: page; }
  .pc-cell { break-inside: avoid; }
  .pc-dayblock, .pc-row { break-inside: avoid; }
}

/* Review Calendar (v3x): pre-publish review printout. */
.pc-call { font-size: 12px; font-weight: 800; margin-top: 2px; }
.pc-more { font-size: 9px; font-style: italic; margin-top: 2px; }
.pc-overflow { margin: 6px 0 10px; font-size: 10px; break-inside: avoid; }
.pc-orow { margin: 2px 0; }
.pc-alarm { border: 2px solid #000; padding: 8px 10px; margin: 8px 0;
  font-size: 12px; break-inside: avoid; }

/* Calendar name-fit (v3x): names stay on one line; JS shrinks the
   individual name's font size until it fits. No truncation, no ellipsis,
   no wrapping; alignment and colors unchanged. */
.fit-name { white-space: nowrap; display: block; }

/* Swap candidates, ranked by each physician's requests. */
.cand { padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; background: #f6f8fb; }
.cand-out { opacity: 0.45; }
.cand-out .small { color: #b91c1c; font-weight: 700; }
.cand-warn .small { color: #b45309; font-weight: 700; }
.cand-good .small { color: #15803d; font-weight: 700; }
.cand-ok .small { color: #1a3a5c; font-weight: 700; }

/* ---------- Requests (Phase 3b) ---------- */
/* Indicators always include text; color is decorative only. */
.req-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; border: 1px solid #cbd5e1; background: #f1f5f9; color: #0f172a; }
.pill-unav { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.pill-pnot { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.pill-pref { background: #dcfce7; border-color: #86efac; color: #14532d; }
.pill-must { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }
.pill-pto { background: #ede9fe; border-color: #c4b5fd; color: #4c1d95; }
.pill-partial { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.pill-frozen { background: #e2e8f0; border-color: #94a3b8; color: #334155; }

.segbar { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.segbar button { flex: 0 0 auto; border: 1px solid #cbd5e1; background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; }
.segbar button.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.filter-row select { font-size: 13px; padding: 4px 6px; }

.req-table-wrap { overflow-x: auto; }
.req-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.req-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: #64748b;
  padding: 6px 8px; border-bottom: 2px solid #e2e8f0; }
.req-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.nowrap { white-space: nowrap; }
.link.danger { color: #b91c1c; }
.btn.danger { color: #b91c1c; }

.flabel { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.flabel input, .flabel select, .flabel textarea { display: block; width: 100%; margin-top: 4px;
  font-size: 15px; padding: 8px; border: 1px solid #cbd5e1; border-radius: 8px; font-weight: 400; }
.row2 { display: flex; gap: 10px; }
.row2 .flabel { flex: 1; }

.review-card { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 8px;
  padding: 10px; margin-bottom: 8px; }
.review-card ul { margin: 6px 0; padding-left: 18px; font-size: 13px; }

/* Matrix: sticky person column, horizontal scroll on phones. */
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.matrix th, .matrix td { border: 1px solid #e2e8f0; padding: 4px 6px; text-align: center;
  min-width: 34px; }
.matrix th.sticky, .matrix td.sticky { position: sticky; left: 0; background: #fff;
  text-align: left; min-width: 110px; max-width: 140px; z-index: 1;
  box-shadow: 2px 0 3px rgba(0,0,0,0.06); }
.matrix th.hol { background: #fef3c7; }
.matrix td.mx-empty { background: #f8fafc; }
.matrix td.mx-unavailable { background: #fee2e2; font-weight: 700; }
.matrix td.mx-cannot_work { background: #fee2e2; font-weight: 700; }
.matrix td.mx-prefer_not { background: #fef3c7; font-weight: 700; }
.matrix td.mx-preferred { background: #dcfce7; font-weight: 700; }
.matrix td.mx-must_work { background: #dbeafe; font-weight: 700; }
.matrix td.mx-pto { background: #ede9fe; font-weight: 700; }
.matrix td.mx-partial_availability { background: #ffedd5; font-weight: 700; }

/* Heat map: number in every cell; shading decorative. */
.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.heat-cell { border-radius: 6px; padding: 6px 2px; text-align: center; border: 1px solid #e2e8f0; }
.heat-cell .hd { display: block; font-size: 12px; font-weight: 700; }
.heat-cell .hn { display: block; font-size: 10px; }
.heat-cell.h0 { background: #f8fafc; }
.heat-cell.h1 { background: #fef9c3; }
.heat-cell.h2 { background: #fed7aa; }
.heat-cell.h3 { background: #fecaca; }

.period-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px; margin-top: 8px; }
.period-person { border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px;
  display: flex; justify-content: space-between; align-items: center; }
.period-person.done { background: #f0fdf4; border-color: #86efac; }
.period-person.todo { background: #fff; }

.pick-row { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: 15px; }
.pick-row .sub { display: block; font-size: 12px; color: #64748b; }

/* ---------- Phase 3 (v3c) ---------- */
.v3-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.v3-grid th { font-size: 10px; color: var(--muted); padding: 2px; font-weight: 600; }
.v3-grid td { border: 1px solid var(--line); vertical-align: top; height: 64px; padding: 2px; font-size: 11px; cursor: pointer; }
.v3-grid td.pad { background: #f7f9fc; cursor: default; }
.v3-cell .dn { font-weight: 700; font-size: 11px; color: var(--muted); }
.v3-cell .who { font-weight: 600; font-size: 11px; line-height: 1.3; }
.v3-cell .who.uncov { color: #dc2626; }
.v3-cell .lk { font-size: 10px; }
.v3-cell.sel { outline: 2px solid var(--navy); }
.wdot { font-size: 10px; line-height: 1; }
.wdot.err { color: #dc2626; }
.wdot.warn { color: #d97706; }
.published-banner { background: #1a3a5c; color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 700; margin: 8px 0; }
.health-line { font-weight: 600; }
.fair-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fair-table th, .fair-table td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: right; white-space: nowrap; }
.fair-table td:first-child, .fair-table th:first-child { text-align: left; }
.tbl-wrap { overflow-x: auto; }
.why-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.why-list { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.why-list li { margin: 3px 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-row .btn { width: auto; margin-top: 0; }
.row2 { display: flex; gap: 10px; }
.row2 > div { flex: 1; min-width: 0; }
.v3-editor input[type="time"] { width: auto; }

/* v3e: import review table */
.rev-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rev-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--card, #fff);
}
.rev-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rev-table tr.rev-low td { background: #fffbeb; }
.rev-table tr.rev-med td { background: #fffdf5; }
.rev-table select, .rev-table input[type="text"] {
  font-size: 14px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; max-width: 100%;
}
.rev-table select { max-width: 150px; }
.rev-date .d { font-weight: 600; white-space: nowrap; }
.cell-crop {
  display: block; margin-top: 6px; max-width: 150px; border-radius: 8px;
  border: 1px solid var(--line); cursor: zoom-in;
}
.pill-ok { background: #dcfce7; color: #14532d; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-bad { background: #fee2e2; color: #991b1b; }

/* ---------- Build Schedule workflow (v4a) ---------- */
.build-steps { display: flex; gap: 4px; margin: 0 0 12px; overflow-x: auto; }
.build-step {
  flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: var(--muted); line-height: 1.2;
}
.build-step .bs-n {
  width: 20px; height: 20px; border-radius: 50%; background: #eef1f6; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.build-step.cur { border-color: var(--navy); color: var(--navy); }
.build-step.cur .bs-n { background: var(--navy); color: #fff; }
.build-step .bs-l { text-align: center; }
.req-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 13px; }
.req-sum strong { font-size: 15px; }

/* ---------- Collapsible sections (v4c) ---------- */
.coll-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.coll-head h2 { margin: 0; }
.coll-chev { font-size: 16px; color: var(--muted); line-height: 1; transition: transform .15s ease; }
.coll-head.closed .coll-chev { transform: rotate(-90deg); }
.coll-count { font-weight: 400; color: var(--muted); font-size: 13px; }

/* ---------- Holidays tab ---------- */
.hol-chip { display: inline-block; font-size: 12px; font-weight: 600; color: var(--navy);
  background: #eef2f7; border: 1px solid var(--line); padding: 3px 10px;
  border-radius: 20px; margin: 3px 4px 3px 0; }
.hol-chip.actual { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.hol-dates { margin: 6px 0 4px; }
.hol-eve { display: block; font-size: 10px; font-weight: 400; opacity: .75; }
.hol-star { color: #b45309; }
.hol-chip.actual .hol-star { color: #ffd97a; }
.hol-actual { margin: 2px 0 4px; }
.hol-tags { display: block; padding: 0 2px 6px; }
.hol-tags .badge { margin: 2px 4px 2px 0; }
.hol-x { background: none; border: none; color: var(--danger); font-size: 15px;
  cursor: pointer; padding: 0 2px; line-height: 1; }
.row-line.tappable { cursor: pointer; }
/* Per-holiday locks + explicit plan status */
.badge.lock-badge { color: #1e3a5f; background: #dbe7f5; border-color: #9db8d8; }
.lock-icon { font-size: 13px; margin-left: 4px; vertical-align: baseline; }
.hol-locked-card { border-left: 4px solid #1a3a5c; }
.plan-status { margin-top: 10px; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.plan-status.draft { background: #f3f4f6; border: 1px solid #d1d5db; color: #374151; }
.plan-status.approved { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.plan-status .small { margin-top: 2px; }

/* Holiday history import: unresolved records need human review. */
.hr-unresolved td { background: #fffbeb; }

/* ---------- Scheduler Decision Packet (decpacket.js) ---------- */
/* Screen-side: the doc preview reuses Print Center classes (pc-*). The
   dp-pagehead/dp-pagefoot strips repeat on every printed page via
   position:fixed in the print block below; they stay hidden on screen. */
.decpacket-print .dp-pagehead, .decpacket-print .dp-pagefoot { display: none; }
.decpacket-print .dp-doc { background: #fff; color: #000; }
.dp-qmark { display: inline-block; border: 1.5px solid #000; border-radius: 50%;
  width: 15px; height: 15px; line-height: 13px; text-align: center;
  font-size: 10px; font-weight: 800; vertical-align: 1px; }
.dp-reviewhead { font-size: 16px; font-weight: 800; border-bottom: 2px solid #000;
  margin: 14px 0 6px; padding-bottom: 3px; }
.dp-reviewcount { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.dp-nonone { font-size: 12px; margin: 8px 0; }
.dp-dateblock { border: 1.5px solid #000; padding: 8px 10px; margin: 0 0 10px;
  background: #fff; }
.dp-datehead { border-bottom: 1px solid #000; padding-bottom: 4px; margin-bottom: 4px; }
.dp-datename { font-size: 14px; font-weight: 800; }
.dp-kind { display: inline-block; border: 1px solid #000; padding: 0 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px; margin-left: 8px;
  vertical-align: 2px; }
.dp-issues { margin: 6px 0; padding-left: 18px; font-size: 11px; }
.dp-issues li { margin-bottom: 3px; }
.dp-current { font-size: 11px; font-weight: 600; margin: 6px 0; }
.dp-candhead { font-size: 11px; font-weight: 800; margin: 8px 0 4px;
  text-transform: uppercase; letter-spacing: 0.5px; }
.dp-cand { border: 1px solid #666; padding: 6px 8px; margin-bottom: 6px; font-size: 11px; }
.dp-candname { font-size: 12px; font-weight: 800; }
.dp-exp { margin-top: 2px; }
.dp-metrics { margin-top: 2px; font-weight: 600; }
.dp-wk, .dp-cons, .dp-pref, .dp-rec { margin-top: 2px; }
.dp-qol { margin-top: 4px; border-left: 3px solid #000; padding-left: 6px; }
.dp-partial { margin-top: 4px; border: 1px dashed #000; padding: 4px 6px; }
.dp-exc { margin-top: 4px; font-weight: 700; }
.dp-candexc { border-style: dashed; }
.dp-nocand { font-size: 11px; font-weight: 700; margin: 6px 0; }
.dp-clinicnote { font-size: 11px; margin: 6px 0; }
.dp-srcnote { font-size: 10px; font-style: italic; margin: 4px 0; }
.dp-decision { display: flex; align-items: flex-end; gap: 8px; margin-top: 14px;
  font-size: 11px; }
.dp-decisionlabel { font-weight: 800; white-space: nowrap; }
.dp-line { flex: 1; border-bottom: 1px solid #000; min-height: 18px; }
.dp-line2 { margin-top: 14px; }
.dp-sumhead { font-size: 16px; font-weight: 800; border-bottom: 2px solid #000;
  margin: 14px 0 6px; padding-bottom: 3px; }
.dp-stale { border: 2px solid #000; padding: 8px 10px; margin-top: 8px; font-size: 12px; }

@media print {
  /* Packet-only: hide the on-screen controls (the global print rules
     already hide .print-hide, buttons, inputs and selects). */
  .decpacket-print .dp-controls { display: none !important; }
  /* DRAFT banner on every page. position:fixed repeats per page in print. */
  .decpacket-print .dp-pagehead { display: flex; justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0; padding: 0.05in 0;
    border-bottom: 2px solid #000; background: #fff;
    font-size: 11px; font-weight: 800; letter-spacing: 1px; }
  .decpacket-print .dp-pagefoot { display: flex; justify-content: space-between;
    position: fixed; bottom: 0; left: 0; right: 0; padding: 0.05in 0;
    border-top: 1px solid #000; background: #fff; font-size: 9px; }
  .decpacket-print .dp-pageno::after { content: counter(page); }
  .decpacket-print .dp-doc { padding-top: 0.45in; padding-bottom: 0.4in; }
  /* One questioned date per unbroken block; breaks fall between dates. */
  .decpacket-print .dp-dateblock { break-inside: avoid; page-break-inside: avoid; }
  .decpacket-print .dp-reviewhead { break-after: avoid; }
  /* The month-end summary table header repeats if the table spans pages. */
  .decpacket-print table.dp-table thead { display: table-header-group; }
  .decpacket-print table.dp-table tr { break-inside: avoid; page-break-inside: avoid; }
  .decpacket-print .pc-cell { break-inside: avoid; }
}
