:root {
  --bg: #0b1220;
  --panel: #111c2e;
  --panel-2: #16233a;
  --line: #22314b;
  --text: #e6edf7;
  --muted: #8ea2bf;
  --accent: #2dd4bf;
  --accent-2: #0ea5e9;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #14304a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
  min-height: 100%;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 14px;
  transition: 0.15s ease;
}
button:hover { border-color: var(--accent); }
button.ghost { background: transparent; }
button.danger { color: #ffb4b4; }
button.wide { width: 100%; margin-top: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 180px;
}
input:focus, select:focus { outline: 2px solid #1f6f8b; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.login-card label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-card button { background: linear-gradient(90deg, #0ea5e9, #2dd4bf); color: #05202c; font-weight: 700; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand.small { gap: 10px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0ea5e9, #2dd4bf);
  color: #04222b; font-weight: 800; font-size: 22px;
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 2px 0 0; }
.error { color: #ffb4b4; margin: 0; font-size: 14px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 22px;
  background: rgba(11, 18, 32, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; margin-inline-start: auto; }
.tab { border: none; background: transparent; color: var(--muted); padding: 10px 14px; }
.tab.active { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.top-actions { display: flex; gap: 8px; }

main { padding: 22px; max-width: 1180px; margin: 0 auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- cards ---------- */
.cards { display: grid; gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.5; }
.meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.body { line-height: 1.9; margin: 12px 0; color: #d7e2f2; white-space: pre-wrap; }
.source { font-size: 13px; color: var(--accent); word-break: break-all; }
.source a { color: inherit; }

.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge.verified { color: #b9f6cf; border-color: #1d6b3a; background: #0e2a1b; }
.badge.flagged { color: #ffd2a8; border-color: #7a4a12; background: #2a1a0a; }
.badge.pending { color: #cbd8ea; }
.badge.scholar_required { color: #c4b5fd; border-color: #4c3d8f; background: #1b1633; }

.verdict {
  margin: 10px 0; padding: 10px 12px; border-radius: 10px;
  background: #1b1206; border: 1px solid #6b3f10; font-size: 13px;
}
.verdict .issues { margin: 6px 0 0; padding-inline-start: 18px; }
.verdict .issues li { margin: 3px 0; }

.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions .approve { background: #123c2a; border-color: #1d6b3a; color: #b9f6cf; }

/* ---------- categories ---------- */
.sections { display: grid; gap: 18px; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section h2 { margin: 0 0 12px; font-size: 18px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px;
}
.cat .slug { color: var(--muted); font-size: 11px; direction: ltr; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.pill.sharia { color: #c4b5fd; border-color: #4c3d8f; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 720px) {
  .tabs { width: 100%; order: 3; }
  .top-actions { margin-inline-start: auto; }
  main { padding: 14px; }
}

/* ---------- coverage table ---------- */
.coverage { margin-bottom: 22px; }
.coverage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.coverage-head h2 { margin: 0; font-size: 17px; }
.coverage-head label { display: flex; align-items: center; gap: 8px; }
.coverage-head input { min-width: auto; accent-color: var(--accent); }
table.cov { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.cov th, table.cov td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.cov thead th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
table.cov tbody tr:last-child td { border-bottom: none; }
table.cov tbody tr:hover { background: var(--panel-2); }
table.cov .ok { color: var(--ok); font-weight: 700; }
table.cov .warn { color: var(--warn); }
.pill.short { color: #ffd2a8; border-color: #7a4a12; background: #2a1a0a; }

/* ---------- settings / names / admin additions ---------- */
.panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:18px 22px; }
.panel h2 { font-size:16px; margin:16px 0 8px; }
.panel h2:first-child { margin-top:0; }
.grid2 { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; margin:10px 0; }
.grid2 label, .panel > label { display:grid; gap:4px; font-size:13px; color:var(--muted); }
.switch { display:flex; align-items:center; gap:10px; font-size:14px; color:var(--text); cursor:pointer; margin:8px 0; }
.switch input { min-width:auto; width:18px; height:18px; accent-color:var(--accent); }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; }
.chip { display:inline-flex; align-items:center; gap:6px; background:var(--panel-2); border:1px solid var(--line); border-radius:999px; padding:5px 10px; font-size:13px; }
.chip-x { background:none; border:none; color:var(--bad); cursor:pointer; font-size:14px; padding:0 2px; }
