:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #151b2e;
  --panel-2: #101827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #273244;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #60a5fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.fake404 {
  position: fixed;
  inset: 0;
  z-index: 10;
  padding: 80px 24px;
  background: #ffffff;
  color: #111827;
  font-family: Arial, Helvetica, sans-serif;
}

.fake404 h1 {
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 12px;
}

.fake404 p {
  color: #374151;
}

.shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; margin-bottom: 14px; }
#subtitle { color: var(--muted); margin-top: 4px; }

.panel, .metric, .status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel { padding: 16px; }
.hidden { display: none; }

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span, .label, .metric span {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel-2);
  font-size: 16px;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 14px;
  color: white;
  background: #374151;
  font-size: 15px;
  font-weight: 650;
}

.primary { background: var(--blue); color: #08111f; }
.danger { background: var(--red); }
.warn { background: var(--yellow); color: #111827; }
.icon-btn { background: #263244; color: var(--text); }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }

.status-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.status-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

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

.metric {
  padding: 14px;
  min-height: 82px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 19px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.nav button.active {
  outline: 2px solid var(--blue);
  background: #1f3a5f;
}

.output {
  min-height: 280px;
  max-height: 56vh;
  overflow: auto;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

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

.page {
  display: grid;
  gap: 14px;
}

.page.hidden {
  display: none;
}

.perf-section {
  display: grid;
  gap: 12px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 16px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.perf-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.perf-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.perf-card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child, td:first-child {
  text-align: left;
}

.sizing-panel {
  display: grid;
  gap: 14px;
}

.sizing-list {
  display: grid;
  gap: 12px;
}

.sizing-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sizing-card .hint {
  margin-top: 4px;
}

.ok { color: var(--green); }
.warning { color: var(--yellow); }
.critical { color: var(--red); }

@media (max-width: 520px) {
  .shell { padding: 14px; }
  .actions { grid-template-columns: 1fr; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-card { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
