:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-hover: rgba(56, 189, 248, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(56, 189, 248, 0.5);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-glow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.06) 0%, transparent 40%);
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Header & Glass Nav */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-color);
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: 1rem;
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
}

[data-theme="light"] .header {
  background: rgba(248, 250, 252, 0.85);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  font-size: 1.75rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.btn:hover {
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

/* Hero Section */
.hero {
  max-width: 1280px;
  margin: 2.5rem auto 1.5rem auto;
  padding: 0 2rem;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #0f172a 30%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

/* Search & Control Bar */
.controls-bar {
  max-width: 1280px;
  margin: 0 auto 2rem auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.search-box {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 1rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-glow);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Category Filters */
.category-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  border-color: var(--border-color-hover);
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  font-weight: 600;
}

/* Main Directory Layout */
.main-content {
  max-width: 1280px;
  margin: 0 auto 4rem auto;
  padding: 0 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-count {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* Grid Layout (2 Across on Web/Desktop View) */
.sites-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 1.5rem;
}

/* Card Component */
.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.site-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

/* Card Drag & Drop Re-ordering Styles */
.site-card[draggable="true"] {
  cursor: grab;
}

.site-card[draggable="true"]:active {
  cursor: grabbing;
}

.site-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
  border: 2px dashed #38bdf8 !important;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.3) !important;
}

.site-card.drag-over {
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.5) !important;
  transform: scale(1.02);
}

.card-reorder-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px 5px;
}

.card-drag-handle {
  cursor: grab;
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0 3px;
  user-select: none;
}

.card-drag-handle:hover {
  color: #38bdf8;
}

.reorder-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.reorder-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.site-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-icon-title {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.card-icon {
  font-size: 2rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.card-title-area {
  display: flex;
  flex-direction: column;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.new-notification-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f43f5e, #ec4899, #8b5cf6);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  animation: newBadgePulse 2s infinite ease-in-out;
}

@keyframes newBadgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 18px rgba(244, 63, 94, 0.7);
  }
}

.is-new-card::before {
  opacity: 1 !important;
  background: linear-gradient(90deg, #f43f5e, #a855f7, #38bdf8) !important;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.card-platform {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

/* Status Indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-indicator.online {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.status-indicator.online .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: greenPulseDot 2s infinite alternate;
}

@keyframes greenPulseDot {
  0% { box-shadow: 0 0 4px #10b981; }
  100% { box-shadow: 0 0 10px #34d399; }
}

.status-dot.checking {
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

/* Site Information Summary Box */
.site-summary-chip {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-left: 3.5px solid #38bdf8;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0 1.1rem 0;
}

.summary-chip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.summary-chip-title-area {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.summary-chip-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #38bdf8;
}

.summary-chip-time {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.summary-chip-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-main);
  font-weight: 500;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.tag-pill {
  font-size: 0.725rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.created-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.launch-btn:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Extensible Widgets Section */
.widgets-section {
  max-width: 1280px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;

}

.widget-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.widget-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.widget-icon {
  font-size: 1.75rem;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-blue);
}

.widget-info h4 {
  font-size: 1rem;
  font-weight: 600;
}

.widget-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 10000;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  position: relative;
  margin: 2rem auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.9rem;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.code-output {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 150px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  grid-column: 1 / -1;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Sticky Top UniFi Summary Bar */
.unifi-summary-bar {
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.5rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 95;
}

[data-theme="light"] .unifi-summary-bar {
  background: rgba(241, 245, 249, 0.95);
  border-bottom: 1px solid rgba(0, 111, 255, 0.2);
}

.unifi-summary-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.unifi-summary-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.unifi-logo-small {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #006FFF, #003B96);
  color: #ffffff;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 111, 255, 0.4);
}

.unifi-summary-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.unifi-summary-wans {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wan-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 9px;
  border-radius: 14px;
  font-size: 0.73rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.wan-att-fiber {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.wan-spectrum-cable {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.wan-att-5g {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.wan-chip-label {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.status-dot.cellular {
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
}

.unifi-summary-stats {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-pill {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.unifi-top-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #006FFF, #0284c7);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.unifi-top-launch-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.unifi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #006FFF, #38bdf8);
}

.unifi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.unifi-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.unifi-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #006FFF, #003B96);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 111, 255, 0.4);
}

.unifi-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.unifi-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.multi-wan-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.wan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.wan-primary {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.wan-secondary {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.wan-name {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-dot.standby {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.metric-value.highlight-cyan {
  color: #38bdf8;
}

.unifi-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.unifi-metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-value.highlight {
  color: #38bdf8;
}

.unifi-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.unifi-cloud-tag {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: monospace;
}

.unifi-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #006FFF, #0284c7);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(0, 111, 255, 0.3);
}

.unifi-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 111, 255, 0.5);
}

/* UniFi Protect Camera Grid Section */
.protect-section {
  max-width: 1280px;
  margin: 0 auto 3rem auto;
  padding: 0 2rem;
}

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

.camera-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-fast);
}

.camera-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.camera-header {
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.camera-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.cam-status.live {
  font-size: 0.7rem;
  font-weight: 800;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseDot 1.5s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

.video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #090d16;
}

.cam-video, .cam-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

.cam-overlay {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.motion-badge {
  pointer-events: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.cam-fullscreen-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.cam-fullscreen-btn:hover {
  background: var(--accent-blue);
  color: #ffffff;
}

/* User Authentication & Profile Pill Styles */
.user-profile-area {
  display: flex;
  align-items: center;
}

.btn-auth {
  background: rgba(66, 133, 244, 0.12);
  border: 1px solid rgba(66, 133, 244, 0.3);
  color: var(--accent-blue);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-auth:hover {
  background: rgba(66, 133, 244, 0.25);
  border-color: #4285f4;
  transform: translateY(-1px);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  border-radius: 30px;
  backdrop-filter: blur(8px);
}

.user-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.user-info-box {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: fit-content;
}

.user-role-badge.admin {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.user-role-badge.viewer {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.logout-btn:hover {
  color: #ef4444;
}

/* Site Permission Chips & Admin User Table */
.site-perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.site-perm-chip.all {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.user-table-row {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.user-table-row:hover {
  background: rgba(56, 189, 248, 0.05);
}

.action-btn-mini {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: 0.25rem;
}

.action-btn-mini:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.action-btn-mini.delete:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Camera Permission Chips & Dual Selectors */
.camera-perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.camera-perm-chip.all {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.btn-mini-toggle {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-mini-toggle:hover {
  background: rgba(56, 189, 248, 0.25);
}

.selector-card {
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
}

.selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .header { padding: 1rem; }
  .hero-title { font-size: 1.8rem; }
  .sites-grid { grid-template-columns: 1fr; }
  .header-container { flex-direction: column; gap: 1rem; }
  .cameras-grid { grid-template-columns: 1fr; }
  .unifi-metrics-grid { grid-template-columns: 1fr 1fr; }
  .unifi-card-footer { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}

/* Emergency Push Alarm Active Alert Banner */
.alarm-active-push-banner {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  padding: 0.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 25px rgba(239, 68, 68, 0.6);
  animation: alarmPulse 1s infinite alternate;
  position: relative;
  z-index: 10000;
}

@keyframes alarmPulse {
  0% { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); }
  100% { background: linear-gradient(135deg, #dc2626, #7f1d1d); box-shadow: 0 0 35px rgba(239, 68, 68, 0.9); }
}

@keyframes bellRing {
  0% { transform: rotate(-15deg); }
  100% { transform: rotate(15deg); }
}

/* Sticky Top Alarm.com Summary Bar */
.alarm-summary-bar {
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(239, 68, 68, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.45rem 2rem;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.15);
  position: relative;
  z-index: 93;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

[data-theme="light"] .alarm-summary-bar {
  background: rgba(254, 242, 242, 0.95);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}

.alarm-summary-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  box-sizing: border-box;
}

.alarm-summary-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.alarm-logo-small {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: #ffffff;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.alarm-summary-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.alarm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.alarm-status-chip {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-dot-shield {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Belterra 78737 Weather Summary Bar */
.weather-summary-bar {
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.45rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 94;
}

[data-theme="light"] .weather-summary-bar {
  background: rgba(255, 251, 235, 0.95);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.weather-summary-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.weather-summary-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.weather-logo-small {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.weather-summary-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.weather-summary-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.73rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.weather-temp-chip {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 0.78rem;
}

.weather-summary-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.weather-top-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.weather-top-launch-btn:hover {
  background: #f59e0b;
  color: #ffffff;
}

/* ==========================================================================
   Smart Contextual Status Squares (3-Column Tile Grid Layout)
   ========================================================================== */

.smart-status-squares-wrapper {
  max-width: 1280px;
  margin: 1.5rem auto 1rem auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.smart-status-squares-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 1.25rem;
  align-items: stretch;
}

.status-square {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
  overflow: hidden;
}

.status-square:hover {
  border-color: var(--border-color-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.status-square-alarm {
  border-top: 4px solid #38bdf8;
  transition: all var(--transition-fast);
}

.status-square-weather {
  border-top: 4px solid #f59e0b;
  transition: all var(--transition-fast);
}

.status-square-network {
  border-top: 4px solid #10b981;
  transition: all var(--transition-fast);
}

.status-square-homekit {
  border-top: 4px solid #a855f7;
  border-color: rgba(168, 85, 247, 0.4);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.08) 0%, var(--bg-card) 100%);
  transition: all var(--transition-fast);
}

/* Dynamic Status-Reflective Tile Colors & Background Tints */

/* 🛡️ Security / Alarm Tile States */
.status-square-alarm.state-disarmed {
  border-color: rgba(56, 189, 248, 0.4);
  border-top: 4px solid #38bdf8;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, var(--bg-card) 100%);
}

.status-square-alarm.state-armed {
  border-color: rgba(16, 185, 129, 0.4);
  border-top: 4px solid #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.status-square-alarm.state-alarm-active {
  border-color: rgba(239, 68, 68, 0.8);
  border-top: 4px solid #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.18) 0%, var(--bg-card) 100%);
  animation: alarmSquarePulse 1.5s infinite alternate;
}

.status-square-alarm.state-unconfigured {
  border-color: rgba(245, 158, 11, 0.4);
  border-top: 4px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

@keyframes alarmSquarePulse {
  0% { border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 0 15px rgba(239, 68, 68, 0.3); }
  100% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

/* ☀️ Belterra Weather Tile States */
.status-square-weather.weather-sunny {
  border-color: rgba(245, 158, 11, 0.4);
  border-top: 4px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

.status-square-weather.weather-cloudy {
  border-color: rgba(56, 189, 248, 0.4);
  border-top: 4px solid #38bdf8;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, var(--bg-card) 100%);
}

.status-square-weather.weather-rainy {
  border-color: rgba(99, 102, 241, 0.5);
  border-top: 4px solid #6366f1;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.12) 0%, var(--bg-card) 100%);
}

.status-square-weather.weather-advisory {
  border-color: rgba(249, 115, 22, 0.5);
  border-top: 4px solid #f97316;
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.12) 0%, var(--bg-card) 100%);
}

/* 🌐 UniFi Network Tile States */
.status-square-network.net-online {
  border-color: rgba(16, 185, 129, 0.4);
  border-top: 4px solid #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.status-square-network.net-failover {
  border-color: rgba(245, 158, 11, 0.5);
  border-top: 4px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, var(--bg-card) 100%);
}

.status-square-network.net-outage {
  border-color: rgba(239, 68, 68, 0.7);
  border-top: 4px solid #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.16) 0%, var(--bg-card) 100%);
  animation: outageSquarePulse 1.5s infinite alternate;
}

@keyframes outageSquarePulse {
  0% { border-color: rgba(239, 68, 68, 0.5); }
  100% { border-color: rgba(239, 68, 68, 0.9); }
}

.square-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.square-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.square-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.square-content-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.square-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  box-sizing: border-box;
  white-space: nowrap;
}

/* Network Square Specific Chip Layout (Horizontal Side-by-Side) */
.status-square-network .square-content-chips {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.45rem !important;
}

.status-square-network .square-mini-chip {
  width: auto !important;
  flex: 0 1 auto !important;
  justify-content: flex-start;
  white-space: nowrap !important;
  font-size: 0.74rem !important;
  padding: 0.28rem 0.55rem !important;
}

/* Active Push Alert Banner */
.wan-service-alert-box {
  width: 100%;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  margin-top: 0.45rem;
  font-size: 0.74rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  box-sizing: border-box;
}

.status-square.net-warning {
  border-color: rgba(245, 158, 11, 0.6) !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25) !important;
}

.wan-chip-degraded {
  border-color: rgba(245, 158, 11, 0.6) !important;
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}

.status-dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: warningPulse 1.5s infinite alternate;
}

@keyframes warningPulse {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #f59e0b; }
}

/* In-Portal Notification Toast */
.portal-toast-container {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 420px;
  width: calc(100vw - 2rem);
  pointer-events: none;
}

.portal-toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.2);
  color: #f8fafc;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.portal-toast.warning {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.25);
}

.portal-toast.success {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.25);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.alarm-active-push-banner {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #ffffff;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
  animation: alarmPulse 1.5s infinite alternate;
}

@keyframes alarmPulse {
  0% { background: linear-gradient(135deg, #dc2626, #991b1b); }
  100% { background: linear-gradient(135deg, #ef4444, #b91c1c); }
}

.bell-ring-anim {
  animation: bellRing 0.8s infinite;
  display: inline-block;
}

@keyframes bellRing {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-15deg); }
  60% { transform: rotate(10deg); }
  80% { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}

/* Sentry Active Guard Header Status Pill */
.sentry-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  letter-spacing: 0.02em;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.sentry-status-pill:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(52, 211, 153, 0.6);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.sentry-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: sentryPulse 2s infinite alternate;
}

@keyframes sentryPulse {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #34d399; }
}

/* ==========================================================================
   iPhone 17 Pro Ultra / Flagship iOS & Mobile Ergonomic Optimization
   ========================================================================== */

@media (max-width: 768px) {
  /* Safe Area Padding for Dynamic Island and Home Bar Indicator */
  .header {
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-bottom: 0.5rem;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .brand {
    width: 100%;
    justify-content: flex-start;
  }

  .brand-title {
    font-size: 1.15rem;
    letter-spacing: -0.01em;
  }

  .brand-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .header-actions {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem;
    box-sizing: border-box;
  }

  .user-profile-area {
    display: inline-flex;
    align-items: center;
  }

  .sentry-status-pill {
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
  }

  .user-pill {
    padding: 0.25rem 0.5rem;
    gap: 0.3rem;
  }

  .user-avatar-badge {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
  }

  .user-name-text {
    font-size: 0.72rem;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn {
    padding: 0.32rem 0.55rem;
    font-size: 0.76rem;
    border-radius: 8px;
    white-space: nowrap;
  }

  /* Smart Contextual Status Squares Responsive Grid */
  .smart-status-squares-wrapper {
    padding: 0 1rem;
    margin: 1rem auto;
  }

  .smart-status-squares-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .status-square {
    padding: 1.1rem;
    border-radius: 14px;
  }

  .square-title {
    font-size: 0.95rem;
  }

  .square-mini-chip {
    font-size: 0.76rem;
    padding: 0.3rem 0.65rem;
  }

  /* Main Directory Grid */
  .main-content {
    padding: 0 1rem;
    margin-top: 1rem;
  }

  .sites-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .site-card {
    padding: 1.15rem;
    border-radius: 14px;
  }
}

  /* Modals on Mobile Viewports */
  .modal-overlay {
    padding: max(1rem, env(safe-area-inset-top)) 0.75rem max(1.5rem, env(safe-area-inset-bottom)) 0.75rem;
  }

  .modal-box {
    width: 95vw;
    max-width: 100%;
    max-height: 86vh;
    padding: 1.25rem;
    border-radius: 16px;
    margin: 0 auto;
  }

  .portal-locked-card {
    margin: 2rem 1rem !important;
    padding: 1.75rem 1.25rem !important;
  }
}

@media (max-width: 430px) {
  /* Dynamic Island & Ultra-compact screen tweaks (iPhone 17 Pro / Pro Max width) */
  .brand-tag {
    display: none;
  }

  .square-content-chips {
    gap: 0.4rem;
  }

  .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   ✨ COMPREHENSIVE LIGHT MODE DESIGN THEME (data-theme="light")
   ========================================================================== */

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border-color: #cbd5e1;
  --border-color-hover: #0284c7;
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;
  --shadow-glow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] body {
  background-color: #f1f5f9 !important;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 40%) !important;
  color: #0f172a !important;
}

/* Header & Navigation Bar in Light Mode */
[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .brand-title,
[data-theme="light"] .section-title,
[data-theme="light"] .card-title,
[data-theme="light"] .modal-title,
[data-theme="light"] .hero-title,
[data-theme="light"] h1, 
[data-theme="light"] h2, 
[data-theme="light"] h3, 
[data-theme="light"] h4 {
  color: #0f172a !important;
}

[data-theme="light"] .brand-tag {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #bae6fd !important;
}

[data-theme="light"] .user-chip,
[data-theme="light"] .admin-badge,
[data-theme="light"] .sentry-guard-pill,
[data-theme="light"] .manage-users-btn,
[data-theme="light"] .theme-toggle-btn {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03) !important;
}

[data-theme="light"] .sentry-chip,
[data-theme="light"] .sentry-guard-pill {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

/* Interactive Summary Squares (Security, Belterra Weather, UniFi Network) */
[data-theme="light"] .summary-card,
[data-theme="light"] .security-summary-card,
[data-theme="light"] .weather-summary-card,
[data-theme="light"] .unifi-summary-card,
[data-theme="light"] .alarm-summary-bar,
[data-theme="light"] .weather-summary-bar,
[data-theme="light"] .unifi-summary-bar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .summary-card:hover,
[data-theme="light"] .security-summary-card:hover,
[data-theme="light"] .weather-summary-card:hover,
[data-theme="light"] .unifi-summary-card:hover {
  border-color: #38bdf8 !important;
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.15) !important;
}

[data-theme="light"] .alarm-chip,
[data-theme="light"] .weather-chip,
[data-theme="light"] .unifi-chip,
[data-theme="light"] .stat-chip,
[data-theme="light"] .tag-pill,
[data-theme="light"] .square-mini-chip,
[data-theme="light"] .created-date {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] .card-platform {
  color: #64748b !important;
}

[data-theme="light"] .card-desc {
  color: #334155 !important;
}

[data-theme="light"] .camera-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .camera-name {
  color: #0f172a !important;
}

/* Category Filter Tabs & Buttons */
[data-theme="light"] .tab-btn,
[data-theme="light"] .category-tab,
[data-theme="light"] .btn-secondary {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .tab-btn.active,
[data-theme="light"] .category-tab.active {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25) !important;
}

/* Site Cards & Camera Cards */
[data-theme="light"] .site-card,
[data-theme="light"] .camera-card,
[data-theme="light"] .widget-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .site-card:hover,
[data-theme="light"] .camera-card:hover,
[data-theme="light"] .widget-card:hover {
  border-color: #38bdf8 !important;
  box-shadow: 0 8px 30px rgba(56, 189, 248, 0.18) !important;
  transform: translateY(-2px);
}

/* Search Bar & Form Controls */
[data-theme="light"] .search-input,
[data-theme="light"] .search-bar,
[data-theme="light"] .form-input,
[data-theme="light"] .form-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
}

[data-theme="light"] .search-input::placeholder,
[data-theme="light"] .form-input::placeholder {
  color: #94a3b8 !important;
}

/* Modals & Dialogs */
[data-theme="light"] .modal-box {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .modal-header {
  border-bottom: 1px solid #e2e8f0 !important;
}



