/* ============================================================
   LEGACY LIVE — Neomorphic UI Design System
   Aesthetic: Soft Depth · Pressed Glass · Premium Neomorphism
   Font: DM Sans (body) + DM Serif Display (headings)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=DM+Serif+Display&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────────── */

:root {
  --navy-950: #0d1117;
  --navy-900: #131a24;
  --navy-800: #1a2535;
  --navy-700: #213045;
  --navy-600: #2c3e58;
  --navy-500: #3d5166;
  --navy-400: #5a7189;
  --navy-300: #8aa0b4;
  --navy-200: #c2d0dc;
  --navy-100: #e8eef4;
  --navy-50:  #f4f6f9;

  --blue-600: #1a6bc4;
  --blue-500: #2179d9;
  --blue-400: #3a8ef0;
  --blue-300: #6aabf5;
  --blue-100: #ddeeff;
  --blue-50:  #eef6ff;

  --success-700: #166534;
  --success-500: #22c55e;
  --success-100: #dcfce7;
  --danger-700:  #991b1b;
  --danger-500:  #ef4444;
  --danger-100:  #fee2e2;
  --warning-500: #f59e0b;
  --warning-100: #fef3c7;

  /* ── Neomorphic Base Palette ── */
  --neo-bg:         #e8edf4;
  --neo-bg-dark:    #dde3ec;
  --neo-surface:    #eef2f8;
  --neo-surface-2:  #f4f7fc;
  --neo-border:     rgba(255,255,255,0.75);

  /* Legacy variable aliases for JS compatibility */
  --bg:            #f1f4f9;
  /* page/body background — lighter than cards */
  --surface:       var(--neo-surface);
  --surface-2:     var(--neo-surface-2);
  --surface-3:     #e4e9f1;
  --border:        #d4dae6;
  --border-strong: #c4ccd9;

  --text-primary:   #1e2a3a;
  --text-secondary: #4a5a72;
  --text-muted:     #8a98b0;
  --text-inverse:   #ffffff;

  /* ── Neomorphic Shadows ── */
  /* Light source: top-left */
  --neo-shadow-light: rgba(255, 255, 255, 0.85);
  --neo-shadow-dark:  rgba(163, 177, 198, 0.72);

  /* Raised (convex) — element pops out */
  --neo-raised:
    6px 6px 14px var(--neo-shadow-dark),
    -6px -6px 14px var(--neo-shadow-light);

  --neo-raised-sm:
    3px 3px 8px var(--neo-shadow-dark),
    -3px -3px 8px var(--neo-shadow-light);

  --neo-raised-lg:
    10px 10px 24px var(--neo-shadow-dark),
    -10px -10px 24px var(--neo-shadow-light);

  --neo-raised-xl:
    16px 16px 36px var(--neo-shadow-dark),
    -16px -16px 36px var(--neo-shadow-light);

  /* Pressed (inset) — element pushed in */
  --neo-pressed:
    inset 4px 4px 10px var(--neo-shadow-dark),
    inset -4px -4px 10px var(--neo-shadow-light);

  --neo-pressed-sm:
    inset 2px 2px 6px var(--neo-shadow-dark),
    inset -2px -2px 6px var(--neo-shadow-light);

  --neo-pressed-lg:
    inset 6px 6px 16px var(--neo-shadow-dark),
    inset -6px -6px 16px var(--neo-shadow-light);

  /* Flat — no depth, just base */
  --neo-flat:
    4px 4px 8px var(--neo-shadow-dark),
    -4px -4px 8px var(--neo-shadow-light);

  /* Blue glow for focus states */
  --neo-focus:
    inset 2px 2px 5px var(--neo-shadow-dark),
    inset -2px -2px 5px var(--neo-shadow-light),
    0 0 0 3px rgba(33,121,217,0.22),
    0 0 18px rgba(33,121,217,0.12);

  /* Legacy shadow aliases */
  --shadow-xs: var(--neo-raised-sm);
  --shadow-sm: var(--neo-raised);
  --shadow-md: var(--neo-raised);
  --shadow-lg: var(--neo-raised-lg);
  --shadow-xl: var(--neo-raised-xl);
  --shadow-glow: 0 0 0 3px rgba(33,121,217,0.22);

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

  --transition-fast: 120ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 380ms ease;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Base ───────────────────────────────────────────────────────────────── */

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--neo-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h4, h5, h6 {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--blue-500); text-decoration: none; }
a:hover { color: var(--blue-400); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.container { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  width: 268px;
  background: linear-gradient(160deg, #1a2535 0%, #131a24 55%, #0d1117 100%);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  /* Neomorphic dark panel shadow */
  box-shadow:
    6px 0 24px rgba(0,0,0,0.35),
    inset -1px 0 0 rgba(255,255,255,0.04);
}

.sidebar h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  text-align: center;
  padding: 30px 20px 24px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
}

.sidebar h1::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(58,142,240,0.9), transparent);
  border-radius: var(--radius-full);
}

.sidebar ul {
  list-style: none;
  padding: 14px 14px;
  margin: 0;
  flex: 1;
}

.sidebar li {
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.sidebar a {
  color: rgba(138,160,180,0.9);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  letter-spacing: 0.01em;
  position: relative;
}

.sidebar a:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
  box-shadow:
    inset 2px 2px 5px rgba(0,0,0,0.25),
    inset -1px -1px 3px rgba(255,255,255,0.05);
}

.sidebar a.active-nav {
  color: #fff;
  background: rgba(33,121,217,0.18);
  box-shadow:
    inset 3px 3px 8px rgba(0,0,0,0.3),
    inset -1px -1px 4px rgba(255,255,255,0.04),
    0 0 12px rgba(33,121,217,0.15);
}

.sidebar a i {
  width: 16px;
  text-align: center;
  opacity: 0.6;
  font-size: 0.82rem;
  transition: opacity var(--transition-base);
}

.sidebar a:hover i,
.sidebar a.active-nav i { opacity: 1; }

