/* Coverage Scheduler — shared design system.
   Class inventory (use these in module templates):
   layout: .page .page-head .grid .grid-2 .grid-3 .card .card-title .toolbar .filter-bar
   tables: .table .schedule-table .cal-table .nowrap .cell-clip .pager
   badges: .badge .badge-critical .badge-high .badge-medium .badge-low .badge-info .badge-ok
   status: .pill .pill-draft .pill-needs_review .pill-ready .pill-sent .pill-revised .pill-archived
   cells:  .gap-cell .pto-cell .conflict-cell .orient-cell .call-cell
   misc:   .btn .btn-primary .btn-danger .btn-sm .btn-block .tag .muted .flash .empty
*/
:root {
  --navy: #1e3a5f;
  --navy-dark: #16283f;
  --teal: #0f766e;
  --teal-light: #e6f2f1;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #dde3ea;
  --text: #23303f;
  --muted: #6b7a8c;
  --critical: #c0392b;
  --critical-bg: #fdecea;
  --high: #d97706;
  --high-bg: #fef3e2;
  --medium: #b7791f;
  --medium-bg: #fdf6e3;
  --low: #64748b;
  --low-bg: #eef2f6;
  --ok: #15803d;
  --ok-bg: #e8f5ec;
  --info: #1d4ed8;
  --info-bg: #e8eefc;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 17px; margin: 18px 0 8px; color: var(--navy); }
h3 { font-size: 15px; margin: 12px 0 6px; color: var(--navy); }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top nav ---------- */
.topnav {
  display: flex; align-items: center; gap: 18px;
  background: var(--navy); color: #fff; padding: 0 18px; height: 52px;
  position: sticky; top: 0; z-index: 50;
}
.topnav .brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.topnav .brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-links .nav-item, .nav-links summary {
  color: #dbe4ee; padding: 6px 10px; border-radius: 6px; cursor: pointer;
  list-style: none; user-select: none; white-space: nowrap;
}
.nav-links .nav-item:hover, .nav-links summary:hover { background: var(--navy-dark); color: #fff; text-decoration: none; }
details.dd { position: relative; }
details.dd summary::-webkit-details-marker { display: none; }
.dd-menu {
  position: absolute; top: 34px; left: 0; background: #fff; min-width: 190px;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20,32,50,.18); padding: 6px; z-index: 100;
}
.dd-menu a { display: block; padding: 7px 10px; color: var(--text); border-radius: 6px; }
.dd-menu a:hover { background: var(--teal-light); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; color: #dbe4ee; white-space: nowrap; }
.nav-user a { color: #9fc1d8; }
.role-chip {
  background: var(--teal); color: #fff; border-radius: 99px;
  padding: 2px 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- page / cards ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 22px 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-title h2, .card-title h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- toolbar & forms ---------- */
.toolbar, .filter-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 3px; font-weight: 600; font-size: 12.5px; color: var(--navy); }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; min-width: 120px;
}
textarea { min-width: 260px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,118,110,.35); border-color: var(--teal); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-actions { margin-top: 14px; display: flex; gap: 8px; }
.checks { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--navy); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 6px;
}
.btn:hover { background: var(--low-bg); text-decoration: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #0c5f59; }
.btn-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-danger:hover { background: #992d22; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th {
  background: var(--low-bg); color: var(--navy); font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 52px;
}
.table tbody tr:hover { background: #fafcff; }
.nowrap { white-space: nowrap; }
.cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 10px; }

/* schedule grid: facility/specialty rows x weekday columns */
.schedule-table { width: 100%; border-collapse: collapse; }
.schedule-table th, .schedule-table td {
  border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; min-width: 96px;
}
.schedule-table thead th { background: var(--navy); color: #fff; font-size: 12.5px; }
.schedule-table .fac-col { background: var(--low-bg); font-weight: 700; color: var(--navy); min-width: 150px; }
.schedule-table .spec-col { background: #f8fafc; font-weight: 600; min-width: 120px; }
.schedule-table td.today-col { background: #fbfdf4; }
.asg { display: block; margin: 1px 0; }
.asg .src-manual { color: var(--info); }
.asg .src-exception { color: var(--high); }

/* monthly calendar */
.cal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-table th, .cal-table td { border: 1px solid var(--line); padding: 6px; vertical-align: top; height: 92px; }
.cal-table th { background: var(--navy); color: #fff; height: auto; }
.cal-table .cal-date { font-weight: 700; color: var(--navy); font-size: 12px; margin-bottom: 3px; }
.cal-table .other-month { background: #f4f6f9; color: var(--muted); }

/* semantic cells */
.gap-cell { background: var(--critical-bg); color: var(--critical); font-weight: 700; }
.pto-cell { background: var(--medium-bg); color: var(--medium); }
.conflict-cell { background: var(--high-bg); }
.orient-cell { background: var(--info-bg); color: var(--info); }
.call-cell { background: var(--teal-light); }

/* ---------- badges / pills / tags ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-high { background: var(--high-bg); color: var(--high); }
.badge-medium { background: var(--medium-bg); color: var(--medium); }
.badge-low { background: var(--low-bg); color: var(--low); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }

.pill { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill-draft { background: var(--low-bg); color: var(--low); }
.pill-needs_review { background: var(--medium-bg); color: var(--medium); }
.pill-ready { background: var(--ok-bg); color: var(--ok); }
.pill-sent { background: var(--info-bg); color: var(--info); }
.pill-revised { background: var(--high-bg); color: var(--high); }
.pill-archived { background: var(--low-bg); color: var(--low); }

.tag {
  display: inline-block; background: var(--low-bg); color: var(--navy);
  border-radius: 5px; padding: 1px 7px; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
}
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 22px; }

/* ---------- flash & alerts ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; }
.flash-success, .flash-info { background: var(--ok-bg); border-color: #bfe3cc; color: var(--ok); }
.flash-warning { background: var(--medium-bg); border-color: #ecd9a8; color: var(--medium); }
.flash-danger, .flash-error { background: var(--critical-bg); border-color: #f2c4be; color: var(--critical); }

.alert-row { display: flex; gap: 10px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: none; }

/* ---------- stat tiles (dashboard) ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-tile .num { font-size: 28px; font-weight: 800; color: var(--navy); }
.stat-tile .lbl { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile.tile-critical .num { color: var(--critical); }
.stat-tile.tile-high .num { color: var(--high); }
.stat-tile.tile-ok .num { color: var(--ok); }

/* ---------- login ---------- */
.login-wrap { display: flex; justify-content: center; padding-top: 9vh; }
.login-card { width: 360px; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 14px; }

/* ---------- print ---------- */
@media print {
  .no-print, .topnav, .flash, .toolbar, .filter-bar, .btn { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { border: none; padding: 0; }
  .table thead th { position: static; }
}
