:root {
  --bg: #0a1217;
  --surface: #12202a;
  --surface-2: #172733;
  --text: #e8f0f4;
  --muted: #9eb0bd;
  --accent: #74d7ff;
  --accent-2: #e6465a;
  --danger: #ff5c5c;
  --ok: #2ed573;
  --border: #2a3d4a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 4% 6%, rgba(116, 215, 255, 0.36), transparent 78%),
    radial-gradient(circle at 96% 96%, rgba(230, 70, 90, 0.32), transparent 79%),
    radial-gradient(circle at 50% 50%, rgba(15, 28, 36, 0.18), transparent 70%),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(96px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.72;
  will-change: transform, opacity;
}

.bg-orb-1 {
  width: 1040px;
  height: 1040px;
  background: var(--accent);
  top: -360px;
  left: -380px;
  animation: orb-drift-1 28s ease-in-out infinite alternate;
}

.bg-orb-2 {
  width: 1000px;
  height: 1000px;
  background: var(--accent-2);
  bottom: -380px;
  right: -360px;
  animation: orb-drift-2 32s ease-in-out infinite alternate;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(16px, 3vw, 40px);
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 30vw) minmax(0, 1fr);
  gap: 18px;
  animation: fade-up 500ms ease-out;
}

.panel {
  background: linear-gradient(160deg, rgba(23, 39, 51, 0.94), rgba(18, 32, 42, 0.9));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.brand-panel h1,
.control-panel h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.01em;
}

.logo {
  width: 190px;
  height: auto;
  margin-bottom: 12px;
}

.subtitle {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 18, 23, 0.6);
  padding: 12px;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.status-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.pill {
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 10px;
  border: 1px solid transparent;
}

.pill-offline {
  color: #ffd2d2;
  background: rgba(255, 92, 92, 0.18);
  border-color: rgba(255, 92, 92, 0.35);
}

.pill-online {
  color: #ccffe4;
  background: rgba(46, 213, 115, 0.16);
  border-color: rgba(46, 213, 115, 0.35);
}

.control-panel {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.full-span {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 209, 178, 0.18);
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.config-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.button-row .btn {
  min-height: 84px;
  min-width: 140px;
  padding: 0 30px;
  font-size: 1.32rem;
  line-height: 1;
  border-radius: 14px;
}

.btn {
  font: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 14px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(140deg, var(--accent), #13b899);
  color: #052620;
  border-color: transparent;
}

.btn-secondary {
  background: linear-gradient(140deg, #2f4760, #273748);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-mini {
  background: transparent;
  color: var(--muted);
  min-height: 0;
  line-height: 1.1;
  padding: 5px 9px;
  font-size: 0.84rem;
}

.log-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 18, 23, 0.55);
  min-height: 340px;
  display: grid;
  grid-template-rows: auto 1fr;
}

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

.log-header h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

#logArea {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  color: #cbdae3;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes orb-drift-1 {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.68;
  }
  to {
    transform: translate3d(70px, 45px, 0) scale(1.05);
    opacity: 0.76;
  }
}

@keyframes orb-drift-2 {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.66;
  }
  to {
    transform: translate3d(-80px, -50px, 0) scale(1.06);
    opacity: 0.74;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-orb-1,
  .bg-orb-2,
  .app-shell {
    animation: none;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .bg-orb-1,
  .bg-orb-2 {
    width: 760px;
    height: 760px;
    filter: blur(84px);
  }

  .bg-orb-1 {
    top: -300px;
    left: -340px;
  }

  .bg-orb-2 {
    bottom: -320px;
    right: -340px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .button-row .btn {
    min-height: 64px;
    min-width: 116px;
    padding: 0 22px;
    font-size: 1.08rem;
  }

  .log-section {
    min-height: 260px;
  }

  .logo {
    width: 150px;
  }
}
