/* xazz Admin – Tantrwm glassmorphism (ogof style) */

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

:root {
  --primary: #24a3ff;
  --primary-contrast: #041423;
  --primary-dim: rgba(36,163,255,0.18);
  --video: #22c18f;
  --events: #f08a45;
  --digital: #8f7cff;
  --bg-body: #090d13;
  --bg-surface: rgba(255,255,255,0.05);
  --bg-glass: rgba(18, 24, 34, 0.86);
  --bg-glass-hover: rgba(26, 33, 47, 0.96);
  --bg-glass-strong: rgba(16, 22, 31, 0.92);
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.16);
  --text-1: #edf3fb;
  --text-2: #a9b5c4;
  --text-3: #8392a4;
  --font: 'Montserrat', -apple-system, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --blur: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.33);
  --shadow-sm: 0 5px 18px rgba(0,0,0,0.24);
  --overlay-bg: rgba(0,0,0,0.55);
  --surface-soft: rgba(255,255,255,0.04);
  --surface-soft-2: rgba(255,255,255,0.06);
  --surface-hover: rgba(255,255,255,0.03);
  --danger: #f16464;
  --success: #20c997;
  /* Back-compat for older inline styles */
  --tantrwm-blue: #24a3ff;
  --tantrwm-blue-dark: #168de6;
  --tantrwm-blue-light: #4bb8ff;
  --header-bg: rgba(11, 15, 22, 0.9);
  --sidebar-bg: rgba(12, 17, 26, 0.96);
  --dropdown-bg: rgba(14, 20, 30, 0.98);
}

body.theme-light {
  --primary: #2b8df9;
  --primary-contrast: #ffffff;
  --primary-dim: rgba(43,141,249,0.14);
  --bg-body: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-glass: #ffffff;
  --bg-glass-hover: #f8fbff;
  --bg-glass-strong: #ffffff;
  --border: rgba(15, 32, 56, 0.1);
  --border-strong: rgba(15, 32, 56, 0.14);
  --text-1: #1a2a3e;
  --text-2: #52657f;
  --text-3: #7a8ca2;
  --header-bg: rgba(255,255,255,0.92);
  --sidebar-bg: #f8fafc;
  --dropdown-bg: rgba(255,255,255,0.98);
  --shadow: 0 10px 24px rgba(30, 56, 92, 0.1);
  --shadow-sm: 0 4px 12px rgba(30, 56, 92, 0.08);
  --overlay-bg: rgba(16, 31, 52, 0.24);
  --surface-soft: #f7faff;
  --surface-soft-2: #f2f7ff;
  --surface-hover: #f6f9fd;
  --danger: #c93a3a;
  --success: #178a67;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-body);
  min-height: 100vh;
  transition: background-color 0.22s ease, color 0.22s ease;
  color-scheme: dark;
}
body.theme-light { color-scheme: light; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.78rem 1.25rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-glass); color: var(--text-1);
  cursor: pointer; font-size: 1.2rem;
}
.nav-toggle:hover { background: var(--bg-glass-hover); }

.header-app-title {
  flex: 1;
  margin: 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-org-separator {
  margin: 0 0.35rem;
  color: var(--text-3);
  font-weight: 500;
}
.header-org-name {
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.88rem;
}

.header-user { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.header-name { font-size: 0.875rem; color: var(--text-2); }
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--bg-glass-hover); }
.theme-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}
@media (max-width: 640px) { .header-name { display: none; } }

