:root {
  --bg: #0b1220;
  --bg2: #111a2e;
  --panel: rgba(22, 32, 54, 0.85);
  --border: #24314d;
  --text: #e8eefc;
  --muted: #8b9bb8;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(34, 211, 238, 0.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(96, 165, 250, 0.10), transparent 45%),
    var(--bg);
}

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

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

header.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #041018;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.brand h1 span { color: var(--cyan); }

.brand p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.chip strong { color: var(--text); font-weight: 600; }

.grid {
  display: grid;
  gap: 1rem;
}

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

@media (min-width: 860px) {
  .grid-2 { grid-template-columns: 1.2fr 0.8fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  backdrop-filter: blur(8px);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.card .sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0 0.25rem;
}

.gauge {
  position: relative;
  width: 220px;
  height: 220px;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge .track {
  fill: none;
  stroke: #1e293b;
  stroke-width: 8;
}

.gauge .value {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.25s ease, stroke 0.25s ease;
}

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.gauge-center .num {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.gauge-center .unit {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.gauge-center .phase {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  width: 100%;
}

@media (min-width: 520px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
}

.metric {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  text-align: center;
}

.metric .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.metric .val {
  font-size: 1.15rem;
  font-weight: 700;
}

.metric .val small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

button, .btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

button.primary {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: white;
}

button.primary:hover:not(:disabled) { transform: translateY(-1px); }

button.secondary {
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) { border-color: var(--cyan); }

button.danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.form-row {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: 1fr auto auto; align-items: end; }
  .form-row.cols-3 { grid-template-columns: 1fr 120px auto; align-items: end; }
}

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input, select, textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(34, 211, 238, 0.35);
  border-color: var(--cyan);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.tab.active {
  color: #041018;
  background: var(--cyan);
  border-color: var(--cyan);
}

.output {
  background: #0a1020;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow: auto;
  color: #cbd5e1;
  min-height: 120px;
}

.output.empty { color: var(--muted); }

.status-ok { color: var(--green); }
.status-bad { color: var(--red); }
.status-warn { color: var(--amber); }

.progress {
  height: 6px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.85rem;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  transition: width 0.2s ease;
}

.report-box {
  display: grid;
  gap: 0.65rem;
}

.report-id {
  font-family: ui-monospace, monospace;
  font-size: 1.1rem;
  color: var(--cyan);
  letter-spacing: 0.04em;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s ease;
  z-index: 50;
  max-width: min(360px, calc(100vw - 2rem));
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error { border-color: rgba(248, 113, 113, 0.5); }
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }

footer {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.hidden { display: none !important; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge.ok { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.badge.bad { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(36, 49, 77, 0.7);
  font-size: 0.9rem;
}

.summary-list li:last-child { border-bottom: none; }
.summary-list .k { color: var(--muted); }
.summary-list .v { font-weight: 600; }
