:root {
  --bg: #f3f1ec;
  --bg-elevated: #fffcf7;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e2d9;
  --accent: #0f766e;
  --accent-ink: #f0fdfa;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #a16207;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: Consolas, "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ddeae6 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #efe6d8 0%, transparent 45%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
button, input, select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.72);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 28px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav a {
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 8px;
}
.nav a.active, .nav a:hover {
  background: #e8f3f1;
  color: var(--accent);
}

.main {
  padding: 28px 36px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}
.user-chip {
  color: var(--muted);
  font-size: 0.9rem;
}

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

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .main { padding: 20px; }
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.panel p.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--danger); }
.status-dot.warn { background: var(--warn); }

.metric {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn:hover { filter: brightness(0.96); }
.btn.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn.danger {
  background: var(--danger);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.field label {
  font-size: 0.85rem;
  color: var(--muted);
}
.field input, .field select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th, .table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.table th { color: var(--muted); font-weight: 500; }

.log {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: #1c1917;
  color: #e7e5e4;
  border-radius: 10px;
  padding: 14px;
  height: 320px;
  overflow: auto;
  white-space: pre-wrap;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}
.login-card .lede {
  color: var(--muted);
  margin: 0 0 22px;
}
.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}
.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 8px 0 0;
}
.muted { color: var(--muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f3f1;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-wrap {
  margin: 14px 0 4px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.progress-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.progress-msg {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e8e4dc;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transition: width 0.35s ease;
}
