/* ═══════════════════════════════════════════════════════════════════════
   ZENTI DESIGN SYSTEM — Standard (dark sidebar + light content) by default.
   Add data-theme="dark" to <html> for full-dark mode.
   Fonts: Space Grotesk (display/headings), Inter (body) — loaded in App.razor.
   Matches the auth/login design language (see wwwroot/css/auth.css).

   Refactor notes (premium pass):
     • Every refinement is token-driven so it adapts to BOTH light + dark themes.
     • Added: animated brand flow-line on modals, accent hover-glow on stat cards,
       custom select chevron, search-field magnifier, live-status badge pulse,
       sidebar active accent bar.
     • Defined previously-missing alias tokens (--accent, --red, --bg-elevated,
       --surface-2, --text-primary, --text-secondary) so all references resolve.
     • De-duplicated .page-header and .photo-thumb; made .btn-icon variants
       theme-aware instead of hardcoded light fills.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────── */
:root {
  /* Brand — Zenti Blue / Velocity Green / Graphite / Cloud Gray */
  --blue:      #2D5BFF;
  --blue-bright:#5B82FF;
  --green:     #00E676;
  --graphite:  #1A1A1B;
  --cloud:     #F4F7FA;
  --gradient:  linear-gradient(135deg, #2D5BFF 0%, #00E676 100%);

  /* Typography */
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Sidebar — always dark regardless of theme */
  --sb-bg:          #111113;
  --sb-width:       252px;
  --sb-text:        rgba(255,255,255,.50);
  --sb-text-hover:  rgba(255,255,255,.82);
  --sb-text-active: #ffffff;
  --sb-hover:       rgba(255,255,255,.06);
  --sb-active-bg:   rgba(45,91,255,.20);
  --sb-divider:     rgba(255,255,255,.07);

  /* Content — Standard (light) mode */
  --bg:          #F4F7FA;
  --bg-card:     #FFFFFF;
  --bg-subtle:   #F8FAFC;
  --text-1:      #0F1117;
  --text-2:      #5E6777;
  --text-3:      #9BA4B1;
  --border:      #E4E8F0;
  --border-mid:  #CFD5E2;

  /* Shadows */
  --sh-xs: 0 1px 3px rgba(15,17,23,.07);
  --sh-sm: 0 2px 8px rgba(15,17,23,.08), 0 1px 3px rgba(15,17,23,.04);
  --sh-md: 0 4px 20px rgba(15,17,23,.09), 0 2px 8px rgba(15,17,23,.05);
  --sh-lg: 0 12px 48px rgba(15,17,23,.13), 0 4px 16px rgba(15,17,23,.08);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Motion */
  --t: 150ms ease;

  /* Accent helpers (used by focus rings + flow line) */
  --ring-blue:  rgba(45,91,255,.14);
  --glow-blue:  rgba(45,91,255,.55);
  --glow-green: rgba(16,185,129,.50);
  --glow-amber: rgba(245,158,11,.50);
  --glow-red:   rgba(239,68,68,.50);

  /* ── Compatibility aliases (referenced by some components) ── */
  --accent:         var(--blue);
  --red:            #ef4444;
  --bg-elevated:    var(--bg-subtle);
  --surface-2:      var(--bg-subtle);
  --text-primary:   var(--text-1);
  --text-secondary: var(--text-2);

  color-scheme: light;
}

/* ── Dark Mode Overrides ─────────────────────────────────────────────── */
html[data-theme="dark"] {
  color-scheme: dark;
  --sb-bg:          #0D0D0F;
  --sb-divider:     rgba(255,255,255,.05);

  --bg:          #111113;
  --bg-card:     #1C1C1F;
  --bg-subtle:   #242428;
  --text-1:      #EEF1F8;
  --text-2:      #8B94A3;
  --text-3:      #5E6777;
  --border:      rgba(255,255,255,.08);
  --border-mid:  rgba(255,255,255,.13);

  --sh-xs: 0 1px 3px rgba(0,0,0,.30);
  --sh-sm: 0 2px 8px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.20);
  --sh-md: 0 4px 20px rgba(0,0,0,.40), 0 2px 8px rgba(0,0,0,.28);
  --sh-lg: 0 12px 48px rgba(0,0,0,.55), 0 4px 16px rgba(0,0,0,.35);
}

/* ── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; overflow-x: hidden; background: var(--bg); }
.content-wrapper { padding: 2rem 2.5rem; max-width: 1400px; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  /* Pin to the viewport so the footer (account + sign out) stays visible no matter
     how tall the page content is. align-self stops the flex row from stretching it. */
  height: 100vh;
  height: 100dvh;
  align-self: flex-start;
  position: sticky;
  top: 0;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.375rem;
  border-bottom: 1px solid var(--sb-divider);
}

.sidebar-brand { display: flex; align-items: center; gap: 0.625rem; }
.sidebar-logo { height: 30px; width: auto; border-radius: 7px; display: block; }

.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffffff;
}

.sidebar-subtitle {
  font-size: 0.63rem;
  color: rgba(255,255,255,.28);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  margin-top: 4px;
}

.nav-list { list-style: none; padding: 0.625rem 0.75rem; flex: 1; overflow-y: auto; min-height: 0; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--r-sm);
  color: var(--sb-text);
  font-size: 0.86rem;
  font-weight: 500;
  transition: color var(--t), background var(--t);
  margin-bottom: 2px;
}

.nav-link:hover { color: var(--sb-text-hover); background: var(--sb-hover); }
.nav-link.active { color: var(--sb-text-active); background: var(--sb-active-bg); }
.nav-link.active .nav-icon { color: var(--blue); }
/* Premium: slim brand accent bar on the active item */
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg { width: 18px; height: 18px; display: block; }

.nav-divider { height: 1px; background: var(--sb-divider); margin: 0.5rem 0.875rem; }

/* Notification count pill on a nav item */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Sidebar Footer ──────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sb-divider);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  text-decoration: none;
  border-radius: var(--r-sm);
  padding: 0.375rem 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  transition: background var(--t);
  cursor: pointer;
}
.sidebar-user:hover { background: rgba(255,255,255,.07); }
.sidebar-user--active { background: rgba(255,255,255,.10); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  display: block;
  font-size: 0.62rem;
  color: rgba(255,255,255,.32);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.footer-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: var(--r-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,.50);
  flex-shrink: 0;
  transition: background var(--t), color var(--t);
}

.theme-toggle-btn:hover {
  background: rgba(255,255,255,.13);
  color: rgba(255,255,255,.85);
}

.icon-sun  { display: block; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun  { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.logout-btn {
  flex: 1;
  background: none;
  border: 1px solid rgba(255,255,255,.13);
  color: rgba(255,255,255,.45);
  padding: 0.44rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.78rem;
  transition: background var(--t), color var(--t), border-color var(--t);
}

.logout-btn:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.82); border-color: rgba(255,255,255,.28); }

/* ── Page Header (heading + optional action, single definition) ──────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.875rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.page-header p { color: var(--text-2); margin-top: 0.3rem; font-size: 0.875rem; }

/* ── Stat Cards ──────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 1.25rem 1.375rem;
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}

.stat-card:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }

.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
}

.stat-icon-wrap svg { width: 20px; height: 20px; }

.stat-card.blue  .stat-icon-wrap { background: rgba(45,91,255,.12);  color: var(--blue); }
.stat-card.green .stat-icon-wrap { background: rgba(16,185,129,.12); color: #10b981; }
.stat-card.amber .stat-icon-wrap { background: rgba(245,158,11,.12); color: #f59e0b; }
.stat-card.red   .stat-icon-wrap { background: rgba(239,68,68,.12);  color: #ef4444; }
.stat-card       .stat-icon-wrap { background: rgba(155,164,177,.12); color: var(--text-3); }

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.stat-card.green .stat-value { color: #10b981; }
.stat-card.amber .stat-value { color: #f59e0b; }
.stat-card.red   .stat-value { color: #ef4444; }
.stat-card.blue  .stat-value { color: var(--blue); }

.stat-card .stat-label {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.65px;
}

/* Premium: accent-tinted lift on hover (works on both themes) */
.stat-card:hover            { border-color: var(--border-mid); }
.stat-card.blue:hover       { box-shadow: var(--sh-sm), 0 14px 32px -18px var(--glow-blue); }
.stat-card.green:hover      { box-shadow: var(--sh-sm), 0 14px 32px -18px var(--glow-green); }
.stat-card.amber:hover      { box-shadow: var(--sh-sm), 0 14px 32px -18px var(--glow-amber); }
.stat-card.red:hover        { box-shadow: var(--sh-sm), 0 14px 32px -18px var(--glow-red); }

