
:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-active-bg: rgba(30, 41, 59, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
}

* { box-sizing: border-box; }
body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 20px 20px 90px 20px;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  position: relative;
  z-index: 100000;
}

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

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-input-group {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  font-weight: 700;
}

.modal-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.container, .shell { width: 100%; max-width: 960px; }
.hidden { display: none !important; }

/* Premium Global Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}
.btn:hover {
  background: rgba(30, 41, 59, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}
.btn-start {
  background: linear-gradient(135deg, #059669, #047857);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}
.btn-start:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
}


.header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.title-section h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

@media (min-width: 640px) {
  .hero-actions {
    width: auto;
  }
}

.hero-actions .btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.9rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.zone-item {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zone-item.active {
  background: var(--card-active-bg);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.zone-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.zone-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sprinkler-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.zone-item.active .sprinkler-icon-wrapper {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  animation: spray 1.5s ease-in-out infinite alternate;
}

@keyframes spray {
  0% { transform: rotate(-5deg); }
  100% { transform: rotate(5deg); }
}

.zone-details {
  display: flex;
  flex-direction: column;
}

.zone-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.zone-status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.zone-item.active .zone-status-text {
  color: var(--accent-blue);
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .25s;
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-blue);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.btn-trigger-timer {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.btn-trigger-timer:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.zone-item.show-timer .btn-trigger-timer {
  color: var(--accent-blue);
  background-color: rgba(59, 130, 246, 0.1);
}

.countdown-badge {
  background: var(--accent-amber);
  color: #000;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: monospace;
}

.zone-timer-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  border-top: 1px solid transparent;
  margin-top: 0;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.zone-item.show-timer .zone-timer-section {
  max-height: 120px;
  border-top: 1px solid var(--border-color);
  margin-top: 12px;
  padding-top: 12px;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.presets-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.preset-btn {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.preset-btn.selected {
  background-color: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.custom-timer-input {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px 6px;
  width: 90px;
}

.custom-timer-input input {
  width: 100%;
  border: none;
  background: transparent;
  color: white;
  text-align: center;
  font-size: 0.95rem;
  font-weight: bold;
  outline: none;
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 68px;
  background-color: rgba(15, 23, 42, 0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; align-items: center; z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; text-decoration: none;
  color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; background: none; border: none;
  padding: 8px 0; flex: 1; transition: color 0.2s; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--accent-blue); }
.nav-icon { width: 22px; height: 22px; margin-bottom: 4px; fill: currentColor; }
.log-box { background: #000000; color: #10b981; font-family: monospace; font-size: 12px; padding: 14px; border-radius: 12px; max-height: 240px; overflow-y: auto; }



.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(30, 106, 80, 0.12), rgba(46, 135, 183, 0.10)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero.hero-product {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 26px;
}

.hero.hero-product::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 106, 80, 0.22), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-family: var(--mono);
}

.eyebrow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 0.98;
}
h2 { margin-bottom: 0; font-size: 22px; }

.subhead, .muted, .meta { color: var(--muted); }
.feature-lead {
  font-size: 18px;
  line-height: 1.65;
  max-width: 62ch;
}

.hero-actions, .badge-row, .button-row, .field-grid, .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.button:hover { transform: translateY(-1px); border-color: var(--accent-2); }
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.button-secondary { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.button.theme-toggle { background: var(--surface-2); backdrop-filter: blur(8px); border-color: var(--line); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  margin-bottom: 18px;
}

.tab-button {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}
.tab-button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.banner-stack { display: grid; gap: 12px; margin-bottom: 18px; }
.banner {
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.banner strong, .banner p { margin: 0; }
.banner p { margin-top: 6px; color: inherit; }
.banner-info { background: var(--banner-info-bg); color: var(--banner-info-fg); }
.banner-warn { background: var(--banner-warn-bg); color: var(--banner-warn-fg); }
.banner-danger { background: var(--banner-danger-bg); color: var(--banner-danger-fg); }

.stack, .zone-card, .schedule-card, .network-card { display: grid; gap: 14px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card, .zone-card, .schedule-card, .network-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}
.tone-ink {
  background: linear-gradient(180deg, #20312b 0%, #15211d 100%);
  color: #edf8f0;
  border-color: transparent;
}
.overview-card { min-height: 120px; }
.overview-card .value { font-size: 28px; line-height: 1; margin: 10px 0 8px; }
.mini-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-family: var(--mono);
}

.hero-stat-row,
.mock-zone-grid,
.trust-grid,
.audience-grid {
  display: grid;
  gap: 14px;
}

.hero-stat-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.stat-tile {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--stat-tile-bg);
  border: 1px solid var(--stat-tile-border);
}

.stat-tile strong {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
}

.hero-device {
  display: grid;
  gap: 14px;
}

.device-shell {
  border-radius: 28px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(21, 33, 29, 0.96), rgba(14, 22, 19, 0.98));
  color: #edf8f0;
  box-shadow: 0 24px 50px rgba(16, 24, 21, 0.34);
}

.device-screen {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--device-screen-bg-top), var(--device-screen-bg-bot));
  color: var(--device-screen-fg);
}

.device-head,
.timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--timeline-item-bg);
  border: 1px solid var(--timeline-item-border);
}

.timeline-time {
  font-family: var(--mono);
  color: var(--accent);
  white-space: nowrap;
}

.mock-zone-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mock-zone,
.trust-card,
.audience-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.mock-zone strong,
.audience-card strong {
  display: block;
  margin-bottom: 4px;
}

.audience-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trust-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cta-band {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(30, 106, 80, 0.12), rgba(46, 135, 183, 0.14)), var(--surface);
  border: 1px solid var(--line);
}

.field { display: grid; gap: 6px; }
.field label {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}
input[type="text"], input[type="number"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
input::placeholder { color: var(--muted); opacity: 1; }
.readout {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.input-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}
.input-suffix span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--input-suffix-bg);
  font-family: var(--mono);
  color: var(--muted);
  font-size: 12px;
}
.input-suffix input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--ink);
  font-size: 12px;
  font-family: var(--mono);
}
.badge.badge-blue { background: var(--badge-blue-bg); border-color: var(--badge-blue-border); }
.badge.badge-red { background: var(--badge-red-bg); border-color: var(--badge-red-border); }
.badge.badge-gold { background: var(--badge-gold-bg); border-color: var(--badge-gold-border); }

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.state-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 18px;
}
.chart-panel { min-height: 100%; }
.metric-chart { display: grid; gap: 10px; }
.metric-row { display: grid; gap: 8px; }
.metric-head { display: flex; justify-content: space-between; gap: 12px; }
.metric-track {
  height: 10px;
  border-radius: 999px;
  background: var(--metric-track-bg);
  overflow: hidden;
}
.metric-fill { height: 100%; border-radius: 999px; }
.metric-fill-0 { background: #7f988a; }
.metric-fill-1 { background: #2e87b7; }
.metric-fill-2 { background: #1e6a50; }
.metric-fill-3 { background: #ad7b22; }

.zone-head, .schedule-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.hidden { display: none !important; }
.tiny { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head > div { flex: 1; }
.panel-head h2, .panel-head h3 { margin-bottom: 4px; }
.panel-head p { margin: 0; font-size: 14px; }

.page { padding-top: 4px; }

.badge.badge-green { background: var(--badge-bg); border-color: var(--badge-border); color: var(--accent); }

@media (max-width: 900px) {
  .hero, .state-layout { grid-template-columns: 1fr; display: grid; }
  .hero.hero-product,
  .hero-stat-row,
  .audience-grid,
  .trust-grid,
  .mock-zone-grid {
    grid-template-columns: 1fr;
  }
  .cta-band {
    flex-direction: column;
    align-items: flex-start;
  }
}
