/* --- CSS VARIABLES & THEME --- */
:root {
  --nedc-blue: #003876;
  --nedc-blue-dark: #002147;
  --nedc-gold: #FDB913;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-sidebar: var(--nedc-blue);
  --bg-controls: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-btn-primary: var(--nedc-blue);
  --text-btn-primary: #ffffff;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.2);
}

.hidden { display: none !important; }

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-sidebar: #0f172a;
  --bg-controls: #1e293b;
  --bg-hover: #334155;
  --bg-btn-primary: var(--nedc-gold);
  --text-btn-primary: #0f172a;
  
  --accent-color: var(--nedc-gold);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-color: #334155;
  --border-light: #1e293b;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.7);
}

[data-theme="ocean"] {
  --bg-primary: #f0f7ff;
  --bg-secondary: #e0efff;
  --bg-sidebar: #015eb9;
  --bg-controls: #ffffff;
  --bg-hover: #d0e6ff;
  --bg-btn-primary: #007bff;
  --accent-color: #007bff;
  --text-primary: #002d5a;
  --text-secondary: #004a95;
  --border-color: #b9d9ff;
}

[data-theme="midnight"] {
  --bg-primary: #0b0118;
  --bg-secondary: #1a0533;
  --bg-sidebar: #0b0118;
  --bg-controls: #1a0533;
  --bg-hover: #2d0a57;
  --bg-btn-primary: #bc13fe;
  --accent-color: #bc13fe;
  --text-primary: #e0b0ff;
  --text-secondary: #b57edc;
  --border-color: #3d107a;
}

* { box-sizing: border-box; }
html, body { 
  height: 100%; margin: 0; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
  background: var(--bg-primary); color: var(--text-primary); overflow: hidden; 
  transition: background-color 0.3s, color 0.3s;
}

/* --- LAYOUT --- */
.app-container { display: flex; height: 100vh; width: 100%; overflow: hidden; position: relative; }

/* --- AUTO-HIDE SIDEBAR --- */
.sidebar-trigger {
  position: absolute; left: 0; top: 0; bottom: 0; width: 15px; z-index: 90; cursor: e-resize;
}

.sidebar { 
  position: absolute; left: -250px; top: 0; bottom: 0; width: 250px; 
  background: var(--bg-sidebar); 
  display: flex; flex-direction: column; z-index: 100; 
  transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s; 
  box-shadow: var(--shadow-lg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto; overflow-x: hidden;
}
.sidebar.open { left: 0; }

.sidebar.open { left: 0; }

.brand { padding: 20px 16px 16px 16px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand img { height: 42px; background: #fff; padding: 4px; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.brand h1 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: 0.5px; }
.brand p { margin: 4px 0 0; color: var(--nedc-gold); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 16px; }

.nav-item { 
  width: 100%; display: flex; align-items: center; padding: 12px 14px; 
  background: transparent; color: rgba(255,255,255,0.7); 
  font-weight: 600; font-size: 13px; border: none; border-radius: 8px;
  cursor: pointer; text-align: left; transition: all 0.2s ease; position: relative; overflow: hidden;
}

.nav-item::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px;
  background: rgba(255,255,255,.3); opacity: 0; border-radius: 100%;
  transform: scale(1, 1) translate(-50%); transform-origin: 50% 50%;
}
.nav-item:active::after { animation: ripple 0.6s ease-out; }

@keyframes ripple {
  0% { transform: scale(0, 0); opacity: 0.5; }
  100% { transform: scale(40, 40); opacity: 0; }
}

.nav-item:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.1); }
.nav-item svg { margin-right: 10px; width: 18px; height: 18px; opacity: 0.7; transition: opacity 0.2s; }
.nav-item:hover:not(.active) svg { opacity: 1; }

.nav-item.active { 
  background: rgba(255,255,255,0.15); color: #fff; font-weight: 800;
  border-left: 4px solid var(--nedc-gold); padding-left: 10px; 
}
.nav-item.active svg { color: var(--nedc-gold); opacity: 1; }

