:root {
  --bg: #f5f6f4; --surface: #ffffff; --ink: #1d2320; --muted: #5d6762; --line: #dfe3df;
  --accent: #1f5f4a; --accent-ink: #ffffff; --warn: #9a5b00; --bad: #a12a2a; --good: #1f6b3a; --chip: #eef1ee;
  --radius: 8px; --font: "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151917; --surface: #1d2321; --ink: #e8ece9; --muted: #a2aca6; --line: #313a36; --accent: #6fbf9f; --accent-ink: #0f1412; --chip: #26302c; --warn: #e0a64a; --bad: #e57373; --good: #7cc795; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.ghost { background: transparent; color: var(--muted); padding: 4px 8px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
nav { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav .brand { font-weight: 700; padding: 0 8px 4px; }
nav .tenant { font-size: 12px; color: var(--muted); padding: 0 8px 14px; }
nav a { display: block; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
nav a.active { background: var(--chip); color: var(--accent); font-weight: 600; }
nav .foot { margin-top: 18px; padding: 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
main { padding: 22px 26px 60px; max-width: 1180px; width: 100%; min-width: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 22px 0 8px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form2 .full { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--chip); }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 1px 9px; font-size: 12px; margin: 1px 2px; }
.ok { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.chip.ok { background: color-mix(in srgb, var(--good) 15%, transparent); }
.chip.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); }
.chip.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); }
.board { display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; }
.col { background: var(--chip); border-radius: var(--radius); padding: 8px; min-height: 140px; }
.col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 2px 4px 8px; color: var(--muted); }
.col .card { padding: 9px 10px; margin-bottom: 8px; font-size: 13px; }
.notice { border-inline-start: 3px solid var(--warn); background: var(--surface); padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; }
.muted { color: var(--muted); }
pre { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-size: 13px; max-height: 480px; overflow: auto; }
details summary { cursor: pointer; color: var(--accent); }
#toast { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; max-width: 420px; }
.login { max-width: 380px; margin: 10vh auto; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  table { display: block; overflow-x: auto; max-width: 100%; }
  .board { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .row { flex-wrap: wrap; }
  td, th { overflow-wrap: anywhere; }
  .row > * { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  details { max-width: 100%; }
  nav { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 2px; }
  nav .brand, nav .tenant { width: 100%; }
  main { padding: 16px; }
  .form2 { grid-template-columns: 1fr; }
}