.sidebar .bottom {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar .bottom a { color: var(--navy-400); font-size: 0.85rem; }
.sidebar .bottom a:hover {
  color: var(--danger-500);
  background: rgba(239,68,68,0.1);
  box-shadow:
    inset 2px 2px 5px rgba(0,0,0,0.2),
    inset -1px -1px 3px rgba(255,255,255,0.03);
}

/* ─── Main Content ───────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  padding: 36px 44px;
  overflow-y: auto;
  min-width: 0;
  background: var(--neo-bg);
}

/* ─── Page Header ────────────────────────────────────────────────────────── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 22px;
  border-bottom: 2px solid rgba(255,255,255,0.6);
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(163,177,198,0.4);
}

.header h2 { font-size: 1.7rem; color: var(--text-primary); }
.header h2 + p { font-size: 0.875rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--neo-bg);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--neo-raised);
  border: none;
  margin-bottom: 22px;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
}

/* Subtle top highlight edge on cards */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 10px; right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
  border-radius: var(--radius-full);
}

.card:hover {
  box-shadow: var(--neo-raised-lg);
  transform: translateY(-2px);
}

.card > h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.7);
  position: relative;
}

.card > h3::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: rgba(163,177,198,0.4);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

button {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  line-height: 1;
  position: relative;
}

/* Default button: raised neo */
button {
  background: var(--neo-bg);
  color: var(--text-secondary);
  box-shadow: var(--neo-raised);
}

button:active {
  box-shadow: var(--neo-pressed) !important;
  transform: translateY(0) !important;
}

/* Primary */
button.primary {
  background: linear-gradient(145deg, #2e88e8, #1a6bc4);
  color: #fff;
  box-shadow:
    5px 5px 14px rgba(22,107,196,0.45),
    -3px -3px 10px rgba(255,255,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.2);
}
button.primary:hover {
  background: linear-gradient(145deg, #3a94f2, #1f75d0);
  box-shadow:
    7px 7px 18px rgba(22,107,196,0.55),
    -3px -3px 10px rgba(255,255,255,0.15),
    0 0 20px rgba(33,121,217,0.3);
  transform: translateY(-2px);
}
button.primary:active {
  box-shadow:
    inset 4px 4px 10px rgba(14,72,150,0.5),
    inset -2px -2px 6px rgba(255,255,255,0.1) !important;
}

/* Success */
button.success {
  background: linear-gradient(145deg, #28d968, #16a34a);
  color: #fff;
  box-shadow:
    5px 5px 14px rgba(20,163,74,0.4),
    -3px -3px 10px rgba(255,255,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.2);
}
button.success:hover {
  background: linear-gradient(145deg, #30e874, #18b552);
  box-shadow:
    7px 7px 18px rgba(20,163,74,0.5),
    -3px -3px 10px rgba(255,255,255,0.15),
    0 0 20px rgba(34,197,94,0.25);
  transform: translateY(-2px);
}
button.success:active {
  box-shadow:
    inset 4px 4px 10px rgba(15,100,52,0.5),
    inset -2px -2px 6px rgba(255,255,255,0.1) !important;
}

/* Danger */
button.danger {
  background: linear-gradient(145deg, #f55555, #cc2222);
  color: #fff;
  box-shadow:
    5px 5px 14px rgba(204,34,34,0.4),
    -3px -3px 10px rgba(255,255,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.2);
}
button.danger:hover {
  background: linear-gradient(145deg, #f76060, #d42828);
  box-shadow:
    7px 7px 18px rgba(204,34,34,0.5),
    -3px -3px 10px rgba(255,255,255,0.15),
    0 0 20px rgba(239,68,68,0.25);
  transform: translateY(-2px);
}

/* Secondary */
button.secondary {
  background: var(--neo-bg);
  color: var(--blue-500);
  box-shadow: var(--neo-raised);
  border: none;
}
button.secondary:hover {
  color: var(--blue-400);
  box-shadow: var(--neo-raised-lg);
  transform: translateY(-2px);
}
button.secondary:active {
  box-shadow: var(--neo-pressed) !important;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--neo-flat) !important;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

input, select, textarea {
  width: 100%;
  padding: 11px 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--neo-bg);
  border: none;
  border-radius: var(--radius-md);
  /* Inset / pressed look for inputs */
  box-shadow: var(--neo-pressed-sm);
  transition: box-shadow var(--transition-fast);
  outline: none;
  margin-bottom: 0;
}

input:focus, select:focus, textarea:focus {
  box-shadow: var(--neo-focus);
}

input::placeholder { color: var(--text-muted); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a98b0' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-color: var(--neo-bg);
  padding-right: 38px;
}

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

.input-with-button { display: flex; gap: 10px; }
.input-with-button input { flex: 1; }

.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input { width: auto; margin: 0; accent-color: var(--blue-500); }

/* ─── Status Messages ────────────────────────────────────────────────────── */

.status-message {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: none;
  margin-top: 14px;
}

.status-success {
  background: var(--neo-bg);
  color: var(--success-700);
  box-shadow:
    inset 3px 3px 8px rgba(163,177,198,0.5),
    inset -3px -3px 8px rgba(255,255,255,0.7),
    inset 0 0 0 1.5px rgba(34,197,94,0.35);
  display: block;
}

.status-error {
  background: var(--neo-bg);
  color: var(--danger-700);
  box-shadow:
    inset 3px 3px 8px rgba(163,177,198,0.5),
    inset -3px -3px 8px rgba(255,255,255,0.7),
    inset 0 0 0 1.5px rgba(239,68,68,0.35);
  display: block;
}

/* ─── Account Info Bar ───────────────────────────────────────────────────── */

.account-info {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: var(--navy-200);
  padding: 11px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow:
    4px 4px 12px rgba(0,0,0,0.3),
    -2px -2px 6px rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.account-info strong { color: #fff; font-weight: 600; }

/* ─── Login Page ─────────────────────────────────────────────────────────── */

body:has(.login-container) {
  background: linear-gradient(145deg, var(--navy-950) 0%, var(--navy-800) 50%, var(--navy-900) 100%);
}

.main-content:has(.login-container) {
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  background: rgba(25,36,54,0.7);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  padding: 56px 48px;
  border-radius: var(--radius-xl);
  width: 430px;
  max-width: 92vw;
  box-shadow:
    20px 20px 48px rgba(0,0,0,0.55),
    -8px -8px 24px rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(58,142,240,0.9), transparent);
}

.login-container::after {
  content: '';
  position: absolute;
  bottom: 0; left: 30%; right: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.login-container h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 2.2rem;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.login-container > p {
  font-size: 0.78rem;
  color: var(--navy-300);
  margin-bottom: 38px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-container input {
  background: rgba(255,255,255,0.04);
  box-shadow:
    inset 3px 3px 8px rgba(0,0,0,0.35),
    inset -2px -2px 6px rgba(255,255,255,0.05),
    inset 0 0 0 1px rgba(255,255,255,0.07);
  color: #fff;
  margin-bottom: 12px;
  padding: 13px 18px;
  font-size: 0.9rem;
  text-align: left;
  border-radius: var(--radius-md);
}

.login-container input::placeholder { color: rgba(255,255,255,0.25); }

.login-container input:focus {
  box-shadow:
    inset 3px 3px 8px rgba(0,0,0,0.35),
    inset -2px -2px 6px rgba(255,255,255,0.04),
    0 0 0 2.5px rgba(58,142,240,0.5),
    0 0 24px rgba(58,142,240,0.15);
}

.login-container button.primary {
  width: 100%;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(145deg, #2e88e8, #1560b8);
  box-shadow:
    6px 6px 18px rgba(18,80,180,0.6),
    -4px -4px 12px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.2);
  margin-top: 10px;
  border-radius: var(--radius-md);
}

.login-container button.primary:hover {
  box-shadow:
    8px 8px 24px rgba(18,80,180,0.7),
    -4px -4px 12px rgba(255,255,255,0.08),
    0 0 28px rgba(33,121,217,0.35);
}

.login-container a { color: var(--blue-300); font-size: 0.85rem; }
.login-container a:hover { color: var(--blue-400); }

.remember-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  text-align: left;
  color: var(--navy-300);
  font-size: 0.83rem;
}
.remember-container input { width: auto; margin: 0; accent-color: var(--blue-400); }

.create-account-link {
  margin-top: 22px;
  font-size: 0.83rem;
  color: var(--navy-300);
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--neo-bg);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  text-align: center;
  box-shadow: var(--neo-raised);
  border: none;
  transition: all var(--transition-base);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 8px; right: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-300));
  opacity: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--neo-raised-lg);
}

.stat-card:hover::after { opacity: 1; }

.stat-card h4 {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.stat-value {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--navy-800);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.accounts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.accounts-table thead th {
  padding: 11px 18px;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--neo-bg);
  border-bottom: 2px solid rgba(255,255,255,0.6);
  position: relative;
}

.accounts-table thead th::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 1px;
  background: rgba(163,177,198,0.4);
}

.accounts-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  color: var(--text-primary);
  vertical-align: middle;
  position: relative;
}

.accounts-table tbody td::after {
  content: '';
  position: absolute;
  bottom: 0; left: 18px; right: 18px;
  height: 1px;
  background: rgba(163,177,198,0.25);
}

.accounts-table tbody tr:last-child td { border-bottom: none; }
.accounts-table tbody tr:last-child td::after { display: none; }

.accounts-table tbody tr {
  transition: background var(--transition-fast);
}

.accounts-table tbody tr:hover td {
  background: rgba(255,255,255,0.35);
}

.action-buttons { display: flex; gap: 8px; align-items: center; }
.action-buttons button { padding: 6px 13px; font-size: 0.76rem; border-radius: var(--radius-sm); }

/* ─── Log Table ──────────────────────────────────────────────────────────── */

.log-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }

