/* ============================================================
   RA Dashboard — Main Stylesheet
   JARVIS dark aesthetic · Cyan neon accent · Monospace data
   ============================================================ */

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select, textarea { font: inherit; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ─── Custom Properties ──────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-app:        #060a0d;
  --bg-sidebar:    #07090c;
  --bg-main:       #080c10;
  --bg-card:       #0b1520;
  --bg-card-hover: #0f1c2a;
  --bg-input:      #09131d;
  --bg-badge:      #0d1a28;

  /* Borders */
  --border:        #152030;
  --border-light:  #1c2e42;
  --border-accent: rgba(0, 212, 255, 0.22);

  /* Blue — primary accent */
  --cyan:     #1a6fd4;
  --cyan-50:  rgba(26, 111, 212, 0.50);
  --cyan-25:  rgba(26, 111, 212, 0.25);
  --cyan-12:  rgba(26, 111, 212, 0.12);
  --cyan-07:  rgba(26, 111, 212, 0.07);
  --cyan-glow: 0 0 18px rgba(26, 111, 212, 0.28);

  /* Status accents */
  --green:     #00ff9d;
  --green-20:  rgba(0, 255, 157, 0.20);
  --green-10:  rgba(0, 255, 157, 0.10);
  --amber:     #d4a014;
  --amber-20:  rgba(212, 160, 20, 0.20);
  --amber-10:  rgba(212, 160, 20, 0.10);
  --red:       #ff4d66;
  --red-20:    rgba(255, 77, 102, 0.20);
  --red-10:    rgba(255, 77, 102, 0.10);

  /* Text Color */
  --text-primary:   #d8eeff;
  --text-secondary: #5a88a8;
  --text-muted:     #375e7b;
  --text-data:      #90c8e0;

  /* Text Sizes — full scale (rem values relative to --font-size-base / html root) */
  --font-size-base: 15px;
  --text-xxs:  0.5625rem;  /* ~8px  — tiny labels, SVG annotations  */
  --text-xs:   0.75rem;    /* ~10px — micro labels, letter-spaced caps */
  --text-sm:   0.8125rem;  /* ~12px — secondary/meta text            */
  --text-base: 1rem;       /* ~14px — body / default                 */
  --text-md:   1.0625rem;  /* ~15px — slightly above body            */
  --text-lg:   1.125rem;   /* ~16px — nav labels, card titles        */
  --text-xl:   1.25rem;    /* ~18px — sub-headings                   */
  --text-2xl:  1.5rem;     /* ~21px — stat values, display numbers   */
  --text-3xl:  2rem;       /* ~28px — large stat headings            */
  --text-4xl:  2.125rem;   /* ~30px — hero ring percentage           */

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Courier New', monospace;

  /* Layout */
  --sidebar-width: 232px;
  --header-height: 56px;
  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Transitions */
  --t: 0.18s ease;
}

/* ─── Base ────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── App Layout ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Header / Branding */
.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.ra-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ra-eye-logo {
  width: 60%;
  height: auto;
  flex-shrink: 0;
  animation: sidebar-eye-glow 4s ease-in-out infinite;
}
@keyframes sidebar-eye-glow {
  0%, 100% { filter: drop-shadow(0 0 4px  rgba(212,160,20,0.55)); }
  50%       { filter: drop-shadow(0 0 10px rgba(212,160,20,0.90))
                       drop-shadow(0 0 20px rgba(212,160,20,0.35)); }
}

.ra-subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Pulse dot — live indicator */
.pulse-wrap {
  position: relative;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}
.pulse-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(2.8); opacity: 0;   }
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--t), color var(--t);
  position: relative;
}
.nav-item:hover {
  background: var(--cyan-07);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--cyan-12);
  color: var(--cyan);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--cyan);
  border-radius: 0 2px 2px 0;
  box-shadow: var(--cyan-glow);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label {
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.2px;
}
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--amber-20);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.footer-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.footer-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  flex-shrink: 0;
}
.footer-status .dot.warn { background: var(--amber); box-shadow: 0 0 5px var(--amber); }
.footer-sync {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ─── Main Content ────────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-main);
}

.page-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

#live-clock {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.header-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
}

