﻿.cp-shell {
  display: flex;
  min-height: 100vh;
  background: var(--cp-bg);
}

.cp-sidebar {
  width: 280px;
  padding: 26px 18px;
  background: linear-gradient(180deg, #055b7c 0%, #0c8b9e 55%, #109ea3 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  /* allow the inner .cp-nav to own the only scrollbar */
  overflow: visible;
  z-index: 30;
}

.cp-brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.cp-sidebar-meta {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.cp-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  overflow-y: auto;
  overflow-x: visible; /* let hover fly-outs escape horizontally */
  flex: 1 1 0;
  min-height: 0;
  /* slim scrollbar that matches the dark sidebar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.cp-nav::-webkit-scrollbar { width: 6px; }
.cp-nav::-webkit-scrollbar-track { background: transparent; }
.cp-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.cp-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.cp-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  border-inline-start: 3px solid transparent;
  transition: all 0.2s ease;
}

.cp-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.cp-nav-link.is-active {
  background: linear-gradient(90deg, rgba(var(--cp-blue-rgb), 0.5), rgba(var(--cp-teal-rgb), 0.16));
  border-inline-start-color: var(--cp-teal);
  color: #fff;
  font-weight: 600;
}

.cp-sidebar-footer {
  margin-top: auto;
}

.cp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar (redesigned) ── */
.cp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--cp-border);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  backdrop-filter: saturate(140%) blur(6px);
}

.cp-topbar-title {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cp-topbar-title > div:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cp-topbar-title h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-topbar-title p {
  margin: 0;
  color: var(--cp-ink-soft);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* Compact rounded icon buttons used for lang / theme / notifications.
   `color` was previously `var(--cp-text)` which is undefined in this codebase
   (the design variable is `--cp-ink` — see clinic.css :root); the unresolved
   var fell back to `canvastext`, which made the icon color drift from the rest
   of the topbar. Aligned to `--cp-ink` so light/dark themes stay consistent. */
.cp-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--cp-panel);
  border: 1px solid transparent;
  color: var(--cp-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-size: 1rem;
  padding: 0;
  position: relative;
}
.cp-icon-btn:hover {
  background: rgba(15, 158, 143, 0.1);
  border-color: rgba(15, 158, 143, 0.3);
  color: var(--cp-blue);
}
.cp-icon-btn:focus { outline: none; }
.cp-icon-btn:focus-visible {
  outline: 2px solid var(--cp-blue);
  outline-offset: 2px;
  border-color: rgba(15, 158, 143, 0.3);
}
.cp-icon-btn svg { width: 18px; height: 18px; }

/* Favorite star sits inline with the title — minimal footprint */
.cp-fav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px;
  line-height: 1;
  color: var(--cp-ink-soft);
  transition: color 0.15s, transform 0.15s;
}
.cp-fav-toggle:hover { transform: scale(1.1); }

/* Separator between action groups */
.cp-topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--cp-border);
  margin: 0 4px;
}

.cp-search {
  background: var(--cp-panel);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 12px;
  min-width: 240px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.cp-search:focus-within {
  background: #fff;
  border-color: var(--cp-blue);
  box-shadow: 0 0 0 3px rgba(16, 158, 163, 0.1);
}
.cp-search svg { width: 16px; height: 16px; color: var(--cp-ink-soft); flex-shrink: 0; }
.cp-search input {
  border: none;
  background: transparent;
  width: 100%;
  font-family: var(--cp-font);
  font-size: 0.88rem;
  outline: none;
}

/* Notification bell — use the generic icon-btn look for consistency */
.cp-notification-bell {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--cp-panel);
  border: 1px solid transparent;
  color: var(--cp-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  text-decoration: none;
  position: relative;
  transition: all 0.15s;
  cursor: pointer;
  padding: 0;
}
.cp-notification-bell:hover {
  background: rgba(15, 158, 143, 0.1);
  border-color: rgba(15, 158, 143, 0.3);
  color: var(--cp-blue);
}
.cp-notification-bell:focus { outline: none; }
.cp-notification-bell:focus-visible {
  outline: 2px solid var(--cp-blue);
  outline-offset: 2px;
}
.cp-notification-bell svg { width: 18px; height: 18px; }
.cp-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  font-weight: 700;
  border: 2px solid #fff;
}

/* ── Shared notification dropdown (topbar bell) ── */
/* Pinned to the bell's far edge via logical positioning so it works in
   both RTL (Arabic) and LTR (English) without per-direction overrides. */