.log-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--neo-bg);
  border-bottom: 2px solid rgba(255,255,255,0.6);
}

.log-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  color: var(--text-secondary);
}

.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: rgba(255,255,255,0.3); }

.log-success { color: var(--success-500); font-weight: 600; }
.log-error   { color: var(--danger-500);  font-weight: 600; }
.log-warning { color: var(--warning-500); font-weight: 600; }

/* ─── Location Cards ─────────────────────────────────────────────────────── */

.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.location-card {
  background: var(--neo-bg);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: none;
  box-shadow: var(--neo-raised);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* Top highlight edge */
.location-card::before {
  content: '';
  position: absolute;
  top: 0; left: 8px; right: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
}

/* Left accent stripe */
.location-card::after {
  content: '';
  position: absolute;
  top: 18px; left: 0;
  width: 3px;
  height: calc(100% - 36px);
  background: var(--border);
  border-radius: 0 2px 2px 0;
  transition: background var(--transition-base);
}

.location-card:hover {
  box-shadow: var(--neo-raised-lg);
  transform: translateY(-3px);
}

.location-card:hover::after {
  background: linear-gradient(180deg, var(--blue-400), var(--blue-300));
}

.location-card h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
}

.location-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.location-card a.primary {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: linear-gradient(145deg, #2e88e8, #1a6bc4);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-base);
  letter-spacing: 0.01em;
  box-shadow:
    4px 4px 10px rgba(22,107,196,0.4),
    -2px -2px 6px rgba(255,255,255,0.15),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.location-card a.primary:hover {
  box-shadow:
    6px 6px 14px rgba(22,107,196,0.5),
    -2px -2px 6px rgba(255,255,255,0.15),
    0 0 16px rgba(33,121,217,0.25);
  transform: translateY(-2px);
}

/* ─── Status Indicators ──────────────────────────────────────────────────── */

.status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-live {
  background: var(--success-500);
  box-shadow:
    0 0 0 3px rgba(34,197,94,0.2),
    0 0 10px rgba(34,197,94,0.4);
  animation: pulse-live 2s infinite;
}

.status-idle    {
  background: var(--warning-500);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}
.status-offline {
  background: var(--danger-500);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.2), 0 0 10px rgba(34,197,94,0.35); }
  50%       { box-shadow: 0 0 0 7px rgba(34,197,94,0.0), 0 0 18px rgba(34,197,94,0.1); }
}

