*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #222635;
  --border: #2a2f3d;
  --text: #e8eaed;
  --muted: #8b919e;
  --accent: #4f8cff;
  --accent-hover: #3a7aef;
  --success: #34c759;
  --warning: #ffd60a;
  --error: #ff453a;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding: 1.25rem;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1rem;
  font-weight: 650;
}

.subtitle,
.hint,
.status-bar,
.empty {
  color: var(--muted);
}

.subtitle {
  margin-top: 0.3rem;
}

.top-actions,
.panel-head,
.settings-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.status-bar {
  font-size: 0.9rem;
}

.dot {
  margin: 0 0.35rem;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #3a1d20;
  color: #ffb4ae;
}

.banner.ok {
  background: #16351f;
  color: #8de2a6;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  border: 0;
  border-radius: 9px;
  padding: 0.65rem 0.95rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 650;
}

.machine-name {
  font-weight: 650;
}

.machine-code {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.percent {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.percent.low {
  color: var(--error);
}

.percent.ok {
  color: var(--success);
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill.low {
  background: #3a1d20;
  color: #ffb4ae;
}

.status-pill.ok {
  background: #16351f;
  color: #8de2a6;
}

.status-pill.off,
.status-pill.unknown {
  background: var(--surface-2);
  color: var(--muted);
}

.threshold-input {
  width: 5.2rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
}

.empty {
  text-align: center;
  padding: 1.4rem 0.5rem;
}

@media (max-width: 720px) {
  .top-actions {
    width: 100%;
  }

  .btn {
    flex: 1;
  }
}