.cp-notif-wrap {
  position: relative;
  display: inline-flex;
}
.cp-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 50;
  width: min(360px, calc(100vw - 24px));
  background: var(--cp-card);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  box-shadow: var(--cp-shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cp-notif-panel[hidden] { display: none; }
.cp-notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cp-border);
}
.cp-notif-panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cp-ink);
}
.cp-notif-mark-all {
  background: none;
  border: none;
  color: var(--cp-blue);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.cp-notif-mark-all:hover { background: rgba(16, 158, 163, 0.08); }
.cp-notif-mark-all:focus { outline: none; }
.cp-notif-mark-all:focus-visible {
  outline: 2px solid var(--cp-blue);
  outline-offset: 2px;
}
.cp-notif-mark-all[hidden] { display: none; }
.cp-notif-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 0;
}
.cp-notif-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--cp-ink-soft);
  font-size: 0.85rem;
}
.cp-notif-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cp-border);
  text-align: start;
  cursor: pointer;
  color: var(--cp-ink);
  transition: background 0.12s;
}
.cp-notif-item:last-child { border-bottom: none; }
.cp-notif-item:hover { background: rgba(16, 158, 163, 0.05); }
.cp-notif-item:focus { outline: none; }
.cp-notif-item:focus-visible {
  outline: 2px solid var(--cp-blue);
  outline-offset: -2px;
}
.cp-notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  margin-top: 7px;
  flex: 0 0 auto;
}
.cp-notif-item.is-unread .cp-notif-dot { background: var(--cp-blue); }
.cp-notif-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.cp-notif-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cp-ink);
  word-wrap: break-word;
}
.cp-notif-item.is-unread .cp-notif-title { font-weight: 700; }
.cp-notif-text {
  font-size: 0.8rem;
  color: var(--cp-ink-soft);
  word-wrap: break-word;
  white-space: normal;
}
.cp-notif-when {
  font-size: 0.72rem;
  color: var(--cp-ink-soft);
  margin-top: 4px;
}
@media (max-width: 480px) {
  .cp-notif-panel { width: calc(100vw - 24px); }
  .cp-notif-list { max-height: 60vh; }
}

/* User chip — compact button with dropdown */
.cp-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cp-panel);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  height: 38px;
  transition: all 0.15s;
}
.cp-user-chip:hover {
  background: rgba(15, 158, 143, 0.1);
  border-color: rgba(15, 158, 143, 0.3);
}

.cp-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
  overflow: hidden;
  flex-shrink: 0;
}

.cp-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-user-name {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.1;
}

.cp-user-role {
  color: var(--cp-ink-soft);
  font-size: 0.7rem;
  line-height: 1.1;
}

/* Hide secondary info on very narrow screens */
@media (max-width: 900px) {
  .cp-user-chip > div[style*="text-align"] { display: none; }
  .cp-search { min-width: 140px; }
  .cp-topbar-title p { display: none; }
}
@media (max-width: 600px) {
  .cp-topbar { padding: 10px 14px; }
  .cp-search { display: none; }
  .cp-topbar-divider { display: none; }
}

.cp-content {
  padding: 28px 32px 40px;
  display: grid;
  gap: 24px;
}

.cp-hero {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(16, 158, 163, 0.12), rgba(15, 158, 143, 0.12));
  border: 1px solid rgba(16, 158, 163, 0.15);
}

.cp-hero h2 {
  margin: 0;
  font-size: 1.4rem;
}

.cp-hero p {
  margin: 0;
  color: var(--cp-ink-soft);
}

.cp-stat-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--cp-border);
  box-shadow: var(--cp-shadow-soft);
  display: grid;
  gap: 10px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cp-stat-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--cp-blue), var(--cp-teal));
  opacity: 0.9;
}

.cp-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--cp-shadow);
}

.cp-stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cp-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex: 0 0 auto;
  background: rgba(var(--cp-blue-rgb), 0.1);
  color: var(--cp-blue-strong);
}

.cp-stat-icon--teal { background: rgba(var(--cp-teal-rgb), 0.12); color: var(--cp-teal-strong); }
.cp-stat-icon--amber { background: rgba(var(--cp-amber-rgb), 0.16); color: var(--cp-amber-strong); }
.cp-stat-icon--danger { background: rgba(var(--cp-danger-rgb), 0.12); color: var(--cp-danger); }

