/* ==========================================================================
   Sadhana Design System
   A single source of truth for color, type, spacing and components.
   Layered on top of Bootstrap 5.3 — supports light & dark themes via
   [data-bs-theme] on <html>.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --sd-primary: #6366f1;
  --sd-primary-strong: #4f46e5;
  --sd-primary-soft: rgba(99, 102, 241, 0.12);
  --sd-accent: #06b6d4;
  --sd-accent-soft: rgba(6, 182, 212, 0.10);
  --sd-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --sd-gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(6, 182, 212, 0.10));

  /* Semantic */
  --sd-success: #10b981;
  --sd-warning: #f59e0b;
  --sd-danger: #ef4444;
  --sd-info: #3b82f6;

  /* Radii */
  --rd-xs: 4px;
  --rd-sm: 8px;
  --rd-md: 12px;
  --rd-lg: 16px;
  --rd-xl: 20px;
  --rd-2xl: 24px;
  --rd-pill: 999px;

  /* Motion */
  --tr-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --tr-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;
  --topbar-h-mobile: 56px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 4px 12px -3px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 12px 32px -8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.22);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.18);

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
}

[data-bs-theme="dark"] {
  color-scheme: dark;

  --sd-bg: #0a0c14;
  --sd-bg-inset: #070910;
  --sd-surface: #111318;
  --sd-surface-2: #181b24;
  --sd-surface-3: #1f2330;
  --sd-border: rgba(255, 255, 255, 0.07);
  --sd-border-strong: rgba(255, 255, 255, 0.12);
  --sd-text: #f0f2f8;
  --sd-text-muted: #8b92a8;
  --sd-text-faint: #5a6178;
  --sd-nav-active-bg: rgba(99, 102, 241, 0.14);
  --sd-shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --sd-shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
  --sd-shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
  --sd-glow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 8px 30px -6px rgba(99, 102, 241, 0.3);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);
}

[data-bs-theme="light"] {
  color-scheme: light;

  --sd-bg: #f8f9fc;
  --sd-bg-inset: #f0f2f7;
  --sd-surface: #ffffff;
  --sd-surface-2: #f5f7fa;
  --sd-surface-3: #eef0f5;
  --sd-border: #e2e5ee;
  --sd-border-strong: #d0d4e0;
  --sd-text: #111827;
  --sd-text-muted: #6b7280;
  --sd-text-faint: #9ca3af;
  --sd-nav-active-bg: rgba(99, 102, 241, 0.08);
  --sd-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --sd-shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.1);
  --sd-shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, 0.14);
  --sd-glow: 0 0 0 1px rgba(99, 102, 241, 0.25), 0 8px 24px -6px rgba(99, 102, 241, 0.2);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.1);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-color: var(--sd-bg);
  color: var(--sd-text);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--tr-base), color var(--tr-base);
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--sd-text);
  line-height: 1.25;
}

a { color: var(--sd-primary); }
[data-bs-theme="dark"] a { color: #97a0ff; }

::selection { background: rgba(90, 103, 242, 0.32); }

hr {
  border-color: var(--sd-border);
  opacity: 1;
}

code {
  background: var(--sd-surface-3);
  padding: 0.15em 0.45em;
  border-radius: var(--rd-sm);
  font-size: 0.85em;
}

/* Slim scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--sd-border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--sd-border-strong); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Accessible focus ring */
:focus-visible {
  outline: 2px solid var(--sd-primary);
  outline-offset: 2px;
  border-radius: var(--rd-xs);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--sd-primary);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 0 0 var(--rd-md) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   3. App shell (sidebar + topbar)
   -------------------------------------------------------------------------- */
.sd-app {
  min-height: 100vh;
}

.sd-sidebar {
  position: fixed;
  inset-block: 0;
  left: 0;
  z-index: 1040;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--sd-surface);
  border-right: 1px solid var(--sd-border);
  transition: transform var(--tr-base), width var(--tr-base);
  box-shadow: 1px 0 0 0 var(--sd-border);
}

.sd-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-h);
  padding: 0 1.25rem;
  text-decoration: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--sd-border);
}
.sd-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--rd-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sd-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}
.sd-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--sd-text);
  line-height: 1;
}
.sd-brand-name small {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  margin-top: 2px;
}

.sd-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.8rem 1.25rem;
}

.sd-nav-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  padding: 1rem 0.7rem 0.4rem;
}

.sd-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 2px;
  border-radius: var(--rd-md);
  color: var(--sd-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  transition: all var(--tr-fast);
}
.sd-nav-link i {
  width: 22px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform var(--tr-fast), color var(--tr-fast);
}
.sd-nav-link:hover {
  background: var(--sd-surface-2);
  color: var(--sd-text);
}
.sd-nav-link:hover i { transform: translateY(-1px) scale(1.05); }
.sd-nav-link.active {
  background: var(--sd-nav-active-bg);
  color: var(--sd-primary);
  font-weight: 600;
}
[data-bs-theme="dark"] .sd-nav-link.active { color: #a5adff; }
.sd-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 99px;
  background: var(--sd-gradient);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}
.sd-nav-link .sd-nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18em 0.55em;
  border-radius: var(--rd-pill);
  background: var(--sd-danger);
  color: #fff;
  display: none;
}
.sd-nav-footer {
  padding: 1rem 0.85rem;
  border-top: 1px solid var(--sd-border);
  flex-shrink: 0;
}

.sd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(8, 10, 16, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr-base);
}
.sd-backdrop.show { opacity: 1; pointer-events: auto; }

.sd-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--tr-base);
}
body.has-sidebar .sd-main {
  margin-left: var(--sidebar-w);
}
@media (min-width: 992px) {
  body.sidebar-collapsed .sd-main { margin-left: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .sd-sidebar { width: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .sd-brand-name,
  body.sidebar-collapsed .sd-nav-link span,
  body.sidebar-collapsed .sd-nav-heading,
  body.sidebar-collapsed .sd-nav-link .sd-nav-badge { display: none; }
  body.sidebar-collapsed .sd-nav-link { justify-content: center; }
  body.sidebar-collapsed .sd-sidebar-footer-user span { display: none; }
}

/* Topbar */
.sd-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--sd-bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--sd-border);
  transition: height var(--tr-base);
}

.sd-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--rd-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--sd-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: all var(--tr-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sd-icon-btn:hover {
  background: var(--sd-surface-2);
  color: var(--sd-text);
  border-color: var(--sd-border);
  transform: translateY(-1px);
}
.sd-icon-btn:active {
  transform: scale(0.95) translateY(0);
}
.sd-icon-btn .sd-dot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--sd-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--sd-bg);
}

.sd-topbar-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sd-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.3);
}

.sd-user-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--rd-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--sd-text);
  text-align: left;
  transition: all var(--tr-fast);
}
.sd-user-menu:hover { background: var(--sd-surface-2); border-color: var(--sd-border); }
.sd-user-name {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-user-role {
  font-size: 0.68rem;
  color: var(--sd-text-faint);
  font-weight: 500;
  text-transform: capitalize;
}
.dropdown-menu.sd-dropdown {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--rd-lg);
  padding: 0.5rem;
  min-width: 220px;
}
.sd-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--rd-sm);
  color: var(--sd-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--tr-fast);
}
.sd-dropdown .dropdown-item i { width: 18px; text-align: center; }
.sd-dropdown .dropdown-item:hover {
  background: var(--sd-surface-2);
  color: var(--sd-text);
}
.sd-dropdown .dropdown-item.text-danger:hover { background: rgba(240, 100, 122, 0.1); }
.sd-dropdown .dropdown-divider { border-color: var(--sd-border); opacity: 1; margin: 0.4rem 0.2rem; }

/* Page canvas */
.sd-content {
  flex: 1;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) 3.5rem;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
}
body.page-full .sd-content { max-width: none; }

.sd-content > .container,
.sd-content > .container-fluid { padding-inline: 0; }

/* --------------------------------------------------------------------------
   4. Page headers
   -------------------------------------------------------------------------- */