.sys-status { margin: auto 16px 16px 16px; padding: 14px; background: rgba(0,0,0,0.2); border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.sys-status-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.sys-status-text { font-size: 10px; color: rgba(255,255,255,0.6); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); } 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* --- MAIN CONTENT --- */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--bg-primary); width: 100%; transition: background-color 0.3s; }

.header { background: var(--bg-primary); padding: 6px 16px; display: flex; justify-content: space-between; align-items: center; z-index: 10; border-bottom: 1px solid var(--border-color); transition: background-color 0.3s, border-color 0.3s; }
.header-left { display: flex; align-items: center; gap: 12px; }

.menu-toggle { 
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border-color); border-radius: 6px;
  cursor: pointer; color: var(--text-secondary); padding: 4px 6px; transition: all 0.2s ease;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.header h2 { margin: 0; font-size: 16px; color: var(--text-primary); font-weight: 800; letter-spacing: -0.2px; transition: color 0.3s; }
.header-right { display: flex; align-items: center; gap: 12px; }
.time-badge { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.time-badge svg { width: 12px; height: 12px; color: var(--nedc-blue); }
[data-theme="dark"] .time-badge svg { color: var(--nedc-gold); }

/* Theme Toggle */
.theme-toggle { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); padding: 4px 12px; border-radius: 20px; font-weight: 700; color: var(--text-primary); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); background: var(--bg-controls); box-shadow: var(--shadow-sm); }
.theme-toggle:hover { background: var(--bg-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--nedc-blue); }
[data-theme="dark"] .theme-toggle:hover { border-color: var(--nedc-gold); }
.theme-toggle svg { width: 15px; height: 15px; }

.theme-toggle .sun-icon { display: block; }
.theme-toggle .moon-icon { display: none; }
.theme-label { font-size: 11px; white-space: nowrap;}
.theme-label::after { content: "Dark Mode"; }

[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; color: var(--nedc-gold); }
[data-theme="dark"] .theme-label::after { content: "Light Mode"; }

/* --- DASHBOARD CONTROLS --- */
.dashboard-container { flex: 1; display: flex; flex-direction: column; padding: 0; gap: 0; position: relative; }

/* Filter Mobile Toggle */
.mobile-filter-toggle {
    display: none;
    width: 100%; padding: 8px; background: var(--bg-secondary); color: var(--text-primary);
    border: none; border-bottom: 1px solid var(--border-color); font-weight: 700; font-size: 12px;
    align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}

.controls-card { background: var(--bg-controls); display: flex; flex-direction: column; flex-shrink: 0; border-bottom: 1px solid var(--border-color); transition: background-color 0.3s, border-color 0.3s; }

.filters-bar { padding: 6px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--border-light); transition: border-color 0.3s; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;}

/* --- ACTIVE FILTER CHIPS --- */
.chips-bar {
  display: none; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 16px; border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary); transition: background-color 0.3s;
  animation: fadeSlideIn 0.2s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-controls); border: 1px solid var(--border-color);
  border-radius: 20px; padding: 3px 8px 3px 10px;
  font-size: 11px; color: var(--text-secondary);
  box-shadow: var(--shadow-sm); transition: all 0.2s;
  animation: chipPop 0.15s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes chipPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.filter-chip:hover { border-color: var(--nedc-blue); }
