/* ============================================================
   DESIGN TOKENS — "The Quiet Clinic"
   No pure white, no pure black. Warm muted tones.
   ============================================================ */
:root {
  --bg:          #f7f5f0;
  --surface:     #fbfaf7;
  --surface-2:   #f5f2ec;
  --text:        #1a1a26;
  --muted:       #5c5450;
  --line:        #e4dfd6;
  --primary:     #1a2a20;
  --primary-2:   #0f1a14;
  --primary-soft:#e8efe9;
  --accent:      #c4a882;
  --accent-soft: #f6f1ea;
  --danger:      #c47b7b;
  --success:     #7d9e87;
  --shadow:      none;
  --shadow-md:   0 1px 2px rgba(45,45,58,0.06);
  --shadow-lg:   0 2px 8px rgba(45,45,58,0.08);
  --r-xl: 8px;
  --r-lg: 8px;
  --r-md: 6px;
  --r-sm: 4px;

  /* team colours */
  --tc-green:  #e5efe8;
  --tc-green-b:#3d6250;
  --tc-blue:   #e8edf2;
  --tc-blue-b: #4a6078;
  --tc-purple: #efeaf5;
  --tc-purp-b: #68567a;
  --tc-amber:  #f5efe0;
  --tc-amb-b:  #8c7040;
  --tc-gray:   #ece9e4;
  --tc-gray-b: #6b6259;
}

/* ============================================================
   BASE RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Assistant', system-ui, sans-serif;
  font-size: 0.9375rem;
  color: var(--text);
  background: #f5f2ed;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

button, input, select, textarea { font: inherit; }

img, svg { max-width: 100%; display: block; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3 { font-weight: 600; margin: 0; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }

.muted      { color: var(--muted); }
.muted.small,
.small      { font-size: 0.88rem; }
.error      { color: var(--danger); font-weight: 600; }

/* ============================================================
   LAYOUT
   ============================================================ */
.shell {
  margin: 0 auto;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 56px 1fr;
}

.main-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem clamp(1rem, 2vw, 2rem);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: #2d2d3a;
  color: #b4aea5;
  border-inline-end: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 200ms ease;
  position: relative;
  height: 100%;
  max-height: 100vh;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-collapsed .sidebar-nav .sidebar-label,
.sidebar-collapsed .sidebar-nav .sidebar-badge,
.sidebar-collapsed .sidebar-footer .sidebar-label { display: none; }
.sidebar-collapsed .sidebar-item { justify-content: center; padding: .7rem; }
.sidebar-toggle {
  position: absolute; top: 8px; inset-inline-start: calc(100% + 2px);
  width: 28px; height: 28px; border-radius: 50%;
  background: #3d3d4a; color: #e2e8f0;
  font-size: .7rem; padding: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 10; cursor: pointer; border: 2px solid #475569;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.sidebar-toggle:hover { background: #4d4d5a; }
.sidebar-collapsed .sidebar-toggle { inset-inline-start: calc(100% + 2px); }
.sidebar::after {
  content: "";
  position: absolute; top: 0; inset-inline-end: 0;
  width: 1px; height: 100%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.sidebar-item {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .45rem .75rem; margin: 0;
  border: none; border-radius: 0;
  background: transparent; color: #8c8279;
  cursor: pointer; font-size: .88rem; font-weight: 500;
  transition: background 120ms, color 120ms;
  text-decoration: none; box-shadow: none;
}
.sidebar-item:hover { background: rgba(255,255,255,0.08); color: #e4dfd6; }
.sidebar-item.active {
  background: rgba(255,255,255,0.12);
  color: #fbfaf7; font-weight: 600;
  --v: 1;
}
.sidebar-icon { width: 20px; text-align: center; font-size: .95rem; flex-shrink: 0; color: inherit; }
.sidebar-badge {
  background: var(--danger); color: #fbfaf7;
  font-size: .65rem; padding: 1px 6px; border-radius: 8px;
  margin-inline-start: auto; font-weight: 700;
}
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: .4rem .6rem; }
.sidebar-footer { padding: .5rem 0; border-top: 1px solid rgba(255,255,255,0.06); }

.sidebar-divider { height: 1px; background: var(--line); margin: .5rem .8rem; }

.sidebar-footer { padding: .5rem 0; border-top: 1px solid var(--line); }

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 2.2vw, 2rem);
  background: #2d2d3a;
  color: #fbfaf7;
  box-shadow: 0 16px 36px rgba(15,23,42,.24);
  position: sticky; top: 0; z-index: 40;
}