.sd-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.sd-page-title {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sd-page-title .sd-title-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--sd-gradient-soft);
  border: 1px solid var(--sd-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--sd-primary);
  flex-shrink: 0;
}
[data-bs-theme="dark"] .sd-page-title .sd-title-icon { color: #a5adff; }
.sd-page-subtitle {
  color: var(--sd-text-muted);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}
.sd-page-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sd-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sd-text-faint);
  text-decoration: none;
  margin-bottom: 0.65rem;
  padding: 0.3rem 0.75rem 0.3rem 0.5rem;
  border-radius: var(--rd-pill);
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  transition: all var(--tr-fast);
}
.sd-breadcrumb:hover { color: var(--sd-primary); border-color: var(--sd-border-strong); }

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */
.card {
  --bs-card-bg: var(--sd-surface);
  --bs-card-border-color: var(--sd-border);
  --bs-card-cap-bg: transparent;
  --bs-card-color: var(--sd-text);
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-xl);
  box-shadow: var(--shadow-xs);
  transition: transform var(--tr-base), box-shadow var(--tr-base), border-color var(--tr-base);
}

.card-header {
  border-bottom: 1px solid var(--sd-border);
  color: var(--sd-text);
  font-weight: 650;
  padding: 1.1rem 1.3rem;
}

.card.sd-card-hover {
  transition: transform var(--tr-base), box-shadow var(--tr-base), border-color var(--tr-base);
}
.card.sd-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sd-border-strong);
}

.sd-card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.sd-card-title i { color: var(--sd-primary); font-size: 0.95rem; }
[data-bs-theme="dark"] .sd-card-title i { color: #a5adff; }

/* Stat cards */
.stat-card {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-lg);
  padding: 1.2rem 1.25rem;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: all var(--tr-base);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--sd-gradient);
  opacity: 0;
  transition: opacity var(--tr-base);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sd-border-strong);
}
.stat-card:hover::before {
  opacity: 1;
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--rd-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.85rem;
  transition: transform var(--tr-spring);
}
.stat-card:hover .stat-icon {
  transform: scale(1.08) rotate(-3deg);
}
.stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  margin-bottom: 0.3rem;
}
.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--sd-text);
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-value small {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  margin-left: 2px;
}
.stat-card .stat-meta {
  font-size: 0.78rem;
  color: var(--sd-text-muted);
  margin-top: 0.2rem;
}

.tint-primary .stat-icon { background: var(--sd-primary-soft); color: var(--sd-primary); }
.tint-success .stat-icon { background: rgba(34, 197, 139, 0.14); color: var(--sd-success); }
.tint-warning .stat-icon { background: rgba(245, 183, 61, 0.15); color: var(--sd-warning); }
.tint-danger .stat-icon  { background: rgba(240, 100, 122, 0.14); color: var(--sd-danger); }
.tint-info .stat-icon    { background: rgba(56, 189, 248, 0.13); color: var(--sd-info); }
.tint-accent .stat-icon  { background: var(--sd-accent-soft); color: var(--sd-accent); }
.tint-neutral .stat-icon { background: var(--sd-surface-3); color: var(--sd-text-muted); }

/* Gradient hero panel used at top of dashboards */
.sd-hero-panel {
  border-radius: var(--rd-xl);
  background:
    radial-gradient(120% 160% at 85% -20%, rgba(6, 182, 212, 0.22) 0%, transparent 50%),
    radial-gradient(120% 160% at 0% 120%, rgba(99, 102, 241, 0.28) 0%, transparent 55%),
    var(--sd-gradient);
  color: #fff;
  padding: 2rem 2.2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.sd-hero-panel .hero-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  opacity: 0.85;
}
.sd-hero-panel .btn { --bs-btn-font-weight: 650; }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  --bs-btn-border-radius: var(--rd-md);
  --bs-btn-font-weight: 600;
  --bs-btn-padding-y: 0.55rem;
  --bs-btn-padding-x: 1.15rem;
  font-size: 0.88rem;
  letter-spacing: 0.005em;
  transition: all var(--tr-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}
.btn-lg { --bs-btn-border-radius: 14px; font-size: 0.95rem; }
.btn-sm { font-size: 0.8rem; }

.btn-primary {
  --bs-btn-bg: var(--sd-primary);
  --bs-btn-border-color: var(--sd-primary);
  --bs-btn-hover-bg: var(--sd-primary-strong);
  --bs-btn-hover-border-color: var(--sd-primary-strong);
  --bs-btn-active-bg: var(--sd-primary-strong);
  --bs-btn-active-border-color: var(--sd-primary-strong);
  --bs-btn-disabled-bg: var(--sd-primary);
  --bs-btn-disabled-border-color: var(--sd-primary);
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-gradient {
  background: var(--sd-gradient);
  border: none;
  color: #fff;
  font-weight: 650;
  box-shadow: 0 4px 16px -4px rgba(99, 102, 241, 0.4);
}
.btn-gradient:hover, .btn-gradient:focus-visible {
  background: linear-gradient(135deg, #5558e6 0%, #0596b4 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -6px rgba(99, 102, 241, 0.5);
}
.btn-gradient:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.35);
}

.btn-outline-secondary {
  --bs-btn-color: var(--sd-text-muted);
  --bs-btn-border-color: var(--sd-border-strong);
  --bs-btn-hover-bg: var(--sd-surface-2);
  --bs-btn-hover-border-color: var(--sd-border-strong);
  --bs-btn-hover-color: var(--sd-text);
  --bs-btn-active-bg: var(--sd-surface-3);
  --bs-btn-active-border-color: var(--sd-border-strong);
  --bs-btn-active-color: var(--sd-text);
}

/* Soft icon action button used in list rows */
.btn-action {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rd-sm);
  transition: all var(--tr-fast);
}
.btn-action:hover { background: var(--sd-surface-3); transform: translateY(-1px); }
.btn-action:active { transform: scale(0.94); }

/* --------------------------------------------------------------------------
   7. Forms
   -------------------------------------------------------------------------- */
.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  margin-bottom: 0.4rem;
}
.form-control, .form-select {
  background-color: var(--sd-surface-2);
  border-color: var(--sd-border-strong);
  color: var(--sd-text);
  border-radius: var(--rd-md);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast), background-color var(--tr-fast);
}
.form-control::placeholder { color: var(--sd-text-faint); }
.form-control:focus, .form-select:focus {
  background-color: var(--sd-surface);
  border-color: var(--sd-primary);
  color: var(--sd-text);
  box-shadow: 0 0 0 3px var(--sd-primary-soft);
}
.form-control:disabled, .form-select:disabled {
  background-color: var(--sd-surface-3);
  opacity: 0.75;
}
.form-select {
  background-position: right 0.85rem center;
}
.input-group-text {
  background: var(--sd-surface-3);
  border-color: var(--sd-border-strong);
  color: var(--sd-text-muted);
  border-radius: var(--rd-md);
}
.form-check-input {
  background-color: var(--sd-surface-3);
  border-color: var(--sd-border-strong);
}
.form-check-input:checked {
  background-color: var(--sd-primary);
  border-color: var(--sd-primary);
}
.form-check-input:focus {
  border-color: var(--sd-primary);
  box-shadow: 0 0 0 3px var(--sd-primary-soft);
}
.form-switch .form-check-input { cursor: pointer; }
textarea.form-control { min-height: 96px; }

