/* ================================================================
   Tasman TV Broadcast System — Enhanced UI v13
   Organized, light-only, responsive professional admin panel
   ================================================================ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  --primary:        #0d9488;
  --primary-dark:   #0f766e;
  --primary-light:  #14b8a6;
  --primary-glow:   rgba(13,148,136,.16);
  --accent:         #6366f1;

  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --surface-3:      #f1f5f9;
  --glass:          rgba(255,255,255,.88);

  --text:           #0f172a;
  --text-2:         #334155;
  --muted:          #64748b;
  --muted-2:        #94a3b8;

  --line:           #e2e8f0;
  --line-2:         #cbd5e1;

  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --warning:        #f59e0b;
  --warning-bg:     #fffbeb;
  --success:        #10b981;
  --success-bg:     #ecfdf5;
  --info:           #3b82f6;
  --info-bg:        #eff6ff;

  --shadow-xs:      0 1px 3px rgba(15,23,42,.08);
  --shadow-sm:      0 4px 14px rgba(15,23,42,.07);
  --shadow-md:      0 10px 30px rgba(15,23,42,.09);
  --shadow-lg:      0 20px 60px rgba(15,23,42,.12);
  --shadow-xl:      0 32px 90px rgba(15,23,42,.15);

  --radius-sm:      10px;
  --radius:         14px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  --radius-2xl:     36px;

  --sidebar-w:      258px;
  --transition:     .18s cubic-bezier(.4,0,.2,1);

  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); line-height: 1.5; }
img, video, iframe { max-width: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.hidden { display: none !important; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: -2px; }

body:not(.tv-body) {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(13,148,136,.09) 0%, transparent 40%),
    radial-gradient(ellipse at 100% 0%, rgba(99,102,241,.06) 0%, transparent 40%),
    linear-gradient(180deg, #f0f7f5 0%, #f0f4f8 60%, #eef0f8 100%);
}

/* ══ LOGIN ══════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(13,148,136,.34) 0%, transparent 46%),
    radial-gradient(ellipse at 80% 85%, rgba(99,102,241,.20) 0%, transparent 40%),
    linear-gradient(145deg, #051521 0%, #0c1f2e 45%, #031a18 100%);
}

.login-card {
  width: min(480px, 100%);
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--radius-2xl);
  padding: 36px;
  box-shadow: 0 40px 100px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1);
  animation: loginIn .4s ease both;
}

@keyframes loginIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

.login-brand-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }

.login-logo {
  width: 60px; height: 60px;
  border-radius: 18px;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.login-logo.no-logo-bg {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: white;
  box-shadow: 0 12px 32px rgba(13,148,136,.35);
}

.login-logo .icon { width: 28px; height: 28px; }
.login-logo img { width: 100%; height: 100%; object-fit: contain; background: transparent; }
.login-brand-row h1 { margin: 0 0 3px; font-size: 25px; font-weight: 800; letter-spacing: -.04em; }
.login-brand-row p { margin: 0; color: var(--muted); font-size: 13px; }
.login-copy { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.55; padding: 11px 13px; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--line); }
.login-submit { width: 100%; justify-content: center; padding: 13px; font-size: 14px; border-radius: var(--radius); margin-top: 6px; }

/* ══ APP SHELL ══════════════════════════════════════════════════ */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ══ SIDEBAR ════════════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 11px;
  margin: 12px 0 12px 12px;
  height: calc(100vh - 24px);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(13,148,136,.30) 0%, transparent 44%),
    radial-gradient(ellipse at 85% 100%, rgba(99,102,241,.14) 0%, transparent 42%),
    linear-gradient(170deg, #071120 0%, #0c1e2d 55%, #051919 100%);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 26px 70px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.07);
  color: white;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.09) 0%, transparent 50%);
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 7px 5px 16px; position: relative; z-index: 1; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  box-shadow: 0 8px 24px rgba(13,148,136,.38), inset 0 1px 0 rgba(255,255,255,.2);
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark .icon { width: 21px; height: 21px; }
.brand-mark > span { display: grid; place-items: center; width: 100%; height: 100%; }
.brand-mark.has-logo { background: transparent !important; box-shadow: none !important; border: 0 !important; }
.brand-mark.has-logo .sidebar-logo { padding: 0; border-radius: 0; object-fit: contain; width: 100%; height: 100%; background: transparent; }
.brand-title { font-size: 14px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.brand-subtitle { color: rgba(148,163,184,.75); font-size: 11px; margin-top: 3px; }

nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; overflow-y: auto; overflow-x: hidden;
  position: relative; z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.10) transparent;
}

.nav-btn {
  border: 1px solid transparent;
  color: rgba(203,213,225,.72);
  background: transparent;
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px;
  text-align: left;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-btn:hover { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.07); }
.nav-btn.active { background: rgba(13,148,136,.20); color: white; border-color: rgba(13,148,136,.32); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 55%;
  border-radius: 0 3px 3px 0;
  background: var(--primary-light);
  box-shadow: 0 0 10px var(--primary-light);
}
.nav-btn .icon { width: 15px; height: 15px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto; padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: grid; gap: 7px;
  position: relative; z-index: 1;
}

.user-card-mini {
  display: flex; gap: 8px; align-items: center;
  padding: 9px 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  font-size: 12px; color: #cbd5e1;
}

.user-card-mini .icon { color: var(--primary-light); }
.mini-muted { color: rgba(148,163,184,.72); font-size: 11px; margin-top: 1px; }

.live-state {
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px; font-size: 11px; color: #6ee7d7; font-weight: 500;
}

.live-state::before {
  content: '';
  width: 6px; height: 6px; border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,.2);
  flex-shrink: 0;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse { 0%,100% { box-shadow: 0 0 0 3px rgba(52,211,153,.2); } 50% { box-shadow: 0 0 0 5px rgba(52,211,153,.08); } }

.logout-btn {
  border: 1px solid rgba(255,255,255,.09);
  padding: 9px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.06); color: rgba(203,213,225,.85);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  transition: all var(--transition);
}

.logout-btn:hover { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.28); color: #fca5a5; }

/* ══ SIDEBAR COLLAPSED ══════════════════════════════════════════ */
.app-shell.sidebar-collapsed { grid-template-columns: 66px 1fr; }
.app-shell.sidebar-collapsed .sidebar { padding: 10px 7px; align-items: center; }
.app-shell.sidebar-collapsed .brand { justify-content: center; padding: 5px 0 13px; }
.app-shell.sidebar-collapsed .brand > div:not(.brand-mark),
.app-shell.sidebar-collapsed .nav-btn span:last-child,
.app-shell.sidebar-collapsed .user-card-mini > div,
.app-shell.sidebar-collapsed .live-state { display: none; }
.app-shell.sidebar-collapsed .brand-mark { width: 38px; height: 38px; }
.app-shell.sidebar-collapsed nav { width: 100%; }
.app-shell.sidebar-collapsed .nav-btn { justify-content: center; padding: 9px; }
.app-shell.sidebar-collapsed .nav-btn::before { display: none; }
.app-shell.sidebar-collapsed .sidebar-footer { width: 100%; align-items: center; }
.app-shell.sidebar-collapsed .user-card-mini { justify-content: center; }
.app-shell.sidebar-collapsed .logout-btn { justify-content: center; }

/* ══ MAIN ════════════════════════════════════════════════════════ */
.main { min-width: 0; padding: 20px 22px 32px; }

/* ══ TOPBAR ══════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px;
  margin: 0 0 18px;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(226,232,240,.88);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--primary-dark);
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
}

.sidebar-toggle:hover { background: #f0fdfa; border-color: var(--primary-light); }
.sidebar-toggle .icon { transform: rotate(90deg); }

.page-title { flex: 1; min-width: 0; }
.page-title h1 {
  margin: 0;
  font-size: clamp(19px, 2vw, 29px);
  font-weight: 800; letter-spacing: -.045em;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; font-size: 12px; font-weight: 700;
  box-shadow: var(--shadow-xs); flex-shrink: 0;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16,185,129,.15);
  animation: statusPulse 2.5s ease-in-out infinite;
}

@keyframes statusPulse { 0%,100% { box-shadow: 0 0 0 4px rgba(16,185,129,.15); } 50% { box-shadow: 0 0 0 7px rgba(16,185,129,.06); } }

/* ══ CARDS ═══════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 17px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); border-color: rgba(13,148,136,.14); }
.card h2 { margin: 0 0 13px; letter-spacing: -.04em; }

.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.section-title h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.03em; }
.section-title > span { color: var(--primary-dark); }

/* ══ GRID ════════════════════════════════════════════════════════ */
.grid { display: grid; gap: 13px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ══ METRICS ═════════════════════════════════════════════════════ */
.metric { display: flex; align-items: center; justify-content: space-between; gap: 11px; min-height: 106px; border-radius: var(--radius-lg); background: linear-gradient(160deg, rgba(255,255,255,.95), rgba(248,250,252,.90)); }
.metric-value { font-size: 32px; font-weight: 800; letter-spacing: -.05em; }
.metric-label { color: var(--text-2); font-weight: 700; font-size: 13px; margin-top: 3px; }
.metric-detail { color: var(--muted); font-size: 11px; margin-top: 3px; }
.metric-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: rgba(13,148,136,.09); color: var(--primary-dark); box-shadow: inset 0 0 0 1px rgba(13,148,136,.12); flex-shrink: 0; }
.metric-icon .icon { width: 21px; height: 21px; }

/* ══ FORMS ═══════════════════════════════════════════════════════ */
.form-row { display: grid; gap: 5px; margin-bottom: 11px; }
.form-row label { font-weight: 700; font-size: 12px; color: var(--text-2); }

.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 11px;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  font-size: 13px;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.textarea { resize: vertical; min-height: 86px; }

/* ══ BUTTONS ═════════════════════════════════════════════════════ */
.btn {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; font-weight: 700; font-size: 13px;
  background: var(--surface-2); color: var(--text-2);
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  text-decoration: none; transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(0); }

.btn.primary { background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)); color: white; border-color: transparent; box-shadow: 0 7px 18px rgba(13,148,136,.26); }
.btn.primary:hover { box-shadow: 0 11px 26px rgba(13,148,136,.36); filter: brightness(1.05); }

.btn.danger { background: var(--danger); color: white; border-color: transparent; box-shadow: 0 5px 14px rgba(239,68,68,.24); }
.btn.danger:hover { box-shadow: 0 9px 22px rgba(239,68,68,.34); filter: brightness(1.05); }

.btn.warning { background: var(--warning); color: white; border-color: transparent; box-shadow: 0 5px 14px rgba(245,158,11,.22); }
.btn.warning:hover { box-shadow: 0 9px 22px rgba(245,158,11,.32); filter: brightness(1.05); }

.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 5px 8px; border-radius: 8px; font-size: 12px; gap: 5px; }
.btn.small .icon { width: 13px; height: 13px; }
.btn:disabled { opacity: .5; transform: none !important; cursor: not-allowed; }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* ══ TOOLBAR ═════════════════════════════════════════════════════ */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 13px; flex-wrap: wrap; }
.media-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.search-wrap { position: relative; min-width: min(220px, 100%); }
.search-wrap .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 32px; }

/* ══ TABLES ══════════════════════════════════════════════════════ */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.responsive-table { display: block; overflow-x: auto; white-space: nowrap; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }

/* ══ BADGES ══════════════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.badge.green { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.badge.red { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.badge.orange { background: var(--warning-bg); color: #92400e; border-color: #fde68a; }
.badge.blue { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }

/* ══ HERO VARIANTS ═══════════════════════════════════════════════ */
.v5-hero, .dashboard-hero, .emergency-hero-v5 {
  border-radius: var(--radius-xl);
  padding: clamp(16px, 2.5vw, 28px);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  box-shadow: var(--shadow-md);
}

.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }

/* ══ DASHBOARD ═══════════════════════════════════════════════════ */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 18px; align-items: stretch; color: white;
  background:
    radial-gradient(ellipse at 5% 15%, rgba(255,255,255,.18) 0%, transparent 32%),
    radial-gradient(ellipse at 95% 88%, rgba(13,148,136,.52) 0%, transparent 42%),
    linear-gradient(145deg, #051a28 0%, #0a2d3a 50%, #042720 100%);
  margin-bottom: 14px;
}
.dashboard-hero .eyebrow { color: #6ee7d7; }
.dashboard-hero h2 { margin: 8px 0; font-size: clamp(22px, 2.8vw, 38px); letter-spacing: -.065em; }
.dashboard-hero p { margin: 0; color: rgba(255,255,255,.72); line-height: 1.55; }
.dashboard-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.broadcast-health {
  border-radius: var(--radius-lg);
  display: grid; place-items: center; align-content: center;
  text-align: center; padding: 18px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px); gap: 5px;
}
.broadcast-health .health-ring { width: 70px; height: 70px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 0 0 7px rgba(255,255,255,.04); margin-bottom: 8px; }
.broadcast-health .icon { width: 36px; height: 36px; }
.broadcast-health b { font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.broadcast-health span { color: rgba(255,255,255,.68); font-size: 12px; line-height: 1.4; }
.broadcast-health.danger { background: rgba(127,29,29,.46); border-color: rgba(239,68,68,.3); }

.dashboard-metrics { margin-bottom: 14px; }
.dashboard-control-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 13px; }

.quick-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.quick-action {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.82); padding: 13px;
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  transition: all var(--transition); cursor: pointer;
}
.quick-action:hover { transform: translateY(-2px); border-color: rgba(13,148,136,.28); background: #f0fdfa; box-shadow: var(--shadow-sm); }
.quick-action > .icon { width: 20px; height: 20px; color: var(--primary-dark); flex-shrink: 0; margin-top: 1px; }
.quick-action b { display: block; color: var(--text); font-size: 13px; }
.quick-action small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; line-height: 1.4; }

.screen-chip-list { display: grid; gap: 7px; max-height: 320px; overflow-y: auto; padding-right: 3px; }
.screen-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.76); border-radius: var(--radius); padding: 9px 11px; transition: border-color var(--transition); }
.screen-chip:hover { border-color: rgba(13,148,136,.24); }
.screen-chip > div { display: flex; gap: 8px; align-items: center; min-width: 0; }
.screen-chip .icon { color: var(--primary-dark); width: 16px; height: 16px; flex-shrink: 0; }
.screen-chip b { display: block; font-size: 13px; }
.screen-chip span { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.permission-note { border: 1px solid #fde68a; background: var(--warning-bg); color: #92400e; border-radius: var(--radius); padding: 13px; font-size: 13px; line-height: 1.55; font-weight: 600; }

.dashboard-flow { margin-top: 13px; }
.flow-card { border: 1px solid var(--line); background: rgba(255,255,255,.86); border-radius: var(--radius-lg); padding: 17px; box-shadow: var(--shadow-xs); }
.flow-card span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-dark); color: white; font-weight: 800; font-size: 14px; }
.flow-card b { display: block; margin-top: 11px; font-size: 15px; letter-spacing: -.03em; }
.flow-card p { color: var(--muted); margin: 4px 0 0; font-size: 12px; line-height: 1.5; }

