/* ===== buttons.css ===== */
@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 { flex-direction: column; align-items: flex-start; }
  .hero-actions, .media-controls, .toolbar { justify-content: flex-start; }
  .settings-hero, .users-hero { flex-direction: column; align-items: flex-start; }
  .settings-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 { grid-template-columns: 36px 1fr; }
  .playlist-item .large-thumb, .playlist-item .playlist-item-main, .playlist-item .duration-control, .playlist-item .playlist-item-actions { grid-column: 1 / -1; }
  .activity-row { grid-template-columns: 38px minmax(0, 1fr); }
  .activity-row time { grid-column: 2; text-align: left; }
  .quick-action-grid { grid-template-columns: 1fr; }
  .user-card-grid { 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 .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; }
}

/* ══ ADMIN UTILITIES AND COMPATIBILITY STYLES ═══════════════════ */


/* 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 ----------------------------------------------------- */
.screen-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.screen-card { display: flex; flex-direction: column; gap: 12px; }
.screen-card.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: #E8F1F4; color: var(--primary-dark); border: 1px solid #C7DDE5; 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 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-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.settings-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: 9px;
  padding: 11px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  border-radius: 16px;
  margin: 8px 6px 10px;
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ecfeff;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 8px 18px rgba(0,0,0,.18);
}
.sidebar-user-avatar.admin { background: linear-gradient(135deg, rgba(239,68,68,.9), rgba(180,83,9,.9)); }
.sidebar-user-avatar.staff { background: linear-gradient(135deg, rgba(44,92,113,.9), rgba(37,99,235,.82)); }
.sidebar-user-avatar .icon { width: 18px; height: 18px; }
.sidebar-user-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sidebar-user-info span { display: block; font-size: 12px; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .sidebar-role-row { display: flex; align-items: center; gap: 4px; color: rgba(255,255,255,.55); }
.sidebar-user-info .sidebar-role { font-size: 10.5px; color: inherit; letter-spacing: .02em; text-transform: uppercase; }
.sidebar-role-icon { width: 15px; height: 15px; flex: 0 0 15px; display: inline-grid !important; place-items: center; color: rgba(255,255,255,.58); }
.sidebar-role-icon.admin { color: #fecaca; }
.sidebar-role-icon.staff { color: #99f6e4; }
.sidebar-role-icon .icon { width: 13px; height: 13px; }
.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; }
}


/* ══ ADMIN UI ORGANIZATION LAYER ═══════════════════════════════ */

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(44,92,113,.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(44,92,113,.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(44,92,113,.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: -.02em; }
.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; width: 100%; min-width: 0; }
.topbar {
  top: 12px;
  margin: 0 0 18px;
  min-height: 70px;
  padding: 12px 16px;
}
.topbar-titles { flex: 1; min-width: 0; overflow: hidden; }
.topbar-titles h1 {
  margin: 0;
  font-size: clamp(19px, 2.0vw, 28px);
  font-weight: 600;
  letter-spacing: -.025em;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.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: 600;
  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: #EEF6F8; border-color: rgba(44,92,113,.24); }


#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-hero, .emergency-hero {
  border: 1px solid rgba(203,213,225,.78);
  box-shadow: var(--shadow-sm);
}
.hero-actions, .settings-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: #EEF6F8;
  color: var(--primary-dark);
  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, .screen-card, .user-card, .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:hover, .screen-card:hover, .user-card:hover, .help-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(44,92,113,.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(44,92,113,.10), transparent 65%);
  pointer-events: none;
}
.settings-panel-badge {
  z-index: 1;
  align-self: flex-start;
  border: 1px solid var(--primary-border);
  background: #EEF6F8;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  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 { 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; margin-inline: 2px; }
.app-shell.sidebar-collapsed .sidebar-user-avatar { width: 36px; height: 36px; flex-basis: 36px; }
.app-shell.sidebar-collapsed .sidebar-user .icon-btn { display: none; }

/* 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-actions .btn, .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-actions, .settings-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; }
}

/* 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: 600; 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; }

/* 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: -.02em; }
.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: 600; letter-spacing: .10em; text-transform: uppercase; }
.modern-screen-emergency-modal { gap: 14px; }
.modern-screen-emergency-modal .form-row label { font-weight: 600; 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: 600; 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: 600; 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: 600; font-size: 11px; letter-spacing: .14em; }
.screen-emergency-preview h3 { margin: 0; text-transform: uppercase; letter-spacing: -.02em; 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; }
}
