/* ============================================================
   Darusalam Hospital — Design System
   Brand palette: crimson #b31b24, dark crimson #8b1016
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --brand:        #b31b24;
  --brand-dark:   #8b1016;
  --brand-light:  #d4252f;
  --brand-soft:   #fdf2f2;
  --brand-glow:   rgba(179,27,36,0.18);

  --ink:          #111827;
  --ink-2:        #374151;
  --muted:        #6b7280;
  --muted-2:      #9ca3af;
  --line:         #e5e7eb;
  --line-2:       #f3f4f6;
  --panel:        #ffffff;
  --bg:           #f8f9fc;

  --accent:       #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-xl:    24px;
  --radius-pill:  9999px;

  --shadow-xs:    0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:    0 4px 12px rgba(0,0,0,.06);
  --shadow:       0 8px 24px rgba(0,0,0,.08);
  --shadow-lg:    0 16px 40px rgba(0,0,0,.1);
  --shadow-brand: 0 8px 24px var(--brand-glow);

  --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
  --sidebar-w:    260px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; display: block; }

/* ── Bootstrap overrides ────────────────────────────────── */
.btn-primary {
  --bs-btn-bg:             var(--brand);
  --bs-btn-border-color:   var(--brand);
  --bs-btn-hover-bg:       var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg:      var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-focus-shadow-rgb: 179,27,36;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-primary:hover {
  box-shadow: 0 4px 14px var(--brand-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline-primary {
  --bs-btn-color:            var(--brand);
  --bs-btn-border-color:     var(--brand);
  --bs-btn-hover-bg:         #ffffff;
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-hover-color:      var(--brand-dark);
  --bs-btn-active-bg:        #ffffff;
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-active-color:     var(--brand-dark);
  --bs-btn-focus-shadow-rgb: 179,27,36;
  font-weight: 600;
  background-color: #ffffff;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-outline-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--brand-glow); }
.btn-outline-primary:active { transform: translateY(0); }

.form-control, .form-select, .input-group-text {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: .925rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(179,27,36,.12);
}
.form-label { font-weight: 600; font-size: .875rem; color: var(--ink-2); margin-bottom: .35rem; }

/* ── Typography helpers ─────────────────────────────────── */
.kicker {
  color: var(--brand);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  display: inline-block;
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: .75rem 0;
  transition: box-shadow var(--transition);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.navbar.scrolled { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border-radius: var(--radius-sm);
  height: 36px;
  width: 36px;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 3px 8px var(--brand-glow);
  transition: transform var(--transition);
}
.navbar-brand:hover .brand-mark { transform: scale(1.08) rotate(-3deg); }
.navbar-brand { font-weight: 800; color: var(--ink) !important; font-size: 1rem; min-width: 0; }

.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}
.brand-logo-nav {
  width: clamp(142px, 18vw, 210px);
  max-height: 46px;
}
.brand-logo-sidebar {
  width: 150px;
  max-height: 48px;
  transition: width var(--transition), height var(--transition), border-radius var(--transition);
}
.brand-logo-auth {
  width: min(230px, 100%);
  max-height: 72px;
}
.brand-logo-footer {
  width: 190px;
  max-height: 58px;
}
.brand-logo-detail {
  width: 178px;
  max-height: 54px;
}
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.navbar .nav-link {
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink-2) !important;
  padding: .45rem .7rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  position: relative;
}
.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 50%; right: 50%;
  height: 2px;
  background: var(--brand);
  border-radius: var(--radius-pill);
  transition: left var(--transition), right var(--transition);
}
.navbar .nav-link:hover, .navbar .nav-link.active { color: var(--brand) !important; }
.navbar .nav-link:hover::after, .navbar .nav-link.active::after { left: .7rem; right: .7rem; }


/* ── Hero ───────────────────────────────────────────────── */
.hero {
  min-height: calc(100vh - 68px);
  padding: 100px 0 60px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  background:
    linear-gradient(125deg, rgba(139,16,22,.95) 0%, rgba(179,27,36,.75) 55%, rgba(30,30,30,.5) 100%),
    url("/assets/img/darusalam-hero.png") center/cover no-repeat;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 50%, rgba(255,255,255,.04) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: .35rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  margin-bottom: 1.25rem;
  animation: fadeSlideUp .6s ease both;
}
.hero-badge i { color: rgba(255,255,255,.8); }

.hero h1 {
  color: #fff;
  font-size: clamp(2.4rem,5vw,4.8rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.02em;
  max-width: 820px;
  animation: fadeSlideUp .7s .1s ease both;
}
.hero h1 span { color: rgba(255,255,255,.75); }

.hero p {
  color: rgba(255,255,255,.88);
  font-size: 1.1rem;
  max-width: 580px;
  line-height: 1.7;
  animation: fadeSlideUp .7s .2s ease both;
}

.hero-actions {
  animation: fadeSlideUp .7s .3s ease both;
}

.hero-strip {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(16px);
  margin-top: 3rem;
  animation: fadeSlideUp .7s .4s ease both;
}
.hero-strip-item { text-align: center; }
.hero-strip-item strong { color: #fff; font-size: 1.3rem; font-weight: 800; display: block; }
.hero-strip-item span { color: rgba(255,255,255,.7); font-size: .8rem; font-weight: 500; }

/* ── Sections ───────────────────────────────────────────── */
.section { padding: 84px 0; }
.section-muted { background: var(--brand-soft); }
.section-dark {
  background: linear-gradient(135deg, var(--ink) 0%, #1f2937 100%);
  color: #fff;
}
.section-dark .text-muted { color: rgba(255,255,255,.6) !important; }

/* ── Cards ──────────────────────────────────────────────── */
.service-card,
.doctor-card,
.stat-card,
.form-panel,
.dashboard-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.service-card { padding: 1.75rem; height: 100%; position: relative; overflow: hidden; }
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
  border-radius: var(--radius) var(--radius) 0 0;
}
.service-card:hover::before { transform: scaleX(1); }
.service-card:hover,
.doctor-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(179,27,36,.2); }

.stat-card { padding: 1.5rem; height: 100%; }

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  height: 52px;
  width: 52px;
  font-size: 1.3rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.service-card:hover .icon-box {
  background: var(--brand);
  color: #fff;
  transform: scale(1.1) rotate(-5deg);
}

/* ── Doctor card ─────────────────────────────────────────── */
.doctor-card { padding: 1.25rem; }
.doctor-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.doctor-card-actions .btn { margin: 0 !important; }
.doctor-avatar {
  aspect-ratio: 1/1;
  background: var(--line-2);
  border-radius: var(--radius-sm);
  object-fit: cover;
  width: 100%;
  border: 1px solid var(--line);
  transition: transform var(--transition);
}
.doctor-card:hover .doctor-avatar { transform: scale(1.03); }
.doctor-specialty {
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Form panels ─────────────────────────────────────────── */
.form-panel { padding: 2rem; border-radius: var(--radius); }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 5rem 0;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  position: relative;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  position: relative;
  z-index: 1;
  animation: fadeSlideUp .5s ease both;
}
.auth-card-sm {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.auth-card a:hover {
  text-decoration: underline;
}
.auth-card .brand-mark { height: 44px; width: 44px; font-size: 1.3rem; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── Dashboard layout ────────────────────────────────────── */
.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-section-title {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: .75rem .5rem .25rem;
  display: block;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 600;
  font-size: .9rem;
  padding: .6rem .8rem;
  margin-bottom: 2px;
  transition: background var(--transition), color var(--transition), padding-left var(--transition);
  position: relative;
}
.sidebar .nav-link i { font-size: 1rem; width: 1.2rem; flex-shrink: 0; }
.sidebar .nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}
.sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}
.sidebar .nav-link:hover:not(.active) {
  background: var(--line-2);
  color: var(--brand);
  padding-left: 1.1rem;
}

/* ── Collapsible Sidebar Rules ───────────────────────────── */
.dashboard-shell {
  transition: grid-template-columns var(--transition);
}
.dashboard-shell.collapsed {
  grid-template-columns: 80px minmax(0, 1fr);
}
.sidebar {
  transition: padding var(--transition), width var(--transition), align-items var(--transition);
}
.sidebar.collapsed {
  padding: 1.5rem 0.5rem;
  align-items: center;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  border-bottom: none;
  margin-bottom: 1rem;
  padding-bottom: 0;
  width: 100%;
}
.sidebar.collapsed .sidebar-brand {
  display: none !important;
}
.sidebar.collapsed .sidebar-section-title {
  display: none !important;
}
.sidebar.collapsed .nav-link span {
  display: none !important;
}
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.6rem 0.8rem;
  gap: 0;
  width: 100%;
}
.sidebar.collapsed .nav-link i {
  margin: 0;
  width: auto;
  font-size: 1.2rem;
}
.sidebar.collapsed .nav-link:hover:not(.active) {
  padding-left: 0.8rem;
}
.sidebar.collapsed .sidebar-profile-info {
  justify-content: center;
  padding: 0 !important;
  margin-bottom: 1rem !important;
}
.sidebar.collapsed .sidebar-profile-text {
  display: none !important;
}
.sidebar.collapsed .logout-btn {
  padding: 0.5rem;
}
.sidebar.collapsed .logout-btn span.logout-text {
  display: none !important;
}
.sidebar.collapsed .notif-badge {
  top: 4px;
  right: 14px;
}


.dashboard-main {
  min-width: 0;
  padding: 2rem 2.5rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,.78) 0%, rgba(248,249,252,0) 240px),
    var(--bg);
}
.dashboard-main > [data-nav-section],
.dashboard-card .row > *,
.dashboard-card form,
.dashboard-card .list-group-item {
  min-width: 0;
}
.dashboard-card .form-control,
.dashboard-card .form-select,
.dashboard-card .input-group {
  min-width: 0;
  max-width: 100%;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-card { padding: 1.5rem; height: 100%; min-width: 0; }
.dashboard-card > h2,
.dashboard-card .dashboard-card-title {
  color: var(--ink);
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-section-header h2 {
  margin-bottom: 0;
}

/* ── Metric cards ────────────────────────────────────────── */
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.metric-card:hover::after { opacity: 1; }
.metric-icon {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  height: 48px; width: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.metric-value { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--ink); }
.metric-label { font-size: .8rem; color: var(--muted); font-weight: 500; margin-top: .2rem; overflow-wrap: anywhere; }

.metric {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  margin-top: .35rem;
}

/* ── Tables ──────────────────────────────────────────────── */
.table { vertical-align: middle; font-size: .9rem; }
.table th { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom-color: var(--line) !important; padding: .75rem 1rem; }
.table td { padding: .8rem 1rem; border-bottom-color: var(--line-2) !important; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--brand-soft); }
.table-responsive {
  border-radius: var(--radius-sm);
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.table-responsive .table { min-width: 680px; }
.table-actions,
.meeting-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
}
.table-actions .btn,
.meeting-card-actions .btn {
  white-space: nowrap;
}

/* ── Status pills ────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 700;
  padding: .28rem .75rem;
  text-transform: capitalize;
  white-space: nowrap;
  letter-spacing: .03em;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.status-confirmed,.status-paid,.status-waiting,.status-active {
  background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
}
.status-pending,.status-pending_payment,.status-scheduled {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
}
.status-cancelled,.status-ended,.status-failed {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
}
.status-completed { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Notification badge ──────────────────────────────────── */
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 800;
  border: 2px solid var(--panel);
}

