:root {
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --critical: #ea580c;
  --critical-bg: #fff3e8;
  --expired: #dc2626;
  --expired-bg: #fef2f2;
  --none: #6b7280;
  --none-bg: #f3f4f6;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.10);
  --radius: 14px;
  --font-display: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }

/* Form controls don't inherit font-family from the page by default in any
   browser - without this, every input/select/textarea/button falls back to
   the OS's UI font regardless of what's loaded for the rest of the page,
   which is why they looked mismatched. */
input, select, textarea, button {
  font-family: inherit;
}
input[type=date], input[type=time], input[type=email], input[type=password],
input[type=number], input[type=text], input[type=file], select, textarea {
  color: var(--text);
  background: var(--surface);
}
input[type=date]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px !important;
}

/* Baseline look for any input/select/textarea that isn't already covered
   by a more specific rule elsewhere (e.g. plain filter bars, inline forms) -
   more specific selectors already in this file still win over this. */
input[type=date], input[type=time], input[type=email], input[type=password],
input[type=number], input[type=text], input[type=file], select, textarea {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13.5px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: transparent;
}

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
  color: white;
  padding: 22px 0;
  box-shadow: var(--shadow-md);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.topbar-actions .muted { color: rgba(255,255,255,0.85); font-size: 14px; }