/* ─── Tab Sections ───────────────────────────────────────────── */
.tab-section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 32px;
}
.tab-section.active { display: block; }

/* ─── Section & Panel Titles ─────────────────────────────────── */
.section-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ─── Card Base (with JARVIS corner brackets) ─────────────────── */
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

/* Top-left bracket */
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 14px; height: 14px;
  border-top: 2px solid var(--cyan-25);
  border-left: 2px solid var(--cyan-25);
  border-radius: var(--radius) 0 0 0;
  pointer-events: none;
}
/* Bottom-right bracket */
.card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 14px; height: 14px;
  border-bottom: 2px solid var(--cyan-25);
  border-right: 2px solid var(--cyan-25);
  border-radius: 0 0 var(--radius) 0;
  pointer-events: none;
}

.card.accent-cyan::before, .card.accent-cyan::after { border-color: var(--cyan-50); }
.card.accent-green::before, .card.accent-green::after { border-color: rgba(0,255,157,0.45); }
.card.accent-amber::before, .card.accent-amber::after { border-color: rgba(255,184,77,0.45); }
.card.accent-red::before,   .card.accent-red::after   { border-color: rgba(255,77,102,0.45); }

/* Card with top accent line */
.card-panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan-50) 0%, transparent 100%);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.panel-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--cyan-12);
  color: var(--cyan);
}
.panel-badge.warn { background: var(--amber-10); color: var(--amber); }
.panel-badge.good { background: var(--green-10); color: var(--green); }
.panel-content { padding: 18px; }

/* ─── Stat Cards (Overview top row) ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px 20px 16px;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--cyan);
  line-height: 1;
  text-shadow: 0 0 20px var(--cyan-25);
  margin-bottom: 6px;
}
.stat-value.green { color: var(--green); text-shadow: 0 0 20px var(--green-20); }
.stat-value.amber { color: var(--amber); text-shadow: 0 0 20px var(--amber-20); }
.stat-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  opacity: 0.12;
  width: 28px; height: 28px;
}
.stat-icon svg {
  width: 28px; height: 28px;
  stroke: var(--cyan);
  fill: none;
  stroke-width: 1.5;
}

/* ─── Two/Three Column Grids ──────────────────────────────────── */
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* ─── System Status Rows ──────────────────────────────────────── */
.sys-status-list { display: flex; flex-direction: column; gap: 0; }
.sys-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.sys-status-row:last-child { border-bottom: none; }

.sys-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sys-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.sys-dot.cyan  { background: var(--cyan);  box-shadow: 0 0 6px var(--cyan); }
.sys-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.sys-dot.red   { background: var(--red);   box-shadow: 0 0 6px var(--red); }

.sys-label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  min-width: 80px;
}
.sys-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.sys-status-chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.sys-status-chip.online  { background: var(--green-10); color: var(--green); }
.sys-status-chip.active  { background: var(--cyan-12);  color: var(--cyan); }
.sys-status-chip.warning { background: var(--amber-10); color: var(--amber); }
.sys-status-chip.offline { background: var(--red-10);   color: var(--red); }

/* ─── Daily Brief ─────────────────────────────────────────────── */
.daily-brief-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
}
.daily-brief-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.brief-item {
  display: flex;
  gap: 10px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}
.brief-bullet {
  color: var(--cyan-50);
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── Recent Activity Rows ────────────────────────────────────── */
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  min-width: 70px;
  text-align: center;
  flex-shrink: 0;
}
.activity-chip.info    { background: var(--cyan-12);  color: var(--cyan); }
.activity-chip.good    { background: var(--green-10); color: var(--green); }
.activity-chip.warning { background: var(--amber-10); color: var(--amber); }
.activity-chip.alert   { background: var(--red-10);   color: var(--red); }

.activity-info { flex: 1; }
.activity-title-text {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.activity-detail-text { font-size: var(--text-sm); color: var(--text-secondary); }
.activity-time-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Alert Card ──────────────────────────────────────────────── */
.alert-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--amber-10);
  border: 1px solid var(--amber-20);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.alert-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--amber-20);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alert-icon svg { width: 15px; height: 15px; stroke: var(--amber); fill: none; stroke-width: 2; }