/* ── Section Headings ────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 1rem;
  letter-spacing: -0.2px;
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.table-container {
  background: var(--bg-card);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--sh-xs);
}

table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-subtle); }

th {
  padding: 0.75rem 1.125rem;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover td { background: var(--bg-subtle); }

.table-link { color: var(--blue); font-size: 0.82rem; font-weight: 500; }
.table-link:hover { opacity: .72; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-green  { background: rgba(16,185,129,.12);  color: #059669; }
.badge-amber  { background: rgba(245,158,11,.12);  color: #d97706; }
.badge-red    { background: rgba(239,68,68,.12);   color: #dc2626; }
.badge-blue   { background: rgba(45,91,255,.12);   color: var(--blue); }
.badge-gray   { background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--border); }
.badge-purple { background: rgba(139,92,246,.12);  color: #7c3aed; }
.badge-orgadmin   { background: rgba(139,92,246,.12); color: #7c3aed; }
.badge-manager    { background: rgba(45,91,255,.12);  color: var(--blue); }
.badge-fieldagent { background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--border); }

/* Premium: live-status pulse dot (add .badge--live to On site / Travelling) */
.badge--live::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 0.4rem;
  box-shadow: 0 0 0 0 currentColor;
  animation: badge-pulse 2.4s ease-out infinite;
}

/* ── Filters ─────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; align-items: center; }

.filter-select {
  padding: 0.5rem 2.1rem 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  background-color: var(--bg-card);
  color: var(--text-1);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239BA4B1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color var(--t), box-shadow var(--t);
}

.filter-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--ring-blue); }

/* ── Agent Cells ─────────────────────────────────────────────────────── */
.agent-name  { font-weight: 600; color: var(--text-1); }
.agent-email { color: var(--text-3); font-size: 0.8rem; margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
/* .btn-primary is a VISUAL modifier only — always compose it on .btn so every
   primary button shares the same height/padding as its neighbours (secondary,
   cancel). This is what keeps page-header actions and modal footers aligned. */
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-bright));
  color: #fff;
  border-color: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 8px 22px -10px var(--glow-blue);
}
.btn-primary:hover  { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 12px 26px -10px var(--glow-blue); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.997); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 0 0 3px var(--glow-green); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

/* Full-width utility for lone form submits that should span their container. */
.btn--block { width: 100%; }

/* Auth pages (login / password reset) are self-contained — see wwwroot/css/auth.css. */

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert-error {
  background: rgba(239,68,68,.08);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,.2);
  border-left: 3px solid #ef4444;
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}

/* ── Detail Page ─────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.375rem;
  transition: opacity var(--t);
}

.back-link:hover { opacity: .7; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.5rem;
  box-shadow: var(--sh-xs);
}

.detail-item .label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--text-3);
  margin-bottom: 0.3rem;
}

.detail-item .value { font-size: 0.9rem; color: var(--text-1); font-weight: 500; }
.detail-item .value a { color: var(--blue); }
.detail-item .value a:hover { text-decoration: underline; }
.detail-section { margin-bottom: 2rem; }
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  background: rgba(45,91,255,.10);
  color: var(--blue);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-warning {
  background: rgba(245,158,11,.14);
  color: #b45309;
}
html[data-theme="dark"] .tag-warning { color: #fbbf5a; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  font-size: 0.875rem;
}

.alert-warning {
  background: rgba(245,158,11,.10);
  color: #b45309;
  border: 1px solid rgba(245,158,11,.30);
}
html[data-theme="dark"] .alert-warning { color: #fbbf5a; }

.media-empty {
  color: var(--text-3);
  font-size: 0.875rem;
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-md);
  display: inline-block;
}

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }

/* .photo-thumb — single definition (base + interactive) */
.photo-thumb {
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 4/3;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.photo-thumb:hover { transform: translateY(-2px); box-shadow: var(--sh-sm); border-color: var(--blue); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Misc ────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-3); }
.loading    { color: var(--text-2); padding: 3rem; text-align: center; font-size: 0.9rem; }

