:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1a202c;
  --muted: #64748b;
  --brand: #16803c;
  --brand-dark: #11602d;
  --border: #e2e8f0;
  --danger: #b91c1c;
  --warn: #b45309;
}

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

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #0f2417;
  color: #d7e5db;
  padding: 1.25rem 0.75rem;
  flex-shrink: 0;
}
.sidebar h1 { font-size: 1.1rem; margin: 0 0 1.5rem 0.5rem; color: #fff; }
.sidebar a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 0.92rem;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar button {
  margin: 1.5rem 0.5rem 0;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: inherit;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

.main { flex: 1; padding: 1.5rem 2rem; max-width: 1100px; }
.main h2 { margin-top: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--border); }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
}
.badge.ok { background: #dcfce7; color: var(--brand-dark); }
.badge.warn { background: #fef3c7; color: var(--warn); }
.badge.err { background: #fee2e2; color: var(--danger); }

button.primary {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
button.primary:hover { background: var(--brand-dark); }
button.ghost {
  background: none;
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
button.danger { border-color: #fecaca; color: var(--danger); }

input, select {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.error-text { color: var(--danger); font-size: 0.85rem; }
.muted { color: var(--muted); font-size: 0.85rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.8rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h3 { margin-top: 0; }

.metrics { display: flex; gap: 1rem; flex-wrap: wrap; }
.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 90px;
}
.metric .value { font-size: 1.4rem; font-weight: 700; }
.metric .label { color: var(--muted); font-size: 0.8rem; }

.btn {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
.btn.danger { background: var(--danger); }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert.err { background: #fee2e2; color: var(--danger); }

.ellipsis {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
