/* ---------------------------------------------------------------------
   Design tokens
   Palette: clinical, calm, legible. A deep teal does the work a "brand
   color" usually does; amber is reserved only for things that need
   attention (due reminders, warnings). Record/receipt/voucher codes
   (CR-1-00001 etc.) are rendered as monospace chips throughout — they're
   the one truly domain-specific artifact this system produces, so they
   get a consistent visual treatment instead of blending into prose.
------------------------------------------------------------------------ */
:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-alt: #EEF1FA;
  --ink: #1B2340;
  --muted: #64708F;
  --border: #E1E6F2;
  --primary: #3B4FD1;
  --primary-dark: #10163A;
  --primary-tint: #E8EBFC;
  --primary-vivid: #5468F0;
  --violet: #7C5CF0;
  --violet-tint: #EFEAFD;
  --teal: #0FA398;
  --teal-tint: #E0F7F4;
  --amber: #C08A2E;
  --amber-tint: #FBF1DF;
  --danger: #D1373D;
  --danger-tint: #FCEAEA;
  --success: #24925F;
  --success-tint: #E5F5EC;
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-vivid) 100%);
  --gradient-sidebar: linear-gradient(195deg, #2A2E77 0%, #1B1F5C 45%, #0E1140 100%);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 35, 64, 0.05), 0 4px 18px rgba(27, 35, 64, 0.08);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* ---------------------------------------------------------------------
   Doctor portal identity — a clinical teal instead of the indigo used
   for Admin/Nurse/Lab/Receptionist. Overriding the shared tokens here
   (rather than editing every doctor page) means every button, active
   nav state, avatar and stat-card accent that already reads var(--primary)
   etc. picks up the new color for free, with zero markup changes.
------------------------------------------------------------------------ */
body[data-portal="doctor"] {
  --primary: #0FA398;
  --primary-dark: #0A5F58;
  --primary-tint: #E0F7F4;
  --primary-vivid: #12BDAF;
  --gradient-primary: linear-gradient(135deg, #0FA398 0%, #12BDAF 100%);
  --gradient-sidebar: linear-gradient(195deg, #0C3634 0%, #082B29 45%, #041917 100%);
}
body[data-portal="doctor"] .sidebar__avatar {
  background: linear-gradient(135deg, var(--primary-vivid), var(--primary-dark));
  color: #fff;
}

/* ---------------------------------------------------------------------
   Admin portal identity — a deep, saturated navy/royal-blue instead of
   the lighter base indigo, giving Admin its own distinct "executive"
   feel the same way the doctor portal gets a clinical teal. Same
   technique: override the shared tokens under a data-portal scope so
   nurse/lab/receptionist (which still use the plain base indigo) are
   untouched.
------------------------------------------------------------------------ */
body[data-portal="admin"] {
  --primary: #0FA398;
  --primary-dark: #0A5F58;
  --primary-tint: #E0F7F4;
  --primary-vivid: #12BDAF;
  --gradient-primary: linear-gradient(135deg, #0FA398 0%, #12BDAF 100%);
  --gradient-sidebar: linear-gradient(195deg, #0C3634 0%, #082B29 45%, #041917 100%);
}
body[data-portal="admin"] .sidebar__avatar {
  background: linear-gradient(135deg, var(--primary-vivid), var(--primary-dark));
  color: #fff;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--primary-vivid);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   App shell: fixed sidebar + topbar + scrollable content
------------------------------------------------------------------------ */
/* The shell itself never scrolls — it's exactly one viewport tall. Only
   `.content` (inside `.main`) scrolls, so the sidebar and topbar stay put
   no matter how long a table or list gets. */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--gradient-sidebar);
  color: #E8F2F0;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  height: 100vh;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 10px 22px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.2px;
  color: #fff;
  line-height: 1.15;
}
.brand-text span {
  font-size: 10px;
  color: #9FB0DA;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Slim info strip across the top of every page, in the reference site's
   spirit: hours / emergency line / contact, right above the page title. */
.info-bar {
  background: var(--primary-dark);
  color: #C7D2EE;
  font-size: 12px;
  padding: 7px 28px;
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}
.info-bar__item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.info-bar__item strong { color: #fff; font-weight: 600; }
.info-bar__item svg { flex-shrink: 0; }

.sidebar__nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }

.sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #C6CDEF;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar__link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar__link.is-active { background: var(--primary); color: #fff; }

.sidebar__badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--amber);
  color: #241505;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}
.sidebar__badge.is-visible { display: inline-flex; animation: pulse 2.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 122, 43, 0.55); }
  50% { box-shadow: 0 0 0 4px rgba(201, 122, 43, 0); }
}

.sidebar__footer { padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar__user { font-size: 12.5px; color: #B8D9D4; padding: 0 10px 10px; }
.sidebar__user strong { display: block; color: #fff; font-size: 13.5px; }

.btn-logout {
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #E8F2F0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.08); }

.main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(27, 35, 64, 0.03);
  flex-shrink: 0;
}
.topbar h1 { font-size: 21px; }
.topbar__sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* The one scrollable region on every admin page. A page with a single
   long table/list scrolls in here only — sidebar, info-bar and topbar
   stay fixed in place above it. */
.content { padding: 24px 28px 60px; flex: 1; overflow-y: auto; min-height: 0; }

/* A card that should fill the remaining page height and scroll its own
   body (used by pages that are "one big table/grid", e.g. the
   appointments calendar) instead of letting `.content` scroll around it. */
.content--fill { display: flex; flex-direction: column; min-height: 0; }
.content--fill > .card:last-child { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.content--fill > .card:last-child .table-wrap { flex: 1; overflow-y: auto; }

/* ---------------------------------------------------------------------
   Cards, tables, forms
------------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card__header h2 { font-size: 16px; }
.card__body { padding: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-card__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-tint);
  color: var(--primary);
}
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__body { display: flex; flex-direction: column; }
.stat-card__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-card__value { font-family: var(--font-display); font-size: 30px; margin-top: 6px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

/* ---------------------------------------------------------------------
   Searchable select (searchable-select.js)
   Wraps every native <select> with a searchable dropdown. The native
   select is kept in the DOM (visually hidden) as the source of truth.
------------------------------------------------------------------------ */
.ss-wrap {
  position: relative;
  display: inline-block;
  width: auto;
  min-width: 170px;
  font-family: var(--font-body);
}
.ss-wrap.ss-disabled { opacity: 0.6; pointer-events: none; }

.ss-native {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.ss-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ss-trigger:hover { border-color: var(--primary); }
.ss-wrap.ss-open .ss-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.ss-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ss-trigger-label.is-placeholder { color: var(--muted); }
.ss-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.ss-wrap.ss-open .ss-chevron { transform: rotate(180deg); color: var(--primary); }

.ss-panel {
  /* Positioned via inline top/left/bottom/width set by searchable-select.js
     (positionPanel), which computes them from the trigger's live viewport
     rect. This is a portal panel appended to <body> on open, so `fixed`
     positioning lets it float above scroll-clipping ancestors (e.g. a
     table's `overflow-x: auto` wrapper) instead of getting cut off. */
  position: fixed;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 26, 59, 0.16);
  z-index: 1000;
  overflow: hidden;
}

.ss-search-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.ss-search-icon { color: var(--muted); flex-shrink: 0; }
.ss-search {
  border: none;
  background: transparent;
  padding: 2px 0;
  font-size: 13.5px;
  width: 100%;
  color: var(--ink);
}
.ss-search:focus { border: none; outline: none; }

.ss-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}
.ss-item {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-item.is-active { background: var(--primary-tint); color: var(--primary-dark); }
.ss-item.is-selected { font-weight: 600; }
.ss-item.is-selected::after { content: '✓'; float: right; color: var(--primary); }
.ss-item.is-disabled { color: var(--muted); cursor: not-allowed; opacity: 0.6; }
.ss-empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: 13px; }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn:hover { filter: brightness(0.95); }
.btn-primary { background: var(--gradient-primary); color: #fff; box-shadow: 0 2px 10px rgba(53, 80, 216, 0.28); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(53, 80, 216, 0.38); filter: brightness(1.04); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-danger { background: var(--danger-tint); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--primary); padding: 6px 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

/* ---------------------------------------------------------------------
   Icon-only row actions (edit / delete / view / cancel). A small square,
   ghost by default, filled tint on hover in whatever color the action
   implies. Shared across every table's trailing "actions" column so a
   row's controls look the same on every page. Always pair with a
   title="" attribute for accessibility/tooltip since there's no label.
------------------------------------------------------------------------ */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.btn-icon:hover { background: var(--surface-alt); color: var(--primary); }
.btn-icon.btn-icon--danger:hover { background: var(--danger-tint); color: var(--danger); }
.btn-icon-group { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------------
   Icon dropdown menu — a button that opens a small floating list of
   icon + label choices. Native <select><option> can't render inline
   SVGs (options only ever show plain text), so any menu that needs a
   status/action icon next to each choice uses this markup instead:

     <div class="menu-dropdown" data-menu>
       <button type="button" class="btn btn-ghost btn-sm" data-menu-trigger>
         Label <svg data-icon="chevronDown">…</svg>
       </button>
       <div class="menu-dropdown__list is-hidden" data-menu-list>
         <button type="button" class="menu-dropdown__item" data-menu-value="x">
           <svg>…</svg> Label
         </button>
       </div>
     </div>

   Toggle `is-hidden` on `[data-menu-list]` on trigger click, close on
   outside click / after a choice is made. See appointments.blade.php.
------------------------------------------------------------------------ */
.menu-dropdown { position: relative; display: inline-block; }
.menu-dropdown__list {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 20;
  min-width: 168px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu-dropdown__list.is-hidden { display: none; }
.menu-dropdown__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: none; background: transparent; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; text-align: left;
}
.menu-dropdown__item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; flex-shrink: 0; }
.menu-dropdown__item:hover { background: var(--surface-alt); }
.menu-dropdown__item[data-menu-value="cancelled"]:hover,
.menu-dropdown__item[data-menu-value="no_show"]:hover { background: var(--danger-tint); color: var(--danger); }

/* ---------------------------------------------------------------------
   Tables
------------------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }

th, td {
  text-align: left;
  padding: 14px 20px;
  font-size: 13.5px;
  vertical-align: middle;
  white-space: nowrap;
}
td { border-bottom: 1px solid var(--border); color: var(--ink); }

th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
th:first-child { border-top-left-radius: 0; }

/* Flat, whitespace-driven rows — no zebra striping. A row's identity
   comes from hover + the bottom hairline, matching a clean admin-template
   look rather than an old-fashioned banded spreadsheet feel. */
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: none; }

td.muted, th.muted { color: var(--muted); }
td.num, .table-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Cells that hold a row's primary identity (name / title) read slightly
   heavier so the eye has an anchor per row. */
td strong { font-weight: 600; color: var(--ink); }

/* Trailing "actions" column: keep buttons tight and right-aligned without
   requiring every page to add its own alignment classes. */
td:last-child:has(.btn-ghost),
td:last-child:has(.btn-sm),
td:last-child:has(.btn-icon),
td:last-child:has(.btn-icon-group) {
  text-align: right;
  white-space: nowrap;
}

.code-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--primary-tint);
  color: var(--primary-dark);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.avatar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ---------------------------------------------------------------------
   Status badges
   Soft-tint "pill" badges with a colour-coded dot. The dot is drawn with
   currentColor via ::before so every status only needs to set one text
   colour plus a background/border tint — no markup changes required.
------------------------------------------------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Amber — pending / awaiting action */
.pill-pending, .pill-open, .pill-due, .pill-due-today, .pill-partial {
  background: var(--amber-tint); color: var(--amber); border-color: rgba(185, 130, 43, 0.22);
}
/* Blue — scheduled / informational */
.pill-confirmed, .pill-booked, .pill-upcoming {
  background: var(--violet-tint); color: var(--violet); border-color: rgba(109, 93, 246, 0.22);
}
/* Green — positive / successful outcome */
.pill-completed, .pill-closed, .pill-active, .pill-paid, .pill-sent, .pill-approved {
  background: var(--success-tint); color: var(--success); border-color: rgba(47, 125, 92, 0.2);
}
/* Red — negative outcome / needs attention now */
.pill-cancelled, .pill-no_show, .pill-failed, .pill-overdue, .pill-unpaid, .pill-on_leave, .pill-rejected, .pill-resigned, .pill-terminated {
  background: var(--danger-tint); color: var(--danger); border-color: rgba(193, 39, 45, 0.2);
}
/* Teal — in progress / processed but not final */
.pill-processed, .pill-draft {
  background: var(--teal-tint); color: var(--teal); border-color: rgba(14, 158, 150, 0.22);
}
/* Neutral grey — inactive / off, not inherently negative */
.pill-inactive {
  background: var(--surface-alt); color: var(--muted); border-color: var(--border);
}

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.empty-state {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pagination .btns { display: flex; gap: 8px; }

/* ---------------------------------------------------------------------
   Modal
------------------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 26, 25, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal-overlay.is-hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal__header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal__header h3 { font-size: 17px; }
.modal__close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal__body { padding: 20px 22px; }
.modal__footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-error-banner { background: var(--danger-tint); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ---------------------------------------------------------------------
   Toasts
------------------------------------------------------------------------ */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 9px;
  font-size: 13.5px; box-shadow: var(--shadow); min-width: 220px;
  animation: toast-in 0.18s ease;
}
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------------------
   Login page
------------------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(22, 41, 92, 0.14), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(193, 39, 45, 0.10), transparent 40%),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
}
.login-card__mark { font-family: var(--font-display); font-size: 24px; color: var(--primary-dark); margin-bottom: 2px; }
.login-card__tag { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); background: var(--surface-alt); padding: 10px 12px; border-radius: 8px; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------------
   Sidebar v2 — icons, accent bar, avatar chip, mobile off-canvas
   (extends the base .sidebar rules above; loaded via shell.js partial)
------------------------------------------------------------------------ */
.sidebar__brand { position: relative; }
.sidebar__close, .sidebar__open {
  display: none;
  background: transparent; border: none; cursor: pointer;
  color: #C7D2EE; padding: 4px;
}
.sidebar__open { color: #C7D2EE; margin-right: 4px; }
.sidebar__close { margin-left: auto; }

.sidebar__link { justify-content: flex-start; }
.sidebar__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; flex-shrink: 0; color: #8FA3D6; transition: color 0.15s ease;
}
.sidebar__label { flex: 1; }
.sidebar__link:hover .sidebar__icon { color: #fff; }
.sidebar__link.is-active .sidebar__icon { color: var(--teal); }

.sidebar__link {
  position: relative;
  border-radius: 0 8px 8px 0;
  margin-left: -14px;
  padding-left: 17px;
}
.sidebar__link::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 60%;
  background: var(--teal);
  border-radius: 0 3px 3px 0;
  transition: transform 0.18s ease;
}
.sidebar__link.is-active::before { transform: translateY(-50%) scaleY(1); }
.sidebar__link.is-active { background: rgba(255,255,255,0.08); }

.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 12px;
}
.sidebar__avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--amber), #8a5f1e);
  color: #241505;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px;
}
.sidebar__user-meta { min-width: 0; }
.sidebar__user-meta strong { display: block; color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-meta span { font-size: 11.5px; color: #AEB7E8; text-transform: capitalize; }

.btn-logout { display: flex; align-items: center; justify-content: center; gap: 7px; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 0 100vmax rgba(9, 14, 32, 0);
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(9, 14, 32, 0.45); }
  .sidebar__close { display: block; }
  .sidebar__open { display: inline-flex; }
  .sidebar__mobile-fab { display: flex; }
}

/* Standalone mobile menu toggle for pages with no info-bar to host
   `.sidebar__open` (currently the doctor portal). Fixed top-left, hidden
   on desktop, shown only under the same breakpoint as the off-canvas
   sidebar itself. */
.sidebar__mobile-fab {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 61;
  width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); color: var(--ink); cursor: pointer;
}
/* Pages that include partials.info-bar already render a .sidebar__open
   button inside it — showing the standalone FAB too would give mobile
   users two overlapping menu buttons on the same page. */
