:root {
  --bg: #080b12;
  --panel: rgba(17, 24, 39, .82);
  --panel-strong: rgba(15, 23, 42, .96);
  --border: rgba(148, 163, 184, .16);
  --text: #eef5ff;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --accent: #22d3ee;
  --accent-2: #7c3aed;
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, .16), transparent 28rem),
    radial-gradient(circle at top right, rgba(124, 58, 237, .22), transparent 30rem),
    linear-gradient(135deg, #050816, #0b1020 45%, #020617);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .25;
  background-image:
    linear-gradient(rgba(148, 163, 184, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.hidden { display: none !important; }

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
  position: relative;
}

.hero-card,
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  margin-bottom: 18px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -120px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, .28), transparent 68%);
}

.brand-pill,
.badge {
  width: max-content;
  border: 1px solid rgba(34, 211, 238, .36);
  background: rgba(34, 211, 238, .1);
  color: #a5f3fc;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .14em;
  font-size: 11px;
  padding: 8px 12px;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin: 14px 0 10px;
  font-size: clamp(30px, 5vw, 56px);
  line-height: .95;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 7px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.hero-copy,
.panel p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.panel { padding: 20px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-head.compact { margin-bottom: 14px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .18);
  outline: none;
  color: var(--text);
  background: rgba(2, 6, 23, .68);
  padding: 13px 14px;
  border-radius: 14px;
  font-size: 14px;
}

input:focus {
  border-color: rgba(34, 211, 238, .55);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .08);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  color: var(--text);
  background: rgba(30, 41, 59, .82);
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.small { padding: 9px 12px; font-size: 12px; }
.btn-primary { background: linear-gradient(135deg, #0891b2, #7c3aed); }
.btn-muted { background: rgba(51, 65, 85, .78); }
.btn-danger { background: linear-gradient(135deg, #991b1b, #ef4444); }
.btn-preset { background: linear-gradient(135deg, rgba(34, 197, 94, .85), rgba(14, 165, 233, .88)); }

.hint-box {
  margin-top: 14px;
  border: 1px dashed rgba(250, 204, 21, .32);
  background: rgba(250, 204, 21, .07);
  color: #fde68a;
  border-radius: 16px;
  padding: 14px;
  line-height: 1.5;
}

.dashboard {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

.sidebar { min-height: 640px; }

.zones-list {
  display: grid;
  gap: 10px;
  max-height: 74vh;
  overflow: auto;
  padding-right: 4px;
}

.zone-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, .12);
  color: var(--text);
  background: rgba(15, 23, 42, .62);
  border-radius: 16px;
  padding: 13px;
  cursor: pointer;
}

.zone-item.active {
  border-color: rgba(34, 211, 238, .55);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .18), 0 14px 40px rgba(34, 211, 238, .08);
}

.zone-item strong {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
}

.zone-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  gap: 18px;
}

#zoneView {
  display: grid;
  gap: 18px;
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-content: center;
  text-align: center;
}

.zone-summary {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) 1.2fr;
  gap: 16px;
}

.muted { color: var(--muted); font-size: 12px; font-weight: 800; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.status-grid div {
  border: 1px solid rgba(148, 163, 184, .12);
  background: rgba(2, 6, 23, .38);
  border-radius: 16px;
  padding: 13px;
  min-width: 0;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.status-grid b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.preset-buttons,
.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.feature-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid rgba(148, 163, 184, .13);
  background: rgba(2, 6, 23, .34);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
}

.feature-card input {
  width: 18px;
  height: 18px;
  accent-color: #22d3ee;
  margin-top: 1px;
}

.feature-card strong { display: block; margin-bottom: 4px; }
.feature-card small { color: var(--muted); line-height: 1.45; }

.codebox {
  width: 100%;
  max-height: 460px;
  overflow: auto;
  margin: 0;
  color: #dbeafe;
  background: rgba(2, 6, 23, .76);
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 18px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.logs-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.log-item {
  border: 1px solid rgba(148, 163, 184, .12);
  background: rgba(2, 6, 23, .32);
  border-radius: 14px;
  padding: 12px;
}

.log-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.log-top strong { color: #e0f2fe; }
.log-item p { font-size: 13px; }
.log-time { color: var(--muted-2); font-size: 12px; white-space: nowrap; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  border: 1px solid rgba(34, 211, 238, .34);
  background: rgba(15, 23, 42, .94);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .zones-list { max-height: 340px; }
  .zone-summary { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1440px); padding-top: 12px; }
  .hero-card { align-items: flex-start; flex-direction: column; padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}