/* ── Meeting cards ───────────────────────────────────────── */
.meeting-card-list { display: grid; gap: .75rem; }
.meeting-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.meeting-card:hover { border-color: var(--brand); box-shadow: var(--shadow-brand); }
.meeting-card > div { min-width: 0; }
.meeting-meta { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.meeting-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.meeting-time { font-size: .82rem; color: var(--muted); }
.countdown {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: .95rem;
  min-width: 110px;
  text-align: right;
}

/* ── Detail panel ────────────────────────────────────────── */
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.detail-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.detail-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.detail-item span { color: var(--muted); display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .25rem; }
.detail-item strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* ── Notifications ───────────────────────────────────────── */
.notification-item {
  display: flex;
  gap: .75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line-2);
  transition: background var(--transition);
}
.notification-item:hover { background: var(--brand-soft); }
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { border-left: 3px solid var(--brand); padding-left: calc(1rem - 3px); }
.notif-icon {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 50%;
  height: 36px; width: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ── Video call ──────────────────────────────────────────── */
.call-shell {
  background: #07111f;
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0,1fr) 340px;
  height: 100vh;
  overflow: hidden;
}
.call-stage { height: 100vh; position: relative; overflow: hidden; }
.call-stage > video:not(.local-video) { background: #020813; height: 100%; object-fit: contain; width: 100%; }
.local-video {
  background: #050b14;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: var(--radius-sm);
  bottom: 90px; right: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  height: 130px; width: 195px;
  object-fit: cover;
  position: absolute;
  z-index: 4;
}
.call-panel {
  background: var(--panel);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: auto;
}
.call-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}
.call-actions .btn:first-child,
.call-actions .btn:last-child {
  grid-column: 1 / -1;
}
.meeting-lock {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--radius);
  color: var(--ink);
  left: 50%; top: 50%;
  max-width: 420px;
  padding: 2rem;
  position: absolute;
  text-align: center;
  transform: translate(-50%,-50%);
  width: calc(100% - 2rem);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}