/* ── Settings Page ───────────────────────────────────────────────────── */
.settings-group { margin-bottom: 2.5rem; }

.settings-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  margin-bottom: 1rem;
}

.theme-cards { display: flex; gap: 1rem; flex-wrap: wrap; }

.theme-card {
  cursor: pointer;
  border-radius: var(--r-md);
  border: 2px solid var(--border);
  overflow: hidden;
  width: 175px;
  background: var(--bg-card);
  box-shadow: var(--sh-xs);
  transition: border-color var(--t), box-shadow var(--t);
}

.theme-card:hover { border-color: var(--border-mid); box-shadow: var(--sh-sm); }
.theme-card.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), var(--sh-sm); }

.theme-preview {
  height: 96px;
  position: relative;
  overflow: hidden;
}

.theme-preview--light { background: #F4F7FA; }
.theme-preview--light::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 46px;
  background: #111113;
}

.theme-preview--dark { background: #111113; }
.theme-preview--dark::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 46px;
  background: #0D0D0F;
}

.theme-preview-bars {
  position: absolute;
  left: 56px; top: 14px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-preview-bar {
  height: 7px;
  border-radius: 3px;
}

.theme-preview--light .theme-preview-bar { background: rgba(0,0,0,.10); }
.theme-preview--light .theme-preview-bar:first-child { width: 55%; background: rgba(0,0,0,.18); }
.theme-preview--dark  .theme-preview-bar { background: rgba(255,255,255,.12); }
.theme-preview--dark  .theme-preview-bar:first-child { width: 55%; background: rgba(255,255,255,.22); }

.theme-card-footer {
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.theme-card-name { font-size: 0.82rem; font-weight: 600; color: var(--text-1); }

.theme-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t);
  font-size: 9px;
  color: #fff;
  font-weight: 700;
}

.theme-card.selected .theme-check { opacity: 1; }

/* ── Toasts ──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1.25rem; right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--sh-md);
  min-width: 260px; max-width: 380px;
  pointer-events: auto;
  animation: toast-in .2s ease;
  border: 1px solid transparent;
}

.toast-success { background: rgba(16,185,129,.10);  color: #059669; border-color: rgba(16,185,129,.25); }
.toast-error   { background: rgba(239,68,68,.10);   color: #dc2626; border-color: rgba(239,68,68,.25); }
.toast-warning { background: rgba(245,158,11,.10);  color: #d97706; border-color: rgba(245,158,11,.25); }
.toast-info    { background: rgba(45,91,255,.10);   color: var(--blue); border-color: rgba(45,91,255,.25); }

.toast-text  { flex: 1; }
.toast-close { background: none; border: none; cursor: pointer; font-size: 1rem; line-height: 1; opacity: .45; padding: 0; color: inherit; }
.toast-close:hover { opacity: .9; }

/* ── Audio Note ──────────────────────────────────────────────────────── */
.audio-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 560px;
}
.audio-card audio { border-radius: var(--r-sm); width: 100%; }
.audio-actions { display: flex; gap: 0.75rem; }

/* ── Signature Display ───────────────────────────────────────────────── */
.signature-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem;
  display: inline-block;
  max-width: 400px;
}

.signature-img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
}