body:has(.info-bar) .sidebar__mobile-fab { display: none !important; }

/* ---------------------------------------------------------------------
   Topbar v2 — heading + search / notification bell / profile chip
------------------------------------------------------------------------ */
.info-bar { gap: 22px; }
.info-bar__item:nth-child(4) { margin-left: auto; }
@media (max-width: 640px) { .info-bar__item:not(:first-child) { display: none; } }

.topbar { gap: 16px; flex-wrap: wrap; }
.topbar__heading h1 { font-size: 21px; }
.topbar__sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.topbar__actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.topbar__search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  width: 220px;
}
.topbar__search input {
  border: none; background: transparent; padding: 0; font-size: 13px;
  width: 100%; color: var(--ink);
}
.topbar__search input:focus { outline: none; }
@media (max-width: 720px) { .topbar__search { display: none; } }

.topbar__bell {
  position: relative;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); cursor: pointer; flex-shrink: 0;
}
.topbar__bell:hover { border-color: var(--primary); color: var(--primary); }
.topbar__bell-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  align-items: center; justify-content: center;
  display: none; border: 2px solid var(--surface);
}
.topbar__bell-badge.is-visible { display: inline-flex; }

.topbar__divider { width: 1px; height: 26px; background: var(--border); flex-shrink: 0; }