.meeting-lock.is-ready { border-color: #a7f3d0; }
.meeting-lock.is-hidden { display: none; }
.meeting-timer {
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  color: var(--brand);
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  padding: .75rem 1rem;
  text-align: center;
  letter-spacing: .05em;
}
.remote-waiting {
  align-items: center;
  background: rgba(7,17,31,.75);
  color: #fff;
  display: none;
  flex-direction: column;
  gap: .75rem;
  inset: 0;
  justify-content: center;
  position: absolute;
  text-align: center;
  z-index: 2;
  backdrop-filter: blur(4px);
}
.remote-waiting.is-visible { display: flex; }
.remote-waiting i { font-size: 3rem; opacity: .7; }

/* ── Call controls ───────────────────────────────────────── */
.call-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem;
  background: linear-gradient(to top, rgba(7,17,31,.9), transparent);
}
.call-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  height: 52px; width: 52px;
  transition: background var(--transition), transform var(--transition);
}
.call-btn:hover { transform: scale(1.1); }
.call-btn-default { background: rgba(255,255,255,.15); color: #fff; }
.call-btn-danger { background: var(--brand); color: #fff; }
.call-btn.is-off { background: rgba(255,255,255,.08); color: rgba(255,255,255,.4); }

/* ── Chat ────────────────────────────────────────────────── */
.chat-box { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; min-height: 260px; }
.chat-messages { flex: 1; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; max-height: 280px; }
.chat-message { background: var(--bg); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .85rem; }
.chat-message.own { background: var(--brand-soft); align-self: flex-end; }
.chat-author { font-weight: 700; font-size: .75rem; color: var(--brand); margin-bottom: .2rem; }
.chat-form { border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .6rem; }

/* ── Toasts ──────────────────────────────────────────────── */
.toast-area { bottom: 1.5rem; position: fixed; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; min-width: 300px; }
.toast-pop { animation: toastIn .25s ease-out both; }
.toast { border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 0; font-size: .9rem; }
.modal-icon-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex: 0 0 44px;
}
#appActionModal .modal-content { border-radius: 1.25rem; }
#appActionModal .modal-footer .btn { min-width: 110px; }

/* ── 404 Page ────────────────────────────────────────────── */
.error-page {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg);
}
.error-code {
  font-size: clamp(5rem,15vw,10rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.04em;
}
.error-icon {
  width: 100px; height: 100px;
  background: var(--brand-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  color: var(--brand);
  margin: 0 auto 1.5rem;
  animation: pulse 2s ease infinite;
}

/* ── Sidebar nav sections ────────────────────────────────── */
[data-nav-section] { scroll-margin-top: 80px; }

/* ── Sidebar mobile toggle ───────────────────────────────── */
.sidebar-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1020;
  backdrop-filter: blur(2px);
}
.sidebar-mobile-overlay.is-open { display: block; }

/* ── Utility ─────────────────────────────────────────────── */
.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; }
.bg-brand-soft { background: var(--brand-soft) !important; }
.border-brand { border-color: var(--brand) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }
.min-w-0 { min-width: 0; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state i { font-size: 3rem; opacity: .3; display: block; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; margin: 0; }

.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(179,27,36,.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 0 var(--brand-glow); }
  50%      { transform: scale(1.05); box-shadow: 0 0 0 12px transparent; }
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dashboard-tab-hidden { display: none !important; }
.dashboard-tab-active { animation: tabFadeIn .2s ease-out; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }
  .dashboard-shell.collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 1025;
    width: min(var(--sidebar-w), 85vw);
    height: 100vh;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transition: left .28s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.is-open { left: 0; }
  .sidebar.collapsed {
    align-items: stretch;
    padding: 1.5rem 1rem;
  }
  .sidebar.collapsed .sidebar-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }
  .sidebar.collapsed .sidebar-brand,
  .sidebar.collapsed .sidebar-section-title,
  .sidebar.collapsed .nav-link span,
  .sidebar.collapsed .sidebar-profile-text,
  .sidebar.collapsed .logout-btn span.logout-text {
    display: initial !important;
  }
  .sidebar.collapsed .sidebar-brand { display: block !important; }
  .sidebar.collapsed .sidebar-section-title { display: block !important; }
  .sidebar.collapsed .nav-link {
    justify-content: flex-start;
    gap: .6rem;
    padding: .6rem .8rem;
  }
  .sidebar.collapsed .nav-link i {
    font-size: 1rem;
    width: 1.2rem;
  }
  .sidebar.collapsed .sidebar-profile-info {
    justify-content: flex-start;
    padding: 0 .5rem !important;
  }
  .sidebar.collapsed .logout-btn { padding: .5rem .75rem; }
  .sidebar.collapsed .notif-badge {
    top: -4px;
    right: -4px;
  }
  .dashboard-main { padding: 1.25rem 1rem; }
  .call-shell { grid-template-columns: 1fr; height: 100vh; overflow: hidden; }
  .call-stage { height: 50vh; }
  .call-panel { height: 50vh; max-height: 50vh; }
  .hero { min-height: auto; padding: 5rem 0 3.5rem; }
  .hero h1 { font-size: clamp(2rem,7vw,3.5rem); }
  .hero-strip { margin-top: 2rem; }
  .section { padding: 56px 0; }
  .local-video { height: 100px; width: 150px; bottom: 80px; }
  .brand-logo-nav { width: 160px; max-height: 42px; }
  .brand-logo-sidebar { width: 142px; }
}