/* ── Admin Buttons (shared across admin pages) ──────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.05rem;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t), transform var(--t), opacity var(--t);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-1);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-mid); }

.btn-danger {
  background: rgba(239,68,68,.10);
  color: #dc2626;
  border-color: rgba(239,68,68,.25);
}
.btn-danger:hover { background: rgba(239,68,68,.18); }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { opacity: .72; }
.btn-link--danger { color: #dc2626; }
.btn-link--danger:hover { opacity: .72; }
html[data-theme="dark"] .btn-link--danger { color: #f87171; }

.btn-xs {
  padding: .3rem .7rem;
  font-size: .8rem;
}

/* ── Filter extras ───────────────────────────────────────────────────── */
.filter-input {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  background-color: var(--bg-card);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.filter-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--ring-blue); }

/* Search variant gets an inline magnifier glyph */
.filter-input--search {
  min-width: 200px;
  padding-left: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%239BA4B1' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
}

.filter-sep { color: var(--text-3); font-size: .875rem; flex-shrink: 0; }
.filter-bar--wrap { flex-wrap: wrap; }
.ms-auto { margin-left: auto; }

/* ── View toggle ─────────────────────────────────────────────────────── */
.view-toggle { display: flex; gap: .25rem; }

/* ── Table extras ────────────────────────────────────────────────────── */
.row-inactive td { opacity: .5; }
/* Right-aligned action column. Keep the <td> as a real table-cell (no display:flex)
   so vertical-align:middle centres the buttons against the rest of the row — otherwise
   they float to the top of taller (two-line) rows and the row dividers look uneven. */
/* Standalone action group (e.g. Tasks card) — simple flex row. */
.row-actions { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
/* Table action column — keep it a real table-cell so vertical-align:middle centres the
   buttons against the row (display:flex on a <td> drops that and floats them to the top). */
td.row-actions { display: table-cell; text-align: right; vertical-align: middle; }
td.row-actions > * { vertical-align: middle; }
td.row-actions > * + * { margin-left: .4rem; }
th.col-actions { text-align: right; }

/* Premium pill action button for table rows (Edit / Deactivate / etc.) */
.btn-row {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .36rem .74rem;
  border-radius: var(--r-sm);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  /* Accent-coloured by default (not just on hover) so the action reads clearly on
     touch devices that never hover. Hover/press add a soft glow + lift. */
  color: var(--blue);
  background: rgba(45,91,255,.10);
  border: 1px solid rgba(45,91,255,.24);
  transition: color var(--t), background var(--t), border-color var(--t), box-shadow var(--t), transform var(--t);
}
.btn-row:hover {
  background: rgba(45,91,255,.16);
  border-color: var(--blue);
  box-shadow: 0 4px 13px -4px var(--glow-blue);
  transform: translateY(-1px);
}
.btn-row:active { transform: translateY(0); }
.btn-row:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring-blue); }

.btn-row--danger {
  color: var(--red);
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.26);
}
.btn-row--danger:hover {
  background: rgba(239,68,68,.16);
  border-color: var(--red);
  box-shadow: 0 4px 13px -4px var(--glow-red);
}

.btn-row--green {
  color: #059669;
  background: rgba(16,185,129,.12);
  border-color: rgba(16,185,129,.28);
}
.btn-row--green:hover {
  background: rgba(16,185,129,.18);
  border-color: #10b981;
  box-shadow: 0 4px 13px -4px var(--glow-green);
}

/* Dark mode — brighten danger/green text for contrast on the dark tints. */
html[data-theme="dark"] .btn-row--danger { color: #f87171; }
html[data-theme="dark"] .btn-row--green  { color: #34d399; }
.btn-icon { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border:none; border-radius:6px; cursor:pointer; background:var(--bg-elevated); color:var(--text-secondary); font-size:.9rem; transition:background var(--t),color var(--t); }
.btn-icon:hover { background:var(--bg-subtle); color:var(--text-primary); }
.btn-icon--green { background: rgba(16,185,129,.12); color:#059669; }
.btn-icon--green:hover { background: rgba(16,185,129,.20); }
.btn-icon--red { background: rgba(239,68,68,.12); color:#dc2626; }
.btn-icon--red:hover { background: rgba(239,68,68,.20); }

.empty-state { padding: 3rem; text-align: center; color: var(--text-3); }
.clickable-row { cursor: pointer; transition: background var(--t); }
.clickable-row:hover td { background: var(--bg-subtle); }

/* ── Filter toggle checkbox ──────────────────────────────────────────── */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.filter-toggle input { accent-color: var(--blue); width: 16px; height: 16px; }

/* ── Form inputs (modal / panel forms) ──────────────────────────────── */
.form-group { margin-bottom: .875rem; }
.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .375rem;
}
.form-input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: .875rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  box-sizing: border-box;
}
.form-input::placeholder { color: var(--text-3); }
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,91,255,.14); }