.alert-text { flex: 1; }
.alert-text strong { font-size: var(--text-base); color: var(--amber); display: block; margin-bottom: 2px; }
.alert-text span { font-size: var(--text-sm); color: var(--text-secondary); }
.alert-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  align-self: flex-start;
}

/* ─── Camera Placeholder ──────────────────────────────────────── */
.camera-feed {
  aspect-ratio: 16/9;
  background: #040810;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.camera-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,212,255,0.03) 0%, transparent 40%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,212,255,0.02) 3px, rgba(0,212,255,0.02) 4px);
}
.camera-label {
  position: absolute;
  top: 10px; left: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  color: var(--cyan-50);
  text-transform: uppercase;
}
.camera-ts {
  position: absolute;
  top: 10px; right: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--cyan-50);
}
.camera-status-badge {
  position: absolute;
  bottom: 10px; left: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--green-20);
  border-radius: 3px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--green);
  letter-spacing: 1px;
}
.camera-status-badge .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.camera-no-feed {
  text-align: center;
}
.camera-no-feed svg { width: 36px; height: 36px; stroke: var(--text-muted); fill: none; stroke-width: 1.5; margin: 0 auto 10px; }
.camera-no-feed p { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); letter-spacing: 1px; }

/* Camera corner brackets */
.camera-feed::before, .camera-feed::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  z-index: 2;
  pointer-events: none;
}
.camera-feed::before { top: 0; left: 0; border-top: 2px solid var(--cyan-50); border-left: 2px solid var(--cyan-50); }
.camera-feed::after  { bottom: 0; right: 0; border-bottom: 2px solid var(--cyan-50); border-right: 2px solid var(--cyan-50); }

/* ─── Security Stat Cards ─────────────────────────────────────── */
.security-stat {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.security-stat:last-child { border-bottom: none; }
.security-stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.security-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
}
.security-stat-value.cyan  { color: var(--cyan); }
.security-stat-value.green { color: var(--green); }

/* ─── Motion Log Table ────────────────────────────────────────── */
.log-table { width: 100%; border-collapse: collapse; }
.log-table th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.log-table td {
  padding: 10px 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: var(--bg-card-hover); }
.log-type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.log-type-badge.vehicle { background: var(--cyan-12); color: var(--cyan); }
.log-type-badge.person  { background: var(--green-10); color: var(--green); }
.log-type-badge.package { background: var(--green-10); color: var(--green); }
.log-type-badge.animal  { background: var(--amber-10); color: var(--amber); }
.log-conf {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.log-time-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
.log-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.log-status-dot.good    { background: var(--green); box-shadow: 0 0 4px var(--green); }
.log-status-dot.warning { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.log-status-dot.info    { background: var(--text-muted); }

/* ─── Entry Log ───────────────────────────────────────────────── */
.entry-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.entry-row:last-child { border-bottom: none; }
.entry-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 130px;
  flex-shrink: 0;
}
.entry-event {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  min-width: 160px;
}
.entry-detail { font-size: var(--text-sm); color: var(--text-secondary); }
.entry-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.entry-icon.good   { background: var(--green-10); }
.entry-icon.info   { background: var(--cyan-12); }
.entry-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.entry-icon.good svg { stroke: var(--green); }
.entry-icon.info svg { stroke: var(--cyan); }

/* ─── Smart Lights Grid ───────────────────────────────────────── */
.lights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.light-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--t), background var(--t);
}
.light-card.on {
  border-color: rgba(255, 184, 77, 0.3);
  background: rgba(255, 184, 77, 0.04);
}
.light-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.light-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}
.light-room {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}
.light-state {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1px;
  color: var(--text-muted);
}
.light-card.on .light-state { color: var(--amber); }
.light-brightness {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.light-card.on .light-brightness { color: var(--text-secondary); }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-light);
  border-radius: 10px;
  transition: background var(--t);
}
.toggle-switch input:checked + .toggle-track { background: var(--amber); box-shadow: 0 0 8px rgba(255,184,77,0.4); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--t);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }

/* ─── Flood Sensor ────────────────────────────────────────────── */
.sensor-ok-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 1px;
  color: var(--green);
  background: var(--green-10);
  border: 1px solid var(--green-20);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 14px;
}
.sensor-ok-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse-ring 2s ease-out infinite; }
.sensor-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.sensor-row:last-child { border-bottom: none; }
.sensor-row-label { font-size: var(--text-sm); color: var(--text-secondary); }
.sensor-row-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); }

