/* KNAAD CORE admin console — Arabic RTL theme. No build step; plain CSS. */
:root {
  --bg: #0f1720;
  --panel: #16212e;
  --panel-2: #1d2a3a;
  --line: #27384b;
  --text: #e7eef6;
  --muted: #8aa0b6;
  --brand: #2dd4bf;
  --brand-2: #14b8a6;
  --primary: #3b82f6;
  --warn: #ef4444;
  --ok: #22c55e;
  --amber: #f59e0b;
  --radius: 10px;
  --font: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .85em; background: #0b121a; padding: 1px 6px; border-radius: 6px; color: #cfe8ff; }
h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; color: var(--text); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-inline-start: 1px solid var(--line); padding: 18px 14px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 8px 18px; }
.brand .sub { color: var(--muted); font-size: .8rem; }
.brand-logo { height: 44px; width: auto; filter: brightness(0) invert(1); opacity: .95; }  /* navy logo -> white on dark */
.brand-logo.lg { height: 72px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: .95rem; }
.sidebar nav a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar nav a.on { background: var(--brand-2); color: #04201c; font-weight: 700; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar .who { display: flex; align-items: center; gap: 8px; }
.topbar .name { font-weight: 600; }
.content { padding: 22px; max-width: 1100px; }

/* ---------- pieces ---------- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.inline { display: inline; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--brand); }
.stat .lbl { color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .cards { grid-template-columns: repeat(2,1fr); } .grid2 { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.table th, .table td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.table tr:hover td { background: var(--panel-2); }
.table.compact th, .table.compact td { padding: 7px 10px; }
.grantcell { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- forms ---------- */
.form label, .login label { display: block; margin: 10px 0; color: var(--muted); font-size: .9rem; }
.form input, .form select, .form textarea,
.login input, .rowform input, .rowform select, .search input {
  display: block; width: 100%; margin-top: 5px;
  background: #0b121a; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-family: inherit; font-size: .95rem;
}
.form textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; margin: 0; }
.rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 10px; }
.rowform input, .rowform select { width: auto; flex: 1 1 160px; margin: 0; }
.search { display: flex; gap: 8px; margin: 8px 0 14px; max-width: 420px; }
.search input { margin: 0; }
.actions { display: flex; gap: 8px; margin-bottom: 10px; }
.permgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
@media (max-width: 700px) { .permgrid { grid-template-columns: 1fr; } }

/* ---------- buttons ---------- */
.btn { display: inline-block; cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-family: inherit; font-size: .9rem; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04210f; }
.btn.warn { background: transparent; border-color: var(--warn); color: #ff9b9b; }
.btn.warn:hover { background: var(--warn); color: #fff; }
.btn.ghost { background: transparent; }

/* ---------- badges / chips ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge.ok { background: rgba(34,197,94,.18); color: #6ee7a8; }
.badge.off { background: rgba(239,68,68,.16); color: #ff9b9b; }
.badge.super { background: rgba(245,158,11,.18); color: #fbbf24; }
.badge.status-live { background: rgba(34,197,94,.18); color: #6ee7a8; }
.badge.status-migrating { background: rgba(245,158,11,.18); color: #fbbf24; }
.badge.status-dev { background: rgba(59,130,246,.20); color: #93c5fd; }
.badge.status-planned { background: rgba(138,160,182,.18); color: #b9c8d8; }
.chip { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); color: #cfe1f2; padding: 1px 8px; border-radius: 6px; font-size: .78rem; margin: 1px 2px; }

/* ---------- flashes ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: .92rem; }
.flash.ok { background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.4); color: #b9f3cf; }
.flash.err { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #ffc4c4; }

/* ---------- auth / error pages ---------- */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.card.login { width: 100%; max-width: 360px; }
.card.login .code { font-size: 3rem; font-weight: 800; color: var(--brand); }
.card.login .brand { align-items: center; }