/* User dropdown */
.header-user-dropdown { position: relative; }
.header-user-trigger {
  display: flex; align-items: center; gap: 0.5rem;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem; cursor: pointer; font-family: var(--font); font-size: 0.875rem;
  color: var(--text-1); transition: all 0.15s;
}
.header-user-trigger:hover { background: var(--bg-glass); border-color: var(--border); }
.header-avatar { width: 1.75rem; height: 1.75rem; border-radius: 50%; object-fit: cover; }
.header-avatar-initial {
  width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem;
  color: var(--primary); flex-shrink: 0;
}
.header-chevron { font-size: 0.5rem; color: var(--text-3); margin-left: 0.25rem; transition: transform 0.2s; }
.header-user-dropdown.open .header-chevron { transform: rotate(180deg); }
.header-user-menu {
  display: none; position: absolute; top: calc(100% + 0.375rem); right: 0;
  min-width: 12rem; background: var(--dropdown-bg); backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); padding: 0.375rem; z-index: 500;
}
.header-user-dropdown.open .header-user-menu { display: block; }
.header-user-item {
  display: block; width: 100%; text-align: left;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.8125rem; line-height: 1.35;
  color: var(--text-1); text-decoration: none;
  transition: background 0.1s; background: none; border: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.header-user-item:hover { background: var(--bg-glass-hover); text-decoration: none; }
.header-user-menu .logout-form { margin: 0; }

/* ===== Global Search ===== */
.global-search { position: relative; flex: 1; max-width: 28rem; margin: 0 0.75rem; }
.global-search.global-search-placeholder { visibility: hidden; pointer-events: none; }
.gs-input-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-soft); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0 0.75rem; transition: all 0.15s;
}
.gs-input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.gs-icon { font-size: 0.875rem; color: var(--text-3); flex-shrink: 0; line-height: 1; }
.gs-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font); font-size: 0.8125rem; color: var(--text-1);
  padding: 0.5rem 0; min-width: 0;
}
.gs-input::placeholder { color: var(--text-3); }
.gs-kbd {
  font-family: var(--font); font-size: 0.625rem; font-weight: 600;
  color: var(--text-3); background: var(--surface-soft-2);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.1rem 0.375rem; line-height: 1.4; flex-shrink: 0;
}
@media (max-width: 640px) {
  .header-app-title { margin: 0 0.25rem; font-size: 0.88rem; }
}
@media (max-width: 900px) {
  .app-header { padding: 0.5rem 0.75rem; }
  .app-main { padding: 1rem; }
}

/* Body: contains sidebar + main */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ===== Sidebar ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: var(--overlay-bg); backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }

/* Mobile: fixed off-screen drawer */
.app-sidebar {
  position: fixed; top: 0; left: 0; z-index: 200;
  width: 270px; max-width: 85vw; height: 100vh;
  padding: 1.25rem 0 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.app-sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }
.app-sidebar.open { transform: translateX(0); }

.sidebar-logo { padding: 0 1.25rem 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.sidebar-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.sidebar-logo img { height: 36px; width: auto; display: block; }
.sidebar-collapse-toggle {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-glass);
  color: var(--text-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.sidebar-collapse-toggle svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.sidebar-collapse-toggle:hover { background: var(--bg-glass-hover); color: var(--text-1); }

.app-sidebar nav { display: flex; flex-direction: column; flex: 1; }

.nav-section-picker {
  padding: 0.5rem 1.25rem 0.75rem;
}

.nav-section-picker select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-soft-2);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow-sm);
}

.nav-section-panel {
  display: none;
  flex-direction: column;
  padding-bottom: 0.5rem;
}

.nav-section-panel.active {
  display: flex;
}

.nav-section-panel > a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-section-panel > a:hover {
  color: var(--text-1);
  background: var(--bg-glass-hover);
  text-decoration: none;
}

.nav-section-panel > a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--primary-dim);
}