[data-theme="dark"] .filter-chip:hover { border-color: var(--nedc-gold); }
.chip-label { font-weight: 500; white-space: nowrap; }
.chip-label strong { font-weight: 700; color: var(--text-primary); }
.chip-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.chip-remove {
  background: none; border: none; cursor: pointer; padding: 0 0 0 2px;
  color: var(--text-muted); font-size: 11px; line-height: 1;
  display: flex; align-items: center; transition: color 0.2s, transform 0.2s;
}
.chip-remove:hover { color: #ef4444; transform: scale(1.3); }

/* Filter count badge on mobile toggle */
.filter-count-badge {
  background: #ef4444; color: #fff; font-size: 9px; font-weight: 800;
  border-radius: 10px; padding: 1px 6px; margin-left: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(239,68,68,0.4);
  animation: badgePop 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* Custom Multi-Select Dropdown */
.ms-container { position: relative; user-select: none; }
.ms-trigger {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;
  color: var(--text-primary); cursor: pointer; transition: all 0.2s;
  min-width: 140px; height: 26px; white-space: nowrap; overflow: hidden;
}
.ms-trigger span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ms-trigger:hover { border-color: var(--border-color); background: var(--bg-hover); }
.ms-trigger.open { border-color: var(--nedc-blue); box-shadow: 0 0 0 2px rgba(0,56,118,0.1); }
[data-theme="dark"] .ms-trigger.open { border-color: var(--nedc-gold); box-shadow: 0 0 0 2px rgba(253,185,19,0.2); }
.ms-trigger svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); transition: transform 0.2s; }
.ms-trigger.open svg { transform: rotate(180deg); }

.ms-badge { background: var(--nedc-blue); color: #fff; border-radius: 10px; padding: 2px 6px; font-size: 9px; margin-left: auto; line-height: 1; }
[data-theme="dark"] .ms-badge { background: var(--nedc-gold); color: #0f172a; line-height: 1;}

.ms-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; width: 220px;
  background: var(--bg-controls); border: 1px solid var(--border-color); border-radius: 6px;
  box-shadow: var(--shadow-lg); z-index: 200; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.ms-trigger.open + .ms-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

.ms-actions { padding: 8px; border-bottom: 1px solid var(--border-light); display: flex; gap: 6px; }
.ms-action-btn { flex: 1; padding: 4px; font-size: 10px; font-weight: 700; background: var(--bg-hover); color: var(--text-primary); border: 1px solid transparent; border-radius: 4px; cursor: pointer; transition: background 0.2s; }
.ms-action-btn:hover { background: var(--border-color); }

.ms-options-list { flex: 1; overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 2px; max-height: 250px;}
.ms-options-list::-webkit-scrollbar { width: 4px; }
.ms-options-list::-webkit-scrollbar-track { background: transparent; }
.ms-options-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.5); border-radius: 4px; }

.ms-option {
  display: flex; align-items: center; padding: 6px 8px; border-radius: 4px;
  cursor: pointer; transition: background 0.2s; font-size: 11px; color: var(--text-primary); font-weight: 500;
}
.ms-option:hover { background: var(--bg-hover); }
.ms-option input[type="checkbox"] {
  appearance: none; width: 14px; height: 14px; border: 1px solid #94a3b8; border-radius: 3px;
  margin-right: 8px; cursor: pointer; position: relative; display: grid; place-content: center; background: var(--bg-primary); transition: all 0.1s; flex-shrink: 0;
}
.ms-option input[type="checkbox"]::before {
  content: ""; width: 8px; height: 8px; transform: scale(0);
  box-shadow: inset 1em 1em var(--text-inverse); background-color: var(--text-inverse);
  transform-origin: center; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); transition: 0.1s transform ease-in-out;
}
.ms-option input[type="checkbox"]:checked { background: var(--nedc-blue); border-color: var(--nedc-blue); }
[data-theme="dark"] .ms-option input[type="checkbox"]:checked { background: var(--nedc-gold); border-color: var(--nedc-gold); }
[data-theme="dark"] .ms-option input[type="checkbox"]::before { box-shadow: inset 1em 1em #0f172a; background-color: #0f172a; }
.ms-option input[type="checkbox"]:checked::before { transform: scale(1); }

.action-group { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.timer-wrap { display: flex; align-items: center; border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; height: 26px; transition: border-color 0.3s;}
.btn { display: flex; align-items: center; gap: 4px; border: none; background: transparent; color: var(--text-secondary); padding: 4px 8px; font-size: 11px; font-weight: 700; cursor: pointer; transition: 0.2s; height: 100%; border: 1px solid transparent; }
.btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-color); }

