:root,
body[data-theme="asphalt"] {
  --bg: #0F1419;
  --surface: #1A2027;
  --surface-2: #212933;
  --border: #2B3440;
  --primary: #34D186;
  --primary-hover: #2AC27A;
  --on-primary: #0B1215;
  --brand-accent: #34D186;
  --secondary: #FBBF24;
  --info: #38BDF8;
  --danger: #F87171;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --topbar-bg: rgba(15, 20, 25, 0.86);
  --card-glass: rgba(26, 32, 39, 0.88);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.44);
  --tint-brand-bg: rgba(52, 209, 134, 0.14);
  --tint-brand-border: rgba(52, 209, 134, 0.34);
  --tint-live-bg: rgba(56, 189, 248, 0.15);
  --tint-live-border: rgba(56, 189, 248, 0.36);
  --tint-warn-bg: rgba(251, 191, 36, 0.14);
  --tint-warn-border: rgba(251, 191, 36, 0.34);
  --tint-danger-bg: rgba(248, 113, 113, 0.14);
  --tint-danger-border: rgba(248, 113, 113, 0.32);
  --surge: #A855F7;
  --tint-surge-bg: rgba(168, 85, 247, 0.16);
  --tint-surge-border: rgba(168, 85, 247, 0.46);
}

body[data-theme="daylight"] {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #D8E0E8;
  --primary: #34D186;
  --primary-hover: #28BE77;
  --on-primary: #0B1215;
  --brand-accent: #047857;
  --secondary: #B45309;
  --info: #0369A1;
  --danger: #DC2626;
  --text: #111827;
  --muted: #4B5563;
  --topbar-bg: rgba(242, 244, 247, 0.90);
  --card-glass: rgba(255, 255, 255, 0.92);
  --shadow-card: 0 6px 24px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 20px 45px rgba(17, 24, 39, 0.10);
  --tint-brand-bg: rgba(24, 184, 109, 0.12);
  --tint-brand-border: rgba(4, 120, 87, 0.28);
  --tint-live-bg: rgba(3, 105, 161, 0.12);
  --tint-live-border: rgba(3, 105, 161, 0.30);
  --tint-warn-bg: rgba(180, 83, 9, 0.11);
  --tint-warn-border: rgba(180, 83, 9, 0.28);
  --tint-danger-bg: rgba(220, 38, 38, 0.10);
  --tint-danger-border: rgba(220, 38, 38, 0.26);
  --surge: #7E22CE;
  --tint-surge-bg: rgba(147, 51, 234, 0.11);
  --tint-surge-border: rgba(126, 34, 206, 0.36);
}

body[data-theme="amber"] {
  --bg: #090A0C;
  --surface: #121417;
  --surface-2: #1A1D22;
  --border: #2A2E36;
  --primary: #F59E0B;
  --primary-hover: #D97706;
  --on-primary: #1A1100;
  --brand-accent: #FBBF24;
  --secondary: #34D186;
  --info: #38BDF8;
  --danger: #F87171;
  --text: #F8FAFC;
  --muted: #9CA3AF;
  --topbar-bg: rgba(9, 10, 12, 0.94);
  --card-glass: rgba(18, 20, 23, 0.90);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.52);
  --tint-brand-bg: rgba(245, 158, 11, 0.14);
  --tint-brand-border: rgba(245, 158, 11, 0.34);
  --tint-live-bg: rgba(56, 189, 248, 0.15);
  --tint-live-border: rgba(56, 189, 248, 0.36);
  --tint-warn-bg: rgba(251, 191, 36, 0.14);
  --tint-warn-border: rgba(251, 191, 36, 0.34);
  --tint-danger-bg: rgba(248, 113, 113, 0.14);
  --tint-danger-border: rgba(248, 113, 113, 0.32);
  --surge: #A855F7;
  --tint-surge-bg: rgba(168, 85, 247, 0.16);
  --tint-surge-border: rgba(168, 85, 247, 0.46);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 220ms ease, color 220ms ease;
}

button, input, select, textarea { font-family: inherit; touch-action: manipulation; }
.tnum, .sp-mono { font-variant-numeric: tabular-nums; font-family: inherit; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
}

.brand img { width: 32px; height: 32px; border-radius: 8px; }