/* ─── Roomba Card ─────────────────────────────────────────────── */
.roomba-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 1px;
  color: var(--cyan);
  background: var(--cyan-12);
  border: 1px solid var(--cyan-25);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 14px;
}
.roomba-battery-wrap { margin-bottom: 14px; }
.battery-bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 5px;
}
.battery-bar-label span:last-child { color: var(--green); }
.progress-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), #00e688);
  transition: width 0.4s ease;
}
.progress-fill.cyan { background: linear-gradient(90deg, var(--cyan), #5a96f0); }
.progress-fill.amber { background: linear-gradient(90deg, var(--amber), #e8c030); }
.progress-fill.low  { background: linear-gradient(90deg, var(--red), #ff7088); }

/* ─── Smart Schedule ──────────────────────────────────────────── */
.schedule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.schedule-row:last-child { border-bottom: none; }
.schedule-indicator {
  width: 3px; height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}
.schedule-indicator.active { background: var(--green); box-shadow: 0 0 6px var(--green-20); }
.schedule-indicator.inactive { background: var(--border-light); }
.schedule-info { flex: 1; }
.schedule-name { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.schedule-name.inactive { color: var(--text-secondary); }
.schedule-time-action { font-size: var(--text-sm); color: var(--text-secondary); }
.schedule-days {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ─── Energy / Tesla Ring ─────────────────────────────────────── */
.tesla-grid { display: flex; gap: 24px; align-items: flex-start; }
.charge-ring-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}
.charge-ring-svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--border-light); stroke-width: 10; }
.ring-fill  { fill: none; stroke: var(--cyan); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring-fill.charging { stroke: var(--green); }
.charge-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ring-pct {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--cyan);
  line-height: 1;
}
.ring-pct.charging { color: var(--green); }
.ring-unit { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); margin-top: 1px; }
.ring-status { font-size: var(--text-xs); color: var(--green); letter-spacing: 1px; font-family: var(--font-mono); margin-top: 3px; }

.tesla-stats { flex: 1; display: flex; flex-direction: column; gap: 0; }
.tesla-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.tesla-stat-row:last-child { border-bottom: none; }
.tesla-stat-label { font-size: var(--text-sm); color: var(--text-secondary); }
.tesla-stat-val {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.tesla-stat-val.cyan  { color: var(--cyan); }
.tesla-stat-val.green { color: var(--green); }

/* ─── Charge Schedule Grid ────────────────────────────────────── */
.charge-schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.schedule-day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.schedule-day-cell.enabled {
  border-color: var(--cyan-25);
  background: var(--cyan-07);
}
.sched-day {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.schedule-day-cell.enabled .sched-day { color: var(--cyan); }
.sched-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}
.schedule-day-cell.enabled .sched-time { color: var(--text-secondary); }
.sched-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border-light);
}
.schedule-day-cell.enabled .sched-dot { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }

/* ─── Energy Chart ────────────────────────────────────────────── */
.energy-chart-wrap { padding: 18px 18px 8px; }
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--cyan-50), var(--cyan-25));
  transition: height 0.4s ease;
}
.chart-bar.today { background: linear-gradient(to top, var(--cyan), var(--cyan-50)); box-shadow: 0 0 8px var(--cyan-25); }
.chart-day {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.chart-day.today { color: var(--cyan); }
.chart-axis {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 6px;
}
.chart-axis-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

.energy-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.energy-total-cell {
  background: var(--bg-card);
  padding: 14px 18px;
  text-align: center;
}
.energy-total-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.energy-total-val {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--cyan);
}
.energy-total-sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* ─── Device Cards ────────────────────────────────────────────── */
.device-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.device-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.device-type-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--cyan-12);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.device-type-icon svg { width: 18px; height: 18px; stroke: var(--cyan); fill: none; stroke-width: 1.8; }
.device-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.device-model { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.device-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.device-status-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}
.device-status-chip.online { background: var(--green-10); color: var(--green); }
.device-status-chip.away   { background: var(--amber-10); color: var(--amber); }
.device-status-chip.offline{ background: var(--red-10);   color: var(--red); }
.device-charging-icon { width: 12px; height: 12px; }
.device-charging-icon svg { width: 12px; height: 12px; stroke: var(--amber); fill: none; stroke-width: 2; }