.btn-primary { background: var(--bg-btn-primary); color: var(--text-btn-primary); border-radius: 4px; height: 26px; border: none;}
.btn-primary:hover { opacity: 0.9; color: var(--text-btn-primary); border: none;}
.btn-primary svg {stroke: currentColor;}

.timer-countdown { background: var(--bg-primary); color: var(--text-primary); font-family: monospace; font-weight: bold; padding: 0 8px; border-right: 1px solid var(--border-color); font-size: 11px; height: 100%; display: flex; align-items: center; transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.timer-select { border: none; border-radius: 0; background-color: transparent; height: 100%; }
.icon-only { padding: 4px 6px; border: 1px solid var(--border-color); border-radius: 4px; height: 26px; }

/* --- FLOATING STATUS BAR --- */
.floating-status-bar {
  position: absolute; right: 20px; top: 80px; z-index: 100; width: 110px;
  background: rgba(255,255,255,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; transition: opacity 0.3s;
  resize: both; min-width: 100px; min-height: 30px; max-width: 400px; max-height: calc(100vh - 100px);
}
[data-theme="dark"] .floating-status-bar { background: rgba(15,23,42,0.6); border-color: rgba(255,255,255,0.1); }

.status-header {
  padding: 6px; background: rgba(0,0,0,0.03); border-bottom: 1px solid var(--border-color);
  font-weight: 800; text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; justify-content: flex-start; gap: 4px; letter-spacing: 0.5px;
  cursor: grab; user-select: none; touch-action: none;
}
.status-header span { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-action-btn {
  background: transparent; border: none; padding: 2px; color: var(--text-muted); 
  cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.header-action-btn:hover { background: rgba(0,0,0,0.1); color: var(--text-primary); }
[data-theme="dark"] .header-action-btn:hover { background: rgba(255,255,255,0.1); }
.header-action-btn svg { width: 12px; height: 12px; transition: transform 0.3s; }

.floating-status-bar.minimized #minimizeStatusBtn svg { transform: rotate(180deg); }
.floating-status-bar.minimized .status-toggle-group { display: none; }
.floating-status-bar.minimized { height: auto !important; width: 110px !important; min-width: 0 !important; resize: none; border-bottom: none; }
.floating-status-bar.minimized .status-header { border-bottom: none; padding: 6px; gap: 4px; }
.floating-status-bar.minimized .status-header span { font-size: 8px; }
.status-header:active { cursor: grabbing; }
.floating-status-bar.is-dragging { transition: none !important; opacity: 0.95; transform-origin: center; z-index: 1000; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
[data-theme="dark"] .status-header { background: rgba(0,0,0,0.2); }
.status-header svg { width: 12px; height: 12px; color: var(--green); flex-shrink: 0; }

.status-toggle-group { display: flex; flex-direction: column; padding: 4px; gap: 4px; }
.status-helper-actions { display: flex; justify-content: space-between; padding: 2px 6px; margin-bottom: 2px; }
.helper-link { background: none; border: none; font-size: 8px; color: var(--nedc-blue); cursor: pointer; padding: 2px; font-weight: 700; text-transform: uppercase; opacity: 0.7; transition: opacity 0.2s; }
[data-theme="dark"] .helper-link { color: var(--nedc-gold); }
.helper-link:hover { opacity: 1; text-decoration: underline; }

.status-toggle-group:not(:first-of-type) { border-top: 1px solid var(--border-light); margin-top: 4px; }
.floating-status-bar.is-pinned .status-toggle-group:not(:first-of-type) { border-top: none; border-left: 1px solid var(--border-light); padding-left: 10px; margin-left: 10px; margin-top: 0; }

/* Status severity dot */
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; flex-shrink: 0; vertical-align: middle;
  box-shadow: 0 0 4px currentColor; opacity: 0.85;
}
.status-btn { display: flex; align-items: center; }

/* Standalone pin button layout in floating state */
.pin-btn-standalone {
  position: absolute; top: 6px; right: 6px;
  background: transparent !important; border: none; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700;
  padding: 2px 4px; border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.pin-btn-standalone:hover { background: rgba(0,0,0,0.08) !important; color: var(--text-primary); }
[data-theme="dark"] .pin-btn-standalone:hover { background: rgba(255,255,255,0.1) !important; }
.pin-btn-standalone svg { width: 12px; height: 12px; }


.floating-status-bar.horizontal .status-toggle-group { flex-direction: row; flex-wrap: wrap; }
.floating-status-bar.horizontal { width: auto; min-width: 150px; }
.floating-status-bar.horizontal .status-btn { width: auto; padding: 6px 12px; }
.floating-status-bar.horizontal .status-helper-actions { width: 100%; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }

/* -- PINNED OVERRIDES -- */
.floating-status-bar.is-pinned { 
  position: static !important; transform: none !important;
  width: auto !important; height: auto !important;
  background: transparent !important; border: none !important; border-left: 2px solid var(--border-color) !important;
  box-shadow: none !important; padding: 0 0 0 12px !important; margin: 0 !important;
  border-radius: 0 !important; backdrop-filter: none !important; 
  opacity: 1 !important; display: flex !important; flex-direction: row !important;
  align-items: center !important; gap: 6px !important;
  visibility: visible !important; z-index: 1 !important;
  min-width: 0 !important; resize: none !important;
}
/* Hide decorative icon & label — only show pin button */
.floating-status-bar.is-pinned .status-header { 
  background: transparent !important; border: none !important; cursor: default !important;
  padding: 0 !important; display: flex !important; align-items: center !important;
  order: 99; /* push Unpin to the end */
}
.floating-status-bar.is-pinned .status-header > svg:first-child,
.floating-status-bar.is-pinned .status-header > span { display: none !important; }
.floating-status-bar.is-pinned #pinStatusBtn { 
  position: static !important; /* override the absolute from .pin-btn-standalone */
  color: #fff; background: var(--nedc-blue) !important; border: none;
  border-radius: 4px; padding: 4px 10px; opacity: 1; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; gap: 4px; box-shadow: var(--shadow-sm); white-space: nowrap;
  cursor: pointer;
}
[data-theme="dark"] .floating-status-bar.is-pinned #pinStatusBtn { 
  background: #FDB913 !important; color: #0f172a !important; 
  border: 2px solid #FDB913 !important; font-weight: 800 !important;
}
[data-theme="dark"] .floating-status-bar.is-pinned #pinStatusBtn:hover { 
  background: #fcc535 !important; filter: none !important;
}
.floating-status-bar.is-pinned #pinStatusBtn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); filter: brightness(1.1); }
.floating-status-bar.is-pinned #pinStatusBtn svg { width: 10px; height: 10px; stroke-width: 3.5; }
.floating-status-bar.is-pinned #layoutStatusBtn,
.floating-status-bar.is-pinned #minimizeStatusBtn { display: none !important; }
.floating-status-bar.is-pinned .status-helper-actions { display: none !important; }
.floating-status-bar.is-pinned .status-toggle-group { 
  flex-direction: row !important; gap: 4px !important; padding: 0 !important; flex-wrap: wrap !important;
  align-items: center !important;
}
.floating-status-bar.is-pinned .status-btn { 
  padding: 4px 10px !important; font-size: 10px !important; white-space: nowrap !important;
  border-radius: 20px !important; width: auto !important;
}

.floating-status-bar.is-pinned .status-btn { 
  background: var(--bg-primary); border: 1px solid var(--border-color); padding: 4px 8px; 
  font-weight: 600; font-size: 10px; border-radius: 6px; color: var(--text-primary); text-transform: capitalize; width: auto; 
}
/* ------------------------ */

.status-btn { 
  border: 1px solid transparent; background: transparent; padding: 6px 4px; 
  font-size: 8.5px; 
  font-weight: 800; color: var(--text-muted); border-radius: 4px; cursor: pointer; 
  transition: background 0.1s, color 0.1s; text-transform: uppercase; 
  letter-spacing: 0.5px; text-align: center; width: 100%; white-space: normal; line-height: 1.2;
}
.status-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.status-btn.active { background: var(--bg-primary); color: var(--text-primary); box-shadow: var(--shadow-sm); border-color: var(--border-color); }
.status-btn.active[data-status="Affected"] { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3); }
.status-btn.active[data-status="Partial Restoration"] { background: var(--orange); color: #fff; border-color: var(--orange); box-shadow: 0 2px 5px rgba(245, 158, 11, 0.3); }
.status-btn.active[data-status="Full Restoration"],
.status-btn.active[data-status="Nobody Affected"],
.status-btn.active[data-status="Normalized"] { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 2px 5px rgba(34, 197, 94, 0.3); }

/* --- BUTTON HOVER EFFECTS --- */
.btn:active, .status-btn:active, .header-action-btn:active { transform: scale(0.95); }
.btn, .status-btn, .ms-trigger { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }

/* --- IFRAME AREA --- */
.report-container { flex: 1; background: var(--bg-secondary); position: relative; width: 100%; height: 100%; transition: background-color 0.3s; }
#reportContainer iframe { width: 100%; height: 100%; border: none; display: block; opacity: 0; transition: opacity 0.5s; }
#reportContainer iframe.loaded { opacity: 1; }

.loader-overlay { 
  position: absolute; inset: 0; 
  background: var(--bg-primary); 
  display: flex; flex-direction: column; align-items: center; justify-content: center; 
  z-index: 50; 
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
  backdrop-filter: blur(10px);
}
.loader-overlay.hidden { opacity: 0; pointer-events: none; }

.professional-loader {
  position: relative;
  width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2rem;
}

.loader-circle {
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 4px solid var(--border-light);
  border-top-color: var(--nedc-blue);
  animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
[data-theme="dark"] .loader-circle { border-top-color: var(--nedc-gold); }

.loader-logo {
  width: 60%; height: 60%;
  display: flex; align-items: center; justify-content: center;
  animation: logoPulse 2s ease-in-out infinite;
}
.loader-logo img { width: 100%; height: auto; border-radius: 8px; }

@keyframes logoPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1); opacity: 1; }
}

