:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --ink: #161a22;
  --muted: #687082;
  --line: #e4e7ee;
  --brand: #2c56e0;
  --brand-soft: #e9eefc;
  --side: #10141d;
  --side-ink: #c9cfdb;
  --ok: #0f7b55;
  --ok-soft: #e3f5ee;
  --err: #c2362b;
  --err-soft: #fbeaea;
  --warn: #a35c00;
  --warn-soft: #fff3df;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #f0f2f6; padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: embed; }

/* layout */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 4px 12px 18px; display: flex; align-items: center; gap: 10px; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-style: normal; font-size: 16px; }
.side a { color: var(--side-ink); padding: 9px 12px; border-radius: 9px; display: flex; gap: 10px; align-items: center; }
.side a:hover { background: #1c2230; color: #fff; }
.side a.on { background: var(--brand); color: #fff; }
.side .grow { flex: 1; }
.main { padding: 28px 32px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 23px; margin: 0; }
.head p { margin: 2px 0 0; color: var(--muted); }

/* cards & stats */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 17px; margin: 0 0 14px; }
.card h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 27px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12.5px; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; direction: ltr; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 34px; background: var(--brand); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.chart .n { font-size: 11px; color: var(--muted); }
.chart .d { font-size: 10.5px; color: var(--muted); }

/* table */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; background: #eef0f4; color: var(--muted); white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-err { background: var(--err-soft); color: var(--err); }
.b-run { background: var(--brand-soft); color: var(--brand); }
.b-warn { background: var(--warn-soft); color: var(--warn); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f6f7fa; filter: none; }
.btn-danger { background: var(--panel); color: var(--err); border-color: #f0cfcc; }
.btn-sm { padding: 5px 11px; font-size: 13px; font-weight: 500; border-radius: 8px; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 500; }
label.f em { font-style: normal; color: var(--muted); font-weight: 400; font-size: 12.5px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d6dae3; border-radius: 9px; padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox] { width: auto; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; background: #fafbfc; }
.checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.hint { background: var(--brand-soft); color: #23419f; border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px; }
.hint.warn { background: var(--warn-soft); color: var(--warn); }
details.edit summary { cursor: pointer; color: var(--brand); font-size: 13px; }
details.edit form { margin-top: 8px; }

/* progress */
.progress { height: 8px; background: #eceff4; border-radius: 99px; overflow: hidden; min-width: 120px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.progress.done span { background: var(--ok); }

/* flashes */
.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 30px; }
.login h1 { font-size: 21px; margin: 0 0 4px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 10px; gap: 4px; }
  .side .brand { padding: 4px 8px; font-size: 15px; white-space: nowrap; }
  .side a { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
  .side .grow { display: none; }
  .main { padding: 18px 16px 50px; }
  .two, .form-grid { grid-template-columns: 1fr; }
}