.eyebrow {
  margin: 0 0 .2rem; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .2em; opacity: .72;
}

.session-bar {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .9rem;
  border-radius: 16px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
}

.session-link {
  text-decoration: none;
}

.session-text { display: grid; gap: .1rem; }
.session-role { font-size: .88rem; color: rgba(255,255,255,.82); }

/* ============================================================
   MODE TOOLBAR
   ============================================================ */
.mode-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap;
}

.mode-tabs { display: flex; gap: 2px; background: #ede8e0; border-radius: 8px; padding: 3px; border: 1px solid var(--line); }

.mode-tab {
  padding: .35rem .75rem; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: .82rem; font-weight: 600; transition: all 120ms;
  box-shadow: none;
}

.mode-tab:hover { color: var(--text); }

.mode-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.mode-actions { display: flex; align-items: center; gap: .5rem; }

/* ============================================================
   SEARCH INPUT
   ============================================================ */
.search-input {
  padding: .45rem .8rem; border: 1px solid var(--line);
  border-radius: 8px; font-size: .88rem; width: 240px;
  background: #fff;
}

.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ============================================================
   DASHBOARD SUMMARY CARDS
   ============================================================ */
.dashboard-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem; margin-bottom: 1.25rem;
}

.dash-card {
  background: var(--surface-2); border-radius: 10px;
  padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: .25rem;
  border: 1px solid var(--line);
}

.dash-card .dash-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); font-weight: 700; }
.dash-card .dash-label { font-size: .85rem; color: var(--muted); }

.dash-card.highlight { border-color: var(--accent); }
.dash-card.highlight .dash-value { color: var(--accent); }

.dash-card.warning { border-color: var(--danger); }
.dash-card.warning .dash-value { color: var(--danger); }

/* ============================================================
   ROOM STATUS DOTS
   ============================================================ */
.room-status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-inline-end: 4px; }
.room-status-free { background: #22c55e; }
.room-status-occupied { background: #ef4444; }
.room-status-soon { background: #f59e0b; }

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  cursor: pointer; border: none;
  border-radius: 8px;
  padding: .5rem 1rem;
  background: var(--primary);
  color: #fbfaf7;
  font-weight: 600;
  font-size: .875rem;
  transition: background 150ms, box-shadow 150ms;
}
button:hover   { background: var(--primary-2); }
button:active  { transform: scale(0.98); }

button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
button.secondary:hover { background: var(--bg); }

button.danger {
  background: var(--danger);
  color: #fbfaf7;
}
button.danger:hover { background: #b91c1c; }

.btn-sm {
  padding: .3rem .65rem;
  font-size: .8rem;
  border-radius: 6px;
}

.icon-btn { padding: .45rem .75rem; font-size: 1rem; }

/* ============================================================
   CARD / PANEL
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  padding: 1.1rem;
  margin-bottom: .75rem;
}

.panel {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  padding: 1rem;
}

.panel-title { margin-bottom: .85rem; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}

/* ============================================================
   FORMS
   ============================================================ */
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  align-items: end;
}

.compact-form { gap: .6rem; }

.full        { grid-column: 1 / -1; }

label {
  display: grid;
  gap: .28rem;
  font-weight: 600;
  font-size: .95rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1.15rem; height: 1.15rem;
  flex-shrink: 0;
  accent-color: var(--primary);
  padding: 0; box-shadow: none;
}

input, select, textarea {
  width: 100%;
  padding: .65rem .8rem;
  border-radius: 10px;
  border: 1px solid rgba(16,42,67,.16);
  background: rgba(255,255,255,.9);
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(15,23,42,.05);
  transition: border-color 120ms;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea { min-height: 90px; resize: vertical; }

.form-actions { display: flex; gap: .55rem; align-items: center; }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-area {
  border: 2px dashed #cbd5e1; border-radius: 10px;
  padding: 2rem; text-align: center;
  margin-bottom: .75rem; color: var(--muted);
  cursor: pointer;
}
.upload-area:hover { border-color: var(--primary); }

/* ============================================================
   AUTH
   ============================================================ */
.auth-card {
  max-width: 820px;
  margin: 1.5rem auto;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .75rem;
  align-items: end;
  margin: .85rem 0;
}

.demo-creds {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: .75rem; font-size: .9rem; color: var(--muted);
}
.demo-creds span {
  padding: .28rem .65rem; border-radius: 999px;
  background: rgba(93,123,111,.08);
  border: 1px solid rgba(93,123,111,.18);
}

.display-entry-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .65rem;
  padding: .46rem .85rem;
  border-radius: 999px;
  border: 1px solid rgba(93,123,111,.25);
  color: #4a665b;
  background: rgba(93,123,111,.08);
  font-weight: 700;
  text-decoration: none;
}

.display-entry-link:hover {
  background: rgba(93,123,111,.14);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; flex-wrap: wrap; gap: .45rem;
  padding: .8rem;
}

.tabs button {
  background: #ede8e0;
  color: var(--text); box-shadow: none;
  font-size: .92rem;
}
.tabs .tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .62rem 1rem;
  border-radius: 999px;
  background: #ede8e0;
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
}
.tabs .tab-link:hover {
  background: var(--primary);
  color: #fbfaf7;
}
.tabs button.active {
  background: var(--primary);
  color: #fbfaf7;
  box-shadow: 0 8px 18px rgba(93,123,111,.22);
}

/* ============================================================
   DAY TABS
   ============================================================ */
.day-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: .1rem .1rem .65rem;
  margin-bottom: .5rem;
  scrollbar-width: thin;
}