@media (max-width: 575.98px) {
  .auth-card { padding: 1.5rem; border-radius: var(--radius); }
  .dashboard-main { padding: 1rem .75rem; }
  .dashboard-card { padding: 1rem; }
  .dashboard-topbar { margin-bottom: 1.25rem; }
  .dashboard-topbar > * { min-width: 0; }
  .dashboard-topbar h1 { font-size: 1.1rem; overflow-wrap: anywhere; }
  .metric-card { padding: 1rem; gap: .75rem; }
  .metric-card > div:last-child { min-width: 0; }
  .metric-icon { height: 40px; width: 40px; font-size: 1.1rem; }
  .meeting-card { flex-direction: column; align-items: flex-start; }
  .countdown { text-align: left; }
  .table-responsive { border-radius: var(--radius-sm); }
  .metric-value { font-size: 1.6rem; }
  .call-controls { gap: .5rem; }
  .call-btn { height: 44px; width: 44px; font-size: 1rem; }
  .dashboard-topbar { align-items: flex-start; }
  .dashboard-section-header { align-items: flex-start; flex-direction: column; }
  .dashboard-section-header > .d-flex,
  .dashboard-card > .d-flex.align-items-center.justify-content-between {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: .75rem;
    width: 100%;
  }
  .dashboard-card .row.g-2 > .col-6 { width: 100%; }
  .doctor-card-actions,
  .doctor-card-actions .btn {
    width: 100%;
  }
  .doctor-card-actions .btn { justify-content: center; }
  .meeting-card-actions { width: 100%; }
  .meeting-card-actions .btn { flex: 1; }
  .notification-item { padding: .85rem .25rem; }
  .toast-area {
    bottom: .75rem;
    left: .75rem;
    right: .75rem;
    min-width: 0;
  }
  .modal-dialog { margin: .5rem; }
  .brand-logo-nav { width: 138px; }
  .brand-logo-auth { width: 190px; }
}

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