/* ══ MEDIA LIBRARY ═══════════════════════════════════════════════ */
.media-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: clamp(14px, 2vw, 22px);
  background: radial-gradient(ellipse at 0% 0%, rgba(13,148,136,.09) 0%, transparent 40%), linear-gradient(135deg, var(--surface), var(--surface-2));
  margin-bottom: 0;
}
.media-hero .eyebrow { color: var(--primary-dark); }
.media-hero h2 { margin: 5px 0; font-size: clamp(20px, 2.5vw, 32px); letter-spacing: -.055em; }
.media-hero p { margin: 0; color: var(--muted); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.drop-zone {
  min-height: 112px; border: 2px dashed rgba(13,148,136,.28); border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 20% 0%, rgba(13,148,136,.06), transparent 50%), var(--surface-2);
  display: grid; place-items: center; align-content: center; text-align: center;
  gap: 5px; padding: 16px; margin-bottom: 11px; cursor: pointer; transition: all var(--transition);
}
.drop-zone:hover { border-color: var(--primary); transform: translateY(-1px); background: #f0fdfa; }
.drop-zone.drag-over { border-color: var(--primary); background: #ccfbf1; transform: scale(1.01); }
.drop-zone b { font-size: 14px; letter-spacing: -.02em; color: var(--text-2); }
.drop-zone span { color: var(--muted); font-size: 12px; max-width: 360px; line-height: 1.4; }
.drop-icon { width: 34px; height: 34px; color: var(--primary); }

.library-note { display: flex; gap: 7px; align-items: center; color: var(--primary-dark); background: #ccfbf1; border: 1px solid #99f6e4; padding: 8px 11px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; margin-bottom: 13px; }

/* ══ ASSET GRID ══════════════════════════════════════════════════ */
.asset-grid { display: grid; gap: 11px; }
.asset-grid.thumb-small  { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.asset-grid.thumb-medium { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.asset-grid.thumb-large  { grid-template-columns: repeat(auto-fill, minmax(234px, 1fr)); }
.thumb-small .asset-preview  { height: 70px; }
.thumb-medium .asset-preview { height: 100px; }
.thumb-large .asset-preview  { height: 142px; }
.thumb-small .enhanced-asset-card  { min-height: 186px; }
.thumb-medium .enhanced-asset-card { min-height: 226px; }
.thumb-large .enhanced-asset-card  { min-height: 280px; }

.enhanced-assets.thumb-small  { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.enhanced-assets.thumb-medium { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.enhanced-assets.thumb-large  { grid-template-columns: repeat(auto-fill, minmax(234px, 1fr)); }

.asset-card { border: 1.5px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-xs); transition: all var(--transition); }
.asset-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(13,148,136,.22); }
.enhanced-asset-card { display: flex; flex-direction: column; position: relative; }

.asset-preview { background: linear-gradient(135deg, #eef2f7, #f8fafc); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.asset-preview img, .asset-preview video { width: 100%; height: 100%; object-fit: cover; background: #1e293b; }
.asset-icon-preview { display: grid; gap: 5px; place-items: center; color: var(--primary-dark); padding: 8px; }
.asset-icon-preview .icon { width: 26px; height: 26px; }

.asset-info { padding: 9px; flex: 1; display: flex; flex-direction: column; }
.asset-title { font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta { color: var(--muted); font-size: 11px; margin: 3px 0 7px; display: inline-flex; align-items: center; gap: 4px; }
.asset-subline { color: var(--muted); font-size: 11px; min-height: 26px; line-height: 1.35; overflow: hidden; word-break: break-word; margin-bottom: 7px; }
.asset-actions-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.asset-actions-row .btn { flex: 1; justify-content: center; font-size: 11px; padding: 4px 6px; }

.media-select-check { position: absolute; top: 6px; left: 6px; z-index: 3; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 999px; background: rgba(15,23,42,.76); color: white; font-size: 10px; font-weight: 700; }
.media-select-check input { accent-color: var(--primary-light); }
.enhanced-asset-card.selected { outline: 2px solid var(--primary); box-shadow: 0 0 0 4px var(--primary-glow) !important; }
.asset-empty { grid-column: 1 / -1; }

.upload-progress { display: grid; gap: 6px; margin-top: 9px; }
.upload-progress span { color: var(--muted); font-size: 12px; font-weight: 700; }
.upload-progress > div { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.upload-progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary-dark), var(--primary-light)); border-radius: inherit; transition: width .25s ease; }

.media-filter { width: 155px; }
.thumb-size-select { width: 135px; }

/* ══ PLAYLISTS ════════════════════════════════════════════════════ */
.playlist-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 0; }
.playlist-hero .eyebrow { color: var(--primary-dark); }
.playlist-hero h2 { margin: 5px 0; font-size: clamp(18px, 2.5vw, 32px); letter-spacing: -.055em; }
.playlist-hero p { margin: 0; color: var(--muted); }

.playlist-workspace { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 13px; align-items: start; margin-top: 13px; }
.playlist-list-card { position: sticky; top: 80px; }
.playlist-card-list { display: grid; gap: 7px; }

.playlist-select-card { width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.82); display: flex; gap: 9px; align-items: center; padding: 11px; text-align: left; transition: all var(--transition); }
.playlist-select-card:hover { background: #ecfdf5; border-color: rgba(13,148,136,.28); transform: translateY(-1px); }
.playlist-select-card.active { background: #ccfbf1; border-color: var(--primary); box-shadow: 0 5px 14px rgba(13,148,136,.14); }
.playlist-select-card > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: rgba(13,148,136,.10); color: var(--primary-dark); flex-shrink: 0; }
.playlist-select-card.active > span { background: var(--primary-dark); color: white; }
.playlist-select-card b { display: block; color: var(--text); font-size: 13px; }
.playlist-select-card small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }

.playlist-editor-v5 { display: grid; gap: 13px; }
.playlist-details-form { display: grid; gap: 9px; }
.big-input { font-size: 16px; font-weight: 700; }
.compact-big-input { font-size: 13px; }

.playlist-summary-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 2px 0 5px; }
.playlist-summary-row span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; border: 1px solid var(--line); }

.playlist-asset-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; max-height: 340px; overflow-y: auto; padding-right: 3px; }

.picker-media-card { border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 9px; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px; text-align: left; transition: all var(--transition); }
.picker-media-card:hover { transform: translateY(-1px); border-color: rgba(13,148,136,.28); background: #f0fdfa; box-shadow: var(--shadow-xs); }
.picker-thumb { width: 56px; height: 44px; border-radius: 9px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.picker-thumb img, .picker-thumb video { width: 100%; height: 100%; object-fit: contain; background: #1e293b; }
.picker-media-card b { display: block; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.picker-media-card small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }

/* ══ PLAYLIST ITEMS ══════════════════════════════════════════════ */
.playlist-items-v5 { display: grid; gap: 9px; }

.playlist-item-v5 {
  display: grid;
  grid-template-columns: 38px 76px minmax(0, 1fr) 110px 148px;
  align-items: center; gap: 9px;
  border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  background: rgba(255,255,255,.90); padding: 9px;
  transition: all var(--transition); position: relative;
}
.playlist-item-v5:hover { border-color: rgba(13,148,136,.20); box-shadow: var(--shadow-xs); }
.playlist-item-v5.disabled { opacity: .54; filter: grayscale(.4); }
.playlist-item-v5.selected { outline: 2px solid var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }

.playlist-select-check { display: grid; place-items: center; width: 38px; height: 32px; border-radius: 9px; background: rgba(15,23,42,.06); font-size: 10px; font-weight: 700; color: var(--muted); }
.playlist-select-check input { accent-color: var(--primary); }

.large-thumb { width: 76px; height: 57px; border-radius: 9px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.large-thumb img, .large-thumb video { width: 100%; height: 100%; object-fit: contain; background: #1e293b; }

.item-thumb { width: 56px; height: 46px; border-radius: 9px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.item-thumb img, .item-thumb video { width: 100%; height: 100%; object-fit: contain; background: #1e293b; }

.playlist-item-main .item-name { font-size: 13px; font-weight: 700; }
.playlist-item-main .item-type { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.duration-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.pill-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-weight: 700; border-radius: 999px; padding: 4px 7px; font-size: 11px; transition: all var(--transition); }
.pill-btn:hover { background: #ccfbf1; border-color: #99f6e4; color: var(--primary-dark); }

.duration-control { display: grid; gap: 3px; text-align: center; }
.duration-control label, .duration-control span { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.duration-input { text-align: center; font-size: 13px; font-weight: 700; }

.playlist-item-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.playlist-order-toolbar .media-controls { flex-wrap: wrap; }

/* ══ EMERGENCY ═══════════════════════════════════════════════════ */
.emergency-hero-v5 {
  display: flex; justify-content: space-between; align-items: center; gap: 15px;
  color: white; background: linear-gradient(145deg, #0f172a 0%, #7f1d1d 100%);
  margin-bottom: 14px;
}
.emergency-hero-v5 .eyebrow { color: #fca5a5; }
.emergency-hero-v5 h2 { margin: 6px 0; font-size: clamp(18px, 2.5vw, 32px); letter-spacing: -.055em; }
.emergency-hero-v5 p { margin: 0; color: rgba(255,255,255,.72); }
.emergency-hero-v5.active { background: radial-gradient(ellipse at 10% 0%, rgba(255,255,255,.14) 0%, transparent 32%), linear-gradient(145deg, #7f1d1d 0%, #dc2626 100%); animation: emHeroPulse 1.5s ease-in-out infinite alternate; }
@keyframes emHeroPulse { from { filter: brightness(.97); } to { filter: brightness(1.06); } }

.emergency-live-badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 9px 13px; font-weight: 800; font-size: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.20); white-space: nowrap; }
.emergency-live-badge.on { background: rgba(254,226,226,.20); border-color: rgba(252,165,165,.35); }

.emergency-grid-v5 { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 13px; align-items: start; }
.emergency-toggle-row { margin-bottom: 13px; }

/* Custom toggle switch for emergency */
.switch-card {
  border: 1.5px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-lg); padding: 13px;
  display: flex; align-items: center; gap: 13px;
  cursor: pointer; transition: all var(--transition);
}
.switch-card:hover { border-color: rgba(239,68,68,.28); background: var(--danger-bg); }
.switch-card input { display: none; }
.switch-track { width: 48px; height: 27px; background: #cbd5e1; border-radius: 999px; position: relative; transition: background var(--transition); flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; width: 21px; height: 21px; border-radius: 999px; background: white; left: 3px; top: 3px; transition: left var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.switch-card input:checked ~ .switch-track { background: var(--danger); }
.switch-card input:checked ~ .switch-track::after { left: 24px; }
.switch-label { display: grid; gap: 2px; }
.switch-label b { color: var(--text); font-size: 14px; }
.switch-label small { color: var(--muted); font-size: 12px; line-height: 1.3; }

.severity-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.severity-option { cursor: pointer; border: 2px solid var(--line); background: var(--surface); border-radius: var(--radius-lg); padding: 13px; display: grid; gap: 5px; text-align: center; transition: all var(--transition); position: relative; }
.severity-option input { position: absolute; opacity: 0; pointer-events: none; }
.severity-option .icon { margin: auto; width: 24px; height: 24px; }
.severity-option b { font-size: 13px; }
.severity-option small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.severity-option.active, .severity-option:has(input:checked) { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.severity-option.info.active, .severity-option.info:has(input:checked) { border-color: var(--info); background: var(--info-bg); color: #1e40af; }
.severity-option.warning.active, .severity-option.warning:has(input:checked) { border-color: var(--warning); background: var(--warning-bg); color: #92400e; }
.severity-option.danger.active, .severity-option.danger:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); color: #991b1b; }

.wide-btn { width: 100%; justify-content: center; }
.emergency-preview-card-v5 { position: sticky; top: 80px; }

.emergency-preview-v5 { border-radius: var(--radius-xl); color: white; padding: clamp(18px, 3.5vw, 36px); text-align: center; min-height: 290px; display: grid; place-items: center; align-content: center; gap: 9px; background: linear-gradient(135deg, #92400e, #c2410c); }
.severity-info .emergency-preview-v5 { background: linear-gradient(135deg, #1e40af, #2563eb); }
.severity-danger .emergency-preview-v5 { background: radial-gradient(ellipse, rgba(239,68,68,.65), #7f1d1d); }

.preview-icon { width: 68px; height: 68px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.preview-icon .icon { width: 34px; height: 34px; }
.emergency-preview-v5 h3 { margin: 0; font-size: clamp(24px, 3.5vw, 44px); letter-spacing: -.06em; text-transform: uppercase; }
.emergency-preview-v5 p { margin: 0; font-size: clamp(14px, 1.8vw, 22px); line-height: 1.25; font-weight: 700; }
.emergency-preview-v5 span { display: inline-flex; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); font-weight: 800; letter-spacing: .08em; font-size: 11px; }
.emergency-tips { margin-top: 11px; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px; background: var(--surface-2); }
.emergency-tips b { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.emergency-tips p { color: var(--muted); margin: 6px 0 0; font-size: 12px; line-height: 1.5; }

.emergency-style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 11px 0; }
.style-panel { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 11px; }
.style-panel h3 { margin: 0 0 9px; display: flex; align-items: center; gap: 6px; font-size: 12px; }

.range-row { display: grid; grid-template-columns: 58px 1fr 40px; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.range-row input { width: 100%; accent-color: var(--primary); }
.range-row output { color: var(--text-2); text-align: right; font-weight: 700; }

.style-toggle-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.format-toggle { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 700; cursor: pointer; transition: all var(--transition); }
.format-toggle:hover { background: #f0fdfa; border-color: rgba(13,148,136,.28); }
.format-toggle .icon { width: 12px; height: 12px; }

/* Rich editor */
.rich-editor-shell { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rich-editor-toolbar { display: flex; align-items: center; gap: 5px; padding: 7px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.rich-editor-toolbar button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 7px; padding: 5px 7px; display: inline-flex; gap: 4px; align-items: center; font-weight: 700; font-size: 11px; transition: all var(--transition); }
.rich-editor-toolbar button:hover { background: var(--surface-3); }
.rich-editor-toolbar button.active { background: var(--primary-dark); color: white; border-color: var(--primary-dark); }
.toolbar-divider { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.rich-editor-area { min-height: 126px; max-height: 290px; overflow-y: auto; padding: 10px 11px; outline: none; background: var(--surface); color: var(--text); line-height: 1.5; font-size: 13px; font-weight: 600; }
.rich-editor-area:empty::before { content: attr(data-placeholder); color: var(--muted-2); font-weight: 500; }
.rich-editor-area ul, .rich-editor-area ol, #previewEmergencyMessage ul, #previewEmergencyMessage ol { display: inline-block; text-align: left; margin: .2em 0 .2em 1.1em; padding-left: .8em; }
.rich-editor-area p, .rich-editor-area div { margin: .2em 0; }
.full-rich-editor .full-toolbar { gap: 4px; padding: 6px; }
.full-rich-editor .rich-editor-toolbar button { min-height: 28px; }
.rich-editor, .full-rich-editor-body { min-height: 220px; max-height: 460px; overflow-y: auto; padding: 14px 15px; outline: none; background: var(--surface); color: var(--text); line-height: 1.55; font-size: 14px; font-weight: 600; }
.rich-editor:focus, .full-rich-editor-body:focus { box-shadow: inset 0 0 0 2px rgba(13,148,136,.22); background: #ffffff; }
.rich-editor:empty::before, .full-rich-editor-body:empty::before { content: attr(data-placeholder); color: var(--muted-2); font-weight: 600; }
.rich-editor ul, .rich-editor ol, .full-rich-editor-body ul, .full-rich-editor-body ol { display: inline-block; text-align: left; margin: .35em 0 .35em 1.25em; padding-left: .9em; }
.rich-editor p, .rich-editor div, .full-rich-editor-body p, .full-rich-editor-body div { margin: .28em 0; }
.global-emergency-message-editor { min-height: clamp(240px, 32vh, 380px); }

/* ══ SETTINGS ════════════════════════════════════════════════════ */
.settings-v10-page { display: grid; gap: 13px; }
.settings-v10-hero { display: flex; justify-content: space-between; align-items: center; gap: 13px; background: radial-gradient(ellipse at 96% 0%, rgba(13,148,136,.12) 0%, transparent 40%), linear-gradient(135deg, rgba(255,255,255,.97), rgba(240,253,250,.90)); overflow: hidden; position: relative; }
.settings-v10-hero h2 { margin: 4px 0 5px; font-size: clamp(19px, 2.2vw, 29px); letter-spacing: -.05em; }
.settings-v10-hero p { margin: 0; color: var(--muted); line-height: 1.45; }
.settings-v10-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.settings-v10-layout { display: grid; grid-template-columns: 305px minmax(0, 1fr); gap: 13px; align-items: start; }
.settings-category-grid { position: sticky; top: 80px; display: grid; gap: 7px; }

.settings-category-card { border: 1.5px solid var(--line); background: rgba(255,255,255,.88); border-radius: var(--radius-lg); padding: 11px; text-align: left; display: grid; grid-template-columns: 38px minmax(0, 1fr) 20px; gap: 9px; align-items: center; box-shadow: var(--shadow-xs); transition: all var(--transition); }
.settings-category-card:hover { transform: translateY(-1px); border-color: rgba(13,148,136,.24); background: #f8fffd; box-shadow: var(--shadow-sm); }
.settings-category-card.active { background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)); color: white; border-color: transparent; box-shadow: 0 14px 32px rgba(13,148,136,.24); }

.settings-category-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(13,148,136,.10); color: var(--primary-dark); }
.settings-category-card.active .settings-category-icon { background: rgba(255,255,255,.18); color: white; }
.settings-category-copy { min-width: 0; display: grid; gap: 2px; }
.settings-category-copy b { font-size: 12px; letter-spacing: -.02em; }
.settings-category-copy small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.settings-category-card.active .settings-category-copy small { color: rgba(255,255,255,.75); }
.settings-category-arrow { color: var(--muted-2); }
.settings-category-card.active .settings-category-arrow { color: rgba(255,255,255,.85); }

.settings-panel-stack { min-width: 0; }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: panelIn .18s ease both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.settings-panel-head { display: flex; justify-content: space-between; gap: 9px; align-items: flex-start; border: 1.5px solid var(--line); background: rgba(255,255,255,.93); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 15px; border-bottom: 0; }
.settings-panel-head > div:first-child { display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 10px; align-items: start; }
.settings-panel-head > div:first-child > span { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: rgba(13,148,136,.10); color: var(--primary-dark); grid-row: 1 / span 2; }
.settings-panel-head h3 { margin: 0; font-size: 17px; letter-spacing: -.04em; }
.settings-panel-head p { grid-column: 2; margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.settings-panel-badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 700; background: #ccfbf1; color: #115e59; border: 1px solid #99f6e4; }

.settings-form-card, .settings-panel > .settings-option-grid { border: 1.5px solid var(--line); background: rgba(255,255,255,.95); border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 15px; box-shadow: var(--shadow-sm); }
.settings-option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 9px; }

.setting-toggle { border: 1.5px solid var(--line); background: rgba(255,255,255,.82); border-radius: var(--radius); padding: 11px; display: flex; gap: 9px; align-items: flex-start; cursor: pointer; transition: all var(--transition); }
.setting-toggle:hover { background: #f0fdfa; border-color: rgba(13,148,136,.26); }
.setting-toggle input { margin-top: 2px; transform: scale(1.15); accent-color: var(--primary); }
.setting-toggle span { display: grid; gap: 3px; }
.setting-toggle .icon { color: var(--primary-dark); width: 16px; height: 16px; }
.setting-toggle b { color: var(--text); font-size: 12px; }
.setting-toggle small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.setting-toggle.single { margin-bottom: 11px; }
.compact-toggle { margin-top: 7px; }

.logo-upload-v10 { display: grid; gap: 11px; }
.logo-upload-zone { min-height: 148px; border: 1.5px dashed #99f6e4; background: linear-gradient(135deg, #f0fdfa, var(--surface)); border-radius: var(--radius-lg); display: grid; place-items: center; align-content: center; gap: 6px; text-align: center; color: #115e59; cursor: pointer; transition: all var(--transition); }
.logo-upload-zone:hover { background: #ecfdf5; border-color: var(--primary); }
.logo-upload-zone .icon { width: 34px; height: 34px; }
.logo-upload-zone b { font-size: 15px; letter-spacing: -.03em; }
.logo-upload-zone span { color: var(--muted); font-size: 12px; }
.logo-upload-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.logo-inline-preview { min-height: 100px; border: 1px dashed var(--line-2); border-radius: var(--radius); display: grid; place-items: center; margin-top: 7px; color: var(--muted); text-align: center; gap: 6px; }
.logo-inline-preview img { max-width: 100%; max-height: 90px; object-fit: contain; background: transparent; }
.logo-inline-preview .icon { width: 34px; height: 34px; color: var(--primary-dark); }

.light-only-note { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); background: var(--info-bg); color: #1e40af; font-size: 12px; font-weight: 700; margin: 7px 0 11px; }
.light-only-note .icon { color: var(--warning); }
.info-strip { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; margin: 7px 0 11px; }
.color-input { min-height: 34px; padding: 4px !important; }
.mini-help { font-size: 11px !important; margin-top: 4px !important; }

/* ══ USERS ════════════════════════════════════════════════════════ */
.users-v10-page { display: grid; gap: 13px; }
.users-hero { display: flex; justify-content: space-between; align-items: center; gap: 13px; background: radial-gradient(ellipse at 96% 0%, rgba(13,148,136,.12) 0%, transparent 40%), linear-gradient(135deg, rgba(255,255,255,.97), rgba(240,253,250,.90)); }
.users-hero h2 { margin: 4px 0 5px; font-size: clamp(18px, 2.2vw, 29px); letter-spacing: -.05em; }
.users-hero p { margin: 0; color: var(--muted); line-height: 1.45; }
.users-layout-v10 { display: grid; grid-template-columns: minmax(270px, 350px) minmax(0, 1fr); gap: 13px; align-items: start; }
.create-user-card-v10 { position: sticky; top: 80px; }
.create-user-form-v10 { display: grid; gap: 4px; }

.role-choice-grid { display: grid; gap: 7px; margin: 4px 0 11px; }
.role-choice { border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 10px 11px; display: flex; gap: 9px; cursor: pointer; transition: all var(--transition); }
.role-choice:hover { border-color: rgba(13,148,136,.26); background: #f0fdfa; }
.role-choice input { accent-color: var(--primary); margin-top: 4px; }
.role-choice span { display: grid; gap: 3px; }
.role-choice .icon { color: var(--primary-dark); }
.role-choice b { font-size: 13px; }
.role-choice small { color: var(--muted); font-size: 11px; line-height: 1.35; }

.users-search { min-width: min(260px, 100%); }
.user-permission-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 11px; }
.user-permission-summary div { display: flex; gap: 7px; align-items: flex-start; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px; font-size: 12px; }
.user-permission-summary .icon { color: var(--primary-dark); flex-shrink: 0; }
.user-permission-summary b { margin-right: 2px; }
.user-permission-summary span { color: var(--muted); }

.user-card-grid-v10 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 9px; }
.user-card-v10 { border: 1.5px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.94); padding: 13px; display: grid; gap: 9px; box-shadow: var(--shadow-xs); transition: all var(--transition); }
.user-card-v10:hover { box-shadow: var(--shadow-sm); border-color: rgba(13,148,136,.15); }
.user-card-v10.role-admin { border-top: 3px solid var(--success); }
.user-card-v10.role-staff { border-top: 3px solid var(--warning); }
.user-card-v10.disabled { opacity: .64; filter: grayscale(.2); }

.user-card-top { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.user-avatar-v10 { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: white; font-weight: 800; font-size: 15px; background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)); box-shadow: 0 6px 14px rgba(13,148,136,.24); }
.user-main-v10 { min-width: 0; }
.user-main-v10 b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-main-v10 span { color: var(--muted); font-size: 11px; font-weight: 700; }

.access-line { border-radius: var(--radius); padding: 9px; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.access-line .icon { color: var(--primary-dark); grid-row: 1 / span 2; }
.access-line b { font-size: 12px; }
.access-line small { color: var(--muted); font-size: 11px; line-height: 1.3; }

.user-meta-v10 { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
.user-meta-v10 span { display: inline-flex; align-items: center; gap: 5px; }
.user-meta-v10 .icon { width: 12px; height: 12px; }
.user-actions-v10 { display: flex; flex-wrap: wrap; gap: 5px; }
.user-actions-v10 .btn { flex: 1 1 auto; font-size: 11px; padding: 5px 8px; }
.modal-form-v10 { display: grid; gap: 7px; }

/* ══ ACTIVITY ════════════════════════════════════════════════════ */
.activity-hero.card { display: flex; justify-content: space-between; align-items: center; background: radial-gradient(ellipse at 96% 0%, rgba(13,148,136,.12) 0%, transparent 40%), linear-gradient(135deg, rgba(255,255,255,.97), rgba(240,253,250,.90)); }
.activity-count { width: 86px; height: 86px; border-radius: 22px; display: grid; place-items: center; align-content: center; background: linear-gradient(135deg, var(--primary-dark), var(--primary-light)); color: white; font-weight: 800; font-size: 26px; box-shadow: 0 12px 32px rgba(13,148,136,.28); flex-shrink: 0; }
.activity-count span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }

.activity-timeline { display: grid; gap: 7px; }
.activity-row-v5 { display: grid; grid-template-columns: 42px minmax(0, 1fr) 150px; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; background: rgba(255,255,255,.80); transition: all var(--transition); }
.activity-row-v5:hover { border-color: rgba(13,148,136,.18); background: rgba(255,255,255,.96); }
.activity-dot { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(13,148,136,.09); color: var(--primary-dark); }
.activity-row-v5 b { display: block; font-size: 12px; font-weight: 700; }
.activity-row-v5 p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.activity-row-v5 time { color: var(--muted); font-size: 11px; font-weight: 700; text-align: right; }

/* ══ HELP ════════════════════════════════════════════════════════ */
.help-hero.card { background: radial-gradient(ellipse at 10% 20%, rgba(13,148,136,.24) 0%, transparent 40%), linear-gradient(145deg, #0f172a 0%, #134e4a 100%); color: white; }
.help-hero.card .eyebrow { color: #6ee7d7; }
.help-hero.card h2 { margin: 8px 0; font-size: clamp(20px, 2.5vw, 34px); letter-spacing: -.055em; }
.help-hero.card p { color: #ccfbf1; margin: 0; }

.help-layout { display: grid; grid-template-columns: 305px 1fr; gap: 13px; margin-top: 13px; align-items: start; }
.help-nav-card { position: sticky; top: 80px; }
.help-nav-card h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 11px; letter-spacing: -.03em; }
.help-steps { margin: 0; padding-left: 18px; color: var(--text-2); line-height: 1.7; font-weight: 600; font-size: 12px; }
.help-checklist { display: grid; gap: 6px; margin-top: 11px; }
.help-checklist div { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text-2); }
.help-checklist .icon { color: var(--success); margin-top: 1px; flex-shrink: 0; }
.help-grid { align-items: stretch; }

.help-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 17px; box-shadow: var(--shadow-xs); transition: all var(--transition); }
.help-card:hover { box-shadow: var(--shadow-sm); border-color: rgba(13,148,136,.18); }
.help-card > .icon { width: 32px; height: 32px; color: var(--primary-dark); background: rgba(13,148,136,.09); padding: 7px; border-radius: 11px; box-sizing: content-box; }
.help-card h3 { margin: 12px 0 6px; letter-spacing: -.03em; font-size: 13px; }
.help-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.help-wide { margin-top: 13px; }
.help-tip { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 13px; display: grid; gap: 5px; }
.help-tip b { color: var(--text); font-size: 12px; }
.help-tip span { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ══ MODAL ════════════════════════════════════════════════════════ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.65); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 200; padding: 18px; animation: backdropIn .15s ease; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(700px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-xl); border: 1px solid var(--line); animation: modalIn .2s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; gap: 11px; align-items: center; margin-bottom: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 17px; letter-spacing: -.04em; }
.close-btn { border: 1px solid var(--line); width: 34px; height: 34px; border-radius: 9px; font-size: 17px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; transition: all var(--transition); flex-shrink: 0; }
.close-btn:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* ══ TOAST ════════════════════════════════════════════════════════ */
.toast { position: fixed; right: 16px; bottom: 16px; padding: 11px 15px; border-radius: var(--radius); background: linear-gradient(135deg, #07111f, #0d2c2a); color: white; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.10); z-index: 999; transform: translateY(14px) scale(.96); opacity: 0; pointer-events: none; transition: all .25s cubic-bezier(.34,1.56,.64,1); font-size: 13px; font-weight: 700; max-width: 320px; }
.toast.show { transform: none; opacity: 1; }

/* ══ UTILITIES ════════════════════════════════════════════════════ */
.help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.link { color: var(--primary-dark); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.link:hover { color: var(--primary); }
.warning-box { border: 1px solid #fde68a; background: var(--warning-bg); color: #92400e; padding: 11px; border-radius: var(--radius-sm); }
.success-box { border: 1px solid #a7f3d0; background: var(--success-bg); color: #065f46; padding: 11px; border-radius: var(--radius-sm); }
.danger-card { border-color: #fecaca; background: var(--danger-bg); }
.loading-card { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); padding: 6px 0; }
.empty-state { min-height: 140px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 22px; }
.empty-state .icon { width: 36px; height: 36px; color: var(--primary-dark); opacity: .6; }
.empty-state h3 { margin: 7px 0 3px; color: var(--text-2); font-size: 14px; }
.empty-state p { margin: 0; font-size: 13px; }
.small-empty { min-height: 90px; }
.check-row label { display: flex; align-items: center; gap: 7px; font-weight: 700; }

/* ══ DEFAULT BROADCAST DESIGNER ══════════════════════════════════ */
.default-designer-card { overflow: hidden; }
.default-designer-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, .9fr); gap: 13px; align-items: start; margin-top: 11px; }
.default-designer-controls { display: grid; gap: 9px; }
.designer-group { border: 1px solid var(--line); background: rgba(248,250,252,.88); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-xs); }
.designer-group h3 { margin: 0 0 9px; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.designer-group h3 .icon { width: 14px; height: 14px; color: var(--primary-dark); }

.default-preview-panel { position: sticky; top: 80px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 11px; box-shadow: var(--shadow-sm); }
.preview-toolbar { display: flex; justify-content: space-between; gap: 9px; align-items: center; margin-bottom: 7px; }
.preview-toolbar span { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 12px; }
.preview-toolbar small { color: var(--muted); font-size: 11px; font-weight: 700; }
.default-broadcast-preview { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #0f172a; border: 1px solid rgba(15,23,42,.10); }
.default-preview-stage { position: relative; width: 100%; height: 100%; overflow: hidden; color: var(--default-text, #fff); display: flex; padding: 16px; }
.default-preview-media, .default-preview-gradient { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.default-preview-file { display: grid; place-items: center; gap: 4px; background: radial-gradient(ellipse at 20% 10%, rgba(13,148,136,.24), transparent 30%), #0f172a; color: white; text-align: center; font-weight: 800; }
.default-preview-overlay { position: absolute; inset: 0; }
.default-preview-content { position: relative; z-index: 2; max-width: 74%; align-self: center; padding: 15px; }
.default-preview-stage.panel-glass .default-preview-content { border: 1px solid rgba(255,255,255,.22); background: rgba(15,23,42,.32); border-radius: 14px; backdrop-filter: blur(8px); }
.default-preview-stage.panel-solid .default-preview-content { background: rgba(15,23,42,.80); border-radius: 14px; }
.default-preview-stage.layout-center { justify-content: center; align-items: center; }
.default-preview-stage.layout-left { justify-content: flex-start; align-items: center; }
.default-preview-stage.layout-right { justify-content: flex-end; align-items: center; }
.default-preview-stage.layout-bottom { align-items: flex-end; justify-content: center; }
.default-preview-stage.layout-bottom .default-preview-content { max-width: 94%; width: 94%; }
.default-preview-stage.align-left .default-preview-content { text-align: left; }
.default-preview-stage.align-center .default-preview-content { text-align: center; }
.default-preview-stage.align-right .default-preview-content { text-align: right; }
.default-preview-subtitle { font-size: var(--default-subtitle, 10px); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .9; margin-bottom: 3px; }
.default-preview-content h1 { margin: 0; font-size: var(--default-title, 20px); line-height: .98; letter-spacing: -.065em; }
.default-preview-content p { margin: 5px 0 0; font-size: var(--default-message, 9px); line-height: 1.22; opacity: .92; }
.default-preview-screenline { margin-top: 7px; font-size: 8px; font-weight: 900; opacity: .7; }

/* ══ TV DEFAULT SCREEN ═══════════════════════════════════════════ */
.tv-default-holder { padding: 0 !important; }
.tv-default-screen { position: relative; width: 100vw; height: 100vh; overflow: hidden; color: var(--default-text, #fff); display: flex; padding: clamp(36px, 5vw, 86px); background: var(--default-solid, #0f172a); }
.default-bg-media, .default-bg-gradient { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; border-radius: 0 !important; }
.default-bg-gradient { background: radial-gradient(ellipse at 16% 14%, rgba(13,148,136,.42), transparent 32%), radial-gradient(ellipse at 88% 82%, rgba(20,184,166,.24), transparent 32%), linear-gradient(135deg, var(--default-solid, #0f172a), #134e4a); }
.default-bg-overlay { position: absolute; inset: 0; z-index: 1; }
.tv-default-content { position: relative; z-index: 2; max-width: min(1180px, 74vw); align-self: center; padding: clamp(22px, 3vw, 48px); }
.tv-default-screen.panel-glass .tv-default-content { border: 1px solid rgba(255,255,255,.22); background: rgba(15,23,42,.34); border-radius: clamp(22px, 3vw, 42px); backdrop-filter: blur(14px); box-shadow: 0 32px 88px rgba(0,0,0,.30); }
.tv-default-screen.panel-solid .tv-default-content { background: rgba(15,23,42,.84); border-radius: clamp(22px, 3vw, 42px); box-shadow: 0 32px 88px rgba(0,0,0,.32); }
.tv-default-screen.layout-center { justify-content: center; align-items: center; }
.tv-default-screen.layout-left { justify-content: flex-start; align-items: center; }
.tv-default-screen.layout-right { justify-content: flex-end; align-items: center; }
.tv-default-screen.layout-bottom { justify-content: center; align-items: flex-end; padding-bottom: clamp(72px, 8vw, 140px); }
.tv-default-screen.layout-bottom .tv-default-content { max-width: min(1480px, 92vw); width: 92vw; }
.tv-default-screen.align-left .tv-default-content { text-align: left; }
.tv-default-screen.align-center .tv-default-content { text-align: center; }
.tv-default-screen.align-right .tv-default-content { text-align: right; }
.tv-default-subtitle { font-size: clamp(16px, calc(var(--default-subtitle, 34px) / 2), var(--default-subtitle, 34px)); font-weight: 900; letter-spacing: .10em; text-transform: uppercase; opacity: .9; margin-bottom: clamp(8px, 1vw, 16px); }
.tv-default-content h1 { margin: 0; font-size: clamp(28px, calc(var(--default-title, 72px) / 1.5), var(--default-title, 72px)); line-height: .98; letter-spacing: -.065em; }
.tv-default-content p { margin: clamp(12px, 1.6vw, 24px) 0 0; font-size: clamp(18px, calc(var(--default-message, 30px) / 1.35), var(--default-message, 30px)); line-height: 1.25; font-weight: 600; opacity: .92; }
.tv-default-screenline { margin-top: clamp(14px, 2vw, 26px); font-size: clamp(13px, 1.2vw, 20px); font-weight: 800; opacity: .65; }

/* ══ TV PLAYER ═══════════════════════════════════════════════════ */
.tv-body { margin: 0; background: #020617; color: white; overflow: hidden; width: 100vw; height: 100vh; }

.tv-stage { position: fixed; inset: 0; background: radial-gradient(ellipse at 10% 8%, rgba(13,148,136,.22) 0%, transparent 30%), radial-gradient(ellipse at 90% 18%, rgba(99,102,241,.13) 0%, transparent 28%), linear-gradient(145deg, #020617 0%, #06111f 55%, #041e1b 100%); }
.tv-body.no-tv-backdrop .tv-stage { background: #020617; }

.tv-media { position: fixed; inset: 0; width: 100vw; height: 100vh; display: grid; place-items: center; overflow: hidden; }
.tv-media img, .tv-media video { width: 100vw; height: 100vh; max-width: none; max-height: none; border: 0; display: block; object-fit: contain; }
.tv-media iframe { width: 100%; height: 100%; border: 0; background: white; }
.tv-body.fit-contain .tv-media img, .tv-body.fit-contain .tv-media video { object-fit: contain; }
.tv-body.fit-cover .tv-media img, .tv-body.fit-cover .tv-media video { object-fit: cover; }
.tv-body.fit-stretch .tv-media img, .tv-body.fit-stretch .tv-media video { object-fit: fill; }

.tv-top { position: fixed; top: 13px; left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; z-index: 8; pointer-events: none; }

.tv-brand { display: flex; align-items: center; gap: 10px; background: rgba(2,6,23,.66); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.10); padding: 9px 13px; border-radius: 17px; max-width: min(640px, 68vw); box-shadow: 0 16px 44px rgba(0,0,0,.26); }
.tv-brand img { width: 40px; height: 40px; object-fit: contain; background: transparent !important; padding: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.tv-brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: transparent !important; box-shadow: none !important; }
.tv-brand-mark .icon { width: 25px; height: 25px; }
.tv-company { font-weight: 900; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(13px, 1.5vw, 21px); }
.tv-screen-name { color: #cbd5e1; font-size: clamp(10px, .9vw, 13px); margin-top: 2px; }

.tv-clock { background: rgba(2,6,23,.66); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.10); padding: 9px 13px; border-radius: 17px; text-align: right; box-shadow: 0 16px 44px rgba(0,0,0,.26); }
.tv-time { font-size: clamp(19px, 2.2vw, 34px); font-weight: 900; letter-spacing: -.04em; }
.tv-date { color: #cbd5e1; font-size: clamp(10px, .95vw, 14px); }

.tv-body.no-tv-overlay-bg .tv-brand, .tv-body.no-tv-overlay-bg .tv-clock { background: transparent !important; border: 0 !important; box-shadow: none !important; backdrop-filter: none !important; padding: 5px 7px; text-shadow: 0 2px 12px rgba(0,0,0,.78); }

.tv-body.compact-tv-header .tv-top { top: 9px; left: 11px; right: 11px; }
.tv-body.compact-tv-header .tv-brand { padding: 6px 9px; border-radius: 13px; }
.tv-body.compact-tv-header .tv-brand img { width: 30px; height: 30px; }
.tv-body.compact-tv-header .tv-company { font-size: clamp(11px, 1.2vw, 17px); }
.tv-body.compact-tv-header .tv-clock { padding: 6px 10px; border-radius: 13px; }
.tv-body.compact-tv-header .tv-time { font-size: clamp(15px, 1.8vw, 27px); }

.tv-ticker { position: fixed; left: 0; right: 0; bottom: 0; height: 50px; background: rgba(2,6,23,.90); border-top: 1px solid rgba(255,255,255,.08); overflow: hidden; display: flex; align-items: center; z-index: 6; }
.tv-ticker-label { height: 100%; padding: 0 17px; display: grid; place-items: center; background: var(--primary-dark, #0f766e); font-weight: 900; font-size: 12px; z-index: 2; letter-spacing: .05em; white-space: nowrap; }
.tv-ticker-track { white-space: nowrap; font-size: clamp(16px, 1.7vw, 26px); font-weight: 700; animation: tickerScroll 32s linear infinite; padding-left: 100%; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.tv-progress { position: fixed; left: 0; bottom: 50px; height: 4px; background: var(--primary-dark, #0f766e); width: 0%; z-index: 7; transition: width .2s linear; box-shadow: 0 0 16px var(--primary-light, #14b8a6); }
.tv-body.no-ticker .tv-progress { bottom: 0; }
.tv-body.no-progress .tv-progress { display: none; }

.tv-empty { text-align: center; padding: 40px; max-width: 800px; }
.tv-empty h1 { font-size: clamp(28px, 5vw, 62px); margin: 0 0 13px; }
.tv-empty p { color: #cbd5e1; font-size: clamp(15px, 2vw, 25px); line-height: 1.4; }

.tv-emergency { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 6vw; background: radial-gradient(ellipse, rgba(239,68,68,.22), rgba(2,6,23,.97)); animation: tvEmPulse 1.3s ease-in-out infinite alternate; }
@keyframes tvEmPulse { from { filter: brightness(.94); } to { filter: brightness(1.24); } }
.tv-emergency-card { width: min(1200px, 100%); border: 3px solid rgba(255,255,255,.32); border-radius: 38px; background: rgba(127,29,29,.80); backdrop-filter: blur(12px); padding: clamp(30px, 6vw, 88px); text-align: center; box-shadow: 0 40px 100px rgba(0,0,0,.44); }
.tv-emergency-card h1 { margin: 0 0 20px; font-size: clamp(40px, 8vw, 108px); letter-spacing: -.06em; text-transform: uppercase; }
.tv-emergency-card p { margin: 0; font-size: clamp(24px, 4vw, 58px); line-height: 1.2; font-weight: 800; }
.tv-emergency-header { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-bottom: 18px; }
.tv-emergency-badge { display: inline-flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 999px; border: 2px solid rgba(255,255,255,.24); background: rgba(255,255,255,.10); color: white; font-size: clamp(16px, 2vw, 22px); font-weight: 900; letter-spacing: .14em; text-transform: uppercase; box-shadow: 0 14px 36px rgba(0,0,0,.18); }
.tv-emergency-badge-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; }
.tv-emergency-badge-icon svg { width: 100%; height: 100%; }
.tv-emergency-hero-icon { width: clamp(92px, 10vw, 140px); height: clamp(92px, 10vw, 140px); border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.12); border: 3px solid rgba(255,255,255,.24); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 22px 45px rgba(0,0,0,.22); }
.tv-emergency-hero-icon svg { width: 58%; height: 58%; }
.tv-emergency-badge.severity-info, .tv-emergency-hero-icon.severity-info { background: rgba(191,219,254,.16); border-color: rgba(191,219,254,.38); color: #dbeafe; }
.tv-emergency-badge.severity-warning, .tv-emergency-hero-icon.severity-warning { background: rgba(253,230,138,.14); border-color: rgba(253,230,138,.36); color: #fef3c7; }
.tv-emergency-badge.severity-danger, .tv-emergency-hero-icon.severity-danger { background: rgba(254,202,202,.14); border-color: rgba(254,202,202,.36); color: #fee2e2; }

.tv-emergency.severity-info { background: radial-gradient(ellipse, rgba(59,130,246,.22), rgba(2,6,23,.97)); animation: none; }
.tv-emergency.severity-info .tv-emergency-card { background: rgba(30,64,175,.80); }
.tv-emergency.severity-warning { background: radial-gradient(ellipse, rgba(245,158,11,.22), rgba(2,6,23,.97)); }
.tv-emergency.severity-warning .tv-emergency-card { background: rgba(146,64,14,.82); }
.tv-emergency.severity-danger { background: radial-gradient(ellipse, rgba(239,68,68,.30), rgba(2,6,23,.98)); }
.tv-emergency.severity-danger .tv-emergency-card { background: rgba(127,29,29,.85); }

.emergency-preview-v5 .emergency-preview-message, .tv-emergency-card .tv-emergency-message { margin: 0; line-height: 1.2; font-weight: 800; }
.emergency-preview-v5 .emergency-preview-message { font-size: clamp(14px, 1.8vw, 22px); }
.tv-emergency-card .tv-emergency-message { font-size: clamp(24px, 4vw, 58px); }
.emergency-preview-v5 p { white-space: normal; }
.tv-emergency-card p { white-space: normal; }

@media (max-width: 768px) {
  .tv-emergency-header { gap: 14px; margin-bottom: 14px; }
  .tv-emergency-badge { gap: 10px; padding: 10px 14px; letter-spacing: .1em; }
  .tv-emergency-badge-icon { width: 22px; height: 22px; }
}

/* ── Missing utility classes ───────────────────────────────────── */
.dashboard-command-card { display: flex; flex-direction: column; gap: 11px; }
.emergency-form-card { display: flex; flex-direction: column; gap: 13px; }
.link-card { display: flex; flex-direction: column; gap: 11px; }
.modern-upload { display: flex; flex-direction: column; }
.multi-drop-zone { border: 2px dashed var(--line-2); border-radius: var(--radius-lg); padding: 26px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; transition: all var(--transition); background: var(--surface-2); color: var(--muted); }
.multi-drop-zone:hover { border-color: var(--primary-light); background: #f0fdfa; color: var(--primary-dark); }
.multi-drop-zone .drop-icon { width: 32px; height: 32px; color: var(--muted); margin-bottom: 4px; }
.multi-drop-zone b { font-size: 14px; color: var(--text-2); font-weight: 700; }
.multi-drop-zone span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.size-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.users-list-card-v10 { display: flex; flex-direction: column; gap: 11px; }
.compact-form-card { padding: 16px; }
.advanced-upload-card { min-height: 0; }

/* ══ RESPONSIVE ══════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .settings-v10-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .users-layout-v10 { grid-template-columns: 310px minmax(0, 1fr); }
  .emergency-grid-v5 { grid-template-columns: minmax(0, 1fr) 370px; }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-control-grid { grid-template-columns: 1fr; }
  .emergency-grid-v5 { grid-template-columns: 1fr; }
  .settings-v10-layout { grid-template-columns: 1fr; }
  .users-layout-v10 { grid-template-columns: 1fr; }
  .settings-category-grid { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-user-card-v10 { position: static; }
  .emergency-preview-card-v5 { position: static; }
  .playlist-workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .help-layout { grid-template-columns: 260px 1fr; }
  .help-nav-card { position: static; }
  .default-designer-grid { grid-template-columns: 1fr; }
  .default-preview-panel { position: static; }
  .user-stats-grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr !important; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh !important; margin: 0; border-radius: 0; z-index: 300; transform: translateX(0); transition: transform .25s cubic-bezier(.4,0,.2,1); box-shadow: 8px 0 40px rgba(0,0,0,.35); }
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(calc(-100% - 10px)); box-shadow: none; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 299; background: rgba(2,6,23,.5); backdrop-filter: blur(2px); animation: overlayIn .2s ease; }
  @keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
  .main { padding: 13px 14px 26px; }
  .topbar { margin: 0 0 14px; border-radius: var(--radius); }
  .page-title p { display: none; }
  .page-title h1 { font-size: 19px; }
}

@media (max-width: 760px) {
  .topbar { border-radius: var(--radius-sm); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: 1fr; }
  .v5-hero, .media-hero, .playlist-hero, .activity-hero.card, .emergency-hero-v5 { flex-direction: column; align-items: flex-start; }
  .hero-actions, .media-controls, .toolbar { justify-content: flex-start; }
  .settings-v10-hero, .users-hero { flex-direction: column; align-items: flex-start; }
  .settings-v10-actions .btn { width: 100%; }
  .severity-picker { grid-template-columns: 1fr; }
  .emergency-style-grid { grid-template-columns: 1fr; }
  .size-grid { grid-template-columns: 1fr; }
  .playlist-workspace { grid-template-columns: 1fr; }
  .playlist-list-card { position: static; }
  .help-layout { grid-template-columns: 1fr; }
  .playlist-item-v5 { grid-template-columns: 36px 1fr; }
  .playlist-item-v5 .large-thumb, .playlist-item-v5 .playlist-item-main, .playlist-item-v5 .duration-control, .playlist-item-v5 .playlist-item-actions { grid-column: 1 / -1; }
  .activity-row-v5 { grid-template-columns: 38px minmax(0, 1fr); }
  .activity-row-v5 time { grid-column: 2; text-align: left; }
  .quick-action-grid { grid-template-columns: 1fr; }
  .user-card-grid-v10 { grid-template-columns: 1fr; }
  .settings-category-grid { grid-template-columns: 1fr !important; }
  .user-permission-summary { grid-template-columns: 1fr; }
  .full-rich-editor .rich-editor-toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .full-rich-editor .rich-editor-toolbar button { justify-content: center; }
  .toolbar-divider { display: none; }
}

@media (max-width: 480px) {
  .login-body { padding: 12px; }
  .login-card { padding: 20px; border-radius: var(--radius-xl); }
  .login-brand-row h1 { font-size: 20px; }
  .grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card { padding: 12px; border-radius: var(--radius); }
  .metric { min-height: 88px; }
  .metric-value { font-size: 24px; }
  .asset-grid.thumb-small, .asset-grid.thumb-medium, .asset-grid.thumb-large { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .user-actions-v10 .btn { flex-basis: calc(50% - 3px); }
  .full-rich-editor .rich-editor-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .tv-top { top: 9px; left: 9px; right: 9px; }
  .tv-brand { max-width: 100%; }
  .tv-clock { display: none; }
}

/* ══ V12 NEW STYLES ═══════════════════════════════════════════════ */

/* Dark mode -------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #0f172a; --surface: #1e293b; --surface-2: #162032; --surface-3: #1e293b;
  --text: #e2e8f0; --text-2: #94a3b8; --muted: #64748b;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.12);
  --card-bg: #1a2744; --card-border: rgba(255,255,255,.07);
  --topbar-bg: rgba(15,23,42,.85); --shadow: 0 2px 12px rgba(0,0,0,.4);
}
[data-theme="dark"] .card { background: var(--card-bg); border-color: var(--card-border); }
[data-theme="dark"] .sidebar { background: linear-gradient(180deg,#0c1526 0%,#0a1220 100%); }
[data-theme="dark"] .input, [data-theme="dark"] .select, [data-theme="dark"] .textarea { background: #0f172a; color: var(--text); border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .topbar { background: var(--topbar-bg); border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .modal { background: #1e293b; }
[data-theme="dark"] .quick-action { background: #1e293b; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .quick-action:hover { background: #253347; }
[data-theme="dark"] .flow-card { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .settings-category-card { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .playlist-select-card { background: #1e293b; }
[data-theme="dark"] .picker-media-card { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .playlist-item-v5 { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .asset-card { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .user-card-v10 { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .screen-card-v12 { background: #1e293b; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .multi-drop-zone { background: #1e293b; border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .activity-row-v5 { border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .help-card { background: #1e293b; border-color: rgba(255,255,255,.07); }

/* Theme toggle / icon-btn ----------------------------------------- */
.icon-btn { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--text-2); display: flex; align-items: center; justify-content: center; transition: background var(--transition), color var(--transition); }
.icon-btn:hover { background: rgba(255,255,255,.1); color: var(--text); }

/* Emergency bell dot ---------------------------------------------- */
.emergency-nav-btn { position: relative; }
.emergency-bell-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: transparent; transition: background .3s; }
.emergency-bell-dot.active { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.3); animation: pulse 1.4s ease-in-out infinite; }

/* Emergency clear banner ------------------------------------------ */
.emergency-clear-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 18px; font-size: 14px; font-weight: 600; color: var(--danger); }
.emergency-clear-banner .btn { flex-shrink: 0; }

/* Screen status dot ----------------------------------------------- */
.screen-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-right: 6px; }
.screen-status-dot.online  { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.screen-status-dot.offline { background: #94a3b8; }

/* Screen cards (v12) --------------------------------------------- */
.screen-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.screen-card-v12 { display: flex; flex-direction: column; gap: 12px; }
.screen-card-v12.disabled { opacity: .65; }
.screen-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.screen-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.screen-card-title b { font-size: 15px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-card-location { font-size: 12px; color: var(--muted); }
.screen-card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.screen-card-meta span { display: flex; align-items: center; gap: 4px; }
.screen-card-meta .icon { width: 13px; height: 13px; }
.screen-card-url { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: var(--radius); padding: 7px 10px; font-size: 12px; flex-wrap: wrap; }
.screen-card-url code { flex: 1; font-family: var(--font-mono, monospace); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-card-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* Asset tags ------------------------------------------------------ */
.asset-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.asset-tag { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); letter-spacing: .03em; }

/* Upload progress bar fill --------------------------------------- */
.upload-progress { margin-top: 10px; }
.upload-progress span { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.upload-progress div { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.upload-progress i { display: block; height: 100%; background: var(--primary); border-radius: 999px; width: 0%; transition: width .2s ease; }

/* Playlist item schedule line ------------------------------------ */
.item-schedule { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.item-schedule .icon { width: 12px; height: 12px; }

/* Set All Duration button ---------------------------------------- */
.playlist-order-toolbar .media-controls { flex-wrap: wrap; gap: 6px; }

/* Bulk item action / confirm modal ------------------------------- */
.modal .btn-row { display: flex; gap: 10px; }

/* Relative timestamps in audit ----------------------------------- */
.activity-row-v5 time { white-space: nowrap; font-size: 11px; color: var(--muted); }

/* Screen target picker in emergency ------------------------------ */
.screen-target-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.screen-target-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); user-select: none; }
.screen-target-check:hover { background: var(--surface-3); }
.screen-target-check input { accent-color: var(--danger); }

/* Emergency form quick-clear action area ------------------------- */
.emergency-form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* TV slide transition wrapper ------------------------------------ */
.tv-slide-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; backface-visibility: hidden; will-change: transform, opacity; }
.tv-slide-wrap img, .tv-slide-wrap video { width: 100%; height: 100%; }
.tv-slide-wrap iframe { width: 100%; height: 100%; border: 0; }
.tv-media { position: relative; }

/* Import/Export buttons in settings ------------------------------ */
.settings-v10-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.settings-v10-actions a.btn { text-decoration: none; }

/* Confirm modal -------------------------------------------------- */
.modal .btn-row { gap: 10px; }

/* Dashboard: screen heartbeat in chip ---------------------------- */
.screen-chip .screen-status-dot { margin-right: 2px; }

/* Help section headings ------------------------------------------ */
.help-section { margin-bottom: 18px; }
.help-section .section-title { margin-bottom: 14px; }
.help-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.help-card { background: var(--surface-2); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.help-card .icon { width: 20px; height: 20px; color: var(--primary); }
.help-card h3 { font-size: 13px; font-weight: 700; }
.help-card p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
.help-nav-card a { display: block; font-size: 13px; color: var(--primary); padding: 3px 0; }
.help-nav-card a:hover { text-decoration: underline; }

/* Sidebar user footer -------------------------------------------- */
.sidebar-user { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info span { display: block; font-size: 12px; color: rgba(255,255,255,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .sidebar-role { font-size: 10px; color: rgba(255,255,255,.4); }
.sidebar-footer { margin-top: auto; }

/* Missing moon icon (dark mode toggle) ---------------------------- */
[data-lucide="moon"] { display: none; }

/* Responsive -------------------------------------------------------- */
@media (max-width: 760px) {
  .screen-cards-grid { grid-template-columns: 1fr; }
  .emergency-clear-banner { flex-direction: column; align-items: flex-start; }
  .screen-card-actions { gap: 5px; }
  .help-card-grid { grid-template-columns: 1fr; }
}


/* ══ V13 ADMIN UI ORGANIZATION LAYER ═══════════════════════════════
   Keeps the admin panel light-only, fixes class-name drift between
   admin.html and earlier CSS, and improves spacing/responsiveness.
   ═════════════════════════════════════════════════════════════════ */

html[data-theme="light"] body:not(.tv-body),
body.no-admin-theme:not(.tv-body) {
  color-scheme: light;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(13,148,136,.10) 0%, transparent 36%),
    radial-gradient(ellipse at 100% 0%, rgba(14,165,233,.07) 0%, transparent 36%),
    linear-gradient(180deg, #f6fbfa 0%, #f2f6fb 58%, #eef3f8 100%);
}

/* Login shell used by admin.html */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 42px);
  background:
    radial-gradient(ellipse at 20% 15%, rgba(13,148,136,.28) 0%, transparent 42%),
    radial-gradient(ellipse at 82% 78%, rgba(59,130,246,.16) 0%, transparent 40%),
    linear-gradient(145deg, #061521 0%, #0b2230 48%, #041d1b 100%);
}
.login-shell .login-card { width: min(460px, 100%); }
.login-logo-area { display: grid; place-items: center; margin-bottom: 16px; }
.login-logo-area img {
  max-width: 190px;
  max-height: 82px;
  object-fit: contain;
  background: transparent !important;
  box-shadow: none !important;
}
.login-logo-fallback {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  box-shadow: 0 18px 45px rgba(13,148,136,.34);
}
.login-logo-fallback .icon { width: 31px; height: 31px; }
.login-card h1 { margin: 0; text-align: center; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.05em; }
.login-subtitle { margin: 6px 0 20px; color: var(--muted); text-align: center; font-weight: 650; }
.login-form { display: grid; gap: 12px; }
.login-form .form-row { margin-bottom: 0; }
.login-form .input { min-height: 46px; }

/* Main shell alignment */
.app-shell {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  column-gap: 0;
}
.sidebar-header { position: relative; z-index: 1; }
.sidebar .brand-mark img,
.sidebar .brand-mark.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
  background: transparent !important;
  border-radius: 0;
}
.sidebar-fallback-icon { display: grid; place-items: center; width: 100%; height: 100%; }
.brand-text { min-width: 0; }
.nav-divider { height: 1px; background: rgba(255,255,255,.09); margin: 7px 8px; }
.nav-btn-inner { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.sidebar .icon-btn { color: rgba(255,255,255,.68); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.sidebar .icon-btn:hover { color: white; background: rgba(255,255,255,.12); }

.main-area {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 22px 34px 20px;
  scroll-behavior: smooth;
}
.page-content { display: grid; gap: 18px; padding-bottom: 18px; }
.topbar {
  top: 12px;
  margin: 0 0 18px;
  min-height: 70px;
  padding: 12px 16px;
}
.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h1 {
  margin: 0;
  font-size: clamp(21px, 2.1vw, 31px);
  font-weight: 850;
  letter-spacing: -.055em;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-description { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar .live-state {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 7px 11px;
  font-weight: 800;
  box-shadow: var(--shadow-xs);
}
.sidebar-toggle-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: var(--shadow-xs);
}
.sidebar-toggle-btn:hover { background: #f0fdfa; border-color: rgba(13,148,136,.24); }

/* Light-only admin: hide legacy theme controls if old HTML/browser cache keeps them */
#themeToggle { display: none !important; }

/* Improve common page sections */
.card { border-color: rgba(203,213,225,.82); }
.v5-hero, .media-hero, .playlist-hero, .users-hero, .activity-hero, .settings-v10-hero, .emergency-hero-v5 {
  border: 1px solid rgba(203,213,225,.78);
  box-shadow: var(--shadow-sm);
}
.hero-actions, .settings-v10-actions, .btn-row { align-items: center; }
.btn { min-height: 36px; }
.btn.primary, .btn.warning, .btn.danger { color: #fff; }
.input, .select, .textarea { min-height: 40px; }
.textarea { line-height: 1.45; }
.inline-tip {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  border: 1px dashed #99f6e4;
  border-radius: var(--radius-sm);
  background: #f0fdfa;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

/* Media / playlist organization */
.media-stats, .dashboard-metrics { margin-top: 0; }
.upload-panel, .link-card, .dashboard-command-card { min-height: 100%; }
.asset-toolbar, .toolbar {
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.78);
}
.asset-card, .playlist-select-card, .playlist-item-v5, .screen-card-v12, .user-card-v10, .help-card {
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}
.asset-card:hover, .playlist-select-card:hover, .playlist-item-v5:hover, .screen-card-v12:hover, .user-card-v10:hover, .help-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(13,148,136,.22);
}
.playlist-workspace { align-items: start; }
.playlist-item-actions .btn, .screen-card-actions .btn { white-space: nowrap; }

/* Settings categories: easier to scan */
.settings-category-grid { gap: 9px; }
.settings-category-card { min-height: 70px; }
.settings-panel-head { position: relative; overflow: hidden; }
.settings-panel-head::after {
  content: '';
  position: absolute;
  inset: 0 0 auto auto;
  width: 160px;
  height: 100%;
  background: radial-gradient(ellipse at top right, rgba(13,148,136,.10), transparent 65%);
  pointer-events: none;
}
.settings-panel-badge {
  z-index: 1;
  align-self: flex-start;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.settings-form-card, .settings-panel > .settings-option-grid { background: rgba(255,255,255,.98); }
.advanced-setting-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.setting-toggle { min-height: 76px; }

/* Emergency editor and preview */
.rich-editor-toolbar { gap: 6px; }
.rich-editor-toolbar button { min-height: 30px; }
.emergency-preview-card-v5 { top: 96px; }
.emergency-clear-banner { box-shadow: var(--shadow-xs); }

/* Better collapsed sidebar */
.app-shell.sidebar-collapsed { grid-template-columns: 74px minmax(0, 1fr); }
.app-shell.sidebar-collapsed .sidebar { margin-left: 8px; padding-inline: 8px; }
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-btn > span:not(.nav-btn-inner),
.app-shell.sidebar-collapsed .nav-btn-inner span,
.app-shell.sidebar-collapsed .sidebar-user-info,
.app-shell.sidebar-collapsed .nav-divider { display: none !important; }
.app-shell.sidebar-collapsed .nav-btn { justify-content: center; padding: 10px; }
.app-shell.sidebar-collapsed .brand-mark { margin-inline: auto; }
.app-shell.sidebar-collapsed .sidebar-user { padding: 10px 6px; justify-content: center; }

/* Modal polish */
.modal-backdrop { z-index: 1000; }
.modal { width: min(760px, calc(100vw - 28px)); }
.modal-head h2 { line-height: 1.25; }
.toast { z-index: 1200; }

/* Mobile and tablet organization */
@media (max-width: 1100px) {
  .main-area { padding: 14px 16px 30px; }
  .settings-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) !important; }
  .main-area { height: auto; min-height: 100vh; overflow: visible; padding: 12px 12px 26px; }
  .sidebar { width: min(300px, 88vw); }
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(calc(-100% - 18px)); }
  .topbar { top: 8px; min-height: 60px; border-radius: var(--radius); }
  .topbar .live-state { font-size: 0; padding: 8px; }
  .topbar .live-state::before { margin: 0; }
  .page-description { display: none; }
}
@media (max-width: 760px) {
  :root { font-size: 13px; }
  .grid-2, .grid-3, .grid-4, .dashboard-control-grid { grid-template-columns: 1fr !important; }
  .settings-category-grid { grid-template-columns: 1fr !important; }
  .severity-picker { grid-template-columns: 1fr; }
  .topbar { gap: 8px; padding: 10px; }
  .topbar-titles h1 { font-size: 20px; }
  .btn, .settings-v10-actions .btn, .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-actions, .settings-v10-actions, .media-controls { width: 100%; }
  .modal { padding: 16px; }
}
@media (max-width: 520px) {
  .login-card { padding: 24px; border-radius: 24px; }
  .sidebar { width: min(286px, 90vw); }
  .topbar-right { display: none; }
  .settings-panel-head { flex-direction: column; }
  .settings-panel-badge { align-self: flex-start; }
}

/* v14/v16 — Per-TV emergency broadcast controls ---------------------- */
.emergency-left-stack { display: grid; gap: 13px; }
.muted-label { color: var(--muted); font-size: 12px; font-weight: 700; margin-left: 6px; }
.individual-emergency-panel { display: grid; gap: 12px; }
.individual-tv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.individual-tv-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.92)); box-shadow: var(--shadow-sm); transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); }
.individual-tv-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.individual-tv-card.active { border-color: rgba(239,68,68,.35); background: linear-gradient(180deg, rgba(254,242,242,.95), rgba(255,255,255,.95)); }
.individual-tv-card.global-active { border-color: rgba(245,158,11,.35); background: linear-gradient(180deg, rgba(255,251,235,.95), rgba(255,255,255,.95)); }
.individual-tv-card.severity-info.active { border-color: rgba(37,99,235,.34); background: linear-gradient(180deg, rgba(239,246,255,.96), rgba(255,255,255,.96)); }
.individual-tv-card.severity-warning.active { border-color: rgba(245,158,11,.38); background: linear-gradient(180deg, rgba(255,251,235,.96), rgba(255,255,255,.96)); }
.individual-tv-card.severity-danger.active { border-color: rgba(239,68,68,.42); background: linear-gradient(180deg, rgba(254,242,242,.98), rgba(255,255,255,.96)); }
.individual-tv-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.individual-tv-head > div { display: flex; gap: 9px; min-width: 0; }
.individual-tv-head .icon { color: var(--primary-dark); width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.individual-tv-head b { display: block; font-size: 14px; line-height: 1.2; }
.individual-tv-head small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.individual-tv-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.individual-tv-card.active .individual-tv-status { color: #b91c1c; background: rgba(254,226,226,.75); border-color: rgba(239,68,68,.24); }
.individual-tv-card.global-active .individual-tv-status { color: #92400e; background: rgba(254,243,199,.75); border-color: rgba(245,158,11,.24); }
.individual-tv-card p { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 12px 0; min-height: 34px; }
.individual-tv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.screen-emergency-modal-form { gap: 12px; }
.screen-emergency-modal-form .rich-editor { min-height: 220px; }
.screen-emergency-modal-form .inline-tip { margin: 2px 0 4px; }

/* v16 — modern individual TV emergency modal -------------------- */
.emergency-modal-head { border-bottom: 0; margin: -2px -2px 12px; padding: 18px 18px 16px; border-radius: 22px; background: radial-gradient(ellipse at 0% 0%, rgba(255,255,255,.28), transparent 42%), linear-gradient(135deg, #7f1d1d, #dc2626); color: white; }
.emergency-modal-head .close-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.24); color: white; }
.emergency-modal-head .close-btn:hover { background: rgba(255,255,255,.22); color: white; }
.modal-title-stack { display: grid; gap: 4px; min-width: 0; }
.modal-title-stack h2 { color: white; font-size: clamp(19px, 2.2vw, 27px); letter-spacing: -.055em; }
.modal-title-stack p { margin: 0; color: rgba(255,255,255,.78); font-size: 12px; font-weight: 700; }
.modal-kicker { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,.78); font-size: 11px; font-weight: 900; letter-spacing: .10em; text-transform: uppercase; }
.modern-screen-emergency-modal { gap: 14px; }
.modern-screen-emergency-modal .form-row label { font-weight: 900; color: var(--text-2); }
.screen-emergency-top-note { border: 1px solid rgba(239,68,68,.18); background: linear-gradient(135deg, rgba(254,242,242,.95), rgba(255,251,235,.88)); border-radius: var(--radius-lg); padding: 12px 14px; }
.screen-emergency-top-note > div { display: grid; grid-template-columns: 20px minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 8px; color: #991b1b; font-size: 12px; }
.screen-emergency-top-note span { color: #92400e; font-weight: 700; line-height: 1.4; }
.screen-emergency-modal-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 14px; align-items: start; }
.screen-emergency-main-panel, .screen-emergency-preview-panel { border: 1px solid var(--line); border-radius: var(--radius-xl); background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.92)); padding: 14px; box-shadow: var(--shadow-sm); }
.screen-emergency-main-panel { display: grid; gap: 12px; }
.screen-emergency-section-title { display: flex; align-items: center; gap: 7px; margin-top: 2px; color: var(--text-2); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.screen-message-editor-shell { border-radius: 18px; border-color: #dbe4ee; box-shadow: inset 0 0 0 1px rgba(255,255,255,.8); }
.compact-emergency-toolbar { background: linear-gradient(180deg, #f8fafc, #eef2f7); }
.compact-emergency-toolbar button { border-radius: 10px; }
.individual-emergency-message-editor { min-height: clamp(230px, 34vh, 390px); font-size: 15px; }
.screen-severity-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal-style-grid { margin: 0; }
.screen-emergency-preview-panel { position: sticky; top: 12px; display: grid; gap: 10px; }
.screen-emergency-preview-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 900; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.screen-emergency-preview { min-height: 320px; border-radius: 28px; padding: 22px; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; color: white; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18), 0 24px 48px rgba(15,23,42,.20); overflow: hidden; }
.screen-emergency-preview.severity-info { background: radial-gradient(ellipse at 50% 0%, rgba(147,197,253,.45), transparent 45%), linear-gradient(135deg, #1e40af, #2563eb); }
.screen-emergency-preview.severity-warning { background: radial-gradient(ellipse at 50% 0%, rgba(253,230,138,.44), transparent 45%), linear-gradient(135deg, #92400e, #d97706); }
.screen-emergency-preview.severity-danger { background: radial-gradient(ellipse at 50% 0%, rgba(252,165,165,.44), transparent 45%), linear-gradient(135deg, #7f1d1d, #dc2626); }
.screen-emergency-preview > span { display: inline-flex; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); font-weight: 950; font-size: 11px; letter-spacing: .14em; }
.screen-emergency-preview h3 { margin: 0; text-transform: uppercase; letter-spacing: -.05em; line-height: 1.05; max-width: 100%; overflow-wrap: anywhere; }
.screen-emergency-preview-message { line-height: 1.18; max-width: 100%; overflow-wrap: anywhere; }
.screen-emergency-preview-message ul, .screen-emergency-preview-message ol { display: inline-block; text-align: left; margin: .25em 0 .25em 1.1em; padding-left: .8em; }
.screen-emergency-priority-tip { border: 1px solid #bfdbfe; background: var(--info-bg); color: #1e40af; border-radius: var(--radius); padding: 10px 11px; line-height: 1.45; }
.screen-emergency-modal-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; padding-top: 2px; }
.screen-emergency-modal-actions .btn { min-height: 42px; }
.modal:has(.modern-screen-emergency-modal) { width: min(1180px, calc(100vw - 28px)); padding: 18px; }

@media (max-width: 1280px) { .individual-tv-grid { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .screen-emergency-modal-layout { grid-template-columns: 1fr; }
  .screen-emergency-preview-panel { position: static; }
  .screen-emergency-preview { min-height: 240px; }
}
@media (max-width: 760px) {
  .individual-tv-head { flex-direction: column; }
  .individual-tv-status { align-self: flex-start; }
  .individual-tv-head small { max-width: 70vw; }
  .screen-severity-picker { grid-template-columns: 1fr; }
  .screen-emergency-top-note > div { grid-template-columns: 20px 1fr; }
  .screen-emergency-top-note span { grid-column: 2; }
  .screen-emergency-modal-actions .btn { width: 100%; justify-content: center; }
}

/* ================================================================
   v19 Admin polish: logo-only sidebar, advanced login, TV status
   ================================================================ */

/* Sidebar top: company logo only, centered */
.sidebar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 8px 20px;
  position: relative;
  z-index: 1;
}
.sidebar-header .brand-mark {
  width: 120px;
  height: 76px;
  margin: 0 auto;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  display: grid;
  place-items: center;
  overflow: visible;
}
.sidebar-header .brand-text { display: none !important; }
.sidebar-header .brand-mark img,
.sidebar-header .brand-mark.has-logo img,
#sidebarLogo {
  width: 100%;
  height: 100%;
  max-width: 120px;
  max-height: 76px;
  object-fit: contain;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.sidebar-header .sidebar-fallback-icon {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: #fff;
}
.sidebar-header .sidebar-fallback-icon .icon {
  width: 30px;
  height: 30px;
}
.app-shell.sidebar-collapsed .sidebar-header .brand-mark {
  width: 46px;
  height: 46px;
}
.app-shell.sidebar-collapsed .sidebar-header {
  padding: 12px 4px 14px;
}

/* Advanced login page */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(20,184,166,.28), transparent 32%),
    radial-gradient(circle at 80% 85%, rgba(99,102,241,.22), transparent 34%),
    linear-gradient(135deg, #061827 0%, #0b2632 46%, #061e1b 100%);
}
.login-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
  pointer-events: none;
}
.login-backdrop-orb {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(8px);
  opacity: .42;
  animation: loginOrbFloat 8s ease-in-out infinite;
  pointer-events: none;
}
.login-backdrop-orb.orb-one { left: -120px; top: 10%; background: rgba(20,184,166,.32); }
.login-backdrop-orb.orb-two { right: -140px; bottom: 8%; background: rgba(99,102,241,.24); animation-delay: -3s; }
@keyframes loginOrbFloat { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-22px) scale(1.04); } }

.advanced-login-card {
  width: min(480px, 100%);
  padding: 32px;
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: 0 36px 110px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.96);
  backdrop-filter: blur(22px) saturate(145%);
}
.login-card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(20,184,166,.14), transparent 42%);
  pointer-events: none;
}
.advanced-login-card > *:not(.login-card-glow) { position: relative; z-index: 1; }
.login-logo-area {
  min-height: 86px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.login-logo-area img {
  max-width: 230px;
  max-height: 88px;
  object-fit: contain;
  background: transparent !important;
  box-shadow: none !important;
}
.login-logo-fallback {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  color: white;
  box-shadow: 0 18px 45px rgba(13,148,136,.32);
}
.login-kicker {
  width: fit-content;
  margin: 0 auto 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid #a7f3d0;
}
.advanced-login-card h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.05;
  letter-spacing: -.065em;
  color: #0f172a;
}
.login-subtitle {
  margin: 8px 0 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}
.advanced-login-form {
  display: grid;
  gap: 13px;
}
.login-input-row { margin: 0; }
.login-input-row label {
  font-size: 12px;
  font-weight: 850;
  color: #334155;
}
.login-input-shell {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-input-shell:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.login-input-shell > span {
  text-align: center;
  font-size: 15px;
  opacity: .75;
}
.login-input-shell .input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 46px;
  padding-left: 0;
}
.login-submit-btn {
  min-height: 48px;
  border-radius: 16px;
  margin-top: 2px;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
}
.login-error {
  margin: 0 0 14px;
  border-radius: 16px;
  border: 1px solid #fecaca;
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
  color: #991b1b;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(239,68,68,.10);
  animation: loginShake .22s ease;
}
.login-error div { display: grid; gap: 3px; }
.login-error b { font-size: 13px; }
.login-error span { color: #b45309; font-size: 12px; font-weight: 700; }
@keyframes loginShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.login-security-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: #eff6ff;
  color: #1e40af;
}
.login-security-note p {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

/* Dashboard animated TV activity cards */
.dashboard-tv-panel { overflow: hidden; }
.dashboard-tv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.dashboard-tv-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
}
.dashboard-tv-summary .active { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.dashboard-tv-summary .inactive { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.dashboard-tv-summary .disabled { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.dashboard-tv-status-grid {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow-y: auto;
  padding-right: 3px;
}
.dashboard-tv-card {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-xs);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
  position: relative;
  overflow: hidden;
}
.dashboard-tv-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.dashboard-tv-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: #cbd5e1;
}
.dashboard-tv-card.active { border-color: #a7f3d0; background: linear-gradient(135deg, #ffffff, #ecfdf5); }
.dashboard-tv-card.active::before { background: #10b981; box-shadow: 0 0 18px rgba(16,185,129,.55); }
.dashboard-tv-card.inactive { border-color: #e2e8f0; background: linear-gradient(135deg, #ffffff, #f8fafc); }
.dashboard-tv-card.disabled { opacity: .72; background: #f8fafc; }
.dashboard-tv-orb {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #64748b;
  position: relative;
}
.dashboard-tv-card.active .dashboard-tv-orb {
  color: #047857;
  background: #d1fae5;
}
.dashboard-tv-card.active .dashboard-tv-orb::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  border: 2px solid rgba(16,185,129,.30);
  animation: tvPulse 1.7s ease-in-out infinite;
}
.dashboard-tv-card.inactive .dashboard-tv-orb::after {
  content: '';
  position: absolute;
  right: 5px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
}
@keyframes tvPulse { 0% { transform: scale(.92); opacity: .95; } 70% { transform: scale(1.18); opacity: 0; } 100% { transform: scale(1.18); opacity: 0; } }
.dashboard-tv-copy { min-width: 0; }
.dashboard-tv-copy b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-tv-copy span,
.dashboard-tv-copy small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-tv-copy small { margin-top: 2px; font-weight: 700; color: #475569; }
.dashboard-tv-state {
  display: grid;
  justify-items: end;
  min-width: 116px;
  gap: 1px;
}
.dashboard-tv-state strong {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f1f5f9;
  color: #475569;
}
.dashboard-tv-card.active .dashboard-tv-state strong { background: #d1fae5; color: #047857; }
.dashboard-tv-card.disabled .dashboard-tv-state strong { background: #fef3c7; color: #92400e; }
.dashboard-tv-state em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.dashboard-tv-card .btn { grid-column: 1 / -1; justify-content: center; }
.screen-status-dot.online { animation: statusDotPulse 1.8s ease-in-out infinite; }
@keyframes statusDotPulse { 0%,100% { box-shadow: 0 0 0 4px rgba(16,185,129,.15); } 50% { box-shadow: 0 0 0 8px rgba(16,185,129,.05); } }

@media (max-width: 900px) {
  .sidebar-header .brand-mark { width: 100px; height: 62px; }
  .dashboard-tv-card { grid-template-columns: 48px minmax(0,1fr); }
  .dashboard-tv-state { grid-column: 2; justify-items: start; min-width: 0; }
  .dashboard-tv-state em { text-align: left; }
}
@media (max-width: 560px) {
  .login-shell { padding: 16px; }
  .advanced-login-card { padding: 24px 18px; border-radius: 26px; }
  .dashboard-tv-card { grid-template-columns: 44px minmax(0,1fr); padding: 11px; }
  .dashboard-tv-orb { width: 40px; height: 40px; border-radius: 14px; }
}


/* ================================================================
   v20 settings + playlist UX refinements
   ================================================================ */

.default-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
  align-items: center;
}

.default-media-actions .btn {
  justify-content: center;
}

.default-preview-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.add-playlist-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.add-playlist-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 76ch;
}

.playlist-picker-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.picker-filter-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  min-height: 36px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  transition: all var(--transition);
}

.picker-filter-chip b {
  color: var(--text);
}

.picker-filter-chip:hover,
.picker-filter-chip.active {
  background: #ecfdf5;
  border-color: rgba(13, 148, 136, .34);
  color: #0f766e;
  box-shadow: 0 10px 24px rgba(15, 118, 110, .08);
}

.playlist-picker-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.playlist-picker-controls .inline-tip {
  white-space: nowrap;
}

.playlist-asset-picker.optimized-picker {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  max-height: 430px;
  gap: 11px;
  padding: 2px 4px 4px 2px;
}

.picker-media-card.optimized {
  grid-template-columns: 72px minmax(0, 1fr) 34px;
  padding: 11px;
  border-radius: 18px;
  min-height: 88px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.picker-media-card.optimized:hover {
  transform: translateY(-2px);
  border-color: rgba(13,148,136,.42);
  box-shadow: 0 16px 32px rgba(15, 23, 42, .09);
}

.picker-media-card.optimized .picker-thumb {
  width: 72px;
  height: 58px;
  border-radius: 14px;
}

.picker-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.picker-copy b {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.picker-copy small {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.picker-add-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ecfdf5;
  color: #0f766e;
  border: 1px solid rgba(13,148,136,.2);
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mini-tags em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 800;
  color: #475569;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  padding: 2px 6px;
}

@media (max-width: 980px) {
  .add-playlist-head,
  .playlist-picker-controls {
    grid-template-columns: 1fr;
  }

  .add-playlist-head {
    display: grid;
  }

  .playlist-picker-controls .inline-tip {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .playlist-asset-picker.optimized-picker {
    grid-template-columns: 1fr;
    max-height: 520px;
  }

  .picker-media-card.optimized {
    grid-template-columns: 64px minmax(0, 1fr) 30px;
  }

  .picker-media-card.optimized .picker-thumb {
    width: 64px;
    height: 52px;
  }
}


/* ================================================================
   v22 enhanced Help Guide styles
   ================================================================ */
.help-version-badge {
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color: #ecfeff;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.enhanced-help-layout { grid-template-columns: 285px minmax(0, 1fr); }
.help-main { display: grid; gap: 14px; min-width: 0; }
.help-nav-card b { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--text); }
.help-nav-card b .icon { width: 17px; height: 17px; color: var(--primary); }
.help-nav-card a {
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text-2);
  font-weight: 800;
  text-decoration: none;
  transition: all var(--transition);
}
.help-nav-card a:hover { background: rgba(13,148,136,.08); color: var(--primary-dark); text-decoration: none; }
.help-role-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 11px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.help-role-note .icon { width: 19px; height: 19px; flex-shrink: 0; color: var(--primary); }
.help-role-note.admin .icon { color: var(--danger); }
.help-role-note b { display: block; margin: 0 0 2px; }
.help-role-note small { color: var(--muted); line-height: 1.35; }
.help-intro { color: var(--muted); font-weight: 700; margin-top: -2px; }
.help-flow-list { display: grid; gap: 9px; margin-top: 12px; }
.help-flow-list.compact { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.help-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.help-step > b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 18px rgba(15,118,110,.18);
}
.help-step strong { display: block; font-size: 13px; color: var(--text); margin-bottom: 3px; }
.help-step small { color: var(--muted); line-height: 1.45; }
.help-tip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.help-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(13,148,136,.08);
  border: 1px solid rgba(13,148,136,.18);
  color: #115e59;
  font-weight: 800;
  line-height: 1.45;
}
.help-note.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.help-note.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.help-trouble-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 11px; }
.help-trouble {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 15px;
  padding: 13px;
}
.help-trouble b { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.help-trouble b .icon { width: 17px; height: 17px; color: var(--warning); flex-shrink: 0; }
.help-trouble p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }

@media (max-width: 1024px) {
  .enhanced-help-layout { grid-template-columns: 1fr; }
  .help-nav-card { position: static; }
}
@media (max-width: 640px) {
  .help-flow-list.compact, .help-tip-grid, .help-trouble-list { grid-template-columns: 1fr; }
  .help-version-badge { display: none; }
}

/* v23 SMTP settings and TV offline alert UI */
.smtp-settings-card { display: grid; gap: 16px; }
.smtp-toggle-grid { margin-bottom: 0; }
.smtp-relay-note { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, rgba(14, 165, 233, .10), rgba(15, 118, 110, .08)); border: 1px solid rgba(14, 165, 233, .22); }
.smtp-relay-note > span { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.85); color: #0369a1; box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.smtp-relay-note svg { width: 22px; height: 22px; }
.smtp-relay-note b { display: block; font-size: 14px; color: #0f172a; margin-bottom: 4px; }
.smtp-relay-note p { margin: 0; color: #475569; font-size: 12.5px; line-height: 1.5; }
.smtp-recipient-box { min-height: 88px; }
.input-with-suffix { display: flex; align-items: center; border: 1px solid #cbd5e1; border-radius: 14px; background: #fff; overflow: hidden; }
.input-with-suffix .input { border: 0; border-radius: 0; min-width: 0; flex: 1; }
.input-with-suffix span { padding: 0 12px; color: #64748b; font-size: 12px; font-weight: 800; border-left: 1px solid #e2e8f0; background: #f8fafc; align-self: stretch; display: grid; place-items: center; }
.smtp-test-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px; border-radius: 16px; border: 1px dashed #cbd5e1; background: #f8fafc; }
.smtp-test-row .help { margin: 0; }
@media (max-width: 768px) {
  .smtp-relay-note { grid-template-columns: 1fr; }
  .smtp-test-row { flex-direction: column; align-items: stretch; }
}