.day-tab {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .28rem .55rem;
  padding: .65rem 1rem;
  border-radius: 10px;
  background: rgba(255,255,255,.88);
  border: 1.5px solid rgba(93,123,111,.14);
  color: var(--text);
  box-shadow: none;
  flex: 0 0 auto;
  min-width: 130px;
  transition: background 130ms, border-color 130ms, box-shadow 130ms;
}
.day-tab:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(93,123,111,.14);
  transform: none;
}
.day-tab.active {
  background: var(--primary);
  color: #fbfaf7;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(93,123,111,.3);
}

.dt-short   { font-size: 1.1rem; font-weight: 800; grid-column: 1; grid-row: 1/3; }
.dt-label   { font-weight: 700; font-size: .95rem; grid-column: 2; grid-row: 1; }
.dt-date    { font-size: .8rem; opacity: .82; grid-column: 2; grid-row: 2; }
.dt-count   {
  grid-column: 3; grid-row: 1/3;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  font-size: .78rem; font-weight: 700;
}
.day-tab:not(.active) .dt-count {
  background: rgba(93,123,111,.14);
  color: var(--primary-2);
}

.day-heading {
  font-size: 1rem; font-weight: 700;
  color: var(--muted);
  margin: 0 0 .7rem;
}

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .65rem;
  margin: .85rem 0;
}

.stat-card {
  padding: .8rem 1rem;
  border-radius: 10px;
  background: rgba(93,123,111,.06);
  border: 1px solid rgba(93,123,111,.12);
  display: flex; flex-direction: column; gap: .15rem;
}
.stat-card span   { font-size: .84rem; color: var(--muted); }
.stat-card strong { font-size: 1.55rem; font-weight: 700; }

/* ============================================================
   TAG FILTERS
   ============================================================ */
.filter-collapsible {
  margin-bottom: .8rem;
}
.filter-collapsible summary {
  cursor: pointer; font-weight: 700; font-size: .9rem;
  color: var(--muted); padding: .3rem 0;
  user-select: none;
}
.chips {
  display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .5rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .38rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  border: 1.5px solid rgba(93,123,111,.2);
  background: rgba(255,255,255,.88);
  cursor: pointer; font-size: .88rem;
  color: var(--text);
  font-weight: 500;
}
.chip input { width: auto; padding: 0; box-shadow: none; border: none; background: transparent; }
.chip-active, .chip:has(input:checked) {
  background: rgba(93,123,111,.18);
  border-color: var(--primary);
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   OCCUPANCY TABLE
   ============================================================ */
.table-scroll {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(93,123,111,.15);
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-lg);
  /* provide some min-height so the table looks right */
  min-height: 200px;
}

