:root {
  --bg: #f5f7fb;
  --bg-2: #eaf0ff;
  --panel: #ffffff;
  --panel-2: #f7f9ff;
  --border: #dce4f2;
  --text: #172033;
  --muted: #657186;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --accent: #10b981;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .15), transparent 30rem),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 44%, #fff 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
code { background: #eef3ff; color: #1d4ed8; padding: 2px 6px; border-radius: 8px; }
.app-shell { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }
.admin-shell .sidebar {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.main, .user-shell { padding: 26px; }
.user-shell { max-width: 1120px; margin: 0 auto; }
.brand h1 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.03em; }
.brand p, .muted { color: var(--muted); }
.brand.compact { text-align: center; }
.brand-mark {
  width: 54px; height: 54px; border-radius: 18px; margin: 0 auto 14px;
  display: grid; place-items: center; font-weight: 900; font-size: 28px;
  color: white; background: linear-gradient(135deg, var(--primary), #7c3aed);
  box-shadow: var(--shadow);
}
.sidebar-section { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
.one-col { grid-template-columns: 1fr; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.top-gap { margin-top: 16px; }
.gap { gap: 12px; }
.card, .mini-card, .auth-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.fourapps-card { position: relative; overflow: hidden; }
.fourapps-card:before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--primary), #7c3aed, var(--accent));
}
.auth-card { width: min(480px, calc(100vw - 32px)); }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.hero h1 { font-size: clamp(32px, 5vw, 56px); line-height: .98; margin: 6px 0 10px; letter-spacing: -.05em; }
.mini-card { padding: 14px; }
.card-header { margin-bottom: 12px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline-form, .inline-actions { display: flex; gap: 10px; align-items: end; }
.wrap { flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 650; }
input, textarea, button, select {
  font: inherit;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(37, 99, 235, .18); border-color: var(--primary); }
textarea { resize: vertical; }
.button {
  cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  padding: 11px 15px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}
.button-wide { width: 100%; margin-top: 8px; }
.button-secondary { background: #eef3ff; color: #1d4ed8; box-shadow: none; border: 1px solid #d7e2ff; }
.button-danger { background: var(--danger); color: white; }
.button:disabled { opacity: 0.6; cursor: not-allowed; }
.law-list, .question-list { display: flex; flex-direction: column; gap: 10px; }
.law-item, .question-item, .test-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  background: var(--panel-2);
  text-align: left;
}
.law-item { cursor: pointer; }
.law-item.active { outline: 3px solid rgba(37, 99, 235, .30); border-color: var(--primary); background: #fff; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; background: #eef3ff; color: #1d4ed8; font-weight: 750;
}
.badge.inactive { background: #fee2e2; color: #991b1b; }
.badge.success { background: #dcfce7; color: #166534; }
.empty-state { min-height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.hidden { display: none !important; }
.status-box {
  margin-top: 10px; padding: 12px; border-radius: 14px; border: 1px dashed var(--border); background: #f8fbff; color: var(--muted);
}
.toast { padding: 10px 14px; border-radius: 999px; background: #dcfce7; color: #166534; border: 1px solid #86efac; font-weight: 750; }
.topbar { display: flex; justify-content: space-between; align-items: start; margin-bottom: 16px; }
.question-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.option-list { margin: 10px 0 0; padding-left: 18px; color: var(--text); }
.answer-grid { display: grid; gap: 10px; margin-top: 12px; }
.answer-option { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: #fff; color: var(--text); flex-direction: row; align-items: flex-start; }
.answer-option input { margin-top: 4px; }
.answer-feedback { margin-top: 12px; border-radius: 14px; padding: 12px; border: 1px solid var(--border); }
.answer-feedback.correct { background: #ecfdf5; border-color: #86efac; }
.answer-feedback.wrong { background: #fef2f2; border-color: #fecaca; }
.eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 900; }
.center-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.fourapps-bg { background: radial-gradient(circle at 20% 10%, rgba(37,99,235,.18), transparent 28rem); }
small, .small { color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.divider:before, .divider:after { content: ""; height: 1px; background: var(--border); flex: 1; }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .admin-shell .sidebar { position: relative; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .hero, .topbar, .split { flex-direction: column; align-items: stretch; }
}

.law-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  cursor: default;
}
.law-select {
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.law-select:focus { outline: none; }
.law-delete {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #dc2626;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.law-delete:hover { background: #dc2626; color: #fff; }
.button-small { padding: 8px 12px; font-size: 13px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  width: min(420px, calc(100vw - 32px));
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-logo {
  width: 86px;
  max-height: 64px;
  object-fit: contain;
  margin: 0 auto 8px;
}
.login-box h1 {
  margin: 0;
  text-align: center;
  font-size: 32px;
  letter-spacing: -.04em;
}
.login-box p {
  margin: 0 0 8px;
  text-align: center;
  color: var(--muted);
}
.login-box button {
  cursor: pointer;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border: none;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}
.alert.bad {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
}
.login-admin-link {
  margin-top: 8px;
  text-align: center;
  color: var(--primary-2);
  font-weight: 800;
}
