/* ── MDS Pro Timesheet Admin — clinical editorial ─────────────── */
:root {
  --ink: #102b28;
  --ink-soft: #43615c;
  --pine: #14695c;
  --pine-deep: #0c4a41;
  --pine-night: #0a2622;
  --paper: #f6f3ec;
  --card: #fffdf8;
  --line: #e3ddcf;
  --line-soft: #ece7d9;
  --amber: #dca33c;
  --amber-deep: #b97f1f;
  --amber-soft: #f7ead2;
  --danger: #c4574a;
  --cream: #f3eee1;
  --display: 'Fraunces', Georgia, serif;
  --body: 'Public Sans', -apple-system, 'Segoe UI', sans-serif;
  --shadow-card: 0 18px 40px -28px rgba(16, 43, 40, 0.55);
  --shadow-soft: 0 10px 24px -18px rgba(16, 43, 40, 0.45);
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }
/* Clip stray horizontal overflow (e.g. the off-canvas mobile sidebar parked at
   translateX(100%)) so iOS Safari doesn't shrink-to-fit and load the page zoomed.
   `clip` (not `hidden`) keeps position: sticky working — it makes no scroll box. */
html, body { overflow-x: clip; }
body {
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
/* lock background scroll while a modal/overlay is open */
body.modal-open { overflow: hidden; }

/* ── icons ───────────────────────────────────── */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 1.05em; height: 1.05em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.18em;
}