.occ-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Time column – sticky on the RIGHT in RTL */
.time-col-head,
.time-cell {
  position: sticky;
  inset-inline-start: 0;
  z-index: 5;
  background: linear-gradient(135deg, #5d7b6f, #4a665b);
  color: #fbfaf7;
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: center;
  padding: .45rem .5rem;
  border-inline-end: 1px solid rgba(93,123,111,.3);
}

.time-col-head { font-size: .82rem; font-weight: 700; z-index: 8; }
.time-cell     { font-size: .82rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12); }
.time-hour     { background: linear-gradient(135deg, #3d4a40, #2d3630); font-size: .88rem; }

/* Room column headers */
.room-col-head {
  position: sticky; top: 0; z-index: 4;
  background: linear-gradient(180deg, #f2f0ea, #dfdbd2);
  color: #4a665b;
  text-align: center;
  padding: .5rem .4rem;
  min-width: 150px;
  border-inline-end: 1px solid rgba(93,123,111,.08);
  border-bottom: 2px solid rgba(93,123,111,.2);
}

.rcol-name {
  display: block; font-weight: 700; font-size: .9rem;
}
.rcol-tags {
  display: block; font-size: .74rem; color: var(--muted); margin-top: .15rem;
}

/* Slot rows */
.slot-row { height: 52px; }
.slot-full-hour td,
.slot-full-hour th { border-top: 1.5px solid rgba(93,123,111,.18); }

/* Empty slot */
.slot-empty {
  border: 1px solid rgba(93,123,111,.07);
  background: rgba(237,245,252,.8);
  vertical-align: middle;
  text-align: center;
  cursor: pointer;
  transition: background 100ms;
}
.slot-empty:hover,
.slot-droptarget:hover { background: rgba(93,123,111,.07); }

.slot-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 999px;
  background: rgba(93,123,111,.18);
  color: var(--primary-2);
  font-size: 1.1rem; font-weight: 900;
  opacity: 0;
  transition: opacity 120ms;
}
.slot-empty:hover .slot-plus,
.slot-droptarget:hover .slot-plus { opacity: 1; }

/* Drag over highlight */
.drag-over {
  background: rgba(93,123,111,.16) !important;
  outline: 2px dashed var(--primary) !important;
}

.move-mode .slot-droptarget { cursor: pointer; }
.move-target {
  background: rgba(244,123,32,.10) !important;
  outline: 2px dashed var(--accent) !important;
}

/* Booked slot */
.slot-booked {
  padding: 0;
  vertical-align: top;
  border: 1px solid rgba(93,123,111,.08);
  position: relative;
}

/* ============================================================
   BOOKING CARD
   ============================================================ */
.bcard {
  display: flex; flex-direction: column; gap: 2px;
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 100%;
  padding: .42rem .55rem;
  border-radius: 0;
  border: 1px solid rgba(0,0,0,.06);
  cursor: pointer;
  transition: transform 110ms, box-shadow 110ms;
  user-select: none;
  overflow: hidden;
}
.bcard:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15,23,42,.12); }