.device-metrics { display: flex; flex-direction: column; gap: 8px; }
.device-metric-row { display: flex; flex-direction: column; gap: 4px; }
.device-metric-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.device-metric-label span:last-child {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-data);
}

.device-meta { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.device-meta-row { display: flex; justify-content: space-between; }
.device-meta-label { font-size: var(--text-sm); color: var(--text-secondary); }
.device-meta-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); }
.device-warning {
  font-size: var(--text-sm);
  color: var(--amber);
  background: var(--amber-10);
  border: 1px solid var(--amber-20);
  border-radius: 4px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.device-warning svg { width: 12px; height: 12px; stroke: var(--amber); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ─── RA Agent Chat ───────────────────────────────────────────── */
.agent-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.agent-status-left { display: flex; align-items: center; gap: 8px; }
.agent-online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.agent-status-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--green);
}
.agent-status-bar .divider {
  width: 1px; height: 24px;
  background: var(--border-light);
}
.agent-meta-item { display: flex; flex-direction: column; gap: 1px; }
.agent-meta-label { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 1px; color: var(--text-muted); text-transform: uppercase; }
.agent-meta-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); }
.agent-model-chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 3px 10px;
  background: var(--cyan-12);
  border: 1px solid var(--cyan-25);
  border-radius: 4px;
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.chat-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 260px);
  min-height: 400px;
  overflow: hidden;
}
#chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-message { display: flex; }
.chat-message.user { justify-content: flex-end; }
.chat-message.agent { justify-content: flex-start; }
.chat-message.agent.thinking .message-bubble { background: var(--bg-input); }

.message-bubble {
  max-width: 70%;
  padding: 11px 15px;
  border-radius: var(--radius);
  position: relative;
}
.chat-message.user .message-bubble {
  background: var(--cyan-12);
  border: 1px solid var(--cyan-25);
  border-radius: var(--radius) var(--radius-sm) var(--radius) var(--radius);
}
.chat-message.agent .message-bubble {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm) var(--radius) var(--radius) var(--radius);
}
.chat-message.agent.type-system .message-bubble {
  background: transparent;
  border-color: var(--border);
  max-width: 100%;
}
.message-text {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.chat-message.user .message-text { color: var(--text-primary); }
.chat-message.agent.type-system .message-text { color: var(--text-secondary); font-style: italic; text-align: center; font-size: var(--text-sm); }
.message-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}
.chat-message.agent .message-time { text-align: left; }

.thinking-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}
.thinking-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.chat-quick-commands {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.quick-cmd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.5px;
  padding: 5px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-secondary);
  transition: border-color var(--t), color var(--t);
}
.quick-cmd:hover { border-color: var(--cyan-25); color: var(--cyan); }

.chat-input-row {
  display: flex;
  gap: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
#chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--t);
}
#chat-input::placeholder { color: var(--text-muted); }
#chat-input:focus { border-color: var(--cyan-25); }
#chat-send {
  background: var(--cyan-12);
  border: 1px solid var(--cyan-25);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 16px;
  color: var(--cyan);
  transition: background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}
#chat-send:hover { background: var(--cyan-25); }
#chat-send svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── Activity Log Tab ────────────────────────────────────────── */
.activity-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.search-wrap {
  position: relative;
  flex: 1;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}
#activity-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px 9px 36px;
  color: var(--text-primary);
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--t);
}
#activity-search::placeholder { color: var(--text-muted); }
#activity-search:focus { border-color: var(--cyan-25); }
#activity-filter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  outline: none;
  font-family: var(--font-mono);
  cursor: pointer;
  min-width: 130px;
}
#activity-filter:focus { border-color: var(--cyan-25); }

.activity-feed-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-card-hover); }