.app-sidebar nav > a {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  color: var(--text-2); font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.app-sidebar nav > a .nav-text {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.nav-icon {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.nav-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.nav-group-items a .nav-text {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.app-sidebar nav > a:hover { color: var(--text-1); background: var(--bg-glass-hover); text-decoration: none; }
.app-sidebar nav > a.active { color: var(--primary); border-left-color: var(--primary); background: var(--primary-dim); }

.nav-badge {
  margin-left: auto;
  background: #ffb74d;
  color: #111;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
}

.nav-group { margin: 0; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 1.25rem;
  margin: 0; border: none; background: none; cursor: pointer;
  color: var(--text-3); font-family: var(--font); font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-group-toggle:hover { color: var(--text-1); background: var(--bg-glass-hover); }
.nav-group.open > .nav-group-toggle { color: var(--text-2); }

.nav-chevron {
  margin-left: auto; font-size: 0.625rem; transition: transform 0.2s ease; line-height: 1;
}
.nav-group.open > .nav-group-toggle .nav-chevron { transform: rotate(90deg); }

.nav-group-items {
  display: none; flex-direction: column;
  overflow: hidden;
}
.nav-group.open > .nav-group-items { display: flex; }

.nav-group-items a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4375rem 1.25rem 0.4375rem 2.875rem;
  color: var(--text-2); font-size: 0.8125rem; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-group-items a:hover { color: var(--text-1); background: var(--bg-glass-hover); }
.nav-group-items a.active { color: var(--primary); border-left-color: var(--primary); background: var(--primary-dim); }

.sidebar-org {
  margin-top: auto;
  color: var(--text-3);
  font-size: 0.8rem;
  padding: 0.75rem 1.25rem 0.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-version {
  color: var(--text-3);
  font-size: 0.75rem;
  padding: 0 1.25rem 1rem;
}

/* Main content area */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.35rem;
}

/* Desktop: sidebar becomes static, sits beside main */
@media (min-width: 1024px) {
  body.app-shell {
    height: 100vh;
    overflow: hidden;
  }
  body.app-shell .app-body {
    height: calc(100vh - 56px);
    overflow: hidden;
  }
  body.app-shell .app-sidebar {
    position: sticky;
    top: 0;
    transform: none;
    width: 260px;
    height: calc(100vh - 56px);
    min-height: calc(100vh - 56px);
  }
  body.app-shell .nav-toggle { display: none; }
  body.app-shell .sidebar-overlay { display: none !important; }
  body.app-shell .app-main {
    padding: 2rem 2.5rem;
    height: calc(100vh - 56px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  body.app-shell .app-main::-webkit-scrollbar { width: 0; height: 0; display: none; }

  body.app-shell.sidebar-collapsed .app-sidebar {
    width: 82px;
  }
  body.app-shell.sidebar-collapsed .sidebar-logo {
    padding: 0 0.75rem 1rem;
  }
  body.app-shell.sidebar-collapsed .sidebar-logo-row {
    justify-content: center;
  }
  body.app-shell.sidebar-collapsed .sidebar-logo img {
    height: 26px;
  }
  body.app-shell.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
  }
  body.app-shell.sidebar-collapsed .app-sidebar nav > a,
  body.app-shell.sidebar-collapsed .nav-group-toggle,
  body.app-shell.sidebar-collapsed .nav-group-items a {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  body.app-shell.sidebar-collapsed .nav-group-toggle {
    pointer-events: none;
  }
  body.app-shell.sidebar-collapsed .nav-group-items {
    display: flex;
  }
  body.app-shell.sidebar-collapsed .nav-chevron,
  body.app-shell.sidebar-collapsed .nav-text,
  body.app-shell.sidebar-collapsed .sidebar-org,
  body.app-shell.sidebar-collapsed .sidebar-version {
    display: none;
  }
  body.app-shell.sidebar-collapsed .nav-badge {
    position: absolute;
    right: 7px;
    top: 4px;
    margin-left: 0;
  }
  body.app-shell.sidebar-collapsed .nav-group-items a {
    position: relative;
  }
}

/* ===== Profile settings ===== */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.profile-layout > .glass-panel {
  padding: 1.25rem;
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 170px);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-sidebar-title {
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  flex: 1;
}

.profile-sidebar nav a {
  display: flex;
  align-items: center;
  padding: 0.66rem 1rem;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
}

.profile-sidebar nav a:hover {
  color: var(--text-1);
  background: var(--bg-glass-hover);
}

.profile-sidebar nav a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--primary-dim);
}

@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-sidebar { min-height: 0; }
  .profile-layout > .glass-panel { padding: 1rem; }
}

/* ===== Glass cards ===== */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.glass:hover { background: var(--bg-glass-hover); }

.glass-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

/* ===== Stat cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  text-decoration: none; color: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.stat-card:hover { background: var(--bg-glass-hover); border-color: var(--primary); text-decoration: none; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--text-1); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card .label { font-size: 0.875rem; color: var(--text-2); margin-top: 0.25rem; }
@media (max-width: 640px) {
  .stat-card .value { font-size: 1.375rem; }
  .stats-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font); font-size: 0.9375rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.btn-primary:hover { background: var(--tantrwm-blue-dark); border-color: var(--tantrwm-blue-dark); color: #fff; }
.btn-secondary { background: var(--bg-glass); color: var(--text-1); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-glass-hover); }
.btn-ghost { background: var(--bg-glass); color: var(--text-1); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-glass-hover); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }
.btn:disabled,
.btn[disabled] {
  background: var(--surface-soft-2) !important;
  color: var(--text-3) !important;
  border-color: var(--border-strong) !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  opacity: 1;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: 0.875rem; font-weight: 500;
  color: var(--text-2); margin-bottom: 0.375rem;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  width: 100%; padding: 0.625rem 0.875rem;
  font-family: var(--font); font-size: 1rem;
  color: var(--text-1);
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-3); }

/* ===== Login ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: var(--bg-body);
}
.login-box {
  width: 100%; max-width: 420px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
}
.login-box img { display: block; margin: 0 auto 1.5rem; height: 48px; }
.login-box h1 { font-size: 1.25rem; font-weight: 600; text-align: center; margin: 0 0 1.5rem; color: var(--text-1); }

/* ===== Alerts ===== */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: rgba(218,54,51,0.12); border: 1px solid rgba(218,54,51,0.3); color: var(--danger); }
.alert-success { background: rgba(0,204,153,0.12); border: 1px solid rgba(0,204,153,0.3); color: var(--success); }
.flash-message { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.flash-message.success { background: rgba(0,204,153,0.12); border: 1px solid rgba(0,204,153,0.3); color: var(--success); }
.flash-message.error { background: rgba(218,54,51,0.12); border: 1px solid rgba(218,54,51,0.3); color: var(--danger); }

/* ===== Page elements ===== */
.page-title { font-size: clamp(1.42rem, 1.2rem + 0.7vw, 1.85rem); font-weight: 750; line-height: 1.2; margin: 0 0 0.45rem; color: var(--text-1); letter-spacing: 0.01em; }
.page-intro { color: var(--text-2); margin: 0 0 1.15rem; max-width: 72ch; font-size: 0.96rem; line-height: 1.55; }
.powered-by { text-align: center; font-size: 0.8125rem; color: var(--text-3); margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.app-footer { padding: 0.75rem 1.25rem; }
.app-footer .powered-by { margin: 0; padding: 0; border: none; }

.app-main h1,
.app-main h2 {
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.app-main h2 {
  font-size: clamp(1.35rem, 1.15rem + 0.6vw, 1.72rem);
  margin: 0 0 0.55rem;
  font-weight: 750;
}

.app-main h3 {
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.18rem);
  margin: 0 0 0.55rem;
  font-weight: 700;
}

.app-main p {
  max-width: 76ch;
  color: var(--text-2);
}

/* ===== Tables ===== */
table {
  width: 100%;
  color: var(--text-1);
  border-collapse: collapse;
}
table th { font-weight: 600; }
table td, table th {
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Schedule timeline ===== */
.schedule-timeline { display: flex; flex-direction: column; gap: 0.75rem; }
.timeline-header { display: grid; grid-template-columns: 180px 1fr; gap: 0.75rem; align-items: center; }
.timeline-label { font-size: 0.85rem; color: var(--text-3); }
.timeline-hours { position: relative; height: 18px; color: var(--text-3); font-size: 0.7rem; }
.timeline-hours span { position: absolute; transform: translateX(-50%); }
.timeline-row { display: grid; grid-template-columns: 180px 1fr; gap: 0.75rem; align-items: center; }
.timeline-bar { position: relative; height: 34px; background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.timeline-block {
  position: absolute; top: 3px; bottom: 3px;
  border-radius: 8px; padding: 0 0.5rem;
  display: flex; align-items: center;
  color: #0b0f13; font-size: 0.75rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timeline-block.bar-media { background: var(--primary); }
.timeline-block.bar-playlist { background: var(--digital); color: #120717; }
.timeline-block.bar-black { background: #11161d; color: var(--text-2); border: 1px dashed var(--border-strong); }
.timeline-off {
  position: absolute;
  top: 0; bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0.05),
    rgba(255,255,255,0.05) 6px,
    rgba(255,255,255,0.12) 6px,
    rgba(255,255,255,0.12) 12px
  );
  border-right: 1px solid rgba(255,255,255,0.12);
  border-left: 1px solid rgba(255,255,255,0.12);
  z-index: 3;
  pointer-events: none;
}
.timeline-bar .timeline-block { position: relative; z-index: 1; }

/* ===== Screen hours ===== */
.screen-hours-card {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.screen-hours-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 1rem;
  align-items: end;
}
@media (max-width: 1100px) {
  .screen-hours-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .screen-hours-grid { grid-template-columns: 1fr; }
}
/* ===== Billing plans ===== */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.plan-card {
  display: block;
  cursor: pointer;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-glass);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.plan-card:hover { background: var(--bg-glass-hover); border-color: var(--primary); }
.plan-card.selected { border-color: var(--primary); background: var(--primary-dim); }
.plan-card input[type="radio"] { margin-right: 0.5rem; }
.plan-price { display: block; font-size: 1.25rem; font-weight: 700; color: var(--primary); margin: 0.35rem 0 0.2rem; }
.plan-price small { font-size: 0.75rem; color: var(--text-3); margin-left: 0.2rem; }
.plan-detail { display: block; font-size: 0.85rem; color: var(--text-2); }

.billing-addon-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.addon-purchase-form {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.75rem;
}

.addon-qty-input {
  width: 94px;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft-2);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.addon-qty-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.addon-purchase-form .btn {
  margin-left: auto;
}

/* ===== Screen calculator ===== */
.screen-calc {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(240px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}
.calc-inputs,
.calc-visual {
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.panel-grid-wrap {
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  min-height: 240px;
}
@media (max-width: 980px) {
  .screen-calc { grid-template-columns: 1fr; }
}

/* ===== Responsive helpers ===== */
@media (min-width: 768px) {
  .contact-email-desktop { display: inline !important; }
}
@media (max-width: 640px) {
  form[style*="grid-template-columns"] > * { grid-column: 1 / -1 !important; }
}

/* ===== Focus-visible for keyboard accessibility ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.app-sidebar nav > a:focus-visible,
.nav-group-items a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.glass-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

/* ===== Compatibility with existing admin markup ===== */
.admin-content {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  max-width: none;
  margin: 0;
}
/* Remove legacy outer "glass panel" wrapper on authenticated admin pages.
   Inner cards still keep .glass-panel styling. */
body.app-shell .admin-content.glass-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
}
.glass-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(0.9rem, 0.85rem + 0.35vw, 1.2rem);
}
.admin-content > .glass-panel + .glass-panel {
  margin-top: 0.95rem;
}

.admin-content > p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.admin-content > .alert + .glass-panel,
.admin-content > .alert + .backup-grid,
.admin-content > p + .glass-panel,
.admin-content > p + .backup-grid {
  margin-top: 0.85rem;
}

.admin-content table thead th {
  color: var(--text-2);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-content table tbody tr:hover td {
  background: var(--surface-hover);
}

body.theme-light .nav-badge {
  color: #fff;
  background: #b45309;
}
.btn-compact { padding: 0.35rem 0.7rem; font-size: 0.82rem; border-radius: 999px; }
.viewer-badge { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 999px; background: var(--bg-glass); color: var(--text-1); }
.logout-form button:not(.header-user-item) { background: none; border: none; color: var(--text-1); cursor: pointer; font: inherit; font-weight: 500; padding: 0; }
.logout-form button:not(.header-user-item):hover { color: var(--text-1); text-decoration: underline; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.form-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.section-heading {
  margin-top: 1.75rem;
}

.onboarding-wizard {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.onboarding-steps {
  padding-left: 1.25rem;
  margin: 0.75rem 0 0;
}

.auto-refresh-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.badge,
.badge-online,
.badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-online {
  background: rgba(0, 204, 153, 0.12);
  color: var(--video);
  border: 1px solid rgba(0, 204, 153, 0.3);
}

.badge-offline {
  background: rgba(255,255,255,0.06);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}

.player-setup-card {
  padding: 1rem;
  background: var(--surface-hover);
}

.setup-field {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.setup-field label {
  min-width: 110px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.drop-zone.drag-over {
  border-color: var(--accent, #44b5ff);
  background: rgba(68, 181, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(68, 181, 255, 0.14);
  transform: translateY(-1px);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* Shared confirm modal (profile/account/MFA) */
.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 350;
  padding: 1rem;
}

.confirm-modal-card {
  width: min(460px, 100%);
  padding: 1rem 1rem 1.1rem;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-strong);
}

.confirm-modal-title {
  margin: 0 0 0.35rem;
}

.confirm-modal-copy {
  opacity: 0.82;
  margin: 0 0 0.8rem;
}

.confirm-modal-field {
  margin-bottom: 0.8rem;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* Players layout */
.players-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  margin-top: 1.5rem;
}
.players-panel {
  padding: 1.25rem;
}
.page-tour-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 890;
  background: var(--overlay-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.page-tour-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.page-tour-popover {
  position: fixed;
  z-index: 900;
  width: min(420px, calc(100vw - 1.2rem));
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
  padding: 0.8rem;
  display: none;
}
.page-tour-popover.open {
  display: block;
}
.page-tour-popover h4 {
  margin: 0;
  font-size: 1rem;
}
.page-tour-popover p {
  margin: 0.45rem 0 0;
  color: var(--text-2);
  font-size: 0.9rem;
}
.page-tour-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.page-tour-actions-right {
  display: inline-flex;
  gap: 0.4rem;
}
.tour-highlight {
  position: relative;
  z-index: 901;
  border-radius: 12px;
  outline: 3px solid rgba(255, 193, 92, 0.9);
  box-shadow: 0 0 0 6px rgba(255, 193, 92, 0.2), 0 14px 30px rgba(0, 0, 0, 0.45);
}
@media (max-width: 1100px) {
  .players-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-content {
    padding: 0;
    border-radius: 0;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .btn.btn-sm,
  .btn.btn-compact {
    width: auto;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 12px;
  }

  .modal-header,
  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions {
    display: flex;
    justify-content: stretch;
    gap: 0.75rem;
  }

  .modal-actions .btn {
    flex: 1 1 160px;
  }
}

@media (max-width: 720px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .app-main {
    padding: 1rem 0.75rem;
  }

  .players-panel,
  .glass-card,
  .screen-hours-card {
    padding: 1rem;
  }

  .setup-field {
    flex-direction: column;
    align-items: flex-start;
  }

  .setup-field label {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .addon-purchase-form {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .addon-qty-input {
    width: 100%;
    text-align: left;
  }

  .addon-purchase-form .btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .stat-card {
    padding: 1rem;
  }

  .nav-section-picker {
    padding-top: 0.35rem;
  }

  .auto-refresh-bar {
    align-items: flex-start;
  }
}