/* Team colour variants */
.tc-green  { background: var(--tc-green);  color: var(--tc-green-b);  border-color: #6ee7b7; }
.tc-blue   { background: var(--tc-blue);   color: var(--tc-blue-b);   border-color: #93c5fd; }
.tc-purple { background: var(--tc-purple); color: var(--tc-purp-b);   border-color: #c4b5fd; }
.tc-amber  { background: var(--tc-amber);  color: var(--tc-amb-b);    border-color: #fcd34d; }
.tc-gray   { background: var(--tc-gray);   color: var(--tc-gray-b);   border-color: #b4aea5; }
.tc-default{ background: #f0fdf4;          color: #14532d;            border-color: #86efac; }

.bcard-onetime { outline: 2px dashed var(--accent); }
.bcard-meeting { border-inline-start: 3px solid var(--accent); }

.bcard-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .3rem;
}
.bcard-staff { font-size: .88rem; line-height: 1.2; }
.bcard-badge {
  flex-shrink: 0;
  font-size: .68rem; font-weight: 700;
  background: var(--accent); color: #fbfaf7;
  padding: .08rem .38rem;
  border-radius: 999px;
}
.bcard-time { font-size: .78rem; opacity: .85; }
.bcard-dur  { font-size: .74rem; opacity: .7; }
.bcard-room {
  font-size: .74rem;
  font-weight: 700;
  opacity: .9;
}
.bcard-move-btn {
  margin-top: .18rem;
  align-self: flex-start;
  padding: .2rem .52rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.72);
  color: inherit;
  box-shadow: none;
  font-size: .72rem;
  font-weight: 700;
}
.bcard-move-btn:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255,255,255,.9);
}
.bcard-note {
  font-size: .74rem; opacity: .72;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Room color bands — applied on <td> so the stripe spans the full rowspan height */
td.rb-1 { border-inline-start: 5px solid #5d7b6f; }
td.rb-2 { border-inline-start: 5px solid #c4a882; }
td.rb-3 { border-inline-start: 5px solid #0A8042; }
td.rb-4 { border-inline-start: 5px solid #7C3AED; }
td.rb-5 { border-inline-start: 5px solid #BE123C; }
td.rb-6 { border-inline-start: 5px solid #334155; }
td.slot-booked.rb-1 .bcard { border-inline-start: 5px solid #5d7b6f; }
td.slot-booked.rb-2 .bcard { border-inline-start: 5px solid #c4a882; }
td.slot-booked.rb-3 .bcard { border-inline-start: 5px solid #0A8042; }
td.slot-booked.rb-4 .bcard { border-inline-start: 5px solid #7C3AED; }
td.slot-booked.rb-5 .bcard { border-inline-start: 5px solid #BE123C; }
td.slot-booked.rb-6 .bcard { border-inline-start: 5px solid #334155; }

/* Dragging state */
.dragging { opacity: .45; transform: rotate(1.5deg) scale(.97); }

/* ============================================================
   BOOKING LIST VIEW
   ============================================================ */
.booking-list { display: flex; flex-direction: column; gap: .5rem; }

.booking-list-item {
  display: grid; grid-template-columns: 1fr auto auto;
  padding: .7rem 1rem; background: var(--surface-2);
  border-radius: 8px; border: 1px solid var(--line);
  align-items: center; gap: .5rem;
}

/* ============================================================
   BOOKING MODAL  (<dialog>)
   ============================================================ */
dialog {
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 32px 80px rgba(15,23,42,.32);
  max-width: 540px;
  width: 92vw;
  background: var(--surface-2);
}

dialog::backdrop {
  background: rgba(15,23,42,.48);
  backdrop-filter: blur(4px);
}

.booking-dialog { overflow: hidden; }

.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(93,123,111,.08), transparent);
}
.dialog-head h3 { font-size: 1.15rem; }

.dialog-close-btn {
  background: rgba(0,0,0,.06); color: var(--text);
  width: 2rem; height: 2rem;
  padding: 0; display: flex; align-items: center; justify-content: center;
  box-shadow: none; font-size: 1rem;
}
.dialog-close-btn:hover { background: rgba(0,0,0,.12); transform: none; }

.dialog-body   { padding: 1rem 1.25rem; }
.dialog-grid   {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
.d-full { grid-column: 1 / -1; }

.dialog-footer {
  display: flex; gap: .55rem; align-items: center;
  padding: .75rem 1.25rem 1.1rem;
  border-top: 1px solid var(--line);
}

/* ============================================================
   NOTIFICATION BELL & PANEL
   ============================================================ */
.notification-bell {
  position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 100;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

.bell-badge {
  position: absolute; top: -4px; inset-inline-start: -4px;
  background: var(--danger); color: #fbfaf7; font-size: .68rem;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; font-weight: 700;
}

.notification-panel {
  position: fixed; bottom: 84px; inset-inline-end: 24px; z-index: 99;
  width: 320px; max-height: 400px;
  background: var(--surface-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}

.notif-header { display: flex; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.notif-header h4 { margin: 0; font-size: 1rem; }
.notif-clear { font-size: .8rem; padding: .25rem .6rem; }

.notif-list { overflow-y: auto; max-height: 340px; }

.notif-item { padding: .6rem 1rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.notif-item small { color: var(--muted); display: block; margin-top: .15rem; }
.notif-item.critical { border-inline-start: 3px solid var(--danger); }

/* ============================================================
   NOTICES
   ============================================================ */
.notice {
  padding: .8rem 1rem;
  border-radius: 10px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  margin-top: .6rem;
}
.notice-critical {
  border-color: rgba(244,123,32,.4);
  background: rgba(255,237,214,.6);
}
.notice-actions { display: flex; gap: .45rem; margin-top: .6rem; }
.notice-sub     { font-size: .88rem; color: var(--muted); margin-top: .25rem; }

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: .75rem;
}

.admin-list { margin-top: .85rem; display: grid; gap: .55rem; }

.admin-row {
  display: flex; align-items: flex-start; gap: .75rem;
  justify-content: space-between;
  padding: .7rem .85rem;
  border-radius: 10px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  transition: box-shadow 120ms;
}
.admin-row:hover { box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.admin-row-info { display: grid; gap: .2rem; flex: 1; min-width: 0; }
.admin-row-acts { display: flex; gap: .4rem; flex-shrink: 0; align-items: flex-start; }

.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.tag-pill {
  padding: .18rem .55rem;
  border-radius: 999px;
  background: rgba(93,123,111,.10);
  color: var(--primary-2);
  border: 1px solid rgba(93,123,111,.20);
  font-size: .8rem;
}

.file-upload-label {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .75rem; border-radius: 6px;
  font-weight: 600; font-size: .85rem; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); white-space: nowrap;
  user-select: none;
  position: relative; overflow: hidden;
}
.file-upload-label:hover { background: var(--surface-hover, #f0f0f5); }
.file-upload-label:active { background: var(--surface, #e8e8ef); }
.file-upload-label input[type="file"] {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.staff-upload-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.template-links {
  margin-top: .35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .8rem;
}

.template-links a,
.template-links .btn-link {
  color: #4a665b;
  font-weight: 700;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
}

.staff-template-links {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .75rem;
}

.admin-display-panel {
  margin-top: 1rem;
}

.admin-display-message-form {
  margin-top: 1rem;
}

#meetingList h3 {
  margin-top: 1rem;
  margin-bottom: .25rem;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 50%;
  transform: translateX(-50%) translateY(5rem);
  opacity: 0;
  z-index: 1000;
  padding: .75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: 0 12px 32px rgba(15,23,42,.24);
  transition: transform 240ms ease, opacity 240ms ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 88vw;
  text-overflow: ellipsis;
  overflow: hidden;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-info  { background: #5d7b6f; color: #fbfaf7; }
.toast-warn  { background: #c4a882; color: #fbfaf7; }
.toast-error { background: var(--danger); color: #fbfaf7; }

/* ============================================================
   USER MANAGEMENT
   ============================================================ */
.generated-pwd {
  background: #FFF8F0;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: .6rem .9rem;
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: .08em;
  color: #7A3800;
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-top: .4rem;
}
.generated-pwd .pwd-copy {
  margin-inline-start: auto;
  padding: .22rem .6rem;
  font-size: .8rem;
  font-family: inherit;
}
.user-role-badge {
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.role-admin { background: rgba(93,123,111,.15); color: #4a665b; }
.role-staff { background: rgba(244,123,32,.15); color: #7A3800; }
.reset-req-banner {
  background: rgba(244,123,32,.10);
  border: 1px solid rgba(244,123,32,.3);
  border-radius: 10px;
  padding: .55rem .9rem;
  margin-bottom: .5rem;
  font-size: .9rem;
}
.admin-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: .75rem;
}
@media (max-width: 1200px) { .admin-three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px)  { .admin-three-col { grid-template-columns: 1fr; } }

/* ============================================================
   MISC
   ============================================================ */
.hidden { display: none !important; }

.empty-state {
  color: var(--muted); font-size: .94rem;
  padding: 1rem; text-align: center;
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .admin-two-col { grid-template-columns: 1fr; }
  .stats-row     { grid-template-columns: 1fr 1fr; }
}

/* admin-two-col mobile override */
@media (max-width: 800px) {
  .admin-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header   { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .section-head  { flex-direction: column; }
  .auth-form     { grid-template-columns: 1fr; }
  .stats-row     { grid-template-columns: 1fr 1fr; }
  .tabs          { overflow-x: auto; flex-wrap: nowrap; }
  .tabs button   { flex: 0 0 auto; white-space: nowrap; }
  .day-tab       { min-width: 110px; }
  .dialog-grid   { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .site-header, .mode-toolbar, .week-nav, .notification-bell, .notification-panel,
  .filter-collapsible, .session-bar, .tabs, .day-tabs, .dashboard-summary { display: none !important; }
  .app-layout { display: block; height: auto; }
  .main-content { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: none; }
  .occ-table { font-size: 10pt; }
}

/* Session status badges */
.bcard-status-in-session { background: #fef3c7; color: #92400e; }
.bcard-status-done { background: #d1fae5; color: #065f46; }

/* Sidebar hidden items */
.admin-only.hidden { display: none !important; }

/* ============================================================
   ROOM STATUS STRIP (calendar)
   ============================================================ */
.room-status-strip {
  display: flex; gap: .5rem; overflow-x: auto;
  padding-bottom: .5rem; margin-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.room-status-card {
  min-width: 140px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: .6rem .75rem;
}
.room-status-card .rs-room { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.room-status-card .rs-session { font-size: .8rem; color: var(--muted); }
.room-status-card .rs-time { font-size: .72rem; color: var(--muted); }
.room-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-start: 4px; }
.room-status-free { background: var(--success); }
.room-status-occupied { background: var(--danger); }
.room-status-soon { background: var(--accent); }

/* ============================================================
   KANBAN BOARD (issues)
   ============================================================ */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; min-height: 300px; }
.kanban-column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: .65rem; }
.kanban-column h4 { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; text-align: center; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.kanban-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .55rem .65rem; margin-bottom: .4rem; cursor: grab;
  font-size: .82rem; box-shadow: var(--shadow-md);
}
.kanban-card:hover { border-color: var(--primary); }
.kanban-card .kc-room { font-weight: 600; }
.kanban-card .kc-meta { font-size: .75rem; color: var(--muted); margin-top: .2rem; display: flex; gap: .4rem; }
.kanban-card.dragging { opacity: .5; }

/* ============================================================
   TIMELINE (meetings)
   ============================================================ */
.meeting-timeline { display: flex; flex-direction: column; gap: .5rem; }
.mt-date-header { font-size: .85rem; font-weight: 600; color: var(--muted); padding: .3rem 0; border-bottom: 1px solid var(--line); }
.mt-card {
  display: flex; gap: .75rem; padding: .65rem .75rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); border-inline-start: 3px solid var(--primary);
}
.mt-card .mt-time { min-width: 50px; font-weight: 600; font-size: .85rem; }
.mt-card .mt-body { flex: 1; }
.mt-card .mt-title { font-weight: 600; font-size: .88rem; }
.mt-card .mt-speaker { font-size: .8rem; color: var(--muted); }
.mt-card .mt-badges { display: flex; gap: .25rem; margin-top: .2rem; }
.mt-card .mt-badge { font-size: .7rem; padding: 1px 6px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); }
.mt-card .mt-recur { font-size: .72rem; color: var(--muted); margin-top: .15rem; }

/* ============================================================
   STAFF DIRECTORY CARDS
   ============================================================ */
.staff-directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.staff-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .85rem; display: flex; flex-direction: column; gap: .35rem;
}
.staff-card .sc-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: var(--primary); margin-bottom: .25rem;
}
.staff-card .sc-name { font-weight: 600; font-size: .9rem; }
.staff-card .sc-role { font-size: .8rem; color: var(--muted); }
.staff-card .sc-team { font-size: .72rem; }
.staff-card .sc-contact { font-size: .78rem; color: var(--primary); }

/* ============================================================
   REQUEST SUB-TABS
   ============================================================ */
.request-subtabs { display: flex; gap: .25rem; margin-bottom: .75rem; }
.request-subtab {
  padding: .3rem .7rem; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 500;
  box-shadow: none;
}
.request-subtab:hover { background: var(--surface-2); }
.request-subtab.active { background: var(--primary); color: #fbfaf7; }

/* ============================================================
   BULK ACTIONS BAR
   ============================================================ */
.bulk-actions {
  display: flex; gap: .5rem; align-items: center;
  padding: .5rem .75rem; background: var(--primary-soft);
  border: 1px solid var(--primary); border-radius: var(--r-md);
  margin-bottom: .5rem; font-size: .82rem;
}
.bulk-actions.hidden { display: none; }
.bulk-checkbox { width: 16px; height: 16px; cursor: pointer; }

/* ============================================================
   FILE PREVIEW MODAL
   ============================================================ */
.file-preview-modal {
  max-width: 420px; text-align: center; padding: 1.5rem;
}
.file-preview-modal .fp-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.file-preview-modal .fp-name { font-weight: 600; font-size: 1rem; margin-bottom: .3rem; }
.file-preview-modal .fp-meta { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }

/* ============================================================
   FOLDER TREE IN CONTENT
   ============================================================ */
.resource-layout { display: grid; grid-template-columns: 200px 1fr; gap: .75rem; }
.folder-tree { border: 1px solid var(--line); border-radius: var(--r-md); padding: .5rem; }
.folder-tree-item { padding: .25rem .4rem; font-size: .82rem; cursor: pointer; border-radius: var(--r-sm); }
.folder-tree-item:hover { background: var(--primary-soft); }
.folder-tree-item.active { background: var(--primary); color: #fbfaf7; }

/* ============================================================
   TOOLTIP / QUICK INFO
   ============================================================ */
.tooltip-box {
  position: absolute; z-index: 50;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: .65rem .85rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  font-size: .82rem; max-width: 260px;
}

/* ============================================================
   HOUR RANGE FILTER
   ============================================================ */
.hour-range-filters { display: flex; gap: .25rem; margin-inline-start: auto; }
.hour-range-btn {
  padding: .2rem .55rem; font-size: .78rem; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--muted);
  cursor: pointer; box-shadow: none; font-weight: 400;
}
.hour-range-btn.active { background: var(--primary); color: #fbfaf7; border-color: var(--primary); }

/* ============================================================
   ENHANCEMENT STYLES
   ============================================================ */

/* Skip link */
.skip-link { position: absolute; top: -100px; inset-inline-end: 8px; z-index: 200; background: var(--primary); color: #fbfaf7; padding: .5rem 1rem; border-radius: var(--r-sm); font-size: .9rem; text-decoration: none; }
.skip-link:focus { top: 8px; }

/* Screen reader only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* SOAP fields in dialog */
.dialog-section-label { grid-column: 1 / -1; font-weight: 700; font-size: .85rem; color: var(--primary); margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }

/* Statistics bar charts */
.stat-bar-wrap { background: var(--surface-2); border-radius: 4px; height: 18px; overflow: hidden; margin-top: 4px; }
.stat-bar-fill { background: var(--primary); height: 100%; border-radius: 4px; color: #fbfaf7; font-size: .75rem; display: flex; align-items: center; padding: 0 8px; min-width: 36px; font-weight: 700; text-shadow: 0 1px 0 rgba(0,0,0,0.15); font-weight: 600; transition: width 400ms ease; }

/* Slot unavailable (staff availability) */
.slot-unavailable { background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,.03) 4px, rgba(0,0,0,.03) 6px); }

/* Recurring badge */
.bcard-recurring { display: inline-block; background: var(--primary-soft); color: var(--primary); font-size: .65rem; padding: 0 5px; border-radius: 3px; margin-inline-end: 4px; }

/* Settings panel */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus-visible, .sidebar-item:focus-visible, .mode-tab:focus-visible, .day-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* Print enhancements */
@media print {
  .sidebar, .site-header, .mode-toolbar, .week-nav, .notification-bell, .notification-panel,
  .filter-collapsible, .session-bar, .tabs, .day-tabs, .dashboard-summary, .filter-collapsible,
  .room-status-strip, #waitlistPanel, #statsDashboard, .mode-toolbar, .hour-range-filters { display: none !important; }
  .app-layout { display: block; height: auto; }
  .main-content { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: none; padding: .5rem; }
  .occ-table { font-size: 9pt; width: 100%; page-break-inside: avoid; }
  .occ-table th, .occ-table td { padding: 2px 4px; }
  @page { margin: 1cm; }
}


/* ============================================================
   TYPOGRAPHY SCALE — deliberate, restrained, 4 weights only
   ============================================================ */
h1, h2, h3, h4 { font-weight: 600; margin: 0; }
h1 { font-size: 1.125rem; letter-spacing: normal; }
h2 { font-size: 1rem; }
h3 { font-size: 0.9375rem; }
h4 { font-size: 0.875rem; font-weight: 500; }

/* ============================================================
   SIGNATURE ELEMENT — The schedule as a physical form
   The card lifts off the warm paper background with a subtle,
   deliberate shadow. Only this element gets depth.
   ============================================================ */
.card { box-shadow: 0 1px 0 var(--line), 0 2px 8px rgba(45,45,58,0.04); }
.main-content { background: var(--bg); }

/* ============================================================
   EMPTY STATES — invitations to act, not apologies
   ============================================================ */
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: 0.875rem; }
.empty-state::before { display: block; content: ""; font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.4; }

/* Transition for tab content switching */
.tab-content { transition: opacity 150ms ease; opacity: 1; }
.tab-content.hidden { opacity: 0; pointer-events: none; }

/* Table scroll shadow indicator */
.table-scroll { position: relative; }
.table-scroll::after {
  content: "";
  position: sticky; inset-inline-start: 0; bottom: 0;
  width: 100%; height: 0;
  box-shadow: none;
  transition: box-shadow 200ms ease;
  pointer-events: none;
  z-index: 0;
}
.table-scroll.has-scroll::after {
  box-shadow: inset 0 -8px 8px -8px rgba(45,45,58,0.12);
}

/* Slot hover transition */
.slot-empty { transition: background 150ms ease; }

/* Card hover lift */
.bcard { transition: transform 150ms ease, box-shadow 150ms ease; }
.bcard:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(45,45,58,0.1); }

/* ============================================================
   FORM INPUT POLISH — dir="auto" for mixed content
   ============================================================ */
input, textarea, select { font-size: 0.875rem; border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.55rem; background: var(--surface); color: var(--text); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(93,123,111,0.15); outline: none; }
input::placeholder, textarea::placeholder { color: #b0a89e; }
