:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #64748b;
  --line: #d8dee9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--brand); text-decoration: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { background: #172033; color: #fff; padding: 24px; }
.brand { font-weight: 800; font-size: 18px; margin-bottom: 28px; }
.sidebar a { display: block; color: #dbeafe; padding: 10px 0; }
.main { padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.metric { font-size: 30px; font-weight: 800; }
.metric.small { font-size: 20px; }
.muted { color: var(--muted); }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #eef2f7; font-size: 13px; color: #475569; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
button, .button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
button:hover, .button:hover { background: var(--brand-dark); color: #fff; }
.flash { padding: 12px 14px; background: #dcfce7; border: 1px solid #86efac; border-radius: 8px; margin-bottom: 16px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(420px, 100%); }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; background: #e0f2fe; color: #075985; }
.danger { color: var(--danger); }
.secondary { background: #334155; }
.table-wrap { overflow-x: auto; }
.alert { padding: 12px 14px; border-radius: 8px; margin: 10px 0; border: 1px solid #bae6fd; background: #f0f9ff; }
.alert-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-error { background: #fee2e2; color: #991b1b; }
code { font-size: 12px; overflow-wrap: anywhere; }
.module-families { display: grid; gap: 18px; }
.module-family { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.module-family-head { padding: 16px 18px; background: #eef2f7; border-bottom: 1px solid var(--line); }
.module-family-head h4 { margin: 0 0 4px; font-size: 17px; }
.module-family-head p { margin: 0; color: var(--muted); font-size: 13px; }
.module-tree { padding: 10px 18px 16px; }
.module-node { margin-top: 8px; }
.module-children { margin-left: 22px; padding-left: 16px; border-left: 2px solid #cbd5e1; }
.module-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin: 0; border-radius: 7px; color: var(--ink); }
.module-option:hover { background: #f8fafc; }
.module-option input { width: auto; margin: 3px 0 0; }
.module-option span { display: grid; gap: 2px; }
.module-option small { color: var(--muted); font-size: 12px; }
.module-parent { background: #f8fafc; }
.module-checkbox:disabled + span { opacity: .45; }
pre { white-space: pre-wrap; background: #111827; color: #e5e7eb; padding: 14px; border-radius: 8px; overflow: auto; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .main { padding: 18px; }
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
}