.nav-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 140ms ease;
}

.pill-btn:hover { color: var(--text); border-color: var(--primary); }
.pill-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 90ms ease, background-color 140ms ease, border-color 140ms ease;
}

.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 800;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(52, 209, 134, 0.24);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-amber {
  background: var(--tint-warn-bg);
  border-color: var(--tint-warn-border);
  color: var(--secondary);
}
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn-danger { background: var(--tint-danger-bg); border-color: var(--tint-danger-border); color: var(--danger); }

.card {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: background-color 220ms ease, border-color 220ms ease;
}

.card-elevated {
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
}

.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; max-width: 100%; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi-val {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.badge-ok { color: var(--brand-accent); border-color: var(--tint-brand-border); background: var(--tint-brand-bg); }
.badge-warn { color: var(--secondary); border-color: var(--tint-warn-border); background: var(--tint-warn-bg); }
.badge-bad { color: var(--danger); border-color: var(--tint-danger-border); background: var(--tint-danger-bg); }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 300ms ease;
}

.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 600; }

#mapBox {
  width: 100%;
  height: 370px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  touch-action: none;
  z-index: 1;
}

.hour-bars {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  align-items: end;
  height: 92px;
  padding-top: 8px;
}
.hour-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.hour-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--primary);
  min-height: 3px;
}
.hour-lbl { font-size: 9px; color: var(--muted); margin-top: 3px; }

.theme-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.theme-card {
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
}
.theme-card.selected { border-color: var(--primary); }
.theme-swatches { display: flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 9999px; border: 1px solid rgba(255,255,255,0.2); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.78);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
}

.toast {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--primary);
  padding: 10px 18px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 13px;
  z-index: 80;
}

.bottom-nav {
  display: none;
}

@media (max-width: 820px) {
  .desktop-nav { display: none; }
  .container { padding-bottom: 86px; }
  .bottom-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bnav-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
  }
  .bnav-btn.active { color: var(--primary); }
}

.hero {
  padding: 36px 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.hero h1 { font-size: clamp(26px, 4.5vw, 40px); line-height: 1.12; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* =========================================================
 * GREEN & WHITE LIGHT/DARK TOGGLE SWITCHER (DRIBBBLE-INSPIRED)
 * ========================================================= */
.kurso-theme-switch {
  width: 68px;
  height: 36px;
  border-radius: 9999px;
  padding: 3px;
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
  transition: background-color 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.kurso-theme-switch .kts-thumb {
  position: absolute;
  top: 2.5px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.20);
  transition: transform 300ms cubic-bezier(0.34, 1.4, 0.64, 1), background-color 240ms ease;
  z-index: 1;
}

.kurso-theme-switch .kts-ico {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 220ms ease, transform 280ms ease, opacity 220ms ease;
}

.kurso-theme-switch[data-mode="light"] {
  background: #FFFFFF;
  border: 1.5px solid #34D186;
  box-shadow: 0 4px 14px rgba(52, 209, 134, 0.16);
}

.kurso-theme-switch[data-mode="light"] .kts-thumb {
  background: #34D186;
  transform: translateX(0);
}

.kurso-theme-switch[data-mode="light"] .kts-sun {
  color: #FFFFFF;
  transform: scale(1.06);
}

.kurso-theme-switch[data-mode="light"] .kts-moon {
  color: #18B86D;
  opacity: 0.78;
}

.kurso-theme-switch[data-mode="dark"] {
  background: #34D186;
  border: 1.5px solid #34D186;
  box-shadow: 0 4px 16px rgba(52, 209, 134, 0.28);
}

.kurso-theme-switch[data-mode="dark"] .kts-thumb {
  background: #FFFFFF;
  transform: translateX(31px);
}

.kurso-theme-switch[data-mode="dark"] .kts-sun {
  color: rgba(255, 255, 255, 0.90);
  opacity: 0.85;
}

.kurso-theme-switch[data-mode="dark"] .kts-moon {
  color: #047857;
  transform: scale(1.06);
}

.kurso-theme-switch:focus-visible {
  box-shadow: 0 0 0 3px var(--tint-brand-bg);
}

@media (max-width: 768px) {
  .input, input, select, textarea {
    font-size: 16px;
  }
}