.loader-status-container {
  width: 280px;
  text-align: center;
}

.loader-message { 
  font-size: 14px; font-weight: 800; color: var(--text-primary); 
  margin-bottom: 0.75rem; 
  letter-spacing: -0.2px;
}

.loader-progress-bar {
  width: 100%; height: 6px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-light);
}

.loader-progress-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--nedc-blue), #3b82f6);
  border-radius: 10px;
  transition: width 0.4s ease-out;
}
[data-theme="dark"] .loader-progress-fill { background: linear-gradient(90deg, var(--nedc-gold), #fcd34d); }

.loader-subtext {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}

.retry-btn { 
  margin-top: 2rem;
  padding: 8px 24px; cursor: pointer; 
  background: var(--nedc-blue); color: #fff; 
  border: none; border-radius: 30px; 
  font-weight: 700; font-size: 12px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}
.retry-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.retry-btn.hidden { display: none; }

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

/* --- FULLSCREEN --- */
.floating-exit-btn {
  display: none; position: fixed; top: 20px; right: 20px; z-index: 2147483647; 
  align-items: center; gap: 8px; background: var(--red); color: #fff; border: 2px solid #fff; 
  padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.floating-exit-btn:hover { background: #dc2626; transform: scale(1.05); }

/* In native fullscreen we usually just hide elements if they somehow overflow, but native API does it for us on the element.
   However, we might need a fallback if we still use pseudo. But we will use Native if available! */
   
/* Native Fullscreen pseudo-selector styling if needed */
:fullscreen .header, :fullscreen .controls-card { display: none; }
:fullscreen .floating-exit-btn { display: flex; }
/* Webkit prefix for native fullscreen */
:-webkit-full-screen .header, :-webkit-full-screen .controls-card { display: none; }
:-webkit-full-screen .floating-exit-btn { display: flex; }

/* --- RESPONSIVE DESIGN (MOBILE) --- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); z-index: 30; opacity: 0; transition: opacity 0.3s; }

@media (max-width: 768px) {
  .sidebar { left: -260px; width: 260px;}
  .sidebar.open { left: 0; }
  .sidebar-trigger { display: none; }
  .sidebar-overlay.show { display: block; opacity: 1; }
  .time-badge span { display: none; }
  .header h2 { font-size: 16px; }
  
  /* Filter drawer logic */
  .mobile-filter-toggle { display: flex; }
  .controls-card { max-height: 0; overflow: hidden; opacity: 0; border: none; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
  .controls-card.show-filters { max-height: 500px; opacity: 1; overflow: visible; border-bottom: 1px solid var(--border-color); }
  
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filter-group { flex-direction: column; align-items: stretch; }
  .filter-group .ms-trigger { width: 100%; }
  .action-group { margin-left: 0; justify-content: space-between; margin-top: 8px; }
  
  .floating-status-bar { position: static; width: 100%; border: none; box-shadow: none; border-bottom: 1px solid var(--border-color); padding: 8px 16px; overflow-x: auto; background: transparent; flex-direction: row; border-radius: 0; backdrop-filter: none; }
  .status-header { display: none; }
  .status-toggle-group.vertical { flex-direction: row; gap: 8px; padding: 0; }
  .status-btn { width: auto; white-space: nowrap; padding: 6px 12px; }
}
/* --- PREMIUM UI ADDITIONS --- */

/* Onboarding Tour */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.tour-overlay.hidden { opacity: 0; pointer-events: none; }
.tour-tooltip {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: 1.5rem;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--accent-color, var(--nedc-blue));
  transform: translateY(0);
  animation: tourPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes tourPop { from { transform: scale(0.8); opacity: 0; } }
.tour-tooltip h3 { margin-top: 0; color: var(--accent-color, var(--nedc-blue)); }
.tour-tooltip ul { text-align: left; padding-left: 1.2rem; }
.tour-tooltip li { margin-bottom: 0.5rem; }

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content {
  background: var(--bg-primary);
  width: 90%;
  max-width: 450px;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.close-modal {
  background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted);
}
.modal-body { padding: 1.5rem; }

/* Bookmark List */
.bookmark-list { list-style: none; padding: 0; margin: 0 0 1.5rem 0; max-height: 200px; overflow-y: auto; }
.bookmark-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem; border-radius: 0.5rem; margin-bottom: 0.5rem;
  background: var(--bg-secondary); cursor: pointer; transition: 0.2s;
}
.bookmark-item:hover { background: var(--bg-hover); }
.bookmark-delete { background: none; border: none; color: var(--red); cursor: pointer; font-size: 1.2rem; }

.save-bookmark-row { display: flex; gap: 0.5rem; }
.save-bookmark-row input {
  flex: 1; padding: 0.6rem; border-radius: 0.5rem; border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-primary);
}

/* Theme Picker */
.theme-picker { position: relative; }

/* Mute Button - Premium Circular Design */
#muteToggleBtn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: var(--shadow-sm);
}
#muteToggleBtn:hover {
  background: var(--nedc-blue);
  color: white;
  border-color: var(--nedc-blue);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}
#muteToggleBtn svg { width: 16px; height: 16px; }

/* Muted State - Red Accent */
[data-muted="true"] #muteToggleBtn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border-color: var(--red);
}
[data-muted="true"] #muteToggleBtn:hover {
  background: var(--red);
  color: white;
}

.theme-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: 0.75rem; padding: 0.5rem; min-width: 180px;
  box-shadow: var(--shadow-lg); z-index: 1001;
  display: none; flex-direction: column; gap: 4px;
}
.theme-picker:hover .theme-dropdown { display: flex; }
.theme-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 0.6rem 0.8rem; border: none; background: none;
  border-radius: 0.5rem; cursor: pointer; text-align: left;
  color: var(--text-primary); font-size: 0.9rem; transition: 0.2s;
}
.theme-opt:hover { background: var(--bg-hover); }
.color-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); }