.ai-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 65px;
  padding-top: 2px;
}
.ai-system-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  min-width: 72px;
  text-align: center;
  flex-shrink: 0;
}
.ai-system-badge.security { background: var(--cyan-12);  color: var(--cyan);  }
.ai-system-badge.home     { background: var(--green-10); color: var(--green); }
.ai-system-badge.energy   { background: rgba(255,184,77,0.08); color: var(--amber); }
.ai-system-badge.devices  { background: var(--amber-10); color: var(--amber); }
.ai-system-badge.agent    { background: rgba(148,100,255,0.12); color: #b48aff; }
.ai-body { flex: 1; }
.ai-title { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.ai-detail { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; }
.ai-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.ai-status-dot.good    { background: var(--green); box-shadow: 0 0 4px var(--green); }
.ai-status-dot.warning { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.ai-status-dot.info    { background: var(--text-muted); }

/* ─── Settings ────────────────────────────────────────────────── */
.settings-section { margin-bottom: 28px; }
.settings-section-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.integration-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color var(--t);
}
.integration-row:hover { border-color: var(--border-light); }
.integration-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--bg-badge);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
}
.integration-info { flex: 1; }
.integration-name { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.integration-detail { font-size: var(--text-sm); color: var(--text-secondary); }
.integration-note { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.integration-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.integration-status-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
}
.integration-status-chip.connected    { background: var(--green-10); color: var(--green); }
.integration-status-chip.disconnected { background: var(--border);   color: var(--text-muted); }
.integration-last-sync {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.integration-action-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 4px 12px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-secondary);
  background: var(--bg-input);
  transition: border-color var(--t), color var(--t);
  cursor: pointer;
}
.integration-action-btn:hover { border-color: var(--cyan-25); color: var(--cyan); }

.threshold-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.threshold-row:last-child { border-bottom: none; }
.threshold-info { flex: 1; }
.threshold-label { font-size: var(--text-base); font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.threshold-desc { font-size: var(--text-sm); color: var(--text-secondary); }
.threshold-value-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.threshold-val {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--cyan);
  min-width: 50px;
  text-align: right;
}
.threshold-unit { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); }

.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.sys-info-row {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 3px;
}
.sys-info-label { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.sys-info-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); }