.cp-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.cp-stat-label {
  color: var(--cp-ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.cp-stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  width: fit-content;
}

.cp-stat-trend--up { background: rgba(var(--cp-success-rgb), 0.12); color: var(--cp-success); }
.cp-stat-trend--down { background: rgba(var(--cp-danger-rgb), 0.12); color: var(--cp-danger); }
.cp-stat-trend--flat { background: rgba(148, 163, 184, 0.16); color: var(--cp-ink-soft); }

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

.cp-page-header h2 {
  margin: 6px 0 0;
}

.cp-page-header p {
  margin: 6px 0 0;
  color: var(--cp-ink-soft);
}

.cp-support-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
}

.cp-support-card span {
  color: rgba(255, 255, 255, 0.7);
}

.cp-progress {
  width: 100%;
  height: 8px;
  background: var(--cp-panel);
  border-radius: 999px;
  overflow: hidden;
}

.cp-progress__bar {
  height: 100%;
  background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal));
  border-radius: inherit;
}

.cp-stack {
  display: grid;
  gap: 12px;
}

.cp-search-inline {
  min-width: 180px;
}

.cp-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cp-ink);
}

.cp-card-highlight {
  border: 1px solid rgba(16, 158, 163, 0.2);
  background: rgba(16, 158, 163, 0.04);
}

.cp-media-card {
  border: 1px dashed var(--cp-border);
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  color: var(--cp-ink-soft);
  background: rgba(255, 255, 255, 0.6);
}

.cp-media-title {
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--cp-ink);
}

.cp-media-preview {
  font-size: 0.9rem;
  color: var(--cp-ink-soft);
}

.cp-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
}

.cp-photo-thumb {
  width: 100%;
  height: 70px;
  border-radius: 12px;
  border: 1px solid var(--cp-border);
  object-fit: cover;
  background: #fff;
}

.cp-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 20px;
}

.cp-dashboard-intro {
  display: grid;
  gap: 18px;
}

.cp-dashboard-search {
  display: grid;
  gap: 12px;
}

.cp-dashboard-categories {
  display: grid;
  gap: 12px;
}

.cp-dashboard-side {
  display: grid;
  gap: 16px;
}

.cp-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.cp-category-card {
  border: 1px solid var(--cp-border);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-weight: 600;
  font-family: var(--cp-font);
  color: var(--cp-ink);
}

.cp-category-card span {
  font-size: 0.9rem;
}

.cp-category-card.is-active {
  border-color: rgba(16, 158, 163, 0.4);
  background: rgba(16, 158, 163, 0.08);
  color: var(--cp-blue-strong);
}

.cp-category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--cp-shadow-soft);
}

/* Quick-action tiles — dashboard shortcuts (booking, records, prescriptions, …).
   Replaces the old per-page inline `style` + `onmouseover`/`onmouseout` hover
   hack with a single reusable, theme-aware component. */
.cp-quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.cp-quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1.5px solid var(--cp-border);
  background: #fff;
  text-decoration: none;
  color: var(--cp-ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cp-quick-action:hover,
.cp-quick-action:focus-visible {
  border-color: var(--cp-teal);
  color: var(--cp-ink);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(var(--cp-teal-rgb), 0.18);
}

.cp-quick-action:focus-visible { outline: none; }

.cp-quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: rgba(var(--cp-blue-rgb), 0.1);
  color: var(--cp-blue-strong);
}

.cp-quick-action-label {
  font-weight: 700;
  font-size: 0.92rem;
}

.cp-quick-action-hint {
  color: var(--cp-ink-soft);
  font-size: 0.78rem;
  margin-top: -6px;
}

[data-theme="dark"] .cp-quick-action {
  background: #1e293b;
  border-color: var(--cp-border);
}

.cp-offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.cp-offer-card {
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  min-height: 110px;
}

.cp-offer-card strong {
  font-size: 1rem;
}

.cp-offer-card span {
  color: var(--cp-ink-soft);
  font-size: 0.85rem;
}

.cp-offer-amber {
  background: linear-gradient(135deg, rgba(203, 150, 50, 0.18), rgba(255, 255, 255, 0.92));
  border-color: rgba(203, 150, 50, 0.4);
}

.cp-offer-coral {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.16), rgba(255, 255, 255, 0.92));
  border-color: rgba(248, 113, 113, 0.35);
}

.cp-offer-teal {
  background: linear-gradient(135deg, rgba(15, 158, 143, 0.16), rgba(255, 255, 255, 0.92));
  border-color: rgba(15, 158, 143, 0.35);
}

@media (max-width: 1024px) {
  .cp-shell {
    flex-direction: column;
  }

  .cp-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .cp-topbar {
    position: relative;
  }

  .cp-dashboard-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .cp-topbar {
    /* Keep the redesigned single-row layout — just let the title truncate. */
    padding: 10px 14px;
  }

  .cp-topbar-title h1 { font-size: 1rem; }
}