/* ─── Stream Hub ─────────────────────────────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 300px);
  gap: 18px;
}

.quadrant {
  background: var(--neo-bg);
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--neo-raised);
  padding: 20px;
  overflow: auto;
  position: relative;
}

.quadrant::before {
  content: '';
  position: absolute;
  top: 0; left: 10px; right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
  border-radius: var(--radius-full);
}

.quadrant h3 {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.6);
  position: relative;
}

.quadrant h3::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: rgba(163,177,198,0.3);
}

.camera-preview {
  background: #0d1117;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--navy-400);
  height: 100%;
  width: 100%;
  font-size: 0.85rem;
  box-shadow: var(--neo-pressed);
}

.camera-preview video { width: 100%; height: 100%; object-fit: contain; }

#start-stream {
  background: linear-gradient(145deg, #28d968, #14a044) !important;
  box-shadow: 5px 5px 14px rgba(20,160,68,0.45), -3px -3px 10px rgba(255,255,255,0.15), inset 0 1px 0 rgba(255,255,255,0.2) !important;
  font-weight: 700;
  letter-spacing: 0.03em;
}

#stop-stream {
  background: linear-gradient(145deg, #f55555, #cc2222) !important;
  box-shadow: 5px 5px 14px rgba(204,34,34,0.45), -3px -3px 10px rgba(255,255,255,0.12) !important;
  font-weight: 700;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12,18,28,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-content {
  background: var(--neo-bg);
  border-radius: var(--radius-xl);
  border: none;
  box-shadow:
    var(--neo-raised-xl),
    inset 0 1px 0 rgba(255,255,255,0.9);
  padding: 34px;
  width: 520px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-slide-up 240ms cubic-bezier(0.34,1.3,0.64,1);
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  border-radius: var(--radius-full);
}

@keyframes modal-slide-up {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.7);
  position: relative;
}

.modal-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: rgba(163,177,198,0.3);
}

.modal-header h3 { font-size: 1.1rem; color: var(--text-primary); }

.close-modal {
  background: var(--neo-bg);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  overflow: hidden;
  position: static;
  flex-shrink: 0;
  box-shadow: var(--neo-raised-sm);
  transition: all var(--transition-fast);
}

.close-modal:hover {
  color: var(--danger-500);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.7),
    -3px -3px 8px rgba(255,255,255,0.9),
    0 0 0 1.5px rgba(239,68,68,0.3);
}

.close-modal:active {
  box-shadow: var(--neo-pressed-sm) !important;
}

/* ─── Gallery ────────────────────────────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 18px;
}

.gallery-item {
  background: var(--neo-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: none;
  box-shadow: var(--neo-raised);
  transition: all var(--transition-base);
  position: relative;
}

.gallery-item::before {
  content: '';
  position: absolute;
  top: 0; left: 8px; right: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);
  z-index: 1;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--neo-raised-lg);
}

.gallery-item img { width: 100%; height: 175px; object-fit: cover; }

.gallery-item-content { padding: 18px; }
.gallery-item-content h4 { font-size: 0.95rem; color: var(--text-primary); margin-bottom: 4px; }
.gallery-item-content p  { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Settings ───────────────────────────────────────────────────────────── */

.settings-tabs {
  display: flex;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 8px;
  /* Tabs sit in a sunken tray */
  background: var(--neo-bg);
  padding: 6px;
  border-radius: var(--radius-lg);
  box-shadow: var(--neo-pressed-sm);
}

.settings-tab {
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: none;
  margin-bottom: 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-base);
  white-space: nowrap;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  /* Flat within tray */
  box-shadow: none;
  background: transparent;
}

.settings-tab i { margin-right: 7px; font-size: 0.78rem; }
.settings-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.4); }

.settings-tab.active {
  color: var(--blue-600);
  /* Raised "pill" tab effect */
  background: var(--neo-bg);
  box-shadow: var(--neo-raised-sm);
}

.settings-content { display: none; }
.settings-content.active {
  display: block;
  animation: fade-up 200ms ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-section {
  margin-bottom: 34px;
  padding-bottom: 34px;
  border-bottom: 2px solid rgba(255,255,255,0.6);
  position: relative;
}

.settings-section::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 1px;
  background: rgba(163,177,198,0.3);
}

.settings-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-section:last-of-type::after { display: none; }

.settings-section h4 {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 18px;
  font-weight: 700;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.setting-description { font-size: 0.77rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Toggle Switch ──────────────────────────────────────────────────────── */

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: none;
  gap: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--neo-bg);
  box-shadow: var(--neo-raised-sm);
  transition: box-shadow var(--transition-fast);
}

.toggle-row:last-of-type { margin-bottom: 0; }
.toggle-row:hover { box-shadow: var(--neo-raised); }

.toggle-row > div > label,
.toggle-row > label:first-child {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; margin: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--neo-bg);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
  box-shadow: var(--neo-pressed-sm);
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: linear-gradient(145deg, #ffffff, #e8edf4);
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow:
    2px 2px 6px rgba(163,177,198,0.8),
    -1px -1px 4px rgba(255,255,255,0.9);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(145deg, #2e88e8, #1a6bc4);
  box-shadow:
    inset 2px 2px 6px rgba(14,72,150,0.4),
    inset -2px -2px 4px rgba(255,255,255,0.1),
    0 0 12px rgba(33,121,217,0.3);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ─── Role & Status Badges ───────────────────────────────────────────────── */

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--neo-raised-sm);
}

.role-corporate,
.role-professional {
  background: var(--neo-bg);
  color: var(--blue-600);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(33,121,217,0.25);
}
.role-independent,
.role-essential {
  background: var(--neo-bg);
  color: var(--success-700);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(34,197,94,0.3);
}
.role-roam {
  background: var(--neo-bg);
  color: #6d28d9;
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(109,40,217,0.25);
}
.role-enterprise {
  background: var(--neo-bg);
  color: #92400e;
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(245,158,11,0.3);
}
.role-admin {
  background: var(--neo-bg);
  color: #92400e;
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(245,158,11,0.3);
}
.role-user {
  background: var(--neo-bg);
  color: var(--text-secondary);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(163,177,198,0.3);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-active {
  background: var(--neo-bg);
  color: var(--success-700);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(34,197,94,0.3);
}
.status-inactive {
  background: var(--neo-bg);
  color: var(--danger-700);
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(239,68,68,0.3);
}
.status-pending {
  background: var(--neo-bg);
  color: #b45309;
  box-shadow:
    3px 3px 8px rgba(163,177,198,0.6),
    -3px -3px 8px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(245,158,11,0.35);
}

/* ─── Detail Grid ────────────────────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--neo-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--neo-pressed-sm);
}

.detail-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.detail-value { font-size: 0.93rem; color: var(--text-primary); font-weight: 500; }

/* ─── Location Tag ───────────────────────────────────────────────────────── */

.location-tag {
  display: inline-block;
  background: var(--neo-bg);
  color: var(--blue-600);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-right: 3px;
  box-shadow:
    2px 2px 6px rgba(163,177,198,0.6),
    -2px -2px 6px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(33,121,217,0.2);
}

/* ─── Location Assignment Row ────────────────────────────────────────────── */

.location-assignment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  margin-bottom: 8px;
  background: var(--neo-bg);
  box-shadow: var(--neo-raised-sm);
  transition: all var(--transition-fast);
}

.location-assignment-row:hover {
  box-shadow: var(--neo-raised);
  transform: translateY(-1px);
}
.location-assignment-row button { padding: 5px 13px; font-size: 0.74rem; border-radius: var(--radius-sm); }