select.form-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239BA4B1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.form-error {
  background: rgba(239,68,68,.08);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,.2);
  border-left: 3px solid #ef4444;
  border-radius: var(--r-sm);
  padding: .625rem .875rem;
  font-size: .82rem;
  margin-bottom: .875rem;
}

/* ── Modals ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,12,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fade-in .15s ease;
}

.modal {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in .18s cubic-bezier(.2,.8,.25,1);
}
.modal--sm { max-width: 400px; }

/* Premium: animated brand flow-line across the modal's top edge */
.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue) 42%, var(--green) 64%, transparent);
  background-size: 220% 100%;
  animation: brand-flow 7s linear infinite;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; margin: 0; color: var(--text-1); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.375rem;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  transition: color var(--t);
}
.modal-close:hover { color: var(--text-1); }

.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Timeline view ───────────────────────────────────────────────────── */
.schedule-list-col--timeline {
  overflow-y: auto;
  max-height: 720px;
}

.timeline-wrap {
  position: relative;
  height: 980px; /* 06:00–22:00 = 16 hrs × 60px/hr + 20px buffer */
  padding: 4px 8px 8px 56px;
}

.tl-hr {
  position: absolute;
  left: 0;
  right: 8px;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}
.tl-hr-label {
  position: absolute;
  left: 2px;
  width: 46px;
  text-align: right;
  font-size: .68rem;
  color: var(--text-3);
  transform: translateY(-50%);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.tl-appt {
  position: absolute;
  left: 60px;
  right: 8px;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: .75rem;
  cursor: pointer;
  overflow: hidden;
  background: rgba(45,91,255,.11);
  border-left: 3px solid var(--blue);
  transition: background var(--t), box-shadow var(--t);
}
.tl-appt:hover      { background: rgba(45,91,255,.19); }
.tl-appt--active    { background: rgba(45,91,255,.21); box-shadow: 0 2px 8px rgba(45,91,255,.18); }
.tl-appt--green     { background: rgba(16,185,129,.10); border-left-color: #059669; }
.tl-appt--amber     { background: rgba(245,158,11,.10); border-left-color: #d97706; }
.tl-appt--red       { background: rgba(239,68,68,.10);  border-left-color: #dc2626; }
.tl-appt-time   { font-size: .68rem; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-appt-client { font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-appt-agent  { font-size: .68rem; color: var(--text-3); }

.tl-now {
  position: absolute;
  left: 56px;
  right: 8px;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  pointer-events: none;
  z-index: 2;
}
.tl-now::before {
  content: '';
  position: absolute;
  left: -7px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}

.tl-empty {
  position: absolute;
  top: 50%;
  left: 56px;
  right: 8px;
  transform: translateY(-50%);
  text-align: center;
  color: var(--text-3);
  font-size: .9rem;
}

/* ── Photo Modal ─────────────────────────────────────────────────────── */
.photo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 1rem;
  animation: fade-in .15s ease;
}

.photo-modal-inner {
  position: relative;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.photo-modal-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--r-md);
  transition: transform .3s ease;
  transform-origin: center;
}

.photo-modal-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.photo-modal-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}

.photo-modal-btn:hover { background: rgba(255,255,255,.28); }

.photo-modal-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color var(--t);
}

.photo-modal-close:hover { color: #fff; }

/* ── Clickable stat card ─────────────────────────────────────────────── */
.stat-card-link { text-decoration: none; display: block; }
.stat-card-link .stat-card { transition: box-shadow var(--t), transform var(--t), border-color var(--t); }
.stat-card-link:hover .stat-card { box-shadow: var(--sh-md); transform: translateY(-2px); cursor: pointer; }

/* ── Blazor Error UI ─────────────────────────────────────────────────── */
#blazor-error-ui { display: none; }

/* ── Schedule split panel ────────────────────────────────────────────── */
.schedule-split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.schedule-list-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.schedule-panel-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  min-height: 320px;
}

.appt-list { display: flex; flex-direction: column; }

.appt-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t);
}
.appt-item:last-child { border-bottom: none; }
.appt-item:hover      { background: var(--bg-subtle); }
.appt-item--active    { background: rgba(45,91,255,.07); border-left: 3px solid var(--blue); }