/* ========== Dark Mode - Dashboard ========== */
[data-theme="dark"] .cp-topbar {
  background: #1e293b;
  border-color: var(--cp-border);
}

[data-theme="dark"] .cp-stat-card,
[data-theme="dark"] .cp-category-card {
  background: #1e293b;
  border-color: var(--cp-border);
  color: var(--cp-ink);
}

[data-theme="dark"] .cp-category-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .cp-media-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: var(--cp-border);
}

[data-theme="dark"] .cp-photo-thumb {
  background: #0f172a;
  border-color: var(--cp-border);
}

[data-theme="dark"] .cp-search {
  background: #0f172a;
}
[data-theme="dark"] .cp-search:focus-within {
  background: #1e293b;
}

[data-theme="dark"] .cp-search input {
  color: var(--cp-ink);
}

/* Icon buttons + user chip in dark mode */
[data-theme="dark"] .cp-icon-btn,
[data-theme="dark"] .cp-notification-bell,
[data-theme="dark"] .cp-user-chip {
  background: #0f172a;
  color: var(--cp-ink);
}
[data-theme="dark"] .cp-icon-btn:hover,
[data-theme="dark"] .cp-notification-bell:hover,
[data-theme="dark"] .cp-user-chip:hover {
  background: rgba(15, 158, 143, 0.15);
}
[data-theme="dark"] .cp-topbar-divider {
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .cp-notification-badge {
  border-color: #1e293b;
}

/* Notification dropdown — dark mode */
[data-theme="dark"] .cp-notif-panel {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .cp-notif-panel-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .cp-notif-item { border-bottom-color: rgba(255, 255, 255, 0.06); color: var(--cp-ink); }
[data-theme="dark"] .cp-notif-item:hover { background: rgba(59, 130, 246, 0.12); }

/* Theme toggle button */
.cp-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--cp-border);
  background: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.cp-theme-toggle:hover {
  border-color: var(--cp-blue);
}

[data-theme="dark"] .cp-theme-toggle {
  background: #1e293b;
  border-color: var(--cp-border);
}

/* Offline indicator */
.cp-offline-bar {
  display: none;
  background: #f59e0b;
  color: #000;
  text-align: center;
  padding: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}

.cp-offline-bar.is-visible {
  display: block;
}

/* ===================================================================== */
/* Mobile sidebar drawer — provider + admin dashboards, <=600px          */
/* The floating button + overlay are hidden everywhere by default and    */
/* only enabled inside the mobile media query below.                     */
/* Desktop, tablet, TV mode, and other roles are untouched.              */
/* ===================================================================== */
.cp-mobile-menu-btn,
.cp-sidebar-overlay {
  display: none;
}

@media (max-width: 600px) {
  /* Reduce content padding on small screens for all dashboard roles. */
  .cp-content {
    padding: 16px 14px 28px;
  }

  /* Floating menu button — start edge of the viewport: left in LTR,
     right in RTL (inset-inline-start follows the html dir automatically). */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode) .cp-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset-block-start: 12px;
    inset-inline-start: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    background: var(--cp-panel);
    color: var(--cp-ink);
    box-shadow: 0 4px 14px rgba(12, 35, 64, 0.18);
    cursor: pointer;
    z-index: 1200;
  }
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode) .cp-mobile-menu-btn svg {
    width: 22px;
    height: 22px;
  }

  /* Topbar: pull content away from the floating button so the title isn't hidden. */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode) .cp-topbar {
    padding-inline-start: 62px;
  }

  /* Sidebar becomes an off-canvas drawer pinned to the start edge. */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode) .cp-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(82vw, 320px);
    height: 100vh;
    overflow-y: auto;
    z-index: 1200;
    transform: translateX(-100%); /* LTR: slide off the left edge */
    transition: transform 0.25s ease;
  }
  /* RTL: drawer lives on the right, so it hides toward the right edge. */
  [dir="rtl"] body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode) .cp-sidebar {
    transform: translateX(100%);
  }
  /* Open state — slide into view (same rule for both directions). */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode).cp-mobile-nav-open .cp-sidebar {
    transform: none;
  }

  /* Full-viewport backdrop, shown only while the drawer is open. */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode).cp-mobile-nav-open .cp-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 35, 64, 0.5);
    z-index: 1199;
  }

  /* Lock body scroll while the drawer is open. */
  body:is([data-nav-role="provider"],[data-nav-role="admin"]):not(.cp-tv-mode).cp-mobile-nav-open {
    overflow: hidden;
  }
}