/* ─── Loading ────────────────────────────────────────────────────────────── */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--neo-bg);
  box-shadow: var(--neo-raised-sm);
  border: 2.5px solid transparent;
  border-top-color: var(--blue-500);
  animation: spin 0.7s linear infinite;
  margin-bottom: 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Search ─────────────────────────────────────────────────────────────── */

.search-container { position: relative; margin-bottom: 22px; }

/* ─── Notification Bell ──────────────────────────────────────────────────── */

.notification-bell {
  position: fixed;
  top: 22px;
  right: 22px;
  background: var(--neo-bg);
  border: none;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--neo-raised);
  cursor: pointer;
  z-index: 999;
  color: var(--text-muted);
  font-size: 0.87rem;
  transition: all var(--transition-base);
}

.notification-bell:hover {
  color: var(--blue-500);
  box-shadow: var(--neo-raised-lg);
  transform: translateY(-2px);
}

.notification-bell:active {
  box-shadow: var(--neo-pressed-sm);
}

/* ─── Settings Button ────────────────────────────────────────────────────── */

.settings-button {
  background: var(--neo-bg);
  border: none;
  color: var(--text-muted);
  font-size: 0.87rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--neo-raised-sm);
}

.settings-button:hover {
  color: var(--blue-500);
  box-shadow: var(--neo-raised);
}

.settings-button:active {
  box-shadow: var(--neo-pressed-sm);
}

/* ─── Device Select ──────────────────────────────────────────────────────── */

.device-select-btn {
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
  background: var(--neo-bg);
  color: var(--text-primary);
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-base);
  box-shadow: var(--neo-raised-sm);
}

.device-select-btn:hover {
  color: var(--blue-600);
  box-shadow: var(--neo-raised);
  transform: translateY(-1px);
}

.device-select-btn:active {
  box-shadow: var(--neo-pressed-sm);
}

/* ─── Agora Video ────────────────────────────────────────────────────────── */

.agora-video-player {
  width: 100%;
  height: 100%;
  background: #0d1117;
  border-radius: var(--radius-md);
  box-shadow: var(--neo-pressed);
}

/* ─── Modal Body Links ───────────────────────────────────────────────────── */

.modal-body-links a {
  display: block;
  padding: 13px 18px;
  margin-bottom: 8px;
  background: var(--neo-bg);
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-base);
  box-shadow: var(--neo-raised-sm);
}

.modal-body-links a:hover {
  color: var(--blue-600);
  box-shadow: var(--neo-raised);
  transform: translateY(-2px);
}

.modal-body-links a:active {
  box-shadow: var(--neo-pressed-sm);
}

/* ─── SPA View Panels ────────────────────────────────────────────────────── */

.view { display: none; flex-direction: column; width: 100%; }
.view.active { display: flex; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .main-content { padding: 26px 30px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Mobile Nav ─────────────────────────────────────────────────────────── */

.mobile-hamburger {
  display: none;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.06);
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow:
    3px 3px 8px rgba(0,0,0,0.4),
    -2px -2px 5px rgba(255,255,255,0.05),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.mobile-hamburger:hover {
  background: rgba(255,255,255,0.1);
  box-shadow:
    5px 5px 12px rgba(0,0,0,0.5),
    -2px -2px 5px rgba(255,255,255,0.04);
}

.mobile-hamburger:active {
  box-shadow:
    inset 3px 3px 8px rgba(0,0,0,0.5),
    inset -2px -2px 4px rgba(255,255,255,0.04);
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #080d14;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-overlay.open { transform: translateX(0); }

.mobile-nav-overlay-header {
  height: 64px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #131a24 0%, #0d1520 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.mobile-nav-overlay-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  border-radius: 2px;
}

.mobile-nav-overlay-header h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: white;
  letter-spacing: -0.01em;
}

.mobile-nav-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.06);
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    2px 2px 6px rgba(0,0,0,0.4),
    -1px -1px 4px rgba(255,255,255,0.04);
  transition: all 0.2s;
}

.mobile-nav-close:hover {
  background: rgba(255,255,255,0.12);
}

.mobile-nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  list-style: none;
  margin: 0;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 26px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s, color 0.15s;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:active,
.mobile-nav-links a.active {
  background: rgba(255,255,255,0.06);
  color: white;
}

.mobile-nav-links a i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.mobile-nav-links a:hover i,
.mobile-nav-links a:active i,
.mobile-nav-links a.active i { color: rgba(255,255,255,0.7); }