.appt-time-col { flex-shrink: 0; }
.appt-time     { font-size: .8rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

.appt-info     { flex: 1; min-width: 0; }
.appt-client   { font-weight: 500; color: var(--text-1); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-meta     { font-size: .75rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-3);
  font-size: .9rem;
  text-align: center;
  padding: 2rem;
}

.panel-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.panel-detail-header h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin: 0 0 .25rem; }

.detail-fields { display: flex; flex-direction: column; gap: .625rem; margin-bottom: 1.5rem; }
.detail-field  { display: flex; gap: .75rem; align-items: baseline; font-size: .875rem; }
.detail-label  { font-size: .75rem; font-weight: 500; color: var(--text-3); min-width: 90px; flex-shrink: 0; }

.panel-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }

.panel-form { display: flex; flex-direction: column; gap: 0; }
.panel-form .panel-actions { margin-top: 1rem; }

/* ── Two-column form row ─────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Form hint text ──────────────────────────────────────────────────── */
.form-hint {
  font-size: .75rem;
  color: var(--text-3);
  margin: .25rem 0 0;
}

/* ── Reports ─────────────────────────────────────────────────────────── */
.report-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.report-tab {
  padding: .5rem 1.125rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: color .15s, border-color .15s;
}
.report-tab:hover { color: var(--text-1); }
.report-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .875rem;
}
.report-section-header .text-muted { margin: 0; font-size: .875rem; }

.report-chart-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1rem;
  max-width: 100%;
}