/* ─── Spacers & Utilities ─────────────────────────────────────── */
.mb-4  { margin-bottom: 4px;  }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mono   { font-family: var(--font-mono); }
.text-cyan   { color: var(--cyan); }
.text-green  { color: var(--green); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-bold { font-weight: 600; }
.w-full { width: 100%; }

/* ─── Overview Hero (Tab 1) ──────────────────────────────────── */
.ov-hero {
  position: relative;
  background: #03060a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

/* Canvas fills hero background — JS draws the matrix rain */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-scan {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: rgba(212, 160, 20, 0.05);
  animation: hero-scan-move 12s linear infinite;
  pointer-events: none;
  z-index: 3;
}
@keyframes hero-scan-move { 0% { top: 0; } 100% { top: 100%; } }

.ov-hero-inner {
  display: grid;
  grid-template-columns: 210px 1fr 210px;
  position: relative;
  z-index: 1;
  min-height: 320px;
}

/* Stat columns */
.ov-stats-col { display: flex; flex-direction: column; }
.ov-stats-left  { border-right: 1px solid var(--border); }
.ov-stats-right { border-left:  1px solid var(--border); }

.ov-stat {
  flex: 1;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ov-stat:last-child { border-bottom: none; }

.ovs-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.ovs-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ovs-denom { font-size: var(--text-base); color: var(--text-muted); font-weight: 400; }
.ovs-detail { font-size: var(--text-sm); color: var(--text-secondary); }

/* Eye of Ra centerpiece */
.ov-eye-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 14px;
  position: relative;
  z-index: 1;
}

.ov-eye-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Outer ring SVG — rotates clockwise */
.ov-ring1 {
  position: absolute;
  inset: 0;
  width: 280px;
  height: 280px;
  animation: ov-rot-cw 50s linear infinite;
}
/* Inner ring SVG — rotates counter-clockwise */
.ov-ring2 {
  position: absolute;
  top: 24px; left: 24px;
  width: 232px;
  height: 232px;
  animation: ov-rot-ccw 30s linear infinite;
}
@keyframes ov-rot-cw  { from { transform: rotate(0deg); } to { transform: rotate(360deg);  } }
@keyframes ov-rot-ccw { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

/* Eye SVG wrapper — pulsing glow */
.ov-eye-svg-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.ov-eye-svg-wrap svg {
  animation: ov-eye-glow 4s ease-in-out infinite;
}
@keyframes ov-eye-glow {
  0%, 100% {
    filter: drop-shadow(0 0 8px  rgba(212,160,20,0.60))
            drop-shadow(0 0 18px rgba(212,160,20,0.25));
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(212,160,20,1.00))
            drop-shadow(0 0 50px rgba(212,160,20,0.40))
            drop-shadow(0 0 80px rgba(26,111,212, 0.20));
  }
}

.ov-eye-label {
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(212, 160, 20, 0.36);
  margin-top: 12px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* Hero status bar */
.ov-hero-statusbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 7px 24px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.30);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ov-statusbar-sep { color: var(--border-light); }

/* Compact activity rows (overview bottom-right panel) */
.ov-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.ov-activity-row:last-child { border-bottom: none; }
.ov-act-body {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
}
.ov-act-system { font-weight: 600; color: var(--text-primary); }
.ov-act-time {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ─── Travel Tab ──────────────────────────────────────────── */
.travel-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

/* ── Form elements ─────────────────────────────────────────── */
.travel-field { display: flex; flex-direction: column; gap: 5px; }
.travel-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.travel-filter-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.travel-field-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.travel-input,
.travel-select,
.travel-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
.travel-input:focus,
.travel-select:focus,
.travel-textarea:focus { border-color: var(--cyan-25); }

.travel-input    { padding: 8px 10px; }
.travel-select   { padding: 8px 10px; color: var(--text-secondary); font-family: var(--font-mono); cursor: pointer; }
.travel-textarea {
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
  min-height: 90px;
}
.travel-textarea::placeholder { color: var(--text-muted); }
input[type="date"].travel-input { 
  color: var(--text-secondary); 
  padding: 8px 2px;
}

.travel-divider {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 1px;
  margin: 14px 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.travel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.travel-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.travel-btn-gold { background: var(--amber-10); border: 1px solid var(--amber-20); color: var(--amber); margin-bottom: 0; }
.travel-btn-gold:hover { background: var(--amber-20); }
.travel-btn-blue { background: var(--cyan-12); border: 1px solid var(--cyan-25); color: var(--cyan); }
.travel-btn-blue:hover { background: var(--cyan-25); }
.travel-btn-blue:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Rig profile ───────────────────────────────────────────── */
.rig-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.rig-row:last-child { border-bottom: none; }
.rig-label { font-size: var(--text-sm); color: var(--text-secondary); }
.rig-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); text-align: right; }
.rig-input {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 3px 7px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  outline: none;
  width: 145px;
  text-align: right;
  transition: border-color var(--t);
}
.rig-input:focus { border-color: var(--cyan-25); }

/* ── Results column ────────────────────────────────────────── */
.travel-results-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.travel-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ── Empty state ───────────────────────────────────────────── */
.travel-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}
.travel-empty-icon {
  font-size: 38px;
  opacity: 0.3;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 10px rgba(212,160,20,0.5));
}
.travel-empty-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.65;
}

/* ── Loading state ─────────────────────────────────────────── */
.travel-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  text-align: center;
}

/* ── RA Summary card ───────────────────────────────────────── */
.travel-ra-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--amber-20);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}
.travel-ra-summary-card::before {
  content: 'RA ANALYSIS';
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 2px;
  color: var(--amber);
  margin-bottom: 6px;
}

/* ── Error notice ──────────────────────────────────────────── */
.travel-error-card {
  background: var(--amber-10);
  border: 1px solid var(--amber-20);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.3px;
}
.travel-error-card svg { width: 13px; height: 13px; stroke: var(--amber); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ── Result cards ──────────────────────────────────────────── */
.travel-results-list { display: flex; flex-direction: column; gap: 12px; }

.travel-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--t), background var(--t);
}
.travel-result-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

.travel-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.travel-result-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.travel-result-meta {
  display: flex;
  gap: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.travel-result-meta span + span::before { content: ' · '; }

.travel-avail-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.travel-avail-badge.available { background: var(--green-10); color: var(--green); }
.travel-avail-badge.limited   { background: var(--amber-10); color: var(--amber); }
.travel-avail-badge.full      { background: var(--red-10);   color: var(--red); }

.travel-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}
.travel-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--bg-badge);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.travel-tag.electric { background: var(--amber-10); color: var(--amber); border-color: var(--amber-20); }
.travel-tag.water    { background: var(--cyan-12);  color: var(--cyan);  border-color: var(--cyan-25); }
.travel-tag.rv       { background: var(--green-10); color: var(--green); border-color: var(--green-20); }