/* ── brand ───────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--pine-night);
  background: linear-gradient(150deg, #f0c463, var(--amber) 55%, var(--amber-deep));
  box-shadow: 0 8px 18px -8px rgba(185, 127, 31, 0.6);
}
.brand-mark .ico { width: 22px; height: 22px; stroke-width: 2.1; }
.brand-words { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand-main {
  font-family: var(--display); font-style: italic; font-weight: 650;
  font-size: 21px; color: var(--pine-deep);
}
.brand-sub {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* ── login stage ─────────────────────────────── */
.login-stage {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(70% 90% at 85% 10%, rgba(20, 105, 92, 0.16) 0%, transparent 60%),
    radial-gradient(50% 60% at 10% 90%, rgba(220, 163, 60, 0.12) 0%, transparent 60%),
    var(--paper);
}
.login-card {
  width: min(400px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 36px 32px;
  box-shadow: 0 40px 80px -36px rgba(16, 43, 40, 0.5);
  animation: rise 0.4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.login-card h1 {
  font-family: var(--display); font-weight: 500; font-size: 34px;
  line-height: 1.08; margin: 22px 0 22px;
}
.login-card h1 em { font-style: italic; color: var(--pine); }

/* ── shell ───────────────────────────────────── */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background:
    radial-gradient(130% 60% at 0% 0%, rgba(20, 105, 92, 0.5) 0%, transparent 62%),
    var(--pine-night);
  color: var(--cream);
  display: flex; flex-direction: column;
  padding: 26px 18px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-main { color: var(--cream); }
.sidebar .brand-sub { color: #9dbcb2; }

.nav { margin-top: 40px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative; text-align: left; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px; color: #aec7bf;
  padding: 11px 13px; border-radius: 11px;
  display: flex; align-items: center; gap: 12px;
  transition: background 0.16s, color 0.16s;
}
.nav-item .ico { width: 18px; height: 18px; opacity: 0.85; transition: color 0.16s; }
.nav-item .nav-label { flex: 1; }
.nav-item:hover { background: rgba(243, 238, 225, 0.07); color: var(--cream); }
.nav-item.active { background: rgba(243, 238, 225, 0.1); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--amber);
}
.nav-item.active .ico { color: var(--amber); opacity: 1; }
.badge {
  margin-left: auto;
  background: var(--amber); color: #2c1f04; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; min-width: 20px; text-align: center;
}

.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(243, 238, 225, 0.13); padding-top: 16px; }
.admin-chip { display: flex; align-items: center; gap: 11px; }
.admin-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; color: var(--amber);
  background: rgba(243, 238, 225, 0.09);
}
.admin-avatar .ico { width: 18px; height: 18px; }
.admin-meta { min-width: 0; }
.admin-name { font-size: 13px; font-weight: 700; color: var(--cream); margin-bottom: 2px; }
.link-btn {
  border: 0; background: none; font: inherit; font-size: 12px;
  color: #9dbcb2; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.link-btn .ico { width: 13px; height: 13px; }
.link-btn:hover { color: var(--amber); }

.main { padding: 36px 44px 64px; width: 100%; max-width: 2400px; margin: 0 auto; }

/* ── page head ───────────────────────────────── */
.page { animation: rise 0.3s ease both; }
.page-head { margin-bottom: 26px; }
.head-text { min-width: 0; }
.page-head h2 {
  font-family: var(--display); font-weight: 650; font-size: 30px; line-height: 1.12;
}
.page-sub { color: var(--ink-soft); font-size: 13px; margin-top: 5px; max-width: 64ch; }

/* ── toolbar / filters ───────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.field-icon { position: relative; display: inline-flex; align-items: center; }
.field-icon > .ico {
  position: absolute; left: 11px; width: 15px; height: 15px;
  color: var(--ink-soft); pointer-events: none;
}
.field-icon select, .field-icon input,
.filters select, .filters input {
  font: inherit; font-size: 13px; color: var(--ink);
  background-color: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 11px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field-icon select, .field-icon input { padding-left: 32px; }
.field-icon select:focus, .field-icon input:focus,
.filters select:focus, .filters input:focus {
  border-color: var(--pine); box-shadow: 0 0 0 3px rgba(20, 105, 92, 0.12);
}
.date-range { display: inline-flex; align-items: center; gap: 9px; }
.filter-sep { color: var(--ink-soft); font-size: 14px; }
.filter-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-soft);
}

/* ── overview cards ──────────────────────────── */
/* Auto-fit: more cards per row on wide screens, fewer on small — e.g. all six
   nurses in one row on a 2560 display, ~3 on a laptop, 1 on a phone. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 18px; }
.nurse-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px 22px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-card); transition: transform 0.18s, box-shadow 0.18s;
}
.nurse-card:hover { transform: translateY(-2px); box-shadow: 0 24px 46px -28px rgba(16, 43, 40, 0.55); }
.nurse-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--line-soft);
}
.nurse-card.status-working::before { background: linear-gradient(90deg, var(--amber), #efc873); }
.nurse-card.status-break::before { background: linear-gradient(90deg, #6fa0c9, #a9c8e3); }
.nurse-card.status-done::before { background: linear-gradient(90deg, var(--pine), #5fae9c); }
.nurse-card.status-working { border-color: #ecd9ae; background: linear-gradient(180deg, #fffdf8, #fdf6e8); }
.nurse-card.status-break { border-color: #cfe0ef; background: linear-gradient(180deg, #fffdf8, #f1f6fb); }
.nurse-card h3 { font-family: var(--display); font-weight: 650; font-size: 19px; line-height: 1.2; }
.nurse-card .card-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 7px; flex-wrap: wrap;
}
.nurse-card .role { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.nurse-card .clocked-in {
  margin-top: 8px; font-size: 12px; color: var(--ink-soft); font-weight: 600;
  font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px;
}
.nurse-card .clocked-in .ico { width: 14px; height: 14px; color: var(--pine); }
.nurse-card .clocked-out .ico { color: var(--ink-soft); }
.nurse-card .clocked-in strong { color: var(--ink); font-weight: 800; }
.nurse-card .now-task {
  margin-top: 12px; line-height: 1.4;
  background: #fdf6e8; border: 1px solid #ecd9ae; border-radius: 11px; padding: 9px 11px;
}
.nurse-card .now-timer {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--display); font-variant-numeric: tabular-nums;
  font-size: 20px; font-weight: 650; color: var(--pine-deep);
}
.nurse-card .now-timer .ico { width: 17px; height: 17px; color: var(--amber-deep); }
.nurse-card .now-timer small {
  font-family: var(--body); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
}
.nurse-card .now-since { font-size: 11px; color: var(--ink-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.nurse-card .now-note {
  margin-top: 7px; font-size: 12.5px; color: var(--ink);
  display: flex; gap: 5px; align-items: flex-start;
}
.nurse-card .now-note .ico { width: 13px; height: 13px; color: var(--amber-deep); margin-top: 2px; flex: none; }
.nurse-card .meta {
  margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line-soft, #ece7d9);
  display: flex; justify-content: space-between; gap: 10px;
}
.nurse-card .stat { display: flex; flex-direction: column; align-items: flex-start; }
.nurse-card .stat .stat-ico { width: 15px; height: 15px; color: var(--pine); opacity: 0.65; margin-bottom: 7px; }
.nurse-card .stat-num {
  font-family: var(--display); font-size: 22px; font-weight: 650;
  color: var(--pine-deep); line-height: 1.1;
}
.nurse-card .stat small {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); margin-top: 3px;
}

/* status pills */
.live-pill, .break-pill, .done-pill, .off-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px;
}
.live-pill .ico, .break-pill .ico, .done-pill .ico, .off-pill .ico { width: 12px; height: 12px; }
.live-pill { color: #7c5708; background: var(--amber-soft); border: 1px solid #ecd9ae; }
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: pulse 1.6s ease infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 163, 60, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(220, 163, 60, 0); }
}
.off-pill { color: #97917e; }
.break-pill { color: #2f6690; background: #e6eef6; border: 1px solid #cfe0ef; }
.done-pill { color: var(--pine-deep); background: #e2efe7; border: 1px solid #c9ddd4; }

.live-badge {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  font-family: var(--body); font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--pine-deep);
  background: #e2efe7; border: 1px solid #c9ddd4; border-radius: 999px;
  padding: 2px 9px; margin-left: 8px;
}
.live-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--pine);
  animation: pulse 1.6s ease infinite;
}

