/* ============================================================
   NursingOpsIQ — app.css
   Design System + Component Library
   Phase 5 — SNF Staffing Assignment System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --navy:        #1B3A5C;
  --navy-dark:   #112540;
  --navy-deeper: #0B1929;
  --teal:        #0D7377;
  --teal-light:  #14A0A6;
  --teal-dim:    #E8F4F5;
  --teal-mid:    #C2E8EA;
  --amber:       #E8900C;
  --amber-dim:   #FEF3E2;
  --green:       #1A9652;
  --green-dim:   #E6F5EC;
  --red:         #C0392B;
  --red-dim:     #FDECEB;
  --purple:      #6B4FA0;
  --surface:     #F7F8FA;
  --surface2:    #EEF0F4;
  --surface3:    #E4E7EE;
  --border:      #D4D8E0;
  --border-dark: #BCC2CE;
  --text:        #1A1F2E;
  --text-2:      #4A5268;
  --text-3:      #7B849A;
  --white:       #FFFFFF;

  --font:        'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', ui-monospace, monospace;

  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   18px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:      0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.08);

  --sidebar-w:   220px;
  --topbar-h:    52px;
  --transition:  all .18s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-light); }

/* ── Shell Layout ────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--teal);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg { width: 18px; height: 18px; fill: white; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: white;
  letter-spacing: -.01em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  font-weight: 400;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* Facility switcher */
.facility-switcher {
  margin: 10px 10px 4px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.facility-switcher:hover { background: rgba(255,255,255,.1); }

.facility-dot {
  width: 8px; height: 8px;
  background: var(--teal-light);
  border-radius: 50%;
  flex-shrink: 0;
}

.facility-name-short {
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facility-switcher .chevron {
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 6px 8px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 12px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 450;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 1px;
  position: relative;
}

.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }

.nav-link:hover {
  background: rgba(255,255,255,.07);
  color: white;
}

.nav-link.active {
  background: var(--teal);
  color: white;
}

.nav-link.active svg { opacity: 1; }

.nav-link .badge-count {
  margin-left: auto;
  background: var(--amber);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.user-chip:hover { background: rgba(255,255,255,.07); }

.user-avatar {
  width: 28px; height: 28px;
  background: var(--teal);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name-disp { font-size: 12px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-disp { font-size: 10px; color: rgba(255,255,255,.4); }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-3);
}

.topbar-breadcrumb .crumb-sep { color: var(--border-dark); }
.topbar-breadcrumb .crumb-current { color: var(--text); font-weight: 500; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--navy);
}

.card-body { padding: 16px 18px; }
.card-body-flush { padding: 0; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.accent-teal::before   { background: var(--teal); }
.stat-card.accent-navy::before   { background: var(--navy); }
.stat-card.accent-amber::before  { background: var(--amber); }
.stat-card.accent-green::before  { background: var(--green); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -.03em;
  margin-bottom: 4px;
}

.stat-meta {
  font-size: 12px;
  color: var(--text-3);
}

.stat-icon {
  position: absolute;
  top: 14px; right: 16px;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  opacity: .12;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-card.accent-teal  .stat-icon { background: var(--teal);  opacity: 1; color: var(--teal-dim); }
.stat-card.accent-navy  .stat-icon { background: var(--navy);  opacity: 1; color: var(--teal-dim); }
.stat-card.accent-amber .stat-icon { background: var(--amber); opacity: 1; color: #fff3d6; }
.stat-card.accent-green .stat-icon { background: var(--green); opacity: 1; color: var(--green-dim); }
.stat-icon svg { width: 18px; height: 18px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 550;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }

.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-light); color: white; }

.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: var(--navy-dark); color: white; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #a93226; color: white; }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #158042; color: white; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}

.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ── Form Controls ───────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

label, .form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,115,119,.12);
}

.form-control::placeholder { color: var(--text-3); }

textarea.form-control {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  min-height: 80px;
}

select.form-control { cursor: pointer; }

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; height: 38px; }

.form-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}