.travel-result-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
}
.travel-stat-item { display: flex; flex-direction: column; gap: 2px; }
.travel-stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.travel-stat-val { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); font-weight: 600; }

.travel-book-btn {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 5px 13px;
  background: var(--cyan-12);
  border: 1px solid var(--cyan-25);
  border-radius: 4px;
  color: var(--cyan);
  transition: background var(--t);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.travel-book-btn:hover { background: var(--cyan-25); }
.travel-book-btn svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── Hamburger button (visible only on mobile) ───────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: background var(--t), color var(--t);
}
.hamburger-btn:hover { background: var(--cyan-07); color: var(--text-primary); }

/* ─── Mobile sidebar backdrop ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 190;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ─── Mobile Responsive ──────────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --font-size-base: 14px;
    --header-height: 52px;
  }

  /* Unlock body scroll — tab sections handle their own scroll */
  html, body { overflow: auto; }

  /* Full-width layout — sidebar overlaid, not in-flow */
  .app { grid-template-columns: 1fr; }

  /* Sidebar: fixed, slides in from left */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.7);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger */
  .hamburger-btn { display: flex; }

  /* Tab header: tighter padding, no overflow */
  .tab-header { padding: 0 14px; gap: 10px; }

  /* Tab sections: tighter padding */
  .tab-section { padding: 14px 12px 28px; }

  /* ── Grid stacking ───────────────────────────────────────────── */
  .grid-2-1,
  .grid-1-1,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  /* Stats grid: 2 columns on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Travel layout: single column */
  .travel-layout { grid-template-columns: 1fr; }

  /* ── Overview hero: stack stat cols vertically ───────────────── */
  .ov-hero-inner { grid-template-columns: 1fr; }
  .ov-stats-left  { border-right: none; border-bottom: 1px solid var(--border); }
  .ov-stats-right { border-left:  none; border-top:    1px solid var(--border); }

  /* Shrink the Eye ring animations on mobile */
  .ov-eye-wrap { width: 200px; height: 200px; }
  .ov-ring1    { width: 200px; height: 200px; }
  .ov-ring2    { width: 160px; height: 160px; top: 20px; left: 20px; }

  /* ── Tesla ring: center it when grid stacks ──────────────────── */
  .tesla-grid { flex-wrap: wrap; justify-content: center; }
  .charge-ring-wrap { margin: 0 auto 12px; }

  /* ── Energy totals: 2-col on mobile ─────────────────────────── */
  .energy-totals { grid-template-columns: repeat(2, 1fr); }

  /* ── Charge schedule: tighter cells ─────────────────────────── */
  .schedule-day-cell { padding: 7px 2px; }
  .sched-time { font-size: 9px; }

  /* ── Lights: 2-col ───────────────────────────────────────────── */
  .lights-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Chat: adjust height ─────────────────────────────────────── */
  .chat-container { height: calc(100dvh - 200px); min-height: 300px; }

  /* ── Activity toolbar: wrap ──────────────────────────────────── */
  .activity-toolbar { flex-wrap: wrap; }
  #activity-filter  { min-width: 0; width: 100%; }

  /* ── Touch targets: 44px minimum ────────────────────────────── */
  .nav-item   { min-height: 44px; }
  .quick-cmd  { min-height: 36px; padding: 6px 14px; }
  .travel-btn { min-height: 44px; }

  /* ── Clock: hide on small screens to save header space ──────── */
  #live-clock { display: none; }

  /* ── Sys info grid: single column ───────────────────────────── */
  .sys-info-grid { grid-template-columns: 1fr; }

  /* ── Log table: allow horizontal scroll ─────────────────────── */
  .log-table-wrap { overflow-x: auto; }
  .log-table { min-width: 500px; }

  /* ── Entry row: wrap on very small screens ───────────────────── */
  .entry-time { min-width: 100px; }
}
