/* 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;
}
.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; }
.cell.is-today .num { color: #8a6d1f; }
.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; }

/* 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; }
