:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e6e9f2;
  --brand: #0b6bff;
  --danger: #d92d20;
  --ok: #039855;
  --warn: #dc6803;
  --shadow: 0 10px 30px rgba(17, 24, 39, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.login-card { width: min(420px, calc(100% - 32px)); margin: 8vh auto; background: var(--panel); padding: 28px; border-radius: 18px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 8px; }
.login-card p { color: var(--muted); }
label { display:block; margin: 12px 0 6px; font-weight: 700; font-size: 13px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; }
textarea { min-height: 92px; resize: vertical; }
button { border: 0; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 700; }
button.ghost { background: #eef4ff; color: var(--brand); }
button.danger { background: var(--danger); color: #fff; }
button.small { padding: 7px 10px; font-size: 12px; }
.error { color: var(--danger); margin-top: 12px; }
#mainView { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #fff; padding: 20px; position: sticky; top: 0; height: 100vh; }
.sidebar h2 { margin: 0 0 20px; font-size: 20px; }
.nav { display:block; width:100%; margin: 6px 0; text-align:left; background: transparent; color:#d1d5db; }
.nav.active, .nav:hover { background: rgba(255,255,255,.10); color:#fff; }
.sidebar .danger { width:100%; margin-top: 18px; }
.content { padding: 24px; overflow: auto; }
.topbar { display:flex; justify-content:space-between; gap:16px; align-items:center; margin-bottom:20px; }
.topbar h1 { margin:0; }
.topbar p { margin:6px 0 0; color: var(--muted); }
.actions { display:flex; gap:10px; }
.grid { display:grid; gap:16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; }
.stat { font-size: 30px; font-weight: 800; }
.muted { color: var(--muted); }
.table-wrap { overflow:auto; background: var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow: var(--shadow); }
table { width:100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align:left; vertical-align: top; font-size: 14px; }
th { background: #f8fafc; color:#344054; }
.row-actions { display:flex; gap:6px; flex-wrap:wrap; }
.form-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:12px; }
.form-grid .full { grid-column: 1 / -1; }
.badge { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; font-size:12px; background:#eef4ff; color:var(--brand); font-weight:700; }
.badge.ok { background:#ecfdf3; color:var(--ok); }
.badge.warn { background:#fff7ed; color:var(--warn); }
.badge.danger { background:#fef3f2; color:var(--danger); }
#toast { position: fixed; right: 20px; top: 20px; z-index: 99; max-width: 360px; }
.toast { background:#111827; color:#fff; padding:12px 14px; border-radius:12px; margin-bottom:8px; box-shadow: var(--shadow); }
.help { font-size:13px; color:var(--muted); line-height:1.5; }
pre { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) {
  #mainView { grid-template-columns: 1fr; }
  .sidebar { position: relative; height:auto; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