/* ── Performance inline progress bar ────────────────────────────────── */
.perf-bar-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 120px;
}
.perf-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.perf-bar-fill {
  height: 6px;
  background: var(--blue);
  border-radius: 99px;
  transition: width .3s ease;
}
.perf-bar-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  min-width: 38px;
  text-align: right;
}
.perf-bar-fill--amber { background: #d97706; }
.perf-bar-fill--red   { background: #dc2626; }

/* ── Utility ─────────────────────────────────────────────────────────── */
.mb-1     { margin-bottom: .5rem; }
.text-red   { color: #dc2626; }
.text-amber { color: #d97706; }

/* ── Alert banners ───────────────────────────────────────────────────── */
.alert-success {
  background: rgba(16,185,129,.08);
  color: #059669;
  border: 1px solid rgba(16,185,129,.2);
  border-left: 3px solid #10b981;
  border-radius: var(--r-sm);
  padding: .625rem .875rem;
  font-size: .82rem;
  margin-bottom: .875rem;
}

/* ── Toggle switch ───────────────────────────────────────────────────── */
.toggle-row { display: flex; align-items: center; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-mid); border-radius: 24px;
  transition: background var(--t);
}
.toggle-slider::before {
  content: ""; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform var(--t);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px var(--ring-blue); }

/* ── Account page ────────────────────────────────────────────────────── */
.account-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: .875rem;
  border-top: 1px solid var(--border);
}

/* ── Subscription info (Settings page) ──────────────────────────────── */
.sub-info { display: flex; flex-direction: column; gap: 1rem; }

.sub-tier-row { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }

.sub-tier-badge {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 9999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.sub-tier-badge--starter      { background: rgba(100,116,139,.15); color: #64748b; }
.sub-tier-badge--professional { background: rgba(45,91,255,.12);  color: var(--blue); }
.sub-tier-badge--enterprise   { background: rgba(139,92,246,.12); color: #7c3aed; }
.sub-tier-badge--corporate    { background: rgba(245,158,11,.12); color: #b45309; }

.sub-status-badge {
  display: inline-block;
  padding: .2rem .625rem;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 600;
}
.sub-status-badge--trial     { background: rgba(245,158,11,.12); color: #b45309; }
.sub-status-badge--active    { background: rgba(16,185,129,.12); color: #059669; }
.sub-status-badge--pastdue   { background: rgba(239,68,68,.12);  color: #dc2626; }
.sub-status-badge--suspended { background: rgba(239,68,68,.12);  color: #dc2626; }
.sub-status-badge--cancelled { background: rgba(100,116,139,.12); color: #64748b; }

.sub-trial-label {
  font-size: .78rem;
  color: #b45309;
  font-style: italic;
}

.sub-agent-usage { display: flex; flex-direction: column; gap: .375rem; }

.sub-usage-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .82rem;
  color: var(--text-2);
}

.sub-usage-warn {
  font-size: .78rem;
  font-weight: 500;
  margin-top: .25rem;
}

.sub-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .375rem .75rem;
}

.sub-feature {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--text-1);
}

.sub-feature--locked { color: var(--text-3); }

.sub-feature-icon {
  font-size: .75rem;
  font-weight: 700;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Order status timeline ───────────────────────────────────────────── */
.order-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.5rem 0; position: relative;
}
.timeline-row:not(:last-child)::before {
  content: ''; position: absolute; left: 5px; top: 1.4rem; bottom: -0.5rem;
  width: 2px; background: var(--border);
}
.timeline-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  margin-top: 0.2rem; position: relative; z-index: 1;
}
.timeline-row > div { font-size: 0.86rem; }

/* ═══════════════════════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════════════════════ */
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(-12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes brand-flow { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes badge-pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 768px)
   ═══════════════════════════════════════════════════════════════════════ */

.mob-header {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--sb-bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.mob-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}
.mob-header-logo { height: 24px; width: auto; border-radius: 6px; display: block; }

.mob-header-brand span {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.mob-hamburger {
  background: none;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

.mob-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,.75);
  border-radius: 2px;
  transition: all 0.2s;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  opacity: 0;
  /* When closed the backdrop is invisible but still in the DOM (mobile sets it to
     display:block) — without this it would sit on top and eat the hamburger tap. */
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
}

.mob-sidebar-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,.6);
  font-size: 14px;
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .main-content { margin-left: 0 !important; }
  .content-wrapper { padding: 1rem 1rem 2rem; }

  .mob-header { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 200;
    min-height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.nav-open { transform: translateX(0); }
  .sidebar-header { padding-right: 3rem; }

  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.nav-open { opacity: 1; pointer-events: all; }
  .mob-sidebar-close { display: flex; }

  .page-header { margin-bottom: 1.25rem; }
  .page-header h1 { font-size: 1.25rem; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .stat-card { padding: 1rem 1.125rem; }
  .stat-card .stat-value { font-size: 1.75rem; }

  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 540px; }
  th, td { padding: 0.7rem 0.875rem; font-size: 0.82rem; }

  .filter-bar { flex-wrap: wrap; gap: 0.5rem; }
  .filter-select,
  .filter-bar input,
  .form-input,
  input.form-input,
  select.form-input,
  textarea.form-input { font-size: 16px; /* prevents iOS zoom on focus */ }

  .detail-grid { grid-template-columns: 1fr 1fr; padding: 1rem; gap: 0.875rem 1rem; }

  .modal { padding: 0; }
  .modal-panel { padding: 1.25rem; max-width: 100%; margin: 1rem; }

  .settings-grid-2 { grid-template-columns: 1fr !important; }
  .form-row-2 { grid-template-columns: 1fr !important; }
  .form-row { grid-template-columns: 1fr; }

  .page-actions { flex-direction: column; }
  .page-actions .btn { width: 100%; justify-content: center; }

  .sub-info { padding: 1rem; }

  .schedule-split { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .content-wrapper { padding: 0.75rem 0.75rem 2rem; }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .modal::before,
  .badge--live::before { animation: none; }
  .toast, .modal, .modal-overlay, .photo-modal-overlay { animation: none; }
  * { scroll-behavior: auto; }
}