/* ── Focus Outline & Link Clicking Overrides ── */
a:focus, a:active, .btn:focus, .btn:active, .navbar-toggler:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* ── Mobile Sidebar Drawer ── */
@media (max-width: 991.98px) {
  .navbar-toggler {
    z-index: 1060;
    position: relative;
    box-shadow: none !important;
    outline: none !important;
  }
  
  .navbar-collapse {
    position: fixed;
    top: 0;
    right: -100%;
    width: 50%;
    min-width: 280px;
    height: 100vh !important;
    background: #ffffff;
    z-index: 1050;
    box-shadow: -4px 0 15px rgba(0,0,0,0.08);
    transition: right 0.3s ease-in-out, visibility 0.3s ease-in-out !important;
    padding: 2.2rem 1.5rem 1.5rem;
    display: block !important;
    visibility: hidden;
  }

  /* Custom brand-colored hamburger icon by default */
  .navbar-toggler .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23b31b24' stroke-width='2.5' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    background-size: 24px 24px;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Change mobile hamburger to close X when menu is open */
  .navbar-toggler.menu-open .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23b31b24'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") !important;
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    animation: rotateInX 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0.15s;
  }

  @keyframes rotateInX {
    from { transform: rotate(0deg) scale(0.6); opacity: 0; }
    to { transform: rotate(90deg) scale(1); opacity: 1; }
  }

  /* Slide-in stagger animation for mobile nav items */
  .navbar-collapse.show .navbar-nav .nav-item {
    animation: navItemFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
  }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(1) { animation-delay: 0.05s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(2) { animation-delay: 0.1s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(3) { animation-delay: 0.15s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(4) { animation-delay: 0.2s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(5) { animation-delay: 0.25s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(6) { animation-delay: 0.3s; }
  .navbar-collapse.show .navbar-nav .nav-item:nth-child(7) { animation-delay: 0.35s; }

  @keyframes navItemFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
  }

  .navbar-collapse:not(.show) {
    display: block !important;
    right: -100%;
    height: 100vh !important;
    visibility: hidden;
  }

  .navbar-collapse.collapsing {
    transition: right 0.3s ease-in-out, visibility 0.3s ease-in-out !important;
    right: -100%;
    display: block !important;
    height: 100vh !important;
    visibility: visible;
  }

  .navbar-collapse.show {
    right: 0;
    height: 100vh !important;
    visibility: visible;
  }

  .navbar-collapse .navbar-nav {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1.25rem !important;
    width: 100%;
  }

  .navbar-collapse .nav-item {
    width: 100%;
  }

  .navbar-collapse .nav-link {
    width: 100%;
    padding: .5rem .7rem !important;
  }

  /* Make buttons inside mobile sidebar look like simple links */
  .navbar-collapse .nav-item .btn {
    border: none !important;
    background: none !important;
    color: var(--ink-2) !important;
    padding: .5rem .7rem !important;
    font-weight: 600 !important;
    font-size: .9rem !important;
    box-shadow: none !important;
    transform: none !important;
    display: inline-flex !important;
    align-items: center;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }
  
  .navbar-collapse .nav-item .btn i {
    display: none !important;
  }

  .navbar-collapse .nav-item .btn:hover {
    color: var(--brand) !important;
    background: var(--brand-soft) !important;
  }
}

/* ── Case Discussions Workspace Layout Redesign ── */
body.dashboard-no-scroll {
  height: 100vh;
  overflow: hidden;
}
body.dashboard-no-scroll .dashboard-shell {
  height: 100vh;
  overflow: hidden;
}
body.dashboard-no-scroll .dashboard-main {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
}
body.dashboard-no-scroll #case-discussions {
  flex-grow: 1;
  height: 0; /* allows flex column child to scroll independently without expanding parent */
}

#case-discussions.dashboard-tab-active {
  display: flex !important;
  flex-direction: row;
  gap: 1rem;
  overflow: hidden;
  align-items: stretch;
}

.case-sidebar,
.case-chat-pane,
.case-details-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.case-list-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.case-list-item:hover {
  background: var(--brand-soft);
}
.case-list-item.active {
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  padding-left: calc(1rem - 3px);
}

@media (max-width: 1399.98px) {
  .case-sidebar { width: 260px !important; }
  .case-details-pane { width: 280px !important; }
}

@media (max-width: 1199.98px) {
  body.dashboard-no-scroll,
  body.dashboard-no-scroll .dashboard-shell,
  body.dashboard-no-scroll .dashboard-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  body.dashboard-no-scroll .dashboard-main {
    display: block;
    padding: 1.25rem 1rem;
  }
  body.dashboard-no-scroll #case-discussions {
    height: auto;
  }
  #case-discussions.dashboard-tab-active {
    flex-direction: column;
    overflow: visible;
  }
  .case-sidebar,
  .case-chat-pane,
  .case-details-pane {
    height: auto;
    width: 100% !important;
  }
  .case-sidebar { max-height: 480px; }
  .case-chat-pane { min-height: 620px; }
}

@media (max-width: 575.98px) {
  .case-chat-pane { min-height: 700px; }
  .case-room-content > .border-bottom,
  .case-attachment-form > .d-flex {
    align-items: stretch !important;
    flex-direction: column;
  }
  .case-room-content .table-actions { width: 100%; }
  .case-room-content .table-actions .btn { flex: 1; }
  .case-room-content .chat-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }
  .case-attachment-form input[type="file"] { width: 100% !important; }
}