/* ── insights ────────────────────────────────── */
/* period segmented control */
.seg {
  display: inline-flex; gap: 3px; padding: 4px; margin-bottom: 20px;
  background: var(--cream); border: 1px solid var(--line); border-radius: 12px;
}
.seg-btn {
  border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px;
  color: var(--ink-soft); padding: 7px 16px; border-radius: 9px; transition: background 0.15s, color 0.15s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--card); color: var(--pine-deep);
  box-shadow: 0 2px 6px -3px rgba(16, 43, 40, 0.4);
}

/* top-of-Overview trackers — a single line of plain text */
.overview-trackers {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin-bottom: 16px; font-size: 13.5px; color: var(--ink-soft);
}
.overview-trackers strong { color: var(--pine-deep); font-weight: 700; font-variant-numeric: tabular-nums; }
.trk { display: inline-flex; align-items: center; gap: 6px; }
.trk .ico { width: 15px; height: 15px; color: var(--pine); }
.trk-sep { color: var(--line); }

/* "Hours by nurse" panel header: title left, period control right */
.bynurse-panel { margin-top: 2px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.panel-head h3 {
  font-family: var(--display); font-weight: 650; font-size: 17px;
  display: flex; align-items: center; gap: 8px;
}
.panel-head h3 .ico { width: 17px; height: 17px; color: var(--pine); }
.panel-head .seg { margin-bottom: 0; }

/* clickable Overview nurse cards (open the stats modal) */
.nurse-card.clickable { cursor: pointer; }

/* team charts section, spaced below the nurse cards */
.team-charts { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; }
.charts-head { margin-bottom: 0; }
.charts-head h3 { font-family: var(--display); font-weight: 650; font-size: 18px; }
/* .insight-grid.two-col so it beats the later, single-class .insight-grid rule */
.insight-grid.two-col { grid-template-columns: 1fr 1fr; align-items: stretch; }
@media (max-width: 980px) { .insight-grid.two-col { grid-template-columns: 1fr; } }
/* equal-height panel boxes; the column chart fills the panel so its bars are
   taller and anchored to the bottom (columns already align to flex-end) */
.two-col .insight-panel { display: flex; flex-direction: column; }
.two-col .daychart { flex: 1; height: auto; min-height: 180px; }

/* the nurse modal's own period control */
.seg-modal { margin: 2px 0 12px; }

/* payroll donut + legend */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.donut { width: 150px; height: 150px; flex: none; }
/* segments draw on clockwise; timing/delay set inline per slice for a sweep */
.donut-seg { animation-name: donut-draw; animation-timing-function: linear; animation-fill-mode: both; }
@keyframes donut-draw { from { stroke-dasharray: 0 400; } }
.donut-total { font-family: var(--display); font-weight: 650; font-size: 21px; fill: var(--pine-deep); text-anchor: middle; }
.donut-cap { font-size: 9px; fill: var(--ink-soft); text-anchor: middle; text-transform: uppercase; letter-spacing: 0.12em; }
.donut-legend { list-style: none; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 170px; font-size: 12.5px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-val { margin-left: auto; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* clocked-vs-on-site cross-match */
.cvs-list { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.cvs-row { display: grid; grid-template-columns: 140px 1fr auto; align-items: center; gap: 12px; }
.cvs-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cvs-bar { height: 12px; }
.cvs-track { display: block; height: 100%; border-radius: 999px; background: #e7efe9; overflow: hidden; }
.cvs-fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--pine), #2f8d7c);
  transform-origin: left center; animation: bar-grow 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.cvs-val { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cvs-val strong { color: var(--pine-deep); }
.cvs-val .cvs-low { color: var(--danger); }
@media (max-width: 560px) {
  .cvs-row { grid-template-columns: 1fr; gap: 4px; }
  .cvs-val { font-size: 11.5px; }
}

/* colorful stat cards */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 17px 18px; box-shadow: var(--shadow-card);
}
.stat-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; }
.stat-chip { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 11px; }
.stat-chip .ico { width: 18px; height: 18px; }
.stat-value {
  font-family: var(--display); font-weight: 650; font-size: 28px; color: var(--ink);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-value small { font-family: var(--body); font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-left: 2px; }
.stat-key { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); margin-top: 8px; }
.stat-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.accent-green::before { background: var(--pine); }
.accent-green .stat-chip { background: #e2efe7; color: var(--pine-deep); }
.accent-amber::before { background: var(--amber); }
.accent-amber .stat-chip { background: var(--amber-soft); color: #8a6313; }
.accent-teal::before { background: #2f8d7c; }
.accent-teal .stat-chip { background: #dcefe9; color: #1f6b5d; }
.accent-sky::before { background: #3f7fa6; }
.accent-sky .stat-chip { background: #e4eef5; color: #2f6286; }

.stat-grid-sm { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-grid-sm .stat-card { padding: 14px 14px; }
.stat-grid-sm .stat-value { font-size: 22px; }
.stat-grid-sm .stat-chip { width: 30px; height: 30px; margin-bottom: 8px; }
@media (max-width: 560px) { .stat-grid-sm { grid-template-columns: repeat(2, 1fr); } }

.insight-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .insight-grid { grid-template-columns: 1fr; } }
.insight-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 22px; box-shadow: var(--shadow-card);
}
.insight-panel h3 {
  font-family: var(--display); font-weight: 650; font-size: 17px;
  display: flex; align-items: center; gap: 8px;
}
.insight-panel h3 .ico { width: 17px; height: 17px; color: var(--pine); }
.insight-panel h3.mt { margin-top: 22px; }
.panel-hint { font-size: 12px; color: var(--ink-soft); margin: 5px 0 11px; line-height: 1.45; }

.flag-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.flag-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px;
  padding: 9px 12px; border-radius: 10px; background: #faf7ef; border: 1px solid var(--line-soft);
}
.flag-warn .flag-item { background: var(--amber-soft); border-color: #ecd9ae; }
.flag-name { font-weight: 700; }
.flag-meta { font-size: 12px; color: #7c5708; font-variant-numeric: tabular-nums; }
.flag-empty { font-size: 12.5px; color: var(--ink-soft); font-style: italic; padding: 8px 2px; list-style: none; }

.bars { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bar-row {
  display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px;
  width: 100%; color: var(--ink); padding: 6px 4px;
}
.bar-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar-fill {
  display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pine), #2f8d7c);
  transform-origin: left center; animation: bar-grow 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes bar-grow { from { transform: scaleX(0); } }
.bar-c1 .bar-fill { background: linear-gradient(90deg, #14695c, #2f8d7c); }
.bar-c2 .bar-fill { background: linear-gradient(90deg, #c98a25, #e8b85a); }
.bar-c3 .bar-fill { background: linear-gradient(90deg, #2f6286, #5b9cc2); }
.bar-c4 .bar-fill { background: linear-gradient(90deg, #b9683a, #dca06a); }
.bar-c5 .bar-fill { background: linear-gradient(90deg, #4d8a52, #7faf7f); }
.bar-val { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val small { color: var(--ink-soft); font-weight: 400; }
@media (max-width: 480px) {
  .bar-row { grid-template-columns: 88px 1fr auto; gap: 8px; }
  .bar-name { font-size: 12px; }
  .stat-value { font-size: 24px; }
}

.ins-sub {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); margin: 20px 0 11px;
}
.ins-running {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 13px; color: #7c5708; font-weight: 600;
  background: var(--amber-soft); border: 1px solid #ecd9ae; border-radius: 11px; padding: 10px 13px;
}
.ins-running .ico { width: 16px; height: 16px; flex: none; }

/* ── nurse modal ─────────────────────────────── */
/* .modal-card.modal-wide beats the base .modal-card width (defined later). */
.modal-card.modal-wide {
  width: min(940px, 96vw); max-height: 88vh; overflow: auto;
  padding: 24px 28px; position: relative;
}
.modal-x {
  position: absolute; top: 16px; right: 16px; border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; transition: background 0.15s, color 0.15s;
}
.modal-x .ico { width: 20px; height: 20px; }
.modal-x:hover { background: #faf7ef; color: var(--ink); }
/* On small screens fill the width with symmetric margins (no right-edge clipping). */
@media (max-width: 600px) {
  .modal-overlay { padding: 12px; }
  .modal-card.modal-wide { width: 100%; max-width: 100%; max-height: 92vh; padding: 18px 16px; }
  .modal-x { top: 12px; right: 12px; }

  /* Clock-in history: compact the 6 columns so they fit the modal width instead
     of forcing a horizontal scroll that fights the modal's own scrolling. */
  .hist-scroll table { font-size: 11px; }
  .hist-scroll th, .hist-scroll td { padding: 8px 6px; }
  .hist-scroll th { font-size: 9px; letter-spacing: 0.04em; }
  .hist-scroll .note-cell { max-width: 110px; white-space: normal; word-break: break-word; }
}
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hist-scroll { max-height: 280px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.nurse-modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-right: 34px; }
.modal-avatar {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center;
  color: var(--pine-night); background: linear-gradient(150deg, #f0c463, var(--amber) 60%, var(--amber-deep));
}
.modal-avatar .ico { width: 22px; height: 22px; }
.nurse-modal-head h3 { font-family: var(--display); font-weight: 650; font-size: 22px; line-height: 1.1; }
.modal-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; text-transform: capitalize; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip { font-size: 12px; color: var(--ink-soft); background: #faf7ef; border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 11px; }
.chip strong { color: var(--pine-deep); margin-left: 3px; font-variant-numeric: tabular-nums; }

.daychart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; }
.daybar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; }
.daybar-fill {
  width: 100%; max-width: 24px; border-radius: 5px 5px 0 0; min-height: 2px;
  background: linear-gradient(180deg, var(--amber), var(--pine));
  transform-origin: bottom center; animation: col-grow 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes col-grow { from { transform: scaleY(0); } }
.daybar-val { font-size: 9.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-height: 12px; }
.daybar-x {
  font-size: 10px; color: var(--ink-soft); font-weight: 600;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.5; padding-bottom: 1px;
}

/* ── tables ──────────────────────────────────── */

/* ── tables ──────────────────────────────────── */
.table-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  overflow: auto; box-shadow: var(--shadow-card);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft);
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  background: #faf7ef; position: sticky; top: 0;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: #faf7ef; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.col-action, th.col-action { text-align: center; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sort-active { color: var(--pine-deep); }
.sort-arrow { font-size: 9px; color: #c2bba8; }
.sort-arrow .ico { width: 12px; height: 12px; vertical-align: -0.15em; }
.sort-arrow.active { color: var(--pine-deep); }
.corrected { display: inline-flex; align-items: center; gap: 3px; color: var(--amber-deep); font-size: 11px; font-weight: 700; }
.corrected .ico { width: 11px; height: 11px; }
.in-progress { color: var(--amber-deep); font-style: italic; font-weight: 600; }
.note-cell { color: var(--ink-soft); max-width: 420px; }
.empty-row td { text-align: center; color: var(--ink-soft); padding: 30px; font-style: italic; }

/* role + status indicators in the Team table */
.role-tag {
  display: inline-flex; align-items: center; gap: 5px; text-transform: capitalize;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.role-tag .ico { width: 13px; height: 13px; }
.role-tag.role-admin { background: #e2efe7; color: var(--pine-deep); }
.role-tag.role-nurse { background: var(--amber-soft); color: #7c5708; }
.state-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.state-dot.on { background: var(--pine); box-shadow: 0 0 0 3px rgba(20, 105, 92, 0.14); }
.state-dot.off { background: #c9c2b0; }

/* editable hourly rate in the Team table — click-to-edit */
.rate-view { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.rate-val {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink);
  border-radius: 6px; padding: 1px 3px; transition: background 0.3s, box-shadow 0.3s;
}
.rate-val.rate-saved { background: var(--amber-soft); box-shadow: 0 0 0 3px var(--amber-soft); }
.rate-edit-btn {
  border: 0; background: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 8px; color: var(--pine);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.rate-edit-btn .ico { width: 13px; height: 13px; }
.rate-edit-btn:hover { background: rgba(20, 105, 92, 0.08); }

.rate-form { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); justify-content: flex-end; }
.rate-input {
  width: 70px; font: inherit; font-size: 13px; text-align: right;
  color: var(--ink); background: #fff;
  border: 1px solid var(--pine); border-radius: 8px; padding: 5px 8px; outline: none;
  box-shadow: 0 0 0 3px rgba(20, 105, 92, 0.13);
}
.rate-apply {
  border: 0; background: var(--pine); color: #fdfbf4; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 5px 10px;
  display: inline-flex; align-items: center; gap: 5px;
}
.rate-apply .ico { width: 13px; height: 13px; }
.rate-apply:hover { filter: brightness(1.08); }
.rate-apply[disabled] { opacity: 0.6; cursor: wait; }
.rate-cancel {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rate-cancel .ico { width: 13px; height: 13px; }
.rate-cancel:hover { color: var(--danger); border-color: var(--danger); }

/* payroll totals row */
tfoot .foot-row td {
  border-top: 2px solid var(--line); border-bottom: 0;
  font-weight: 700; color: var(--pine-deep); background: #faf7ef;
}
.muted { color: var(--ink-soft); font-weight: 400; font-size: 12px; }

.pay-detail-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft); background: #faf7ef;
}
.pay-detail-head strong { color: var(--ink); }

/* ── corrections ─────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.correction-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 17px 19px; display: grid; grid-template-columns: 1fr auto; gap: 10px;
  box-shadow: var(--shadow-soft);
}
.correction-card .who { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.correction-card .when { color: var(--ink-soft); font-size: 12.5px; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.correction-card .when .ico { width: 14px; height: 14px; flex: none; color: var(--ink-soft); }
.correction-card .reason { margin-top: 8px; font-size: 13px; }
.correction-card .actions { display: flex; gap: 8px; align-items: flex-start; }
.status-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 10px;
}
.status-tag.pending { background: var(--amber-soft); color: #7c5708; }
.status-tag.approved { background: #e2efe7; color: var(--pine-deep); }
.status-tag.rejected { background: #f6e3df; color: var(--danger); }

/* ── team ────────────────────────────────────── */
/* Stacked: full-width table on top, invite form below. The invite lays out
   horizontally on larger screens (see below) so the card stays short and the
   Team tab fits without a vertical scrollbar. */
.team-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
/* Cap the team list at ~8 rows; scroll past that. Sticky header stays put. */
.team-grid > .table-card { max-height: 498px; }

/* Keep the Timesheets table within the viewport: scroll its body, not the page.
   The subtracted offset covers the page head, toolbar and the main's bottom
   padding, leaving modern breathing room below the card. */
#page-timesheets .table-card { max-height: calc(100vh - 300px); min-height: 220px; }

/* pagination controls */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-soft);
}
.pager:empty { display: none; }
.pager-info, .pager-cur { font-variant-numeric: tabular-nums; }
.pager-btns { display: flex; align-items: center; gap: 10px; }
.pager-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 6px 13px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pager-btn:hover:not([disabled]) { background: #faf7ef; border-color: var(--pine); }
.pager-btn[disabled] { opacity: 0.5; cursor: default; }
.invite-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: var(--shadow-card);
}
.invite-card h3 {
  font-family: var(--display); font-weight: 650; font-size: 20px; margin-bottom: 4px;
  display: flex; align-items: center; gap: 9px;
}
.invite-card h3 .ico { width: 19px; height: 19px; color: var(--pine); }
.invite-card form { margin-top: 14px; }

/* Non-mobile: a 2×2 field grid (Full name / Email in column one, Role / Rate in
   column two) so the card stays short instead of a tall stack. Mobile keeps the
   vertical form. */
@media (min-width: 861px) {
  .invite-card form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name role"
      "email rate"
      "btn   btn"
      "msg   msg";
    gap: 14px 16px;
    align-items: start;
  }
  .invite-card .field { margin-bottom: 0; }
  #invite-name-field { grid-area: name; }
  #invite-email-field { grid-area: email; }
  #invite-role-field { grid-area: role; }
  #invite-rate-field { grid-area: rate; }
  .invite-card form .btn-primary { grid-area: btn; }
  .invite-card #invite-msg { grid-area: msg; margin: 0; }
}

/* ── fields & buttons ────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}
.field input, .field select {
  width: 100%; font: inherit; color: var(--ink);
  background-color: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--pine); box-shadow: 0 0 0 3px rgba(20, 105, 92, 0.13);
}

/* ── bespoke form controls ───────────────────────────────────────
   Drop the default OS arrow on <select> and draw our own chevron, and
   give date fields a single (left) calendar icon that opens the native
   picker on click — no doubled icons, no oversized default control.
   (Placed after the base field rules so the chevron/padding win.) */
.field-icon select, .field select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2343615c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  padding-right: 34px; cursor: pointer; text-overflow: ellipsis;
}
.field select { background-position: right 13px center; }
.field-icon input[type="date"] { cursor: pointer; }
.field-icon input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
.field-icon input[type="date"]::-webkit-inner-spin-button { display: none; }

.btn {
  border: 0; border-radius: 11px; padding: 11px 18px;
  font: inherit; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
}
.btn .ico { width: 16px; height: 16px; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: wait; }
.btn-primary {
  width: 100%; color: #fdfbf4;
  background: linear-gradient(180deg, var(--pine), var(--pine-deep));
  box-shadow: 0 8px 18px -8px rgba(12, 74, 65, 0.55);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-small { padding: 8px 15px; font-size: 12.5px; background: var(--pine); color: #fdfbf4; box-shadow: var(--shadow-soft); }
.btn-small .ico { width: 15px; height: 15px; }
.btn-small:hover { filter: brightness(1.08); }
.btn-amber { background: linear-gradient(180deg, #d9a23a, var(--amber-deep)); color: #2c1f04; }
.btn-approve { background: var(--pine); color: #fff; padding: 7px 13px; font-size: 12.5px; }
.btn-reject { background: #f1e6e3; color: var(--danger); padding: 7px 13px; font-size: 12.5px; }
.btn-approve .ico, .btn-reject .ico { width: 14px; height: 14px; }

.error { color: var(--danger); font-size: 12.5px; margin: 4px 0 10px; }
.ok { color: var(--pine); }

/* ── confirm modal ───────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(10, 38, 34, 0.5); backdrop-filter: blur(3px);
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: min(420px, 100%); background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 26px;
  box-shadow: 0 40px 80px -36px rgba(16, 43, 40, 0.6);
  animation: rise 0.22s ease both;
}
.modal-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  color: var(--danger); background: #f6e3df; margin-bottom: 15px;
}
.modal-icon .ico { width: 24px; height: 24px; }
.modal-card h3 { font-family: var(--display); font-weight: 650; font-size: 21px; line-height: 1.15; }
.modal-card p { margin-top: 9px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions .btn { width: auto; padding: 10px 18px; }
.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: #faf7ef; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 14px -6px rgba(196, 87, 74, 0.55); }
.btn-danger:hover { filter: brightness(1.05); }

/* ── mobile top bar + hamburger (hidden on desktop) ──────────── */
.topbar { display: none; }
.hamburger {
  border: 0; background: none; color: var(--ink); padding: 4px;
  cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.hamburger .ico { width: 24px; height: 24px; stroke-width: 1.9; }
.topbar-lead { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar-mark { width: 36px; height: 36px; border-radius: 11px; }
.topbar-mark .ico { width: 20px; height: 20px; }
.topbar-title { min-width: 0; }
.tb-name {
  display: block; font-family: var(--display); font-weight: 650;
  font-size: 19px; line-height: 1.1; color: var(--ink);
}
.tb-desc {
  display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-close {
  display: none; position: absolute; top: 24px; right: 18px;
  border: 0; background: none; padding: 4px;
  color: var(--cream); cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-close .ico { width: 22px; height: 22px; }
.col-action button { white-space: nowrap; }

/* ── responsive: ≤860px → full-screen hamburger nav ──────────── */
@media (max-width: 860px) {
  .shell { display: block; }

  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 13px;
    position: sticky; top: 0; z-index: 30;
    /* full-bleed bar, but its content lines up with the main content below
       (negative margins cancel .main's padding, padding restores the inset) */
    margin: -16px -16px 14px; padding: 11px 16px;
    background: rgba(246, 243, 236, 0.9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }

  /* Sidebar becomes a full-screen overlay, slid in from the left. */
  .sidebar {
    position: fixed; inset: 0; width: 100%; height: 100%;
    padding: 28px 26px; overflow-y: auto; z-index: 50;
    transform: translateX(100%); transition: transform 0.28s ease;
    box-shadow: none;
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }

  .nav { margin-top: 52px; gap: 6px; }
  .nav-item { font-size: 17px; padding: 15px 14px; border-radius: 13px; }
  .nav-item .ico { width: 22px; height: 22px; }
  .nav-item.active::before { left: -26px; height: 26px; }
  .sidebar-foot { padding-top: 20px; }

  .main { padding: 16px 16px 40px; }
  /* The page title + description live in the sticky top bar on mobile. */
  .page-head { display: none; }
  /* Overview keeps its date + live badge as a slim line above the cards. */
  #page-overview .page-head { display: block; margin: 0 0 14px; }
  #page-overview .page-head h2 { display: none; }
  #page-overview .page-sub { font-size: 12px; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .filters { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .filters > .field-icon, .filters > .date-range { width: 100%; }
  .filters .field-icon { display: flex; }
  .filters .field-icon select, .filters .field-icon input { width: 100%; }
  /* keep the From / → / To inputs together on one row */
  .date-range > .field-icon { flex: 1; min-width: 0; }
  .toolbar .btn-small { width: 100%; }

  /* One nurse card per row on mobile. */
  .cards { grid-template-columns: 1fr; gap: 14px; }

  #page-timesheets .table-card { max-height: calc(100vh - 270px); }
}

/* ── small phones: scale type down so it reads clean, not zoomed, and the
      data tables fit without horizontal scrollbars ──────────────── */
@media (max-width: 480px) {
  .main { padding: 16px 12px 36px; }
  /* match the bar's full-bleed offset to the 12px side padding here */
  .topbar { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  #page-overview .page-sub { font-size: 12px; }
  /* inputs stay ≥16px so iOS doesn't zoom the page on focus */
  .filters select, .filters input, .field-icon select, .field-icon input { font-size: 16px; }

  /* nurse overview cards — tighter so two fit cleanly side by side */
  .cards { gap: 10px; }
  .nurse-card { padding: 13px 13px; border-radius: 14px; }
  .nurse-card h3 { font-size: 15px; }
  .nurse-card .card-sub { gap: 6px; margin-top: 5px; }
  .nurse-card .role { font-size: 10px; }
  .live-pill, .break-pill, .done-pill, .off-pill { font-size: 9px; padding: 2px 7px; gap: 4px; }
  .nurse-card .clocked-in { font-size: 11px; margin-top: 6px; }
  .nurse-card .now-task { padding: 7px 8px; margin-top: 9px; }
  .nurse-card .now-timer { font-size: 16px; gap: 5px; }
  .nurse-card .now-timer .ico { width: 14px; height: 14px; }
  .nurse-card .now-note { font-size: 11.5px; }
  .nurse-card .meta { margin-top: 12px; padding-top: 11px; gap: 6px; }
  .nurse-card .stat .stat-ico { margin-bottom: 4px; }
  .nurse-card .stat-num { font-size: 16px; }
  .nurse-card .stat small { font-size: 8.5px; letter-spacing: 0.04em; }

}

/* ── compact data tables (Timesheets & Team) so they never need a horizontal
      scrollbar on smaller screens. Kicks in before the team table would
      otherwise overflow (~640px), covering the tablet range too. Payroll is
      only four columns and is fine. ────────────────────────────── */
@media (max-width: 680px) {
  #page-timesheets table, .team-grid table { font-size: 11px; }
  #page-timesheets th, #page-timesheets td,
  .team-grid th, .team-grid td { padding: 8px 5px; }
  #page-timesheets th, .team-grid th { font-size: 9px; letter-spacing: 0.04em; }
  .team-grid th.sortable { white-space: normal; }
  .note-cell { max-width: none; }

  /* Team table specifics: compact role tag, rate control, and an icon-only
     activate/deactivate button (full label kept as a tooltip). */
  .role-tag { font-size: 10px; padding: 2px 7px; gap: 3px; }
  .role-tag .ico { width: 11px; height: 11px; }
  .state-dot { display: none; } /* status shows as text only */
  .rate-edit-btn { width: 22px; height: 22px; }
  .rate-edit-btn .ico { width: 11px; height: 11px; }
  .col-action .btn { padding: 6px 8px; gap: 0; }
  .col-action .btn .ico { width: 15px; height: 15px; }
  .col-action .btn-label { display: none; }
  /* deactivate is icon-only here — show just the X, no box */
  .col-action .btn-reject { background: none; box-shadow: none; padding: 4px; }
}