.mobile-nav-footer {
  padding: 22px 26px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.mobile-nav-footer a {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(239,68,68,0.75);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
}

.mobile-nav-footer a i {
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding-top: 64px;
  }

  .sidebar {
    width: 100%;
    height: 64px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1000;
    box-shadow:
      0 4px 20px rgba(0,0,0,0.4),
      0 1px 0 rgba(255,255,255,0.04);
  }

  .sidebar ul { display: none !important; }
  .sidebar .bottom { display: none !important; }

  .sidebar h1 {
    font-size: 1.25rem;
    font-weight: 400;
    padding: 0;
    border: none;
    text-align: center;
    flex: 1;
    white-space: nowrap;
  }

  .sidebar h1::after { display: block; }

  .mobile-hamburger { display: flex; }

  .main-content { padding: 16px; }

  .dashboard-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .locations-grid { grid-template-columns: 1fr; }
  .action-buttons { flex-wrap: wrap; }
  .settings-tab i { display: none; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .login-container { padding: 36px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal-content { padding: 22px; }
}

/* ─── Mobile Stream Hub Fixes ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .stream-hub-grid,
    .dashboard-grid,
    .indie-dash-grid,
    .dash-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 12px !important;
    }

    .upcoming-service-item {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .stream-controls-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    .header > div {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header > div > button,
    .header > div > a {
        font-size: 0.78rem;
        padding: 7px 10px;
    }

    .card { overflow-x: auto; }

    .accounts-table { min-width: 420px; }

    .accounts-table thead th,
    .accounts-table tbody td { padding: 10px 12px; font-size: 0.8rem; }

    .main-content { padding: 12px; }

    /* Default header — column layout with full-width buttons */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header button,
    .header a {
        width: 100%;
        justify-content: center;
    }

    /* Stream Hub header — stack title above full-width button bar on mobile */
    .sh-header {
        flex-direction: column !important;
        align-items: stretch !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }

    .sh-header h2 {
        font-size: 1.1rem !important;
        flex: none;
        min-width: 0;
    }

    .sh-header-actions {
        flex-shrink: 1;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        justify-content: flex-start;
    }

    .sh-btn {
        flex: 1 1 auto !important;
        font-size: 0.78rem !important;
        padding: 9px 10px !important;
        justify-content: center;
    }

    .sh-btn-label {
        display: inline !important;
    }

    /* Header action button rows (dashboard, bookings) — full width on mobile */
    .header-actions {
        width: 100%;
        flex-direction: column !important;
    }
    .header-actions button,
    .header-actions a {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Audio mixer — single column on mobile */
    .audio-mixer-grid {
        grid-template-columns: 1fr !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }

    .stat-value { font-size: 1.9rem; }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
    }

    .modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #addBookingModal .modal-content div[style*="grid-template-columns:1fr 1fr"] {
        display: block !important;
    }

    #addBookingModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > div {
        margin-bottom: 12px;
    }

    .locations-grid { grid-template-columns: 1fr !important; }

    .settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .account-info {
        font-size: 0.75rem;
        padding: 8px 12px;
    }

    .notification-bell { display: none; }

    /* Fixed banners — appear below the 64px mobile top bar */
    #streamEndingBanner,
    #geolockMissingBanner,
    #remoteAuditBanner {
        top: 64px !important;
        z-index: 990 !important;
    }

    /* Quadrant — auto height on mobile, fixed min */
    .quadrant {
        min-height: auto !important;
        height: auto !important;
    }

    /* Camera preview — explicit height on mobile so it doesn't collapse */
    .camera-preview {
        height: 200px !important;
        min-height: 200px !important;
    }

    /* Stream controls — keep 2×2 grid, give buttons explicit height */
    #analytics p { margin-bottom: 6px; }

    /* Stream Hub — two-panel row stacks vertically on mobile */
    #stream-details-card,
    #bookings-card {
        flex: none !important;
        width: 100% !important;
    }
    div:has(> #stream-details-card) {
        flex-direction: column !important;
    }

    /* Upcoming service rows — prevent text squash */
    .upcoming-service-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Detail grid — already handled by 768px rule above, but force 1-col in stream hub */
    .detail-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stream controls 2×2 button grid — explicit height so buttons render */
    #stream-hub-content .quadrant div[style*="grid-template-columns"] button,
    #stream-hub-content .quadrant div[style*="grid-template-columns"] a {
        height: 48px !important;
        font-size: 0.85rem !important;
    }
}

/* ─── Audio Mixer ────────────────────────────────────────────────────────── */
/* ─── Analytics Rows ─────────────────────────────────────────────────────── */
.analytics-rows { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.analytics-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(212,218,230,0.45);
    font-size: 0.85rem;
}
.analytics-row:last-of-type { border-bottom: none; }
.ar-key {
    width: 88px;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.ar-val {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* ─── Audio Mixer ─────────────────────────────────────────────────────────── */
.audio-mixer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.audio-channel {
    background: var(--neo-surface);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--neo-raised-sm);
}
.audio-channel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.audio-channel-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.mic-icon { background: linear-gradient(135deg, #3a8ef0, #2179d9); color: #fff; }
.mem-icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); color: #fff; }
.audio-channel-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.audio-channel-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.audio-channel-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 36px;
    text-align: right;
}
.audio-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
    /* fill set dynamically by JS */
    background: var(--border);
}
.audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(163,177,198,0.7), -1px -1px 3px rgba(255,255,255,0.9);
    border: none;
    transition: transform 120ms ease;
}
.audio-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.audio-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 2px 2px 5px rgba(163,177,198,0.7);
}
.mic-level-track {
    margin-top: 8px;
    height: 4px;
    background: rgba(212,218,230,0.5);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: inset 1px 1px 3px rgba(163,177,198,0.4);
}
.mic-level-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e 0%, #22c55e 60%, #f59e0b 85%, #ef4444 100%);
    border-radius: var(--radius-full);
    transition: width 0.08s linear;
}


/* Remote Control modal — full-screen on mobile (too complex for bottom sheet) */
@media (max-width: 768px) {
    #remoteControlModal {
        align-items: flex-start !important;
        padding: 0 !important;
    }
    #remoteControlModal .modal-content {
        position: fixed !important;
        inset: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; }

    .action-buttons { flex-direction: column; }

    .action-buttons button,
    .action-buttons a {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Showreel Library ───────────────────────────────────────────────────── */

.showreel-library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: none;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--neo-bg);
  box-shadow: var(--neo-raised-sm);
  transition: all var(--transition-fast);
  gap: 12px;
}

.showreel-library-item:last-child { margin-bottom: 0; }

.showreel-library-item:hover {
  box-shadow: var(--neo-raised);
  transform: translateY(-1px);
}

/* ─── Transition Picker ──────────────────────────────────────────────────── */

.transition-option {
  user-select: none;
  background: var(--neo-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--neo-raised-sm);
  border: none !important;
  transition: all var(--transition-base);
}

.transition-option:hover {
  box-shadow: var(--neo-raised) !important;
  color: var(--blue-600) !important;
  background: var(--neo-bg) !important;
  transform: translateY(-2px);
}

.transition-option.selected {
  box-shadow: var(--neo-pressed-sm) !important;
  color: var(--blue-600) !important;
  background: var(--neo-bg) !important;
}

/* ─── AI Chat Bubbles ────────────────────────────────────────────────────── */

.chat-messages { padding: 4px 0; }

.chat-bubble {
  max-width: 82%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: bubble-in 0.2s ease;
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble.ai {
  background: var(--neo-bg);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: var(--neo-raised-sm);
}

.chat-bubble.user {
  background: linear-gradient(145deg, #2e88e8, #1a6bc4);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
  box-shadow:
    4px 4px 12px rgba(22,107,196,0.45),
    -2px -2px 6px rgba(255,255,255,0.1);
}

.chat-bubble.typing {
  background: var(--neo-bg);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  padding: 14px 18px;
  box-shadow: var(--neo-raised-sm);
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
  box-shadow: var(--neo-raised-sm);
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ─── Location Picker Modal ──────────────────────────────────────────────── */

.location-picker-account {
  border: none;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--neo-raised-sm);
  transition: box-shadow var(--transition-fast);
}

.location-picker-account:hover { box-shadow: var(--neo-raised); }

.location-picker-account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--neo-bg);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  user-select: none;
  transition: background var(--transition-fast);
}