/* ---------- Layout ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ---------- Summary cards ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  text-align: center;
  border-top: 4px solid var(--border);
}
.summary-card .summary-num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}
.summary-card .summary-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.summary-card.total { border-top-color: var(--primary); }
.summary-card.total .summary-num { color: var(--primary); }
.summary-card.expired { border-top-color: var(--expired); }
.summary-card.expired .summary-num { color: var(--expired); }
.summary-card.critical { border-top-color: var(--critical); }
.summary-card.critical .summary-num { color: var(--critical); }
.summary-card.warning { border-top-color: var(--warning); }
.summary-card.warning .summary-num { color: var(--warning); }
.summary-card.ok { border-top-color: var(--ok); }
.summary-card.ok .summary-num { color: var(--ok); }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Search ---------- */
.search-row { margin-bottom: 20px; }
.search-row input {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--card-bg);
}
.search-row input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ---------- Facility cards ---------- */
.facility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px;
}
.facility-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 8px;
  transition: box-shadow 0.15s ease;
}
.facility-card:hover { box-shadow: var(--shadow-md); }
.facility-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.facility-card-header h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
}
.facility-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.facility-meta strong { color: var(--text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-table th, .doc-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.doc-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.doc-table tr:last-child td { border-bottom: none; }
.pdf-link { font-weight: 600; }

.admin-table { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }
.admin-table tr:last-child td { border-bottom: none; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.small { padding: 3px 10px; font-size: 11.5px; }
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-critical { background: var(--critical-bg); color: var(--critical); }
.status-expired { background: var(--expired-bg); color: var(--expired); }
.status-none { background: var(--none-bg); color: var(--none); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover { background: rgba(255,255,255,0.28); }
.btn-small { padding: 6px 12px; font-size: 13px; background: #eef2ff; color: var(--primary); }
.btn-small:hover { background: #e0e7ff; }
.btn-danger { background: var(--expired-bg); color: var(--expired); }
.btn-danger:hover { background: #fde3e3; }
.btn-block { width: 100%; }

/* ---------- Auth card ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
}
.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px 30px;
  width: 100%;
  max-width: 360px;
}
.settings-card { max-width: 420px; margin: 0 auto; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.auth-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.auth-card label { font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-card input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.auth-card input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.auth-card button { margin-top: 6px; }
.back-link { display: block; margin-top: 16px; text-align: center; font-size: 13px; }

.alert { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 4px; }
.alert-error { background: var(--expired-bg); color: var(--expired); }
.alert-success { background: var(--ok-bg); color: var(--ok); }

/* ---------- Admin toolbar ---------- */
.admin-toolbar { margin-bottom: 18px; display: flex; justify-content: flex-end; }

/* ---------- Facility form ---------- */
.facility-form { max-width: 720px; }
.form-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.form-section h3 { margin: 0 0 14px; font-size: 15px; color: var(--primary); }
.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.form-row.two-col { flex-direction: row; gap: 16px; }
.form-row.two-col > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-row input[type=text], .form-row input[type=date], .form-row input[type=file],
.form-row input[type=email], .form-row input[type=number], .form-row input[type=password],
.form-row select, .form-row textarea {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
}
.form-row textarea { resize: vertical; }
.form-row input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.existing-pdf { display: flex; align-items: center; gap: 14px; margin-top: 6px; font-size: 13px; }
.inline-check { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

@media (max-width: 600px) {
  .form-row.two-col { flex-direction: column; }
  .facility-grid { grid-template-columns: 1fr; }
}

/* ---------- Document types page ---------- */
.inline-add-form { display: flex; gap: 10px; margin-top: 4px; }
.inline-add-form input { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; }
.inline-edit-form { display: flex; gap: 8px; align-items: center; }
.inline-edit-form input { flex: 1; min-width: 160px; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: 13.5px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

/* ---------- Facility card directory link ---------- */
.facility-links { margin-bottom: 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.facility-links a { font-size: 13px; font-weight: 600; }

/* ---------- Telephone directory admin ---------- */
.dir-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.dir-form input {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  flex: 1 1 140px;
  min-width: 110px;
}
.dir-form button { flex: 0 0 auto; }
.dir-form-row input { font-size: 13px; padding: 7px 9px; }
.dir-table td { vertical-align: middle; }

/* ---------- Tabs (combined directory page) ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.tab-btn:hover { border-color: var(--primary); }
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Weekday checkboxes (doctors / schedule) ---------- */
.weekday-checks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.weekday-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.weekday-checks input { margin: 0; accent-color: var(--primary); }

.doctor-form select, .doctor-form input[type=text] {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  width: 100%;
}
.doctor-form-row select, .doctor-form-row input[type=text] { font-size: 13px; padding: 7px 9px; }

.user-form select, .user-form input[type=text], .user-form input[type=password] {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  width: 100%;
}
.user-form-row select, .user-form-row input[type=text], .user-form-row input[type=password] { font-size: 13px; padding: 7px 9px; }


/* ---------- Schedule filter form (day/week/department/doctor) ---------- */
.sched-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.sched-filter-form > div { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.sched-filter-form label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.sched-filter-form select, .sched-filter-form input[type=date] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.sched-filter-actions { display: flex; gap: 8px; }
.sched-date-heading { font-size: 15px; margin: 0 0 8px; color: var(--primary); }

@media (max-width: 700px) {
  .sched-filter-form { flex-direction: column; align-items: stretch; }
  .sched-filter-form > div { min-width: 0; }
}

/* ---------- Schedule grid (Excel-style matrix: dates x doctors) ---------- */
.grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.grid-toolbar-nav { display: flex; align-items: center; gap: 10px; }
.grid-toolbar-nav h2 { margin: 0; font-size: 16px; min-width: 170px; text-align: center; }
.grid-toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-period-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.grid-period-toggle a {
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--card-bg); text-decoration: none;
}
.grid-period-toggle a.active { background: var(--primary); color: white; }

.grid-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; font-size: 12.5px; }
.grid-legend span { display: inline-flex; align-items: center; gap: 6px; }
.grid-legend .swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,0.1); }

.grid-quickbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.grid-quickbar-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.quickbar-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
}
.quickbar-btn:hover { border-color: var(--primary); }
.quickbar-btn:active { transform: translateY(1px); }
.quickbar-btn.cell-sick { background: #fee2e2; color: #991b1b; }
.quickbar-btn.cell-annual { background: #fef9c3; color: #713f12; }
.quickbar-btn.cell-weekoff { background: #fef9c3; color: #713f12; }
.quickbar-btn.quickbar-clear { background: var(--surface-2); color: var(--muted); }
.grid-quickbar-hint { font-size: 12px; margin-left: auto; }
@media (max-width: 700px) {
  .grid-quickbar-hint { margin-left: 0; width: 100%; }
}

.grid-scroll { overflow: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card-bg); max-height: 78vh; }
.sched-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; white-space: nowrap; }
.sched-grid th, .sched-grid td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  text-align: center;
}
.sched-grid .dept-row th {
  background: #fde68a;
  color: #78350f;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 3;
}
.sched-grid .name-row th {
  background: #fff7db;
  color: #78350f;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 10px;
  position: sticky;
  top: 34px;
  z-index: 3;
  min-width: 90px;
}
.sched-grid .col-date, .sched-grid .col-day {
  position: sticky;
  left: 0;
  background: #fde68a;
  font-weight: 700;
  color: #78350f;
  z-index: 2;
}
.sched-grid .col-day { left: 84px; background: #fff3c4; }
.sched-grid td.col-date, .sched-grid td.col-day {
  background: #fffbeb;
  color: var(--text);
  font-weight: 600;
  z-index: 1;
}
.sched-grid .name-row th.col-date { left: 0; top: 34px; z-index: 4; }
.sched-grid .name-row th.col-day { left: 84px; top: 34px; z-index: 4; }
.sched-grid .dept-row th.col-date, .sched-grid .dept-row th.col-day { z-index: 4; }
.sched-grid td.date-cell { padding: 8px 12px; }
.sched-grid td.day-cell { padding: 8px 10px; font-weight: 500; color: var(--muted); }

.sched-grid .cell {
  padding: 8px 10px;
  min-width: 92px;
  cursor: default;
}
.sched-grid .cell-time { background: #eef2ff; color: #3730a3; font-weight: 600; }
.sched-grid .cell-empty { background: var(--card-bg); color: var(--none); }
.sched-grid .cell-annual, .sched-grid .cell-weekoff { background: #fef9c3; color: #713f12; font-weight: 700; }
.sched-grid .cell-sick { background: #fee2e2; color: #991b1b; font-weight: 700; }
.sched-grid .cell-leave { background: #ffe8cc; color: #7c2d12; font-weight: 700; }

/* Admin-only interactive states */
.sched-grid.editable .cell { cursor: pointer; user-select: none; }
.sched-grid.editable .cell:hover { outline: 1px solid var(--primary); outline-offset: -1px; }
.sched-grid .cell.selected { outline: 2px solid var(--primary); outline-offset: -2px; background: #e0e7ff; }
.sched-grid .cell.copy-source { outline: 2px dashed var(--primary); outline-offset: -2px; }
.sched-grid .cell.just-saved { animation: cellSaved 0.9s ease; }
@keyframes cellSaved { 0% { box-shadow: inset 0 0 0 2px var(--ok); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.sched-grid .cell.save-failed { box-shadow: inset 0 0 0 2px var(--expired); }

.cell-editor-popover {
  position: fixed;
  z-index: 50;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  width: 220px;
}
.cell-editor-popover input[type=text] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  margin-bottom: 8px;
}
.cell-editor-popover .quick-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cell-editor-popover .quick-btns button {
  flex: 1 1 auto;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.cell-editor-popover .quick-btns button:hover { border-color: var(--primary); }
.cell-editor-popover .editor-actions { display: flex; gap: 6px; }
.cell-editor-popover .editor-actions button { flex: 1; padding: 7px; border-radius: 6px; border: none; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.cell-editor-popover .save-btn { background: var(--primary); color: #fff; }
.cell-editor-popover .clear-btn { background: var(--expired-bg); color: var(--expired); }
.cell-editor-popover .hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.grid-savebar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.grid-savebar.show { opacity: 1; }

/* ---------- Module hub landing page ---------- */
.module-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.module-card {
  display: block;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.module-icon { font-size: 32px; margin-bottom: 10px; }
.module-card h2 { margin: 0 0 8px; font-size: 18px; }
.module-card p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.module-stat { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.module-stat-alert { color: var(--expired); }
.module-hub-compact .module-card { padding: 20px 18px; }
.module-card-static { cursor: default; }
.module-card-static:hover { transform: none; box-shadow: var(--shadow); border-color: transparent; }
.module-card-links { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Training catalog: make "this whole card is clickable" obvious ---------- */
.course-card { border: 2px solid var(--border); }
.course-card:hover { border-color: var(--primary); }
.course-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
}
.course-card:hover .course-card-cta { background: #4338ca; }

/* ---------- Training module: player ---------- */
.training-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: start;
}
/* Training's player page gets much more horizontal room than the rest of
   the app (which stays at 1200px) so a slide image has real space to fill. */
.container-wide { max-width: 98vw; }
.training-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  position: sticky;
  top: 16px;
}
.training-sidebar h3 { margin: 0 0 10px; font-size: 13.5px; }
.training-item-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.training-item-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.training-item-list li.done { color: var(--ok); }
.training-item-list li.current { background: #eef2ff; color: #3730a3; font-weight: 700; }
.training-item-list li.locked { color: var(--muted); opacity: 0.7; }
.item-icon { width: 18px; text-align: center; flex-shrink: 0; }
.training-progress-label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.training-progress-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.training-progress-bar div { height: 100%; background: var(--primary); }

.training-main {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 20px;
}
.training-main h2 { margin: 0 0 12px; font-size: 18px; }
.training-hint { margin-top: 8px; font-size: 12.5px; }
.training-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; cursor: pointer; }
.training-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

@media (max-width: 800px) {
  .training-layout { grid-template-columns: 1fr; }
  .training-sidebar { position: static; }
  .container-wide { max-width: 100%; }
}

/* ---------- Training module: quiz ---------- */
.quiz-question { margin-bottom: 20px; }
.quiz-question h3 { font-size: 14.5px; margin: 0 0 10px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
  cursor: pointer;
}
.quiz-option:hover { border-color: var(--primary); }
.quiz-result-badge {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; margin: 0 auto 14px;
}
.quiz-result-badge.pass { background: var(--ok-bg); color: var(--ok); }
.quiz-result-badge.fail { background: var(--expired-bg); color: var(--expired); }

.quiz-admin-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.quiz-admin-options { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.quiz-admin-options li.correct { color: var(--ok); font-weight: 700; }

/* ---------- Training module: certificate ---------- */
.certificate-preview {
  max-width: 720px;
  margin: 20px auto 0;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 2px solid #93c5fd;
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow);
}
.certificate-kicker { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--primary); margin-bottom: 18px; }
.certificate-name { font-size: 30px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.certificate-line { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.certificate-course { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 18px; }
.certificate-meta { font-size: 12px; color: var(--muted); }
.certificate-logo { max-width: 100px; max-height: 100px; object-fit: contain; margin-bottom: 12px; }
.certificate-company { font-size: 19px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.certificate-seal { font-size: 34px; margin: 6px 0 14px; }

.cert-logo-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
}
.cert-logo-preview img { max-width: 90px; max-height: 90px; object-fit: contain; }

.cert-facility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cert-facility-row:last-of-type { border-bottom: none; }
.cert-facility-info { display: flex; align-items: center; gap: 12px; }
.cert-facility-thumb { width: 48px; height: 48px; object-fit: contain; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); }
.cert-facility-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
}
.cert-facility-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cert-facility-actions form { display: flex; align-items: center; gap: 6px; }
.cert-facility-actions input[type=file] { font-size: 12px; max-width: 170px; }

/* ---------- Training module: image slide content ---------- */
.training-slide-img {
  display: block;
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 640px;
  max-height: none;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.training-media-video {
  display: block;
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 640px;
  background: #000;
  border-radius: 10px;
}
.training-media-pdf {
  display: block;
  width: 100%;
  height: calc(100vh - 130px);
  min-height: 640px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
@media (max-width: 800px) {
  .training-slide-img, .training-media-video, .training-media-pdf { height: 70vh; min-height: 320px; }
}

/* ---------- User privileges (modules/facilities checkboxes) ---------- */
.privilege-checks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.privilege-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.privilege-checks input { margin: 0; accent-color: var(--primary); }
.privilege-checks-compact label { font-size: 12px; padding: 4px 10px; }
.privilege-fields { border-left: 2px solid var(--border); padding-left: 12px; margin: 6px 0 10px; }

/* ---------- Facility documents modal (admin panel "View" button) ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
  max-width: 800px;
  width: 100%;
  position: relative;
}
.modal-panel h3 { margin: 0 0 16px; font-size: 17px; padding-right: 30px; }
.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ---------- Dashboard theme (sidebar + cards) - shared by every page
   using the dash-shell layout: main hub, employee portal, and module
   pages as they're converted to match. Moved here from per-page <style>
   blocks so it's defined once and every page stays in sync. ---------- */
.dash-shell { display: flex; min-height: 100vh; }
.dash-sidebar { width: 240px; flex-shrink: 0; background: #ffffff; border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 26px 16px; }
.dash-logo { display: flex; align-items: center; gap: 10px; padding: 2px 8px 26px; }
.dash-logo-badge { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.dash-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.dash-logo-text strong { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15px; color: var(--text); }
.dash-logo-text span { font-size: 10.5px; color: #94a3b8; font-weight: 700; letter-spacing: 0.06em; }
.dash-nav-label { font-size: 11px; font-weight: 700; color: #cbd5e1; letter-spacing: 0.06em; padding: 8px 12px 6px; }
.dash-nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 2px; color: var(--text-2); text-decoration: none; }
.dash-nav-link:hover { background: var(--surface-2); text-decoration: none; }
.dash-nav-link.active { background: #eef2ff; color: var(--primary); }
.dash-nav-link svg { flex-shrink: 0; }
.dash-quicklink { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.dash-quicklink:hover { background: var(--surface-2); text-decoration: none; }
.dash-profile-card { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px 4px; border-top: 1px solid #eef1f6; }
.dash-profile-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 13px; flex-shrink: 0; }

.dash-main { flex: 1; padding: 30px 36px 50px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.dash-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.dash-topbar h1 { margin: 0 0 4px; font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 700; color: var(--text); }
.dash-topbar p { margin: 0; font-size: 14px; color: var(--muted); }

.dash-row { display: grid; gap: 18px; }
.dash-row.split { grid-template-columns: 1.6fr 1fr; }
.dash-row.split2 { grid-template-columns: 1.4fr 1fr; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.dash-card h2 { margin: 0; font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); }
.dash-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dash-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.dash-bar-row { display: flex; align-items: center; gap: 14px; }
.dash-bar-name { width: 190px; font-size: 13px; color: var(--text-2); font-weight: 600; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track { flex: 1; height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 6px; }
.dash-bar-label { width: 100px; text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 600; flex-shrink: 0; }

.dash-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.dash-donut { width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dash-donut-inner { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dash-donut-inner strong { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; color: var(--text); }
.dash-donut-inner span { font-size: 11px; color: var(--faint); }
.dash-donut-legend { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.dash-donut-legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.dash-donut-legend-row span:first-child { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; }

.dash-activity-item { display: flex; gap: 12px; align-items: flex-start; }
.dash-activity-icon { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-activity-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dash-activity-title { font-size: 13px; font-weight: 700; color: var(--text); }
.dash-activity-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-activity-time { font-size: 11.5px; color: var(--faint); flex-shrink: 0; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th { text-align: left; padding: 0 0 10px; font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-table td { padding: 10px 0; border-top: 1px solid var(--border); }
.dash-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }

/* Today's attendance card (Employee Portal overview) */
.att-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.att-block { display: flex; flex-direction: column; gap: 4px; }
.att-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; }
.att-value { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; color: var(--text); }
.att-value.running { color: var(--warning); }
.att-value.muted-val { color: #cbd5e1; }

.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.dash-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.dash-stat-top { display: flex; align-items: center; justify-content: space-between; }
.dash-stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; }
.dash-stat-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-stat-num { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 700; color: var(--text); }

.notif-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.notif-item strong { font-size: 13.5px; }
.notif-item p { margin: 6px 0 0; font-size: 13px; color: var(--text); }

/* Content pages that use the dash-shell but are simpler than a full
   dashboard (a list/table, a form) - a header row plus one big card area. */
.dash-content-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.dash-content-header h1 { margin: 0; font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; color: var(--text); }

@media (max-width: 960px) {
  .dash-row.split, .dash-row.split2 { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
}

/* ======================================================================
   UI refresh v2 - colourful, lively theme. Everything derives from the
   theme colour chosen under Settings > Branding & Theme.
   ====================================================================== */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.75); } 70% { box-shadow: 0 0 0 9px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }

body {
  background:
    radial-gradient(1100px 520px at -5% -8%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 62%),
    radial-gradient(900px 480px at 105% 0%, rgba(236,72,153,.10), transparent 58%),
    radial-gradient(800px 500px at 50% 115%, rgba(245,158,11,.08), transparent 60%),
    #f5f6fc;
  background-attachment: fixed;
}

/* ---- Sidebar ---- */
.dash-shell .dash-sidebar {
  background: linear-gradient(185deg, color-mix(in srgb, var(--primary) 80%, #0b1024) 0%, color-mix(in srgb, var(--primary) 42%, #0b1024) 100%);
  border-right: none;
  box-shadow: 6px 0 36px -10px rgba(15,23,42,.35);
}
.dash-shell .dash-sidebar .dash-logo-badge { background: linear-gradient(135deg, #fbbf24, #f472b6); color: #1e1b4b; box-shadow: 0 8px 20px -6px rgba(0,0,0,.45); overflow: hidden; }
.dash-shell .dash-sidebar .dash-logo-text strong { color: #fff; }
.dash-shell .dash-sidebar .dash-logo-text span { color: rgba(255,255,255,.62); }
.dash-shell .dash-sidebar .dash-nav-label { color: rgba(255,255,255,.5); letter-spacing: .14em; }
.dash-shell .dash-sidebar .dash-nav-link { position: relative; color: rgba(255,255,255,.9); transition: background .2s, transform .2s, box-shadow .2s; }
.dash-shell .dash-sidebar .dash-nav-link:hover { background: rgba(255,255,255,.13); transform: translateX(3px); }
.dash-shell .dash-sidebar .dash-nav-link.active { background: #fff; color: var(--primary-dark); box-shadow: 0 10px 24px -8px rgba(0,0,0,.4); }
.dash-shell .dash-sidebar .dash-nav-link svg {
  width: 30px; height: 30px; padding: 6px; box-sizing: border-box; border-radius: 9px;
  color: var(--nav-accent, #fff);
  background: color-mix(in srgb, var(--nav-accent, #ffffff) 20%, transparent);
  transition: transform .25s;
}
.dash-shell .dash-sidebar .dash-nav-link:hover svg { transform: scale(1.1) rotate(-5deg); }
.dash-shell .dash-sidebar .dash-nav-link.active svg { color: #fff; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 50%, #ec4899)); }
.dash-sidebar a[href="/"], .dash-sidebar a[href="/portal"] { --nav-accent: #a5b4fc; }
.dash-sidebar a[href="/go/tasks"], .dash-sidebar a[href="/portal/tasks"] { --nav-accent: #fbbf24; }
.dash-sidebar a[href="/go/training"], .dash-sidebar a[href="/training"] { --nav-accent: #34d399; }
.dash-sidebar a[href="/go/dms"], .dash-sidebar a[href="/portal/documents"] { --nav-accent: #60a5fa; }
.dash-sidebar a[href="/go/assets"], .dash-sidebar a[href="/portal/assets"] { --nav-accent: #f472b6; }
.dash-sidebar a[href="/admin/hrm"], .dash-sidebar a[href="/portal/leave"] { --nav-accent: #fb923c; }
.dash-sidebar a[href="/portal/attendance"] { --nav-accent: #2dd4bf; }
.dash-sidebar a[href="/portal/approvals"] { --nav-accent: #a78bfa; }
.dash-sidebar a[href="/go/schedule"] { --nav-accent: #38bdf8; }
.dash-sidebar a[href="/go/directory"] { --nav-accent: #c084fc; }
.dash-sidebar a[href="/go/marketing"] { --nav-accent: #fb7185; }
.dash-sidebar a[href="/go/helpdesk"], .dash-sidebar a[href="/portal/helpdesk"] { --nav-accent: #38bdf8; }
.dash-sidebar a[href="/portal/chat"] { --nav-accent: #34d399; }
.dash-sidebar a[href="/admin/notifications"], .dash-sidebar a[href="/portal/notifications"] { --nav-accent: #fbbf24; }
.dash-sidebar a[href="/admin/maintenance"] { --nav-accent: #fb923c; }
.dash-sidebar a[href="/go/vendors"] { --nav-accent: #a3e635; }
.dash-sidebar a[href="/go/incidents"], .dash-sidebar a[href="/portal/incidents"] { --nav-accent: #fda4af; }
.dash-sidebar a[href="/go/ai"] { --nav-accent: #c4b5fd; }
.dash-sidebar a[href="/admin/dashboard"] { --nav-accent: #93c5fd; }
.dash-sidebar a[href="/go/emr"] { --nav-accent: #f87171; }
.dash-sidebar a[href="/go/meetings"], .dash-sidebar a[href="/portal/meetings"] { --nav-accent: #facc15; }
.dash-shell .dash-sidebar .dash-quicklink { color: rgba(255,255,255,.78); }
.dash-shell .dash-sidebar .dash-quicklink:hover { background: rgba(255,255,255,.13); color: #fff; }
.dash-shell .dash-sidebar .dash-profile-card { background: rgba(255,255,255,.13); border-top: none; border-radius: 16px; padding: 12px; margin-bottom: 8px; }
.dash-shell .dash-sidebar .dash-profile-card span { color: #fff !important; }
.dash-shell .dash-sidebar .dash-profile-card span + span { color: rgba(255,255,255,.65) !important; }
.dash-shell .dash-sidebar .dash-profile-avatar { background: linear-gradient(135deg, #fbbf24, #f472b6); color: #1e1b4b; }
/* drag-to-reorder cues (sidebar.js) */
.dash-shell .dash-sidebar .dash-nav-link[draggable="true"] { cursor: grab; }
.dash-shell .dash-sidebar .dash-nav-link[draggable="true"]::after { content: "\22EE\22EE"; position: absolute; right: 10px; font-size: 13px; letter-spacing: -2px; opacity: 0; transition: opacity .2s; }
.dash-shell .dash-sidebar .dash-nav-link[draggable="true"]:hover::after { opacity: .55; }
.dash-shell .dash-sidebar .dash-nav-link.dragging { opacity: .4; cursor: grabbing; }
.dash-shell .dash-sidebar .dash-nav-link.drop-before { box-shadow: 0 -3px 0 #fbbf24; }
.dash-shell .dash-sidebar .dash-nav-link.drop-after { box-shadow: 0 3px 0 #fbbf24; }

/* ---- Headings ---- */
.dash-topbar h1, .dash-content-header h1 {
  background: linear-gradient(90deg, #1e1b4b 0%, var(--primary) 55%, #ec4899 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}

/* ---- Cards ---- */
.dash-card, .form-section {
  position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
  border-radius: 18px; background: rgba(255,255,255,.94);
  box-shadow: 0 14px 34px -16px color-mix(in srgb, var(--primary) 45%, transparent), 0 2px 6px rgba(15,23,42,.04);
  animation: riseIn .5s ease both;
}
.dash-card::before, .form-section::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--primary), #ec4899 55%, #f59e0b); }

/* ---- Stat cards: each gets its own colour ---- */
.dash-stat-card { --card-accent: #6366f1; position: relative; overflow: hidden; border-radius: 18px; border: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent); background: linear-gradient(145deg, color-mix(in srgb, var(--card-accent) 11%, #fff), #fff 70%); transition: transform .22s, box-shadow .22s; animation: riseIn .5s ease both; }
.dash-stat-card::after { content: ""; position: absolute; right: -26px; top: -26px; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--card-accent) 30%, transparent), transparent 70%); pointer-events: none; }
.dash-stat-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -16px color-mix(in srgb, var(--card-accent) 60%, transparent); }
.dash-stat-card .dash-stat-num { color: color-mix(in srgb, var(--card-accent) 55%, #0f172a); }
.dash-stats > .dash-stat-card:nth-child(6n+2) { --card-accent: #ec4899; animation-delay: .05s; }
.dash-stats > .dash-stat-card:nth-child(6n+3) { --card-accent: #f59e0b; animation-delay: .10s; }
.dash-stats > .dash-stat-card:nth-child(6n+4) { --card-accent: #10b981; animation-delay: .15s; }
.dash-stats > .dash-stat-card:nth-child(6n+5) { --card-accent: #0ea5e9; animation-delay: .20s; }
.dash-stats > .dash-stat-card:nth-child(6n+6) { --card-accent: #8b5cf6; animation-delay: .25s; }

/* ---- Module / settings cards ---- */
.module-hub .module-card { --mc-a: #6366f1; --mc-b: #a855f7; border-radius: 20px; border: 1px solid rgba(15,23,42,.06); background: linear-gradient(160deg, color-mix(in srgb, var(--mc-a) 7%, #fff), #fff 60%); animation: riseIn .5s ease both; transition: transform .22s, box-shadow .22s, border-color .22s; }
.module-hub .module-card:hover { transform: translateY(-6px); border-color: var(--mc-a); box-shadow: 0 22px 44px -18px color-mix(in srgb, var(--mc-a) 65%, transparent); }
.module-hub .module-card:nth-child(6n+2) { --mc-a: #ec4899; --mc-b: #f97316; }
.module-hub .module-card:nth-child(6n+3) { --mc-a: #10b981; --mc-b: #06b6d4; }
.module-hub .module-card:nth-child(6n+4) { --mc-a: #f59e0b; --mc-b: #ef4444; }
.module-hub .module-card:nth-child(6n+5) { --mc-a: #0ea5e9; --mc-b: #6366f1; }
.module-hub .module-card:nth-child(6n+6) { --mc-a: #14b8a6; --mc-b: #84cc16; }
.module-card .module-icon { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: linear-gradient(135deg, var(--mc-a, #6366f1), var(--mc-b, #a855f7)); box-shadow: 0 12px 22px -10px var(--mc-a, #6366f1); }

/* ---- Buttons ---- */
.btn { border-radius: 11px; transition: transform .15s, box-shadow .2s, filter .2s; }
.btn-primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #ec4899)); border: none; box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--primary) 75%, transparent); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #ec4899)); filter: brightness(1.07); transform: translateY(-1px); }
.dash-main .btn-ghost, .form-section .btn-ghost { background: var(--surface); color: var(--primary-dark); border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent); }
.dash-main .btn-ghost:hover, .form-section .btn-ghost:hover { background: color-mix(in srgb, var(--primary) 8%, #fff); }
.btn-small { background: color-mix(in srgb, var(--primary) 11%, #fff); color: var(--primary-dark); }
.btn-small:hover { background: color-mix(in srgb, var(--primary) 20%, #fff); }

/* ---- Tables ---- */
.dash-table th, .admin-table th { background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 10%, #fff), #fff); color: var(--primary-dark); }
.dash-table th { padding: 10px 10px; border-radius: 6px; }
.dash-table td { padding-left: 10px; padding-right: 10px; }
.dash-table tbody tr, .admin-table tbody tr { transition: background .15s; }
.dash-table tbody tr:hover, .admin-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 6%, #fff); }

/* ---- Inputs ---- */
.dash-main input:focus, .dash-main select:focus, .dash-main textarea:focus, .form-section input:focus, .form-section select:focus, .form-section textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* ---- Check In / Check Out ---- */
.btn-checkin, .btn-checkout { display: inline-flex; align-items: center; gap: 10px; padding: 13px 28px; font-size: 15px; font-weight: 700; color: #fff; border: none; border-radius: 14px; cursor: pointer; transition: transform .15s, filter .2s; }
.btn-checkin:hover, .btn-checkout:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-checkin { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 12px 24px -10px rgba(16,185,129,.8); }
.btn-checkout { background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: 0 12px 24px -10px rgba(239,68,68,.75); }
.punch-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface); animation: pulseDot 1.6s infinite; }
.punch-capture { margin-top: 14px; max-width: 380px; }
.punch-video-wrap { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: #0f172a; box-shadow: 0 16px 36px -14px rgba(15,23,42,.55); }
.punch-video-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.punch-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 88px 'Sora', sans-serif; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.6); pointer-events: none; }
.punch-checks { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.punch-checks li.ok { color: #047857; font-weight: 600; }
.punch-checks li.bad { color: #b91c1c; font-weight: 600; }
.punch-actions { display: flex; gap: 8px; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) { .dash-card, .form-section, .dash-stat-card, .module-card { animation: none !important; } }

/* ---- Document Management ---- */
.dms-crumbs { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dms-crumbs a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.dms-search { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dms-search input[type=text] { flex: 1; min-width: 220px; max-width: 380px; }
.dms-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dms-folder { border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent); border-radius: 14px; padding: 12px 14px; background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 6%, #fff), #fff); display: flex; flex-direction: column; gap: 8px; transition: transform .15s, box-shadow .2s; }
.dms-folder:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--primary) 55%, transparent); }
.dms-folder-main { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); }
.dms-folder-main strong { display: block; font-size: 14px; }
.dms-folder-main small { color: var(--muted); font-size: 11.5px; }
.dms-folder-icon { font-size: 26px; }
.dms-folder-actions { display: flex; gap: 12px; align-items: flex-start; font-size: 12px; flex-wrap: wrap; }
.dms-folder-actions summary { cursor: pointer; color: var(--primary-dark); font-weight: 600; }
.dms-folder-actions details form { display: flex; gap: 6px; margin-top: 6px; }
.dms-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 10%, #fff); color: var(--primary-dark); margin: 2px 4px 0 0; }
.dms-checklist { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.dms-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dms-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.dms-activity li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

/* ---- Digital Marketing ---- */
.mkt-table th, .mkt-table td { white-space: nowrap; }
.mkt-num { text-align: right; font-variant-numeric: tabular-nums; }
.mkt-scroll { overflow-x: auto; }
.mkt-note { padding: 12px 16px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13.5px; }

/* ---- sidebar badges (unread notifications / chat) ---- */
.dash-shell .dash-sidebar .nav-badge { margin-left: auto; margin-right: 18px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 18px; text-align: center; box-shadow: 0 4px 10px -3px rgba(239,68,68,.7); }

/* ---- Helpdesk ---- */
.hd-two { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .hd-two { grid-template-columns: 1fr; } }
.hd-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hd-timeline li { border-left: 3px solid color-mix(in srgb, var(--primary) 35%, var(--border)); padding: 2px 0 2px 12px; font-size: 13.5px; }
.hd-timeline li.internal { border-left-color: #f59e0b; background: #fffbeb; border-radius: 0 8px 8px 0; }
.hd-timeline .meta { color: var(--muted); font-size: 11.5px; }
.hd-kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.hd-kv dt { color: var(--muted); } .hd-kv dd { margin: 0; }

/* ---- Notifications ---- */
.ntf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ntf-item a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 6px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.ntf-item.unread a { background: color-mix(in srgb, var(--primary) 6%, #fff); font-weight: 600; }
.ntf-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: #3b82f6; }
.ntf-dot.danger { background: #ef4444; } .ntf-dot.warn { background: #f59e0b; } .ntf-dot.ok { background: #10b981; }
.ntf-text { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.ntf-when { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; font-weight: 400; }

/* ---- Chat ---- */
.chat-shell { display: grid; grid-template-columns: 310px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 440px; background: var(--surface); border-radius: 18px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--primary) 14%, transparent); box-shadow: 0 14px 34px -16px color-mix(in srgb, var(--primary) 45%, transparent); }
.chat-list { border-right: 1px solid #eef0f6; overflow-y: auto; display: flex; flex-direction: column; }
.chat-list-head { padding: 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; border-bottom: 1px solid #eef0f6; font-weight: 700; }
.chat-new { display: none; padding: 12px; border-bottom: 1px solid #eef0f6; background: #fafbff; font-size: 13px; }
.chat-new.open { display: block; }
.chat-people { max-height: 200px; overflow-y: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.chat-person { padding: 6px 8px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.chat-person:hover { background: color-mix(in srgb, var(--primary) 8%, #fff); }
.chat-conv { padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #f4f5fa; }
.chat-conv:hover, .chat-conv.active { background: color-mix(in srgb, var(--primary) 8%, #fff); }
.chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #ec4899); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 14px; }
.chat-conv-main { flex: 1; min-width: 0; }
.chat-conv-title { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.chat-conv-prev { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-unread { background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.chat-thread { display: flex; flex-direction: column; min-width: 0; }
.chat-thread-head { padding: 12px 16px; border-bottom: 1px solid #eef0f6; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.chat-thread-head small { font-weight: 400; color: var(--muted); }
.chat-back { display: none; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #f8f9fe; }
.chat-msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid #eceef6; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #ec4899)); color: #fff; border: none; }
.chat-who { font-size: 11px; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.chat-time { font-size: 10.5px; opacity: .65; text-align: right; margin-top: 2px; }
.chat-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--surface-3); padding: 2px 10px; border-radius: 999px; margin: 6px 0; }
.chat-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #eef0f6; background: var(--surface); }
.chat-compose textarea { flex: 1; resize: none; height: 42px; border-radius: 12px; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
@media (max-width: 760px) {
  .chat-shell { grid-template-columns: 1fr; height: calc(100vh - 130px); }
  .chat-shell.has-thread .chat-list { display: none; }
  .chat-shell:not(.has-thread) .chat-thread { display: none; }
  .chat-back { display: inline-flex; }
  .chat-msg { max-width: 86%; }
}

/* ---- Maintenance / Vendors / Incidents / AI ---- */
.st-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.st-row .st-name { width: 140px; font-size: 13px; }
.st-row .st-track { flex: 1; background: var(--surface-3); border-radius: 999px; height: 10px; overflow: hidden; }
.st-row .st-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #ec4899); }
.st-row strong { width: 30px; text-align: right; }
.star { color: #f59e0b; letter-spacing: 1px; }
.ai-shell { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 460px; background: var(--surface); border-radius: 18px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--primary) 14%, transparent); box-shadow: 0 14px 34px -16px color-mix(in srgb, var(--primary) 45%, transparent); }
.ai-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #f8f9fe; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #ec4899)); color: #fff; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid #eceef6; }
.ai-msg.bot table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.ai-msg.bot th, .ai-msg.bot td { border: 1px solid #e5e7f0; padding: 4px 9px; text-align: left; white-space: nowrap; }
.ai-msg.bot th { background: #f1f3fb; }
.ai-msg.bot ul { margin: 6px 0; padding-left: 20px; }
.ai-msg.bot p { margin: 6px 0; }
.ai-trace { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.ai-trace summary { cursor: pointer; }
.ai-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eef0f6; background: var(--surface); }
.ai-compose textarea { flex: 1; resize: none; height: 46px; border-radius: 12px; }
.ai-samples { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-samples button { border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; color: var(--primary-dark); }
.ai-samples button:hover { background: color-mix(in srgb, var(--primary) 8%, #fff); }

/* ---- Dashboards ---- */
.dash-widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.w-card { background: var(--surface); border-radius: 18px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent); box-shadow: 0 12px 28px -18px color-mix(in srgb, var(--primary) 50%, transparent); display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; animation: riseIn .5s ease both; min-width: 0; }
.w-wide { grid-column: span 2; }
.w-kpi { transition: transform .2s, box-shadow .2s; }
.w-kpi:hover { transform: translateY(-3px); box-shadow: 0 18px 34px -16px color-mix(in srgb, var(--primary) 60%, transparent); }
.w-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.w-value { font-family: 'Sora', sans-serif; font-size: 30px; font-weight: 800; line-height: 1.1; }
.w-sub { font-size: 12.5px; color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 110px; padding-top: 6px; }
.spark-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.spark-bar { width: 100%; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--primary), #ec4899); min-height: 3px; }
.spark-col small { font-size: 9.5px; color: var(--muted); }
.ai-prop { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #eef2ff; border: 1px solid #c7d2fe; font-size: 13.5px; }

/* ---- Employee portal: app-style tiles ---- */
.m-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 12px; }
.m-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px; border-radius: 20px; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; font-size: 12.5px; text-align: center; border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent); box-shadow: 0 10px 24px -18px color-mix(in srgb, var(--primary) 55%, transparent); transition: transform .15s; }
.m-tile:active { transform: scale(.96); }
.m-tile span { font-size: 25px; width: 52px; height: 52px; border-radius: 17px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--tc1, #6366f1), var(--tc2, #a855f7)); box-shadow: 0 10px 18px -10px var(--tc1, #6366f1); }
.m-tile:nth-child(6n+2) { --tc1: #f59e0b; --tc2: #ef4444; } .m-tile:nth-child(6n+3) { --tc1: #0ea5e9; --tc2: #6366f1; }
.m-tile:nth-child(6n+4) { --tc1: #10b981; --tc2: #06b6d4; } .m-tile:nth-child(6n+5) { --tc1: #ec4899; --tc2: #f97316; } .m-tile:nth-child(6n+6) { --tc1: #14b8a6; --tc2: #84cc16; }

/* ---- Phone layout: slide-out menu, top bar, bottom tabs ---- */
.m-top, .m-bottom, .m-backdrop { display: none; }
.m-bottom .nav-badge { position: absolute; top: 4px; right: calc(50% - 22px); margin: 0; padding: 0 5px; font-size: 10px; }
@media (max-width: 820px) {
  .m-top { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #ec4899)); color: #fff; box-shadow: 0 8px 20px -10px rgba(0,0,0,.45); }
  .m-menu { background: rgba(255,255,255,.2); border: none; color: #fff; width: 42px; height: 42px; border-radius: 13px; font-size: 22px; cursor: pointer; }
  .m-title { flex: 1; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-bell { color: #fff; text-decoration: none; font-size: 21px; padding: 6px 8px; position: relative; }
  .dash-shell { display: block; }
  .dash-shell .dash-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; transform: translateX(-104%); transition: transform .25s ease; z-index: 60; overflow-y: auto; min-height: 0; height: 100%; }
  body.nav-open .dash-shell .dash-sidebar { transform: none; }
  body.nav-open .m-backdrop { display: block; }
  .m-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 55; }
  .dash-main { padding: 14px 12px 100px !important; }
  .m-bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--surface); border-top: 1px solid #e5e7f0; box-shadow: 0 -10px 26px -14px rgba(15,23,42,.35); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .m-bottom a, .m-bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; border: none; background: none; text-decoration: none; color: var(--muted); font-size: 11px; cursor: pointer; position: relative; font-family: inherit; }
  .m-bottom a span, .m-bottom button span { font-size: 21px; line-height: 1.1; }
  .m-bottom a.on { color: var(--primary); font-weight: 700; }
  .dash-topbar { flex-direction: column; align-items: flex-start !important; gap: 10px; }
  .dash-content-header { flex-direction: column; align-items: flex-start !important; gap: 10px; }
  .dash-table { display: block; overflow-x: auto; }
  .form-row.two-col { display: block !important; } .form-row.two-col > div { margin-bottom: 10px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .dash-widgets { grid-template-columns: repeat(2, 1fr); gap: 10px; } .w-value { font-size: 24px; }
  .hd-two { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 40px; }
  .ai-shell { height: calc(100vh - 220px); } .ai-msg { max-width: 94%; }
}

/* ---------- Employee portal: top-right toolbar + sidebar profile menu ---------- */
.portal-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; margin: -6px 0 -10px; }
.portal-toolbar .tb-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; }
.portal-toolbar .tb-link:hover, .portal-toolbar .tb-bell:hover { background: var(--surface-3); text-decoration: none; }
.portal-toolbar .tb-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: var(--text-2); text-decoration: none; }
.portal-toolbar .tb-bell.has-unread { color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, #fff); }
.portal-toolbar .tb-badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.portal-toolbar a:focus-visible, .profile-menu summary:focus-visible, .pm-pop a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 720px) { .portal-toolbar .tb-link span { display: none; } .portal-toolbar .tb-link { padding: 9px; } }

.profile-menu { position: relative; margin-top: auto; }
.profile-menu summary { list-style: none; cursor: pointer; margin-top: 0; border-radius: 12px; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover { background: rgba(255,255,255,.1); }
.profile-menu .pm-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.profile-menu .pm-name span { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu .pm-name small { font-size: 11.5px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu .pm-caret { opacity: .7; transition: transform .15s; }
.profile-menu[open] .pm-caret { transform: rotate(180deg); }
.pm-pop { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.18); padding: 6px; z-index: 30; }
.pm-pop a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.pm-pop a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- Dashboard category tabs ---------- */
.dash-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; }
.dash-tabs a { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.dash-tabs a:hover { background: rgba(255,255,255,.7); text-decoration: none; }
.dash-tabs a.active { background: var(--surface); color: var(--primary-dark, #1e293b); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.dash-tabs a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* =====================================================================
   DESIGN SYSTEM v2 - restrained healthcare-enterprise look.
   One accent (the organisation's theme colour), slate neutrals, flat surfaces,
   consistent radii/spacing, clear focus states. Overrides the earlier layers.
   ===================================================================== */
:root {
  --bg: #f6f8fb; --surface: #ffffff; --surface-2: #f8fafc; --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --ok: #047857; --ok-bg: #ecfdf5; --warning: #b45309; --warning-bg: #fffbeb; --critical: #c2410c; --critical-bg: #fff7ed;
  --expired: #b91c1c; --expired-bg: #fef2f2; --info: #1d4ed8; --info-bg: #eff6ff; --none: #475569; --none-bg: #f1f5f9;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.05); --shadow-md: 0 4px 14px rgba(15,23,42,.08);
  --sidebar: color-mix(in srgb, var(--primary) 14%, #0b1220);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
body { background: var(--bg) !important; background-image: none !important; color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.dash-shell { background: var(--bg) !important; background-image: none !important; }
h1, h2, h3, h4 { letter-spacing: -.01em; color: var(--text); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Sidebar: quiet, flat, monochrome icons ---- */
.dash-shell .dash-sidebar { background: var(--sidebar); box-shadow: none; border-right: 1px solid rgba(255,255,255,.06); padding: 20px 12px 14px; }
@media (min-width: 961px) { .dash-shell .dash-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; } }
.dash-shell .dash-sidebar .dash-logo { padding: 4px 8px 16px; }
.dash-shell .dash-sidebar .dash-logo-badge { background: color-mix(in srgb, var(--primary) 70%, #fff); color: #fff; box-shadow: none; border-radius: 10px; }
.dash-shell .dash-sidebar .dash-logo-text strong { font-size: 14px; font-weight: 700; letter-spacing: 0; }
.dash-shell .dash-sidebar .dash-logo-text span { font-size: 10.5px; letter-spacing: .12em; color: rgba(255,255,255,.5); }
.dash-shell .dash-sidebar .dash-nav-label { color: rgba(255,255,255,.4); font-size: 10.5px; letter-spacing: .12em; padding: 14px 10px 6px; }
.dash-shell .dash-sidebar .dash-nav-link { color: rgba(255,255,255,.76); font-size: 13.5px; font-weight: 500; padding: 9px 10px; border-radius: 8px; gap: 11px; margin-bottom: 1px; transition: background .15s, color .15s; }
.dash-shell .dash-sidebar .dash-nav-link:hover { background: rgba(255,255,255,.07); color: #fff; transform: none; }
.dash-shell .dash-sidebar .dash-nav-link.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 55%, #fff); font-weight: 600; }
.dash-shell .dash-sidebar .dash-nav-link svg { width: 18px; height: 18px; padding: 0; border-radius: 0; background: none !important; color: currentColor !important; opacity: .85; transition: none; transform: none !important; }
.dash-shell .dash-sidebar .dash-nav-link.active svg { opacity: 1; background: none !important; }
.dash-shell .dash-sidebar .dash-quicklink { color: rgba(255,255,255,.7); }
.dash-shell .dash-sidebar .nav-badge { background: #dc2626; }
.dash-shell .dash-sidebar .dash-profile-card { background: rgba(255,255,255,.07); border-radius: 10px; padding: 10px; margin-bottom: 0; }
.dash-shell .dash-sidebar .dash-profile-card span, .dash-shell .dash-sidebar .dash-profile-card small { color: #fff !important; }
.dash-shell .dash-sidebar .dash-profile-card small { opacity: .62; }
.dash-shell .dash-sidebar .dash-profile-avatar { background: color-mix(in srgb, var(--primary) 70%, #fff); color: #fff; width: 32px; height: 32px; font-size: 12px; }
.dash-shell .dash-sidebar .profile-menu { padding-top: 10px; }

/* ---- Page header ---- */
.dash-main { padding: 28px 36px 56px; gap: 20px; }
.dash-topbar h1, .dash-content-header h1 { background: none !important; -webkit-text-fill-color: var(--text) !important; color: var(--text) !important; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.dash-topbar p, .dash-content-header p { color: var(--muted); }
@media (max-width: 720px) { .dash-main { padding: 18px 16px 40px; } }

/* ---- Surfaces ---- */
.dash-card, .form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); animation: none; padding: 20px 22px; }
.dash-card::before, .form-section::before { display: none; }
.dash-card h2, .form-section h2 { font-size: 15px; font-weight: 700; color: var(--text); }
.dash-stat-card, .w-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); animation: none; }
.dash-stat-card::after { display: none; }
.dash-stat-card:hover, .w-kpi:hover { transform: none; box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.dash-stat-card .dash-stat-num { color: var(--text); }
.dash-stat-icon { background: var(--none-bg) !important; color: var(--text-2) !important; }
.w-title { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.w-value { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
.module-hub .module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.module-hub .module-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow-md); }
.module-card .module-icon { background: color-mix(in srgb, var(--primary) 10%, #fff) !important; box-shadow: none !important; border-radius: 12px; }

/* ---- Buttons ---- */
.btn { min-height: 38px; padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600; transition: background .15s, border-color .15s, box-shadow .15s; box-shadow: none; }
.btn:hover { transform: none; }
.btn-primary { background: var(--primary) !important; color: #fff; border: 1px solid var(--primary); box-shadow: 0 1px 2px rgba(15,23,42,.12); filter: none; }
.btn-primary:hover { background: var(--primary-dark) !important; border-color: var(--primary-dark); filter: none; transform: none; }
.dash-main .btn-ghost, .form-section .btn-ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong); }
.dash-main .btn-ghost:hover, .form-section .btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-small { min-height: 30px; padding: 5px 11px; font-size: 12.5px; background: var(--none-bg); color: var(--text-2); border: 1px solid transparent; }
.btn-small:hover { background: var(--surface-3); }
.btn-danger { background: var(--expired-bg); color: var(--expired); border: 1px solid transparent; }
.btn-danger:hover { background: #fee2e2; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
.form-row label, .sched-filter-form label, .dash-main label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-row input[type=text], .form-row input[type=date], .form-row input[type=file], .form-row input[type=email], .form-row input[type=number], .form-row input[type=password], .form-row select, .form-row textarea,
.dash-main input[type=text], .dash-main input[type=date], .dash-main input[type=time], .dash-main input[type=month], .dash-main input[type=number], .dash-main input[type=email], .dash-main input[type=password], .dash-main input[type=url], .dash-main select, .dash-main textarea {
  min-height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 11px; background: var(--surface); font-size: 13.5px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.dash-main input:focus, .dash-main select:focus, .dash-main textarea:focus, .form-section input:focus, .form-section select:focus, .form-section textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.dash-main input::placeholder, .dash-main textarea::placeholder { color: var(--faint); }

/* ---- Tables ---- */
.dash-card .dash-table, .admin-table { border-collapse: separate; border-spacing: 0; }
.dash-table th, .admin-table th { background: var(--surface-2) !important; color: var(--muted) !important; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 10px 12px; border-radius: 0 !important; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.dash-table td, .admin-table td { padding: 12px; border-top: 0; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; font-variant-numeric: tabular-nums; }
.dash-table tbody tr:last-child td, .admin-table tbody tr:last-child td { border-bottom: 0; }
.dash-table tbody tr:hover, .admin-table tbody tr:hover { background: var(--surface-2); }
.dash-table td strong { color: var(--text); }
.mkt-scroll, .table-wrap { overflow-x: auto; }

/* ---- Status indicators ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.small { padding: 2px 9px; font-size: 11.5px; }
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-critical { background: var(--critical-bg); color: var(--critical); }
.status-expired { background: var(--expired-bg); color: var(--expired); }
.status-none { background: var(--none-bg); color: var(--none); }
.alert { border-radius: 10px; padding: 11px 14px; border: 1px solid transparent; }
.alert-error { background: var(--expired-bg); color: var(--expired); border-color: #fecaca; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #a7f3d0; }
.mkt-note { background: var(--info-bg); color: #1e3a8a; border: 1px solid #bfdbfe; border-radius: 10px; }

/* ---- Bars / trends / portal tiles: single accent, no rainbow ---- */
.st-row .st-track { background: var(--surface-3); }
.st-row .st-fill, .spark-bar { background: var(--primary) !important; opacity: .9; }
.spark-bar { border-radius: 4px 4px 1px 1px; }
.m-tiles { gap: 10px; }
.m-tile { background: var(--surface) !important; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.m-tile span { background: color-mix(in srgb, var(--primary) 9%, #fff) !important; box-shadow: none !important; border-radius: 12px; font-size: 22px; width: 46px; height: 46px; filter: saturate(.85); }
.m-tile:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); text-decoration: none; }
.btn-checkin, .btn-checkout { border-radius: 10px; box-shadow: none; }
.btn-checkin { background: var(--ok); } .btn-checkout { background: var(--text-2); }

/* ---- Tabs ---- */
.dash-tabs { background: var(--surface-3); }
.dash-tabs a.active { color: var(--text); }
.portal-toolbar .tb-bell.has-unread { background: color-mix(in srgb, var(--primary) 10%, #fff); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Compliance & Quality ---- */
.cq-subnav{display:flex;flex-direction:column;gap:1px;margin:2px 0 6px 34px}
.dash-subnav-link{font-size:13px;color:#cbd5e1;padding:5px 10px;border-radius:8px;text-decoration:none}
.dash-subnav-link:hover{background:rgba(255,255,255,.07);color:#fff}
.dash-subnav-link.active{color:#fff;font-weight:600;background:rgba(255,255,255,.12)}
.cq-filters{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin:0 0 16px}
.cq-filters label{display:flex;flex-direction:column;font-size:12px;color:var(--muted,#64748b);gap:4px}
.cq-filters select,.cq-filters input{min-width:140px}
.cq-bar{height:10px;border-radius:6px;background:var(--surface-3);overflow:hidden;display:flex}
.cq-bar>span{display:block;height:100%}
.cq-note{font-size:12.5px;color:var(--muted);line-height:1.5}
.cq-tag{display:inline-block;padding:2px 9px;border-radius:999px;font-size:11.5px;font-weight:700;letter-spacing:.04em;background:#2596be;color:#fff}
/* printable forms: ADHICS classification band (#2596be) */
.cq-print-band{background:#2596be;color:#fff;display:flex;align-items:center;gap:14px;padding:12px 18px;border-radius:6px}
.cq-print-band img{height:42px;background:#fff;border-radius:6px;padding:3px}
.cq-print-band .cq-class{margin-left:auto;font-weight:800;letter-spacing:.08em;border:2px solid #fff;padding:4px 12px;border-radius:6px}
.cq-print-foot{border-top:3px solid #2596be;margin-top:18px;padding-top:6px;font-size:11px;color:#475569;display:flex;justify-content:space-between}
@media print{.dash-sidebar,.no-print{display:none!important}.dash-main{margin:0!important;padding:0!important}body{background:#fff}}
.dash-shell .dash-sidebar{overflow-y:auto}
.cq-filters input:not([type=checkbox]):not([type=file]),.cq-filters select{padding:9px 11px;border:1px solid var(--border,var(--border));border-radius:10px;background:var(--surface);font:inherit;font-size:14px;color:var(--text,#0f172a)}
.cq-filters input:focus,.cq-filters select:focus{outline:2px solid var(--primary);outline-offset:1px}