.form-error {
  font-size: 11.5px;
  color: var(--red);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead { background: var(--navy); color: white; }

.data-table th {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius) 0 0; }

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--teal-dim); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges / Pills ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.badge-teal   { background: var(--teal-dim);  color: var(--teal);  }
.badge-navy   { background: var(--surface2);  color: var(--navy);  }
.badge-amber  { background: var(--amber-dim); color: #9b5e08; }
.badge-green  { background: var(--green-dim); color: #0f6335; }
.badge-red    { background: var(--red-dim);   color: var(--red);   }
.badge-purple { background: #ede8f7;          color: var(--purple); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Shift badges */
.shift-am  { background: var(--green-dim); color: #0f6335; font-family: var(--font-mono); }
.shift-pm  { background: var(--amber-dim); color: #9b5e08; font-family: var(--font-mono); }
.shift-noc { background: var(--surface2);  color: var(--navy);  font-family: var(--font-mono); }

/* Status badges */
.status-draft     { background: var(--surface2);  color: var(--text-2); }
.status-finalized { background: var(--green-dim);  color: #0f6335; }
.status-printed   { background: var(--teal-dim);   color: var(--teal); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 14px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-info    { background: var(--teal-dim);  color: var(--teal);  border: 1px solid var(--teal-mid); }
.alert-warning { background: var(--amber-dim); color: #9b5e08; border: 1px solid #f5c97b; }
.alert-danger  { background: var(--red-dim);   color: var(--red);   border: 1px solid #f5b7b1; }
.alert-success { background: var(--green-dim); color: #0f6335; border: 1px solid #a3d9b5; }

.alert-title { font-weight: 650; display: block; margin-bottom: 2px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 37, 64, .55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  transform: translateY(16px) scale(.97);
  transition: transform .22s ease;
}

.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 15px; font-weight: 700; color: var(--navy); }

.modal-body { padding: 18px 20px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--navy-deeper);
  color: white;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transform: translateX(120%);
  transition: transform .25s ease;
  max-width: 340px;
}

.toast.show { transform: translateX(0); }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast.toast-success { background: var(--green); }
.toast.toast-warning { background: #8c5a08; }
.toast.toast-error   { background: var(--red); }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.spinner-dark {
  border-color: rgba(13,115,119,.2);
  border-top-color: var(--teal);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Upload drop zone ────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.drop-zone-icon { font-size: 36px; margin-bottom: 10px; }
.drop-zone-text { font-size: 15px; font-weight: 550; color: var(--navy); margin-bottom: 4px; }
.drop-zone-sub  { font-size: 12.5px; color: var(--text-3); }
.drop-zone input[type=file] { display: none; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}

.tab-link {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}

.tab-link:hover { color: var(--navy); }
.tab-link.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 650; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Bed grid ────────────────────────────────────────────── */
.bed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 8px;
  padding: 16px;
}

.bed-cell {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.bed-cell:hover { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
.bed-cell.occupied  { background: var(--teal-dim);  border-color: var(--teal); }
.bed-cell.vacant    { background: var(--surface);   border-color: var(--border-dark); }
.bed-cell.has-shower::after {
  content: '🚿';
  position: absolute; top: 3px; right: 4px;
  font-size: 8px;
  line-height: 1;
}

.bed-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--font-mono);
}

.bed-section {
  font-size: 9px;
  color: var(--text-3);
  text-align: center;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state-icon {
  width: 52px; height: 52px;
  background: var(--surface2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}

.empty-state-icon svg { width: 24px; height: 24px; color: var(--text-3); }
.empty-state-title { font-size: 15px; font-weight: 650; color: var(--text-2); margin-bottom: 5px; }
.empty-state-sub   { font-size: 13px; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-2);
  transition: var(--transition);
}

.page-btn:hover       { border-color: var(--teal); color: var(--teal); }
.page-btn.active      { background: var(--teal); border-color: var(--teal); color: white; }
.page-btn:disabled    { opacity: .4; cursor: not-allowed; }

.pagination-info { font-size: 12.5px; color: var(--text-3); margin-left: auto; }

/* ── Assignment sheet inline edit ────────────────────────── */
.assignment-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 10px;
}

.assignment-section-header {
  background: var(--navy);
  color: white;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 650;
}

.section-staff-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  background: transparent;
  border: none;
  color: white;
  outline: none;
  min-width: 0;
  padding: 0;
  font-family: var(--font);
}

.section-staff-name::placeholder { color: rgba(255,255,255,.4); }

.section-body { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; }

.bed-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.bed-tag {
  background: var(--teal-dim);
  border: 1px solid var(--teal-mid);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 4px;
}

.shower-tag {
  background: var(--amber-dim);
  border: 1px solid #f5c97b;
  color: #9b5e08;
}

/* ── Utility ─────────────────────────────────────────────── */
.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.ml-auto     { margin-left: auto; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.mb-20       { margin-bottom: 20px; }
.fw-600      { font-weight: 600; }
.text-muted  { color: var(--text-3); font-size: 12.5px; }
.text-sm     { font-size: 12.5px; }
.text-navy   { color: var(--navy); }
.text-teal   { color: var(--teal); }
.text-danger { color: var(--red); }
.w-100       { width: 100%; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  flex-direction: column;
  gap: 12px;
}

.loading-overlay .spinner { width: 36px; height: 36px; border-width: 3px; }
.loading-overlay .spinner { border-color: var(--teal-mid); border-top-color: var(--teal); }
.loading-overlay p { font-size: 14px; color: var(--text-2); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
}

/* ── Module/Page access checklist (frontend/js/module-access.js) ────────── */
/* Shared by Facility Config's Facilities tab and User Management's user modal. */
.mac-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.mac-dept { border-bottom: 1px solid var(--border); }
.mac-dept:last-child { border-bottom: none; }
.mac-dept-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  background: var(--surface2, #f9fafb);
}
.mac-dept-row input { accent-color: var(--teal); cursor: pointer; }
.mac-pages { padding: 4px 12px 8px 34px; display: flex; flex-direction: column; gap: 4px; }
.mac-page-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 400; cursor: pointer; padding: 2px 0;
}
.mac-page-row input { accent-color: var(--teal); cursor: pointer; }
.mac-unrestricted-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 8px 0; cursor: pointer;
}
.mac-unrestricted-toggle input { accent-color: var(--teal); cursor: pointer; }
.mac-list.mac-disabled { opacity: .45; pointer-events: none; }