.location-picker-account-header:hover { background: rgba(255,255,255,0.4); }

.location-picker-locations { background: var(--neo-surface); }

.location-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 12px 44px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 10px;
  background: var(--neo-bg);
}

.location-picker-item:last-child { border-bottom: none; }

.location-picker-item:hover {
  background: rgba(255,255,255,0.5);
  box-shadow: inset 3px 0 0 var(--blue-400);
}

.location-picker-item:hover .fa-arrow-right {
  color: var(--blue-500) !important;
  transform: translateX(3px);
  transition: all var(--transition-fast);
}

/* ─── Camera Slot Rows ───────────────────────────────────────────────────── */

.camera-slot-row {
  background: var(--neo-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--neo-raised-sm);
  border: none !important;
  transition: box-shadow var(--transition-base);
}

.camera-slot-row:hover { box-shadow: var(--neo-raised); }

.camera-label-input:focus {
  outline: none;
  border-bottom: 2px solid var(--blue-400) !important;
}

/* ─── Viewer Camera Strip ────────────────────────────────────────────────── */

#camera-strip { transition: opacity var(--transition-base); }

#camera-strip > div {
  border: none !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--neo-raised-sm);
  transition: box-shadow 0.2s, transform 0.15s;
}

#camera-strip > div:hover {
  transform: translateY(-3px);
  box-shadow: var(--neo-raised) !important;
}

/* Active/selected camera in strip */
#camera-strip > div.active,
#camera-strip > div[style*="border: 2px solid"] {
  box-shadow:
    var(--neo-pressed-sm),
    0 0 0 2px var(--blue-500) !important;
}

/* ─── Main Video Player Fade ─────────────────────────────────────────────── */

#main-video-player { transition: opacity 0.28s ease; }

/* ─── Geo-Lock Badge ─────────────────────────────────────────────────────── */

.geo-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.geo-lock-badge.active {
  background: var(--neo-bg);
  color: var(--success-700);
  box-shadow:
    2px 2px 6px rgba(163,177,198,0.6),
    -2px -2px 6px rgba(255,255,255,0.9),
    inset 0 0 0 1.5px rgba(34,197,94,0.3);
}

.geo-lock-badge.inactive {
  background: var(--neo-bg);
  color: var(--text-muted);
  box-shadow:
    2px 2px 6px rgba(163,177,198,0.5),
    -2px -2px 6px rgba(255,255,255,0.8),
    inset 0 0 0 1.5px rgba(163,177,198,0.25);
}

/* ─── Neomorphic Dividers ────────────────────────────────────────────────── */
/* Double-line dividers: white top + grey bottom creates depth illusion */

hr, .neo-divider {
  border: none;
  height: 2px;
  background: linear-gradient(rgba(255,255,255,0.7), rgba(163,177,198,0.3));
  border-radius: var(--radius-full);
  margin: 20px 0;
}

/* ─── Scrollbar Neomorphic Style ─────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track {
  background: rgba(196, 205, 216, 0.15);
  border-radius: var(--radius-full);
  margin: 24px 0;
}
::-webkit-scrollbar-thumb {
  background: rgba(180, 192, 204, 0.7);
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 165, 180, 0.9);
}
::-webkit-scrollbar-corner { background: transparent; }
/* ─── Dashboard Widget Panel ─────────────────────────────────────────────── */

/* ─── Dashboard Edit Overlay ──────────────────────────────────────────────── */

/* Full-screen transparent overlay — the inner panel slides up from it */
.widget-panel {
    position: fixed;
    inset: 0;
    z-index: 1051;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.widget-panel.open {
    opacity: 1;
    pointer-events: all;
}

/* The actual panel card */
.widget-panel-inner {
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 32px 80px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 1120px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(12px);
    transition: transform 0.22s cubic-bezier(0.34,1.3,0.64,1);
}
.widget-panel.open .widget-panel-inner {
    transform: scale(1) translateY(0);
}

/* Backdrop — blurs & dims the dashboard behind */
.widget-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,18,32,0.45);
    z-index: 1050;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.widget-panel-backdrop.open { display: block; }

/* Header row: title+hint on left, buttons on right */
.widget-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 16px;
}
.widget-panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 3px;
    border: none;
    padding: 0;
    color: var(--text-primary);
}
.widget-panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.widget-panel-close {
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.widget-panel-close:hover { background: var(--danger-100,#fee2e2); color: var(--danger-700,#b91c1c); border-color: var(--danger-300,#fca5a5); }

/* Scrollable grid area */
.widget-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

/* ─── Widget Grid Preview ──────────────────────────────────────────────────── */
.wp-grid-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: dense;
    gap: 14px;
}

/* Each widget card in the preview */
.wp-grid-item {
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 16px 12px;
    cursor: grab;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}
.wp-grid-item:hover {
    border-color: var(--blue-300);
    box-shadow: 0 4px 16px rgba(59,130,246,0.1);
    transform: translateY(-1px);
}
.wp-grid-item[data-span="2"] { grid-column: span 2; }
.wp-grid-item.dragging {
    opacity: 0.25;
    cursor: grabbing;
    transform: scale(0.97);
}
.wp-grid-item.drag-over {
    border-color: var(--blue-500);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
    transform: translateY(-2px);
}
.wp-grid-item.hidden-widget {
    opacity: 0.4;
    border-style: dashed;
}
.wp-grid-item.hidden-widget:hover {
    opacity: 0.65;
}

/* Drop position indicator */
.wp-drag-placeholder {
    border: 2px dashed var(--blue-400, #60a5fa);
    border-radius: var(--radius-md);
    background: rgba(59,130,246,0.06);
    min-height: 90px;
    pointer-events: none;
    transition: none;
}
.wp-drag-placeholder[data-span="2"] { grid-column: span 2; }

/* Drag handle indicator (top-left dot pattern) */
.wp-drag-dots {
    position: absolute;
    top: 10px;
    right: 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
    opacity: 0.5;
    cursor: grab;
}

/* Top section: icon + label */
.wp-item-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.wp-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-500);
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(59,130,246,0.18);
}
.wp-item-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wp-item-hidden-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1px;
}

/* Bottom section: size toggle + visibility toggle */
.wp-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.wp-span-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.72rem;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.12s;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 600;
}
.wp-span-btn:hover {
    background: #eff6ff;
    border-color: var(--blue-400);
    color: var(--blue-600);
}
.wp-span-btn.is-half {
    background: #eff6ff;
    border-color: var(--blue-300);
    color: var(--blue-600);
}