.topbar__profile { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar__avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(59, 79, 209, 0.28);
}
.topbar__profile-meta { line-height: 1.25; }
.topbar__profile-meta strong { display: block; font-size: 13px; }
.topbar__profile-meta span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
@media (max-width: 560px) { .topbar__profile-meta { display: none; } }

/* ---------------------------------------------------------------------
   Dashboard polish — colored stat accents, card-header icons, avatar
   chips for doctor rows, due-status pills. Reusable across pages.
------------------------------------------------------------------------ */
.stat-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-primary);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16, 26, 59, 0.10); }
.stat-card--primary::before { background: var(--gradient-primary); }
.stat-card--success::before { background: linear-gradient(135deg, var(--success), #46A87D); }
.stat-card--amber::before { background: linear-gradient(135deg, var(--amber), #D6A24C); }
.stat-card--danger::before { background: linear-gradient(135deg, var(--danger), #E14A50); }
.stat-card--violet::before { background: linear-gradient(135deg, var(--violet), #8F7FFA); }
.stat-card--teal::before { background: linear-gradient(135deg, var(--teal), #3FC2B8); }
.stat-card--primary .stat-card__icon { background: var(--primary-tint); color: var(--primary-vivid); }
.stat-card--success .stat-card__icon { background: var(--success-tint); color: var(--success); }
.stat-card--amber .stat-card__icon { background: var(--amber-tint); color: var(--amber); }
.stat-card--danger .stat-card__icon { background: var(--danger-tint); color: var(--danger); }
.stat-card--violet .stat-card__icon { background: var(--violet-tint); color: var(--violet); }
.stat-card--teal .stat-card__icon { background: var(--teal-tint); color: var(--teal); }

.dashboard-greeting { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dashboard-greeting strong { color: var(--ink); }

.card__header .card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-tint); color: var(--primary);
  margin-right: 8px; vertical-align: -8px;
}
.card__header .card__icon svg { width: 15px; height: 15px; }

.avatar-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  font-size: 11px; font-weight: 800; color: #fff;
  margin-right: 8px; vertical-align: -8px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Sidebar nav groups — small uppercase section labels between groups
   of related links, instead of one long undifferentiated list.
------------------------------------------------------------------------ */
.sidebar__group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #7C93CC;
  padding: 10px 12px 5px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar__nav > .sidebar__group-label:first-child { padding-top: 0; margin-top: 0; border-top: none; }

/* ---------------------------------------------------------------------
   Slot availability preview — used on the Doctor dashboard's own
   availability section, the Admin "manage availability" modal, and the
   booking forms (Admin + Receptionist) to show real open/taken times
   before booking.
------------------------------------------------------------------------ */
.slot-grid { display: flex; flex-direction: column; gap: 16px; }
.slot-session h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--success-tint);
  color: var(--success);
  border: 1px solid rgba(47, 125, 92, 0.2);
}
.slot-chip.is-taken {
  background: var(--surface-alt);
  color: var(--muted);
  border-color: var(--border);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.slot-chip.is-selectable { cursor: pointer; transition: transform 0.1s ease; }
.slot-chip.is-selectable:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(16,26,59,0.12); }
.slot-chip.is-selected {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-tint);
}

.availability-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ---------------------------------------------------------------------
   Dashboard — two-column panel row (chart + today's schedule, then
   doctor load + reminders) instead of everything stacked full-width.
------------------------------------------------------------------------ */
.dash-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.dash-row + .dash-row { margin-top: 16px; }
@media (max-width: 980px) { .dash-row { grid-template-columns: 1fr; } }
.dash-row > .card { margin-top: 0; }

/* ---------------------------------------------------------------------
   Pill toggle switch — used for "is this day a working day" style
   on/off controls instead of a bare checkbox.
------------------------------------------------------------------------ */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 999px; transition: background 0.15s ease; pointer-events: none;
}
.switch__track::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(16, 26, 59, 0.3);
}
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::before { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--primary); outline-offset: 2px; }

.week-row.is-off { color: var(--muted); }
.week-row.is-off input[type="time"], .week-row.is-off input[type="number"] { opacity: 0.45; }
.week-row.is-weekend td:first-child::after {
  content: 'Weekend'; margin-left: 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  background: var(--surface-alt); padding: 2px 7px; border-radius: 999px;
}

/* Simple dependency-free bar chart: each bar is a flex column with the
   filled portion pinned to the bottom, height set inline (0-100%) from JS. */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  padding: 4px 4px 0;
}
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.chart-bar-track { width: 100%; max-width: 40px; height: 100%; display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 3px 3px;
  background: var(--gradient-primary);
  transition: height 0.4s ease;
  position: relative;
}
.chart-bar-col.is-today .chart-bar { background: linear-gradient(135deg, var(--amber), #D6A24C); }
.chart-bar-value { font-size: 11px; font-weight: 700; color: var(--ink); }
.chart-bar-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Today's schedule — compact list of appointment rows with a colour dot
   for the doctor, time, and a status pill, for the dashboard side panel. */
.schedule-list { display: flex; flex-direction: column; }
.schedule-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.schedule-row:last-child { border-bottom: none; }
.schedule-row__time { font-size: 12px; font-weight: 700; color: var(--ink); width: 46px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.schedule-row__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.schedule-row__body { flex: 1; min-width: 0; }
.schedule-row__name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-row__meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------
   Appointments — full calendar page (month grid + list view, day
   agenda). Sits inside `.content--fill` so the grid/agenda area is the
   one part of the page that scrolls, matching every other module.
------------------------------------------------------------------------ */
.cal-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav__label { font-family: var(--font-display); font-size: 18px; min-width: 168px; text-align: center; }
.cal-view-tabs { display: inline-flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.cal-view-tab {
  border: none; background: transparent; padding: 6px 14px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.cal-view-tab.is-active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(16,26,59,0.12); }

.cal-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.cal-legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cal-legend__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.cal-grid { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.cal-grid__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); flex-shrink: 0; }
.cal-grid__weekdays span {
  padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); text-align: center;
  background: var(--surface-alt); border-bottom: 1px solid var(--border);
}
.cal-grid__weeks { flex: 1; display: grid; grid-auto-rows: minmax(108px, 1fr); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px 7px; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: background-color 0.12s ease;
}
.cal-day:hover { background: var(--surface-alt); }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.is-outside { background: rgba(219, 226, 240, 0.22); }
.cal-day.is-outside .cal-day__num { color: var(--muted); opacity: 0.6; }
.cal-day.is-today .cal-day__num {
  background: var(--primary); color: #fff; border-radius: 6px;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-day.is-selected { background: var(--primary-tint); box-shadow: inset 0 0 0 2px var(--primary-vivid); }
.cal-day__num { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.cal-day__events { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-event {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600;
  color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event__time { opacity: 0.85; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-day__more { font-size: 10.5px; color: var(--primary); font-weight: 700; padding-left: 6px; }

/* Agenda drawer — the selected day's full appointment list, slides in
   below the grid on click instead of a separate modal. */
.cal-agenda { border-top: 1px solid var(--border); flex-shrink: 0; max-height: 260px; overflow-y: auto; }
.cal-agenda__header { padding: 12px 20px; font-size: 13px; font-weight: 700; color: var(--ink); background: var(--surface-alt); border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.cal-agenda-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border);
}
.cal-agenda-row:last-child { border-bottom: none; }
.cal-agenda-row__time { width: 54px; flex-shrink: 0; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-agenda-row__body { flex: 1; min-width: 0; }
.cal-agenda-row__name { font-size: 13px; font-weight: 600; }
.cal-agenda-row__meta { font-size: 11.5px; color: var(--muted); }