/* Auth split layout */
.auth-wrap {
  min-height: calc(100vh - var(--topbar-h) - 1px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 60%;
  height: 80%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -15%;
  width: 50%;
  height: 70%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.06) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  padding: 2.5rem 2.4rem;
  position: relative;
  z-index: 1;
  animation: rise-in 0.5s ease both;
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.sd-table-wrap {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.sd-table-wrap .table-responsive { border-radius: inherit; }

.table {
  --bs-table-color: var(--sd-text);
  margin-bottom: 0;
}
.table > :not(caption) > * > * {
  background-color: transparent;
  color: inherit;
  border-bottom-color: var(--sd-border);
  padding: 0.8rem 1rem;
  vertical-align: middle;
}
.table thead th {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  border-bottom: 1px solid var(--sd-border);
  white-space: nowrap;
  background: var(--sd-surface-2);
}
.table tbody tr {
  transition: background var(--tr-fast);
}
.table tbody tr:hover > * {
  --bs-table-accent-bg: transparent;
  background: var(--sd-surface-2);
  color: var(--sd-text);
  box-shadow: none;
}
.table td code { white-space: nowrap; }
/* Neutralize legacy table-dark when it appears inside themed shell */
.table-dark {
  --bs-table-bg: transparent;
  --bs-table-color: var(--sd-text);
}
.table-dark thead th { background: var(--sd-surface-2); color: var(--sd-text-faint); }

/* --------------------------------------------------------------------------
   9. Badges & pills
   -------------------------------------------------------------------------- */
.badge {
  font-weight: 650;
  letter-spacing: 0.015em;
  padding: 0.42em 0.75em;
  border-radius: var(--rd-pill);
  font-size: 0.7rem;
}
.badge.soft-primary { background: var(--sd-primary-soft); color: var(--sd-primary); }
.badge.soft-success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge.soft-warning { background: rgba(245, 158, 11, 0.13); color: #d97706; }
.badge.soft-danger  { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.badge.soft-info    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.badge.soft-neutral { background: var(--sd-surface-3); color: var(--sd-text-muted); }
[data-bs-theme="dark"] .badge.soft-success { color: #34d399; }
[data-bs-theme="dark"] .badge.soft-warning { color: #fbbf24; }
[data-bs-theme="dark"] .badge.soft-danger  { color: #f87171; }
[data-bs-theme="dark"] .badge.soft-info    { color: #60a5fa; }
[data-bs-theme="dark"] .badge.soft-primary { color: #a5adff; }

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: var(--rd-pill);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--sd-surface-3);
  color: var(--sd-text-muted);
  border: 1px solid transparent;
}
.pill-tag.ok    { background: rgba(34, 197, 139, 0.13); color: #17a06d; border-color: rgba(34, 197, 139, 0.25); }
.pill-tag.warn  { background: rgba(245, 183, 61, 0.14); color: #cf8d13; border-color: rgba(245, 183, 61, 0.3); }
.pill-tag.bad   { background: rgba(240, 100, 122, 0.13); color: #e04b63; border-color: rgba(240, 100, 122, 0.28); }
.pill-tag.brand { background: var(--sd-primary-soft); color: var(--sd-primary); border-color: rgba(90, 103, 242, 0.28); }
.pill-tag.cool  { background: rgba(56, 189, 248, 0.12); color: #0d9ddd; border-color: rgba(56, 189, 248, 0.26); }
[data-bs-theme="dark"] .pill-tag.ok    { color: #4ade9e; }
[data-bs-theme="dark"] .pill-tag.warn  { color: #ffd166; }
[data-bs-theme="dark"] .pill-tag.bad   { color: #ff8ba0; }
[data-bs-theme="dark"] .pill-tag.cool  { color: #5cc8fb; }
[data-bs-theme="dark"] .pill-tag.brand { color: #a5adff; }

.priority-HIGH   { background: rgba(240, 100, 122, 0.14); color: #e04b63; }
.priority-MEDIUM { background: rgba(245, 183, 61, 0.15); color: #cf8d13; }
.priority-LOW    { background: var(--sd-surface-3); color: var(--sd-text-muted); }
[data-bs-theme="dark"] .priority-HIGH { color: #ff8ba0; }
[data-bs-theme="dark"] .priority-MEDIUM { color: #ffd166; }

/* Status dot */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-dot.live::before {
  animation: sd-pulse 1.8s ease-in-out infinite;
}
@keyframes sd-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 139, 0.45); }
  55%      { box-shadow: 0 0 0 6px rgba(34, 197, 139, 0); }
}

/* --------------------------------------------------------------------------
   10. Progress
   -------------------------------------------------------------------------- */
.progress {
  --bs-progress-bg: var(--sd-surface-3);
  --bs-progress-bar-bg: var(--sd-primary);
  background: var(--sd-surface-3);
  border-radius: var(--rd-pill);
  overflow: hidden;
}
.progress-bar {
  border-radius: var(--rd-pill);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-thin { height: 6px; }
.progress-bar.bg-success, .progress.thin-green .progress-bar { background: linear-gradient(90deg, #10b981, #34d399) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, #f59e0b, #fbbf24) !important; }
.progress-bar.bg-danger  { background: linear-gradient(90deg, #ef4444, #f87171) !important; }
.progress-bar.bg-info    { background: linear-gradient(90deg, #3b82f6, #60a5fa) !important; }
.progress-bar.bg-primary { background: var(--sd-gradient) !important; }

/* --------------------------------------------------------------------------
   11. Alerts & toasts
   -------------------------------------------------------------------------- */
.alert {
  border-radius: var(--rd-lg);
  border-width: 1px;
  font-size: 0.9rem;
}
.alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.25); color: #047857; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); color: #b45309; }
.alert-danger  { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.25); color: #b91c1c; }
.alert-info    { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.25); color: #1d4ed8; }
.alert-primary { background: var(--sd-primary-soft); border-color: rgba(99, 102, 241, 0.25); color: var(--sd-primary); }
[data-bs-theme="dark"] .alert-success { color: #34d399; }
[data-bs-theme="dark"] .alert-warning { color: #fbbf24; }
[data-bs-theme="dark"] .alert-danger  { color: #f87171; }
[data-bs-theme="dark"] .alert-info    { color: #60a5fa; }
[data-bs-theme="dark"] .alert-primary { color: #a5adff; }

#flashToasts {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(380px, calc(100vw - 32px));
}
.flash-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-left: 3px solid var(--sd-primary);
  border-radius: var(--rd-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--sd-text);
  animation: toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.flash-toast.t-success { border-left-color: var(--sd-success); }
.flash-toast.t-error   { border-left-color: var(--sd-danger); }
.flash-toast.t-warning { border-left-color: var(--sd-warning); }
.flash-toast.t-info    { border-left-color: var(--sd-info); }
.flash-toast .ft-icon { font-size: 0.95rem; margin-top: 1px; }
.flash-toast.t-success .ft-icon { color: var(--sd-success); }
.flash-toast.t-error .ft-icon   { color: var(--sd-danger); }
.flash-toast.t-warning .ft-icon { color: var(--sd-warning); }
.flash-toast.t-info .ft-icon    { color: var(--sd-info); }
.flash-toast .ft-close {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--sd-text-faint);
  font-size: 0.85rem;
  padding: 0 2px;
  flex-shrink: 0;
}
.flash-toast .ft-close:hover { color: var(--sd-text); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}
.flash-toast.hide-anim {
  opacity: 0;
  transform: translateX(14px);
  transition: all 0.25s ease;
}

/* Modal */
.modal-content {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-xl);
  box-shadow: var(--shadow-lg);
  color: var(--sd-text);
}
.modal-header, .modal-footer { border-color: var(--sd-border); }
.modal-header { padding: 1.2rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-backdrop.show { opacity: 0.6; }

/* Dropdown menus (generic) */
.dropdown-menu {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-lg);
  box-shadow: var(--sd-shadow-md);
  color: var(--sd-text);
}
.dropdown-item { color: var(--sd-text-muted); border-radius: var(--rd-sm); }
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--sd-surface-2);
  color: var(--sd-text);
}
.dropdown-divider { border-color: var(--sd-border); opacity: 1; }

/* Pagination */
.pagination {
  --bs-pagination-bg: var(--sd-surface);
  --bs-pagination-border-color: var(--sd-border-strong);
  --bs-pagination-color: var(--sd-text-muted);
  --bs-pagination-hover-bg: var(--sd-surface-2);
  --bs-pagination-hover-border-color: var(--sd-border-strong);
  --bs-pagination-hover-color: var(--sd-text);
  --bs-pagination-active-bg: var(--sd-primary);
  --bs-pagination-active-border-color: var(--sd-primary);
  --bs-pagination-disabled-bg: var(--sd-surface);
  --bs-pagination-disabled-border-color: var(--sd-border);
  margin-bottom: 0;
}
.pagination .page-link {
  border-radius: var(--rd-sm) !important;
  margin-inline: 2px;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid var(--sd-border-strong);
}

/* Nav pills / tabs */
.nav-pills { gap: 0.45rem; }
.nav-pills .nav-link {
  color: var(--sd-text-muted);
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--rd-pill);
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  transition: all var(--tr-fast);
}
.nav-pills .nav-link:hover { color: var(--sd-text); background: var(--sd-surface-2); }
.nav-pills .nav-link.active {
  background: var(--sd-surface);
  color: var(--sd-primary);
  border: 1px solid var(--sd-border-strong);
  box-shadow: var(--shadow-sm);
}
[data-bs-theme="dark"] .nav-pills .nav-link.active { color: #a5adff; }

.nav-tabs {
  border-bottom-color: var(--sd-border);
}
.nav-tabs .nav-link {
  color: var(--sd-text-muted);
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
}
.nav-tabs .nav-link.active {
  background: transparent;
  color: var(--sd-primary);
  border-bottom-color: var(--sd-primary);
}
[data-bs-theme="dark"] .nav-tabs .nav-link.active { color: #a5adff; }

/* List groups */
.list-group {
  --bs-list-group-bg: transparent;
  --bs-list-group-border-color: var(--sd-border);
  --bs-list-group-color: var(--sd-text);
}
.list-group-item {
  background: transparent;
  border-color: var(--sd-border);
  color: var(--sd-text);
}
.list-group-item.bg-transparent { background: transparent !important; }

/* --------------------------------------------------------------------------
   12. Empty / loading / error states
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--sd-text-muted);
}
.empty-state .es-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--sd-surface-2);
  border: 1.5px dashed var(--sd-border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--sd-text-faint);
  margin-bottom: 1.1rem;
}
.empty-state .es-title {
  font-weight: 700;
  color: var(--sd-text);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.empty-state .es-text {
  font-size: 0.86rem;
  color: var(--sd-text-muted);
  max-width: 380px;
  margin: 0 auto 0.25rem;
}
.empty-state.compact { padding: 2rem 1rem; }
.empty-state.compact .es-icon {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
  border-radius: 15px;
  margin-bottom: 0.65rem;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 3rem 1rem;
  color: var(--sd-text-faint);
  font-size: 0.88rem;
}
.spinner-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--sd-surface-3);
  border-top-color: var(--sd-primary);
  animation: sd-spin 0.8s linear infinite;
}
@keyframes sd-spin { to { transform: rotate(360deg); } }

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--sd-surface-3);
  border-radius: var(--rd-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: sd-shimmer 1.4s infinite;
}
[data-bs-theme="light"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
}
.skeleton-line { height: 12px; margin-bottom: 10px; }
@keyframes sd-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* --------------------------------------------------------------------------
   13. Shared feature components
   -------------------------------------------------------------------------- */

/* Focus timer */
.focus-timer {
  font-size: clamp(3.4rem, 9vw, 5.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  background: var(--sd-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: filter var(--tr-base);
}
.focus-timer.active { filter: drop-shadow(0 8px 28px rgba(6, 182, 212, 0.35)); }
.focus-timer.interrupted,
.focus-timer.completed {
  background: none;
  -webkit-text-fill-color: currentColor;
  background-image: none;
}
.focus-timer.interrupted { color: var(--sd-danger); }
.focus-timer.completed { color: var(--sd-success); }

.duration-btn.selected {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px var(--sd-primary-soft), 0 8px 24px -8px rgba(99, 102, 241, 0.5);
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  margin: 0.2rem;
  border-radius: var(--rd-pill);
  font-size: 0.82rem;
  font-weight: 600;
}
.app-badge.whitelist {
  background: rgba(16, 185, 129, 0.10);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.app-badge.blacklist {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.22);
}
[data-bs-theme="dark"] .app-badge.whitelist { color: #34d399; }
[data-bs-theme="dark"] .app-badge.blacklist { color: #f87171; }

.approved-app-tile {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--rd-md);
  border: 1.5px solid rgba(6, 182, 212, 0.3);
  background: var(--sd-accent-soft);
  cursor: pointer;
  transition: all var(--tr-fast);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--sd-text);
  text-decoration: none;
}
.approved-app-tile:hover {
  border-color: rgba(6, 182, 212, 0.7);
  background: rgba(6, 182, 212, 0.15);
  transform: translateY(-3px);
  color: var(--sd-text);
  box-shadow: var(--shadow-sm);
}
.approved-app-tile.in-use {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.10);
  color: #059669;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.2);
}
[data-bs-theme="dark"] .approved-app-tile.in-use { color: #34d399; }
.approved-app-tile .fa-solid,
.approved-app-tile .fa-brands { font-size: 1.2rem; }
.approved-app-tile .in-use-badge { font-size: 0.7rem; padding: 0.15rem 0.4rem; }

/* Focus page access-result toast */
#accessResultToast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1050;
  min-width: min(320px, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
}

.session-stats-card {
  background: var(--sd-surface-2);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-lg);
  padding: 0.9rem 0.65rem;
  text-align: center;
  height: 100%;
  transition: all var(--tr-fast);
}
.session-stats-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.session-stats-card h6 {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  margin-bottom: 0.35rem;
}
.session-stats-card h4 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
}

/* Task rows */
.task-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 0.4rem;
  border-bottom: 1px solid var(--sd-border);
  transition: background var(--tr-fast);
  border-radius: var(--rd-sm);
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--sd-surface-2); }
.task-check {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all var(--tr-fast);
}
.task-check.pending { border: 1.5px solid var(--sd-border-strong); color: var(--sd-text-faint); background: transparent; }
.task-check.pending:hover { border-color: var(--sd-success); color: var(--sd-success); background: rgba(16, 185, 129, 0.1); }
.task-check.done { background: var(--sd-success); border: 1.5px solid var(--sd-success); color: #fff; }
.task-done-text { text-decoration: line-through; color: var(--sd-text-faint); }

/* Rewards */
.reward-stat {
  text-align: center;
  padding: 0.45rem 0.55rem;
}
.reward-stat .rs-value {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.reward-stat .rs-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
}
.badge-tile {
  border-radius: var(--rd-lg);
  padding: 1rem 0.6rem;
  text-align: center;
  background: var(--sd-surface-2);
  border: 1px solid var(--sd-border);
  transition: all var(--tr-base);
  height: 100%;
  min-height: 112px;
}
.badge-tile.earned {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.3);
}
.badge-tile.locked { opacity: 0.6; filter: grayscale(0.4); }
.badge-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.badge-tile .bt-icon { font-size: 1.8rem; line-height: 1; }
.badge-tile .bt-name {
  font-size: 0.72rem;
  font-weight: 650;
  margin-top: 0.5rem;
  line-height: 1.3;
}
.badge-tile .bt-state { font-size: 0.66rem; font-weight: 600; }

.leader-rank {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  font-size: 0.88rem;
  background: var(--sd-surface-3);
  color: var(--sd-text-muted);
}
.leader-rank.r1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #451a03; font-size: 1rem; box-shadow: 0 2px 10px -2px rgba(245, 158, 11, 0.4); }
.leader-rank.r2 { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #1f2937; font-size: 1rem; }
.leader-rank.r3 { background: linear-gradient(135deg, #fdba74, #f97316); color: #431407; font-size: 1rem; }

/* Connection / child mini cards */
.request-card { transition: transform var(--tr-fast), box-shadow var(--tr-fast); }
.request-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.list-item-enter { animation: slide-in-left 0.3s ease; }
@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.child-mini-card {
  background: var(--sd-surface-2);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-lg);
  padding: 1.3rem 1.1rem;
  text-align: center;
  height: 100%;
  transition: all var(--tr-base);
}
.child-mini-card:hover {
  transform: translateY(-4px);
  border-color: var(--sd-border-strong);
  box-shadow: var(--shadow-md);
}
.child-mini-card .cmc-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--sd-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 4px 12px -3px rgba(99, 102, 241, 0.3);
}
.child-mini-card .cmc-name { font-weight: 700; font-size: 1rem; }

/* Child ID display */
.child-id-display {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-align: center;
  padding: 1.1rem;
  border-radius: var(--rd-lg);
  background: var(--sd-gradient-soft);
  border: 1.5px dashed rgba(99, 102, 241, 0.35);
  color: var(--sd-primary);
  user-select: all;
}
[data-bs-theme="dark"] .child-id-display { color: #a5adff; }

/* Child ID copy wrapper */
.child-id-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.copy-child-id-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.9rem;
  border-radius: var(--rd-pill);
  letter-spacing: 0.02em;
  transition: all var(--tr-fast);
  color: var(--sd-accent);
  border-color: rgba(8, 89, 104, 0.45);
}
[data-bs-theme="dark"] .copy-child-id-btn { border-color: rgba(6, 182, 212, 0.3); }
.copy-child-id-btn:hover,
.copy-child-id-btn:focus-visible {
  color: #22d3ee;
  border-color: #288493;
  background: rgba(8, 135, 157, 0.12);
  box-shadow: 0 0 12px rgba(10, 115, 134, 0.25);
}
.copy-child-id-btn.copied {
  background: var(--sd-success);
  border-color: var(--sd-success);
  color: #fff;
}
.copy-child-id-btn .copy-label {
  margin-left: 0.25rem;
}

/* Notifications feed */
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem 1rem;
  border-bottom: 1px solid var(--sd-border);
  border-left: 3px solid transparent;
  border-radius: var(--rd-sm);
  transition: background var(--tr-fast);
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--sd-surface-2); }
.notif-row.unread {
  background: var(--sd-primary-soft);
  border-left-color: var(--sd-primary);
}
.notif-row.unread:hover { background: rgba(99, 102, 241, 0.16); }
.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--sd-surface-3);
  color: var(--sd-text-muted);
}
/* Priority: Important */
.notif-row.priority-important {
  border-left-color: var(--sd-warning);
}
.notif-row.priority-important.unread {
  background: rgba(245, 183, 61, 0.08);
  border-left-color: var(--sd-warning);
}
.notif-row.priority-important.unread:hover {
  background: rgba(245, 183, 61, 0.14);
}
.notif-row.priority-important .notif-icon {
  background: rgba(245, 183, 61, 0.15);
  color: var(--sd-warning);
}
/* Priority: Attention Required */
.notif-row.priority-attention {
  border-left-color: var(--sd-danger);
}
.notif-row.priority-attention.unread {
  background: rgba(240, 100, 122, 0.08);
  border-left-color: var(--sd-danger);
}
.notif-row.priority-attention.unread:hover {
  background: rgba(240, 100, 122, 0.14);
}
.notif-row.priority-attention .notif-icon {
  background: rgba(240, 100, 122, 0.15);
  color: var(--sd-danger);
}
/* Attention section header */
.notif-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sd-text-muted);
}
.notif-section-header .badge {
  font-size: 0.65rem;
  padding: 0.2em 0.55em;
}
.notif-section-divider {
  border: none;
  border-top: 1px solid var(--sd-border);
  margin: 0.25rem 0.9rem;
}
/* Action button in notification row */
.notif-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--rd-sm);
  text-decoration: none;
  transition: background var(--tr-fast), color var(--tr-fast);
}

/* DNA insights */
.rec-card {
  border-left: 3px solid;
  background: var(--sd-surface-2);
  border-radius: var(--rd-md);
  padding: 0.9rem 1rem;
  height: 100%;
  transition: all var(--tr-fast);
}
.rec-card:hover { background: var(--sd-surface-3); transform: translateX(2px); }
.insight-badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: var(--rd-pill);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.dna-mini-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sd-text-faint);
}

/* Timeline-ish stat strip (Focus Mode Stats row) */
.strip-stat {
  text-align: center;
  padding: 0.6rem 0.4rem;
  border-radius: var(--rd-md);
  background: var(--sd-surface-2);
  border: 1px solid var(--sd-border);
  transition: all var(--tr-fast);
}
.strip-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.strip-stat .ss-value { font-weight: 750; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.strip-stat .ss-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
}

/* Chart containers */
.chart-box {
  position: relative;
  width: 100%;
}

/* Utility */
.text-muted        { color: var(--sd-text-muted) !important; }
.text-subtle       { color: var(--sd-text-faint) !important; }
.text-brand        { color: var(--sd-primary) !important; }
[data-bs-theme="dark"] .text-brand { color: #a5adff !important; }
.text-good         { color: var(--sd-success) !important; }
.text-bad          { color: var(--sd-danger) !important; }
.gradient-text {
  background: var(--sd-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.fw-750 { font-weight: 750; }
.tabular { font-variant-numeric: tabular-nums; }
.surface-2 { background: var(--sd-surface-2) !important; }
.border-token { border-color: var(--sd-border) !important; }

/* Reveal animation for main content */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sd-content > .container > *:not(style):not(script),
.sd-content > *:not(style):not(script):not(.d-none) {
  animation: rise-in 0.35s ease both;
}
.sd-content > .container > *:nth-child(2) { animation-delay: 0.04s; }
.sd-content > .container > *:nth-child(3) { animation-delay: 0.08s; }
.sd-content > .container > *:nth-child(4) { animation-delay: 0.12s; }
.sd-content > .container > *:nth-child(5) { animation-delay: 0.16s; }
.sd-content > .container > *:nth-child(6) { animation-delay: 0.20s; }
.sd-content > .container > *:nth-child(n+7) { animation-delay: 0.24s; }

/* --------------------------------------------------------------------------
   14. Marketing (guest landing)
   -------------------------------------------------------------------------- */
.marketing-nav {
  position: sticky;
  top: 0;
  z-index: 1020;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  background: color-mix(in srgb, var(--sd-bg) 80%, transparent);
  border-bottom: 1px solid var(--sd-border);
}
.hero-glow {
  position: relative;
  overflow: visible;
}
.hero-glow::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -140px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, var(--sd-primary-soft) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-glow::after {
  content: '';
  position: absolute;
  bottom: -180px;
  left: -160px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, var(--sd-accent-soft) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
.feature-card {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--rd-xl);
  padding: 2rem 1.7rem;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: all var(--tr-base);
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--sd-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.feature-card:hover::before { transform: scaleX(1); }
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sd-border-strong);
}
.feature-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
  transition: transform var(--tr-spring);
}
.feature-card:hover .feature-icon { transform: scale(1.1) rotate(-3deg); }
.feature-icon.teal   { background: var(--sd-accent-soft); color: #0891b2; }
.feature-icon.amber  { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.feature-icon.blue   { background: var(--sd-primary-soft); color: var(--sd-primary); }
.feature-icon.green  { background: rgba(16, 185, 129, 0.10); color: #059669; }
.feature-icon.purple { background: rgba(139, 92, 246, 0.10); color: #7c3aed; }
.feature-icon.orange { background: rgba(249, 115, 22, 0.10); color: #ea580c; }
[data-bs-theme="dark"] .feature-icon.teal   { color: #22d3ee; }
[data-bs-theme="dark"] .feature-icon.amber  { color: #fbbf24; }
[data-bs-theme="dark"] .feature-icon.blue   { color: #a5adff; }
[data-bs-theme="dark"] .feature-icon.green  { color: #34d399; }
[data-bs-theme="dark"] .feature-icon.purple { color: #c4b5fd; }
[data-bs-theme="dark"] .feature-icon.orange { color: #fb923c; }
.marketing-hero-img {
  border-radius: var(--rd-xl);
  background:
    radial-gradient(120% 140% at 80% 0%, rgba(6, 182, 212, 0.2) 0%, transparent 50%),
    radial-gradient(120% 140% at 10% 100%, rgba(99, 102, 241, 0.3) 0%, transparent 55%),
    var(--sd-surface);
  border: 1px solid var(--sd-border);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.marketing-hero-img img { width: 100%; height: auto; object-fit: contain; }
.float-icon {
  position: absolute;
  font-size: 1.35rem;
  color: var(--sd-text-faint);
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}
.stats-band {
  border-radius: var(--rd-xl);
  background: var(--sd-gradient-soft);
  border: 1px solid var(--sd-border);
  padding: 2.8rem 2rem;
}
.cta-band {
  border-radius: var(--rd-xl);
  background:
    radial-gradient(110% 150% at 90% -10%, rgba(6, 182, 212, 0.2) 0%, transparent 50%),
    radial-gradient(110% 150% at 0% 110%, rgba(99, 102, 241, 0.35) 0%, transparent 60%),
    var(--sd-gradient);
  color: #fff;
  padding: 3.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   15. Responsive — Mobile-first overhaul
   -------------------------------------------------------------------------- */

/* ===== TABLET & BELOW (< 992px): Drawer sidebar, compact shell ===== */
@media (max-width: 991.98px) {
  body.has-sidebar .sd-main { margin-left: 0; }

  .sd-sidebar {
    transform: translateX(-105%);
    box-shadow: none;
    width: var(--sidebar-w);
    z-index: 1050;
  }
  .sd-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-collapsed .sd-sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .sd-brand-name,
  body.sidebar-collapsed .sd-nav-link span,
  body.sidebar-collapsed .sd-nav-heading { display: block; }
  body.sidebar-collapsed .sd-nav-link { justify-content: flex-start; }
  body.sidebar-collapsed .sd-sidebar-footer-user span { display: inline; }

  .sd-desktop-only { display: none !important; }
  .sd-user-name, .sd-user-role { display: none; }

  .sd-topbar { height: var(--topbar-h-mobile); }

  .hero-glow::before, .hero-glow::after { display: none; }

  #accessResultToast {
    min-width: 0; width: calc(100vw - 2rem); max-width: 360px;
    right: 1rem; bottom: 1rem;
  }

  .sd-dropdown { min-width: min(220px, calc(100vw - 2rem)); }

  .d-lg-none > .card.border-warning {
    border-width: 2px !important;
    box-shadow: 0 2px 12px rgba(255, 193, 7, 0.15);
  }
  .d-lg-none > .card.border-warning .sd-card-title { font-size: 1rem; }

  .list-group-item.d-flex { flex-wrap: wrap; gap: 0.5rem; }
  .list-group-item .badge { flex-shrink: 0; }

  .child-id-display { font-size: 1.4rem; letter-spacing: 0.18em; padding: 0.9rem; }

  .task-row { flex-wrap: wrap; }
  .notif-row { flex-wrap: wrap; }

  /* Tabs: horizontal scroll */
  .nav.nav-pills {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; gap: 0.4rem; padding-bottom: 0.3rem;
  }
  .nav.nav-pills::-webkit-scrollbar { display: none; }
  .nav.nav-pills .nav-item { flex-shrink: 0; }
  .nav.nav-pills .nav-link {
    font-size: 0.78rem; padding: 0.45rem 0.75rem; white-space: nowrap;
  }

  /* Marketing nav: compact */
  .marketing-nav .container { padding-inline: 0.75rem; }

  /* Tables: horizontal scroll, never page overflow */
  .sd-table-wrap, .table-responsive {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }

  /* Dashboard grids: single column */
  .row.g-3.g-lg-4 > [class*="col-lg-"] { flex: 0 0 100%; max-width: 100%; }

  /* Parent dashboard child card buttons: larger touch targets */
  .child-mini-card .d-grid .btn {
    padding: 0.6rem 0.75rem; font-size: 0.85rem; min-height: 40px;
  }

  /* Focus parent dashboard modals: stack form fields */
  .modal .row.g-3 > .col-4 { flex: 0 0 100%; max-width: 100%; }

  /* Charts: responsive */
  .chart-box canvas, .chart-box { max-width: 100%; }
}

/* ===== MOBILE (< 576px): Compact mobile layout ===== */
@media (max-width: 575.98px) {
  /* Content spacing */
  .sd-content { padding-inline: 0.875rem; padding-top: 0.875rem; padding-bottom: 2rem; }

  /* Topbar */
  .sd-topbar { padding-inline: 0.65rem; gap: 0.4rem; }
  .sd-topbar .sd-topbar-title { font-size: 0.9rem; }

  /* Page header: stack vertically */
  .sd-page-header {
    flex-direction: column; align-items: flex-start;
    gap: 0.6rem; margin-bottom: 1rem;
  }
  .sd-page-title { font-size: clamp(1.15rem, 4vw, 1.3rem); }
  .sd-page-title .sd-title-icon { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }
  .sd-page-actions { width: 100%; }
  .sd-page-actions .btn { flex: 1; font-size: 0.8rem; }

  /* Cards */
  .card { border-radius: var(--rd-lg); }
  .card-body { padding: 1rem; }
  .sd-table-wrap { border-radius: var(--rd-md); }

  /* Stat cards */
  .stat-card { padding: 0.85rem 0.8rem; }
  .stat-card .stat-icon { width: 36px; height: 36px; font-size: 0.95rem; margin-bottom: 0.5rem; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .stat-card .stat-label { font-size: 0.68rem; }

  /* Hero panel */
  .sd-hero-panel { padding: 1rem; }
  .sd-hero-panel h4 { font-size: 1.05rem; }
  .sd-hero-panel .fa-2x { font-size: 1.5em; }

  /* Features */
  .feature-card { padding: 1.1rem 1rem; }
  .feature-icon { width: 42px; height: 42px; font-size: 1.1rem; margin-bottom: 0.75rem; border-radius: 12px; }

  /* Stats band */
  .stats-band { padding: 1.25rem 0.75rem; }
  .stats-band .stat-number { font-size: clamp(1.3rem, 5vw, 1.6rem); }

  /* CTA band */
  .cta-band { padding: 1.5rem 1rem; }
  .cta-band .display-6 { font-size: clamp(1.1rem, 4.5vw, 1.35rem); }
  .cta-band .btn { width: 100%; justify-content: center; padding: 0.65rem 1rem; }

  /* Auth */
  .auth-card { padding: 1.5rem 1.25rem; border-radius: var(--rd-lg); }
  .auth-wrap { padding: 1rem 0.75rem; }

  /* Rewards */
  .reward-stat .rs-value { font-size: 1.2rem; }
  .reward-stat .rs-label { font-size: 0.68rem; }
  .badge-tile { min-width: 52px; padding: 0.4rem 0.25rem; border-radius: var(--rd-md); }
  .badge-tile .bt-icon { font-size: 1.3rem; }
  .badge-tile .bt-name { font-size: 0.65rem; }

  /* Empty states */
  .empty-state { padding: 1.5rem 0.75rem; }
  .empty-state .es-icon { width: 48px; height: 48px; font-size: 1.15rem; border-radius: 14px; margin-bottom: 0.6rem; }
  .empty-state .es-text { font-size: 0.82rem; }

  /* Child mini cards */
  .child-mini-card { padding: 0.85rem 0.75rem; }
  .child-mini-card .cmc-avatar { width: 46px; height: 46px; font-size: 1.1rem; border-radius: 14px; }
  .child-mini-card .cmc-name { font-size: 0.92rem; }

  /* Child ID */
  .child-id-display { font-size: 1.2rem; letter-spacing: 0.15em; padding: 0.75rem; }

  /* Notifications */
  .notif-row { padding: 0.7rem 0.5rem; gap: 0.5rem; }
  .notif-icon { width: 34px; height: 34px; font-size: 0.85rem; border-radius: 10px; }

  /* Tasks */
  .task-row { padding: 0.55rem 0.25rem; gap: 0.5rem; }
  .task-check { width: 28px; height: 28px; border-radius: 8px; }

  /* Forms: prevent iOS zoom */
  .form-control, .form-select, textarea.form-control { font-size: 16px; }
  .form-label { font-size: 0.78rem; margin-bottom: 0.3rem; }

  /* Buttons: touch-friendly */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; font-size: 0.78rem; }
  .btn-action { width: 40px; height: 40px; }
  .btn-lg { padding: 0.6rem 1.2rem; font-size: 0.88rem; }

  /* Modals */
  .modal-dialog { margin: 0.5rem; }
  .modal-content { border-radius: var(--rd-lg); }
  .modal-header { padding: 0.85rem 1rem; }
  .modal-body { padding: 0.85rem 1rem; }

  /* Tables: card-like on mobile */
  .table { font-size: 0.82rem; }
  .table > :not(caption) > * > * { padding: 0.55rem 0.6rem; }
  .table thead th { font-size: 0.64rem; padding: 0.5rem 0.6rem; }

  /* Topbar actions */
  .sd-icon-btn { width: 38px; height: 38px; font-size: 0.95rem; }

  /* Prevent overflow */
  html, body { overflow-x: hidden; }

  /* Global box-sizing safety */
  img, video, canvas, svg { max-width: 100%; height: auto; }

  /* Connection request cards on parent dashboard */
  .request-card .card-body { padding: 0.85rem; }
  .request-card h6 { font-size: 0.88rem; }

  /* Leaderboard */
  .leader-rank { width: 32px; height: 32px; font-size: 0.8rem; }

  /* Rec cards */
  .rec-card { padding: 0.75rem 0.85rem; }
}

/* ===== EXTRA SMALL (< 375px): Maximum compactness ===== */
@media (max-width: 374.98px) {
  .sd-content { padding-inline: 0.6rem; padding-top: 0.65rem; }
  .sd-topbar { padding-inline: 0.5rem; }
  .auth-card { padding: 1.25rem 1rem; }
  .sd-page-title { font-size: 1.05rem; }
  .sd-page-title .sd-title-icon { width: 32px; height: 32px; }
  .stat-card .stat-value { font-size: 1.25rem; }
  .stat-card .stat-icon { width: 32px; height: 32px; }
  .reward-stat .rs-value { font-size: 1rem; }
  .child-id-display { font-size: 1.05rem; padding: 0.65rem; letter-spacing: 0.12em; }
  .sd-hero-panel { padding: 0.85rem; }
  .stats-band { padding: 1rem 0.6rem; }
  .cta-band { padding: 1.25rem 0.75rem; }
  .feature-card { padding: 0.9rem 0.8rem; }
  .feature-icon { width: 38px; height: 38px; font-size: 1rem; }
  .card-body { padding: 0.85rem; }
  .btn-action { width: 38px; height: 38px; }
  .child-mini-card .cmc-avatar { width: 40px; height: 40px; }
}

/* ===== LARGE TABLETS (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .sd-content { padding: 1.5rem clamp(1.25rem, 3vw, 2rem) 2.5rem; }
}

/* ===== DESKTOP (992px+) ===== */
@media (min-width: 992px) {
  .sd-sidebar { transition: width var(--tr-base); }
}

/* ===== LARGE DESKTOP (1440px+) ===== */
@media (min-width: 1440px) {
  .sd-content { max-width: 1440px; }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .flash-toast { animation: none; }
}

/* ===== PAGE-SPECIFIC MOBILE OVERRIDES ===== */

/* Child dashboard: proper column ordering and spacing on mobile */
@media (max-width: 991.98px) {
  .child-dashboard-row { gap: 0.75rem !important; }
}
@media (max-width: 575.98px) {
  .sd-hero-panel {
    padding: 0.85rem;
    margin-bottom: 0;
  }
  .sd-hero-panel h4 { margin-bottom: 0.25rem !important; }
  .sd-hero-panel p { margin-bottom: 0.5rem !important; font-size: 0.8rem !important; }
}

/* Chat page: hide sidebar on mobile, full-screen chat */
@media (max-width: 991.98px) {
  .page-chat .wa-app { flex-direction: column; }
  .page-chat .wa-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--sd-border); max-height: 40vh; }
  .page-chat .wa-conv-list { max-height: 30vh; }
  .page-chat .wa-main { min-height: 60vh; }
}
@media (max-width: 575.98px) {
  .page-chat .wa-msgs { padding: 0.5rem; }
  .page-chat .wa-composer { padding: 0.4rem 0.6rem; }
  .page-chat .wa-input { font-size: 16px; padding: 0.5rem 0.75rem; }
  .page-chat .wa-send { width: 40px; height: 40px; }
  .page-chat .wa-icon-btn { width: 40px; height: 40px; }
  .page-chat .wa-bubble { max-width: 88%; font-size: 0.88rem; }
}

/* Child dashboard: compact connection info on mobile */
@media (max-width: 575.98px) {
  .child-id-display { font-size: 1.15rem; letter-spacing: 0.14em; padding: 0.7rem; }
  .copy-child-id-btn { padding: 0.25rem 0.75rem; font-size: 0.78rem; }
}

/* Parent dashboard: tab badges smaller on mobile */
@media (max-width: 575.98px) {
  .nav.nav-pills .badge { font-size: 0.6rem; padding: 0.15em 0.4em; }
}

/* Leaderboard: mobile card-like rows */
@media (max-width: 575.98px) {
  .table-responsive { border-radius: var(--rd-md); }
}

/* ==========================================================================
   Focus Stage - active Focus Mode screen (Super Power Saving lock)
   Full-screen, distraction-free environment built from Sadhana tokens.
   ========================================================================== */

body.focus-stage-open { overflow: hidden; }

/* Hide site chrome; keep .sd-main visible (the stage itself lives inside it). */
body.focus-stage-open .sd-sidebar,
body.focus-stage-open .sd-topbar,
body.focus-stage-open #flashToasts { display: none !important; }

.focus-stage-open #focusStage {
  display: flex !important;
  position: fixed;
  inset: 0;
  z-index: 5000;
  overflow-y: auto;
  background:
    radial-gradient(900px 480px at 50% -10%, var(--sd-primary-soft), transparent 65%),
    radial-gradient(700px 420px at 92% 110%, var(--sd-accent-soft), transparent 60%),
    var(--sd-bg);
  color: var(--sd-text);
}

.fs-shell {
  width: min(860px, 100%);
  margin-inline: auto;
  padding: clamp(0.9rem, 2.5vw, 1.6rem) clamp(0.9rem, 3vw, 1.5rem) 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Top line: lock chip + subtle parent monitoring note ─────────────── */
.fs-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.fs-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: var(--rd-pill);
}
.fs-chip-lock {
  color: var(--sd-success);
  border: 1px solid rgba(34, 197, 139, 0.45);
  background: rgba(34, 197, 139, 0.10);
  box-shadow: 0 0 16px rgba(34, 197, 139, 0.12);
}
.fs-monitor {
  font-size: 0.76rem;
  color: var(--sd-text-faint);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.fs-monitor b { color: var(--sd-warning); }

/* ── Hero card: timer, task, progress, stats ─────────────────────────── */
.fs-hero {
  text-align: center;
  padding: clamp(1.4rem, 3.5vw, 2.2rem) clamp(1.1rem, 4vw, 2.2rem) 1.6rem;
  border-radius: var(--rd-xl);
  border: 1px solid var(--sd-border-strong);
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.06), rgba(6, 182, 212, 0.03)),
    var(--sd-surface);
  box-shadow: var(--shadow-md);
}
.fs-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sd-accent);
}
.fs-timer {
  margin-top: 0.4rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(3.4rem, 11vw, 5.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 50px rgba(99, 102, 241, 0.3);
}
.fs-task {
  margin-top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.42rem 1rem;
  border-radius: var(--rd-pill);
  border: 1px solid var(--sd-border);
  background: var(--sd-surface-2);
  color: var(--sd-text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.fs-task i { color: var(--sd-primary); }
.fs-task span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-status {
  min-height: 1.5em;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sd-text-muted);
}
.fs-status.is-ok { color: var(--sd-success); }
.fs-status.is-info { color: var(--sd-info); }
.fs-status.is-warn { color: var(--sd-warning); }
.fs-status.is-bad { color: var(--sd-danger); }

.fs-progress { max-width: 480px; margin: 1rem auto 0; }
.fs-progress-track {
  height: 10px;
  border-radius: var(--rd-pill);
  background: var(--sd-surface-3);
  overflow: hidden;
}
.fs-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--rd-pill);
  background: var(--sd-gradient);
  transition: width 1s linear;
}
.fs-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sd-text-faint);
  font-variant-numeric: tabular-nums;
}

.fs-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  max-width: 540px;
  margin: 1.2rem auto 0;
}
.fs-stat {
  padding: 0.75rem 0.55rem;
  border-radius: var(--rd-md);
  border: 1px solid var(--sd-border);
  background: var(--sd-surface-2);
  transition: all var(--tr-fast);
}
.fs-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.fs-stat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-faint);
  margin-bottom: 0.2rem;
}
.fs-stat b {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.fs-stat b.is-bad { color: var(--sd-danger); }

/* ── Approved-use banner (timer paused) ──────────────────────────────── */
.fs-using {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.2rem;
  border-radius: var(--rd-lg);
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: var(--shadow-sm);
}
.fs-using[hidden] { display: none; }
.fs-using-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--rd-md);
  background: var(--sd-surface-2);
  border: 1px solid var(--sd-border);
  font-size: 1.4rem;
  color: var(--sd-info);
}
.fs-using-body { flex: 1 1 200px; min-width: 0; }
.fs-using-body strong { display: block; margin-bottom: 0.1rem; }
.fs-using-body span { font-size: 0.84rem; color: var(--sd-text-muted); }
.fs-using-body b { color: var(--sd-info); font-variant-numeric: tabular-nums; }

/* ── Sections & tiles ───────────────────────────────────────────────── */
.fs-section[hidden] { display: none; }
.fs-section.dimmed { opacity: 0.35; pointer-events: none; }
.fs-heading {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.fs-heading i { font-size: 0.9rem; }
.fs-heading small {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--sd-text-faint);
}
.fs-heading.is-ok i { color: var(--sd-success); }
.fs-heading.is-info i { color: var(--sd-info); }
.fs-heading.is-bad i { color: var(--sd-danger); }

.fs-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}
.fs-empty {
  font-size: 0.82rem;
  color: var(--sd-text-faint);
  padding: 0.35rem 0.15rem;
}

/* Base tile — vertical card layout: icon → name → action */
.fs-app {
  appearance: none;
  font: inherit;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.9rem 0.65rem 0.75rem;
  border-radius: var(--rd-lg);
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-text);
  cursor: pointer;
  transition: all var(--tr-fast);
}
.fs-app:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.fs-app:focus-visible { outline: 2px solid var(--sd-primary); outline-offset: 2px; }
.fs-app-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--rd-md);
  background: var(--sd-surface-3);
  font-size: 1.2rem;
}
.fs-app-name {
  width: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--sd-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Allowed: green accent + open affordance */
.fs-app.allowed:hover { border-color: rgba(16, 185, 129, 0.5); }
.fs-app.allowed .fs-app-icon { color: var(--sd-success); background: rgba(16, 185, 129, 0.10); }
.fs-app-open {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sd-success);
  opacity: 0.85;
}

/* Approved: info accent + countdown + Open pill */
.fs-app.approved { border-color: rgba(59, 130, 246, 0.35); }
.fs-app.approved .fs-app-icon { color: var(--sd-info); background: rgba(59, 130, 246, 0.10); }
.fs-app-countdown {
  flex: 0 0 auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sd-info);
  font-variant-numeric: tabular-nums;
}
.fs-btn-mini {
  flex: 0 0 auto;
  appearance: none;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.38rem 1rem;
  border-radius: var(--rd-pill);
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: var(--sd-info);
  cursor: pointer;
  width: 100%;
  max-width: 115px;
  transition: all var(--tr-fast);
}
.fs-btn-mini:hover { background: rgba(59, 130, 246, 0.22); transform: translateY(-1px); }
.fs-app.approved.in-use {
  border-color: var(--sd-success);
  background: rgba(16, 185, 129, 0.06);
}

/* Restricted: red/locked + Request Access pill */
.fs-app.restricted { cursor: default; }
.fs-app.restricted .fs-app-icon { color: var(--sd-danger); background: rgba(239, 68, 68, 0.10); }
.fs-btn-request {
  flex: 0 0 auto;
  appearance: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  border-radius: var(--rd-pill);
  border: 1px solid var(--sd-border-strong);
  background: var(--sd-surface-2);
  color: var(--sd-text-muted);
  cursor: pointer;
  width: 100%;
  max-width: 120px;
}
.fs-btn-request:hover { border-color: var(--sd-warning); color: var(--sd-warning); }
.fs-btn-request.sent {
  border-color: rgba(245, 183, 61, 0.5);
  background: rgba(245, 183, 61, 0.12);
  color: var(--sd-warning);
  cursor: default;
}

/* ── Focus Warning Modal ─────────────────────────────────────────────── */
.fs-warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.fs-warning-overlay[hidden] { display: none; }
.fs-warning-card {
  width: min(420px, 92vw);
  padding: 2rem 1.8rem 1.6rem;
  border-radius: var(--rd-xl);
  border: 1px solid rgba(245, 183, 61, 0.4);
  background: var(--sd-surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(245, 183, 61, 0.15);
  text-align: center;
  animation: fs-warn-in 0.25s ease-out;
}
@keyframes fs-warn-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.fs-warning-icon {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(245, 183, 61, 0.15);
  color: var(--sd-warning);
  font-size: 1.6rem;
  margin-bottom: 0.9rem;
}
.fs-warning-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--sd-text);
}
.fs-warning-card p {
  font-size: 0.88rem;
  color: var(--sd-text-muted);
  margin-bottom: 1.4rem;
  line-height: 1.55;
}
.fs-warning-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.fs-warning-actions .fs-btn {
  width: 100%;
  min-width: 0;
}
.fs-btn-stay {
  border: none;
  background: var(--sd-success);
  color: #fff;
  box-shadow: 0 4px 14px -3px rgba(34, 197, 139, 0.5);
}
.fs-btn-stay:hover { filter: brightness(1.08); color: #fff; }
.fs-btn-continue {
  border: 1px solid rgba(245, 183, 61, 0.55);
  background: rgba(245, 183, 61, 0.14);
  color: var(--sd-warning);
}
.fs-btn-continue:hover { background: rgba(245, 183, 61, 0.26); }
.fs-warning-grace {
  font-size: 0.82rem;
  color: var(--sd-success);
  margin-bottom: 1rem;
  padding: 0.5rem 0.8rem;
  background: rgba(34, 197, 139, 0.1);
  border-radius: var(--rd-md);
  border: 1px solid rgba(34, 197, 139, 0.3);
}
.fs-warning-grace b {
  color: var(--sd-success);
  font-weight: 700;
}
.fs-warning-card #focusWarningMessage {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sd-danger);
  padding: 0.6rem 0.8rem;
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--rd-md);
  border: 1px solid rgba(239, 68, 68, 0.25);
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* ── Controls ────────────────────────────────────────────────────────── */
.fs-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
}
.fs-btn {
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 168px;
  padding: 0.72rem 1.5rem;
  border-radius: var(--rd-pill);
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  transition: transform var(--tr-fast), filter var(--tr-fast),
    background var(--tr-fast);
}
.fs-btn:hover { transform: translateY(-1px); }
.fs-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.fs-btn-danger {
  border: none;
  background: var(--sd-danger);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(240, 100, 122, 0.6);
}
.fs-btn-danger:hover { filter: brightness(1.08); color: #fff; }
.fs-btn-warn {
  border: 1px solid rgba(245, 183, 61, 0.55);
  background: rgba(245, 183, 61, 0.14);
  color: var(--sd-warning);
}
.fs-btn-warn:hover { background: rgba(245, 183, 61, 0.26); }
.fs-btn-light {
  min-width: 0;
  padding: 0.5rem 1rem;
  font-size: 0.84rem;
  border: 1px solid var(--sd-border-strong);
  background: var(--sd-surface-2);
  color: var(--sd-text);
}
.fs-btn-light:hover { background: var(--sd-surface-3); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .fs-shell { gap: 0.85rem; padding-bottom: 1.5rem; }
  .fs-topline { justify-content: center; }
  .fs-monitor { order: 3; width: 100%; justify-content: center; }
  .fs-hero { padding: 1rem 0.75rem 1.2rem; }
  .fs-timer { font-size: clamp(2.6rem, 14vw, 4rem); }
  .fs-stats { gap: 0.45rem; max-width: 100%; }
  .fs-stat { padding: 0.55rem 0.35rem; }
  .fs-stat span { font-size: 0.7rem; }
  .fs-stat b { font-size: 0.92rem; }
  .fs-tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; }
  .fs-app { padding: 0.65rem 0.45rem 0.55rem; gap: 0.35rem; border-radius: var(--rd-md); }
  .fs-app-icon { width: 36px; height: 36px; font-size: 0.95rem; }
  .fs-app-name { font-size: 0.75rem; }
  .fs-btn-mini, .fs-btn-request { font-size: 0.7rem; padding: 0.28rem 0.55rem; max-width: 100%; }
  .fs-controls { flex-direction: column; gap: 0.6rem; }
  .fs-controls .fs-btn { width: 100%; min-width: 0; }
  .fs-btn { min-width: 0; padding: 0.65rem 1.2rem; font-size: 0.88rem; }
  .fs-progress { max-width: 100%; }
  .fs-using { flex-direction: column; text-align: center; gap: 0.6rem; }
  .fs-using-body { flex: none; }
}

/* Tablets (576px - 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .fs-shell { max-width: 600px; }
  .fs-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .fs-app, .fs-btn, .fs-progress-bar { transition: none; }
}