/* Toggle switch */
.wp-toggle {
    position: relative;
    width: 38px;
    height: 21px;
    flex-shrink: 0;
}
.wp-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.wp-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 21px;
    cursor: pointer;
    transition: background 0.2s;
}
.wp-toggle-slider::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.wp-toggle input:checked + .wp-toggle-slider { background: var(--blue-500); }
.wp-toggle input:checked + .wp-toggle-slider::before { transform: translateX(17px); }

/* Edit Dashboard button */
.edit-dash-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.edit-dash-btn:hover { border-color: var(--blue-500); color: var(--blue-500); background: #eff6ff; }

@media (max-width: 768px) {
    .widget-panel { padding: 0; align-items: flex-end; }
    .widget-panel-inner { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; }
    .wp-grid-preview { grid-template-columns: 1fr; }
    .wp-grid-item[data-span="2"] { grid-column: span 1; }
    .widget-panel-header {
        padding: 16px 16px 12px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .widget-panel-header > div:first-child { width: 100%; }
    .widget-panel-header > div:last-child { width: 100%; justify-content: flex-end; }
    .widget-panel-list { padding: 14px 16px 20px; }
    .wp-grid-item { min-height: 80px; padding: 12px; }
}

/* ─── Enhanced Mobile Fixes ──────────────────────────────────────────────────
   Covers 375px–430px (iPhone SE, Android compact) and general modal/form
   improvements not caught by the 768px / 480px breakpoints above.
   ─────────────────────────────────────────────────────────────────────────── */

/* 1. Collapse inline 2-col form grids in specific modals at 480px and below */
@media (max-width: 480px) {
  /* Booking form */
  #addBookingModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > *,
  #addBookingModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] > * { margin-bottom: 10px; }

  /* Stream info forms (stream-hub + RC) */
  #streamInfoModal .modal-content div[style*="grid-template-columns:1fr 1fr"],
  #streamInfoModal .modal-content div[style*="grid-template-columns: 1fr 1fr"],
  #rcStreamInfoModal .modal-content div[style*="grid-template-columns:1fr 1fr"],
  #rcStreamInfoModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] {
    display: block !important;
    margin-bottom: 0 !important;
  }
  #streamInfoModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > *,
  #streamInfoModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] > *,
  #rcStreamInfoModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > *,
  #rcStreamInfoModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] > * {
    margin-bottom: 10px !important;
  }

  /* Location create/edit modal geo-lock grid */
  #createLocationModal .modal-content div[style*="grid-template-columns:1fr 1fr"],
  #editLocationModal .modal-content div[style*="grid-template-columns:1fr 1fr"] {
    display: block !important;
  }
  #createLocationModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > *,
  #editLocationModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > * {
    margin-bottom: 10px !important;
  }

  /* Audit modal — camera/mic grid */
  #locationAuditModal .modal-content div[style*="grid-template-columns:1fr 1fr"],
  #locationAuditModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] {
    display: block !important;
  }
  #locationAuditModal .modal-content div[style*="grid-template-columns:1fr 1fr"] > *,
  #locationAuditModal .modal-content div[style*="grid-template-columns: 1fr 1fr"] > * {
    margin-bottom: 12px !important;
  }

  /* Audit modal status bar — stack vertically, full-width button */
  #locationAuditModal #runFullAuditBtn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* 2. Extra-small screens (375px–430px) */
@media (max-width: 430px) {
  /* Reduce stat value font size so it fits in 2-col grid */
  .stat-value { font-size: 1.5rem !important; }
  .stat-label { font-size: 0.68rem !important; }
  .stat-card { padding: 16px 14px !important; }

  /* Modal padding — tighter on very small screens */
  .modal-content { padding: 16px !important; }
  .modal-header { padding-bottom: 12px; margin-bottom: 12px; }
  .modal-header h3 { font-size: 1rem; }

  /* Form groups — reduce spacing */
  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 0.78rem; }

  /* RC modal header — compact buttons */
  #remoteControlModal #rcAddStreamInfoBtn,
  #remoteControlModal #rcMemorialBtn {
    font-size: 0.72rem !important;
    padding: 5px 8px !important;
  }

  /* RC analytics quadrant — compact text */
  #rc-analytics-quadrant p { font-size: 0.82rem; margin-bottom: 5px; }
  #rc-stream-status-indicator { font-size: 1rem !important; }

  /* RC status bar — wrap tightly */
  #remoteControlModal .modal-content > div[style*="justify-content:space-between"] {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }

  /* Command log — slightly less height on small screens */
  #rc-command-log { max-height: 120px !important; }

  /* Camera preview in RC modal */
  #rc-camera-preview { height: 160px !important; min-height: 160px !important; }

  /* Bookings table row — allow text to wrap */
  .upcoming-service-row { flex-direction: column; align-items: flex-start !important; }
  .upcoming-service-row > div:last-child { align-self: flex-end; margin-top: -4px; }

  /* Analytics table — ensure it scrolls rather than overflows */
  #sessionsTableContainer { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 3. View stream — ensure controls are accessible on all phones */
@media (max-width: 480px) {
  .viewer-container { padding: 12px 10px !important; }
}

/* 4. Settings / Accounts tables — compact at mobile */
@media (max-width: 480px) {
  .accounts-table { min-width: 380px; }
  .accounts-table thead th,
  .accounts-table tbody td { padding: 8px 10px; font-size: 0.77rem; }
}

/* 5. Homepage — nav and hero safe on small screens */
@media (max-width: 430px) {
  .hp-nav { padding: 0 14px !important; }
  .hp-hero-headline { font-size: clamp(1.6rem, 8vw, 3rem) !important; }
}

/* 6. General: ensure all modals have scrollable content body */
@media (max-width: 768px) {
  .modal-content { overflow-y: auto; }

  /* Prevent any fixed-width card from causing horizontal overflow */
  .card { max-width: 100%; box-sizing: border-box; }
  .main-content { overflow-x: hidden; }

  /* Bookings header row — full-width search on mobile */
  .action-buttons input[type="search"],
  .action-buttons input[type="text"] { width: 100% !important; }

  /* Ensure all buttons in action-buttons bar wrap */
  .action-buttons { flex-wrap: wrap; gap: 8px; }

  /* Dashboard page — section headers flex-wrap */
  .header { flex-wrap: wrap; }
}
