:root {
  --bg: #f5f3ee; --card: #fff; --ink: #1d2a2a; --muted: #6b7774; --line: #e4e0d6;
  --brand: #12443d; --brand-2: #a8843a; --red: #b3261e; --red-bg: #fbe9e7; --amber: #8a5a00; --amber-bg: #fff4dc;
  --green: #1b6b3a; --green-bg: #e5f4ea; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1240px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; align-items: center; gap: 24px; background: var(--brand); color: #fff; padding: 10px 24px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: #e8efe9; padding: 6px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.topbar .who { font-size: 14px; }
button, .btn { font: inherit; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 7px 16px; border-radius: 8px; cursor: pointer; }
button.secondary { background: #fff; color: var(--brand); }
button.danger { background: var(--red); border-color: var(--red); }
button.link { background: none; border: none; color: inherit; text-decoration: underline; padding: 0 4px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat .num { font-size: 30px; font-weight: 700; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: 14px; }
.stat.alert .num { color: var(--red); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #faf8f3; }
tr:hover td { background: #fbfaf6; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { min-width: 280px; flex: 1; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; background: #eef1ef; color: var(--ink); white-space: nowrap; }
.badge.red { background: var(--red-bg); color: var(--red); font-weight: 700; }
.badge.amber { background: var(--amber-bg); color: var(--amber); font-weight: 600; }
.badge.green { background: var(--green-bg); color: var(--green); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pre { white-space: pre-wrap; background: #faf8f3; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 320px; overflow: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; }
.day { margin-bottom: 18px; }
.day h3 { margin: 0 0 8px; font-size: 15px; color: var(--brand); border-bottom: 2px solid var(--brand-2); display: inline-block; padding-bottom: 2px; }
.login { max-width: 380px; margin: 10vh auto; }
.login .card { padding: 26px; }
.login label, .form label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 14px; }
.login input, .form input, .form select { width: 100%; }
.error { color: var(--red); margin-top: 10px; min-height: 1.2em; }
.ok { color: var(--green); }
.token { font-family: ui-monospace, Menlo, monospace; direction: ltr; text-align: left; background: #faf8f3; padding: 10px; border-radius: 8px; word-break: break-all; border: 1px dashed var(--brand-2); }
.sens { direction: ltr; unicode-bidi: embed; font-family: ui-monospace, Menlo, monospace; }
.empty { color: var(--muted); padding: 18px; text-align: center; }
@media (max-width: 760px) { .kv { grid-template-columns: 1fr; } .toolbar input[type=search] { min-width: 0; } th:nth-child(n+5), td:nth-child(n+5) { display: none; } }
.full { width: 100%; }
.mt { margin-top: 10px; }
.narrow { max-width: 520px; }
.stat .num.small { font-size: 16px; line-height: 1.5; padding-top: 8px; }
