:root {
  --blue: #1c6fc0;
  --blue-dark: #155a9c;
  --blue-soft: #e8f1fb;
  --navy: #0f2a47;
  --navy-2: #173a5e;
  --navy-line: #23466d;
  --navy-text: #c9d8ea;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --ok: #15803d;      --ok-bg: #e7f6ec;
  --warn: #a16207;    --warn-bg: #fdf3dc;
  --err: #c62828;     --err-bg: #fdecea;
  --info: #1d4ed8;    --info-bg: #e8effd;
  --gray-bg: #eef1f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 42, 71, .05), 0 1px 3px rgba(15, 42, 71, .06);
  --side-w: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- Shell ---------- */
.side {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--side-w);
  background: var(--navy);
  color: var(--navy-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  z-index: 30;
  overflow-y: auto;
}
.side-brand { display: block; background: #fff; border-radius: 10px; padding: 10px 12px; text-align: center; }
.side-brand img { display: block; width: 100%; height: auto; max-height: 56px; object-fit: contain; }
.side-title { font-size: 12.5px; color: #8fb0d3; text-align: center; margin: 10px 0 16px; letter-spacing: .2px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--navy-text); font-size: 14.5px;
}
.side-nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.side-nav a.on { background: var(--blue); color: #fff; font-weight: 600; }
.side-nav .ic { width: 19px; height: 19px; }
.side-sec { font-size: 11.5px; color: #7f9cbd; padding: 16px 12px 6px; letter-spacing: .3px; }
.side-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--navy-line);
  padding: 14px 4px 2px;
}
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.who { flex: 1; min-width: 0; line-height: 1.35; }
.who b { display: block; color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: #8fb0d3; }
.side-logout { color: var(--navy-text); padding: 8px; border-radius: 8px; display: grid; }
.side-logout:hover { background: var(--navy-2); color: #fff; }
.content { margin-inline-start: var(--side-w); min-height: 100vh; }
.main { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }
.mobilebar { display: none; }
.side-backdrop { display: none; }

@media (max-width: 900px) {
  .side { transform: translateX(100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-open .side { transform: none; box-shadow: -8px 0 24px rgba(0,0,0,.2); }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,42,71,.45); z-index: 20; }
  .content { margin-inline-start: 0; }
  .mobilebar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 10;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 14px;
  }
  .mobilebar img { height: 34px; }
  .menu-btn { appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px; color: var(--navy); cursor: pointer; display: grid; }
  .menu-btn .ic { width: 22px; height: 22px; }
  .main { padding: 18px 14px 50px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 24px; line-height: 1.3; color: var(--navy); margin: 0; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 16px; color: var(--navy); margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h2 .ic { color: var(--blue); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card.narrow { max-width: 620px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -4px 0 14px; flex-wrap: wrap; }
.card-head .more { font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 0; margin: 0 0 12px; }
.card.danger { border-color: #f5c2c0; }
.card.danger h2, .card.danger h2 .ic { color: var(--err); }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cols > .card, .cols-2 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }
@media (max-width: 1100px) { .cols, .cols-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; color: inherit;
}
a.stat:hover { text-decoration: none; border-color: var(--line-2); }
.stat-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.stat-ic .ic { width: 24px; height: 24px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; color: var(--navy); }
.stat span { color: var(--muted); font-size: 13.5px; }
.tone-ok   .stat-ic { background: var(--ok-bg); color: var(--ok); }
.tone-warn .stat-ic { background: var(--warn-bg); color: var(--warn); }
.tone-info .stat-ic { background: var(--info-bg); color: var(--info); }
.tone-gray .stat-ic { background: var(--gray-bg); color: var(--muted); }
.tone-err  .stat-ic { background: var(--err-bg); color: var(--err); }

/* ---------- Search ---------- */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 6px 6px 8px; padding-inline-start: 16px; margin-bottom: 20px; }
.searchbar .ic { color: var(--muted); width: 20px; height: 20px; }
.searchbar input { border: 0; margin: 0; padding: 9px 4px; box-shadow: none; flex: 1; font-size: 15px; }
.searchbar input:focus { outline: none; box-shadow: none; }
.searchbar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(28,111,192,.15); }

/* ---------- Lists ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list .t { font-weight: 600; color: var(--navy); }
.list .s { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .ic { width: 34px; height: 34px; color: var(--line-2); display: block; margin: 0 auto 8px; }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 14px; font-weight: 600; color: var(--navy); font-size: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px;
  font: inherit; font-weight: normal; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(28,111,192,.15); }
input[type=checkbox] { display: inline-block; width: 17px; height: 17px; margin: 0; margin-inline-end: 8px; vertical-align: -3px; accent-color: var(--blue); }
input[type=file] { padding: 8px; background: #f8fafc; }
textarea { min-height: 80px; }
label.check { font-weight: normal; color: var(--text); display: flex; align-items: center; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.hint { color: var(--muted); font-size: 13.5px; margin: -4px 0 14px; }
.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.filters label { margin: 0; font-size: 13px; }
.filters .btns { display: flex; gap: 6px; }
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters .grow { grid-column: 1 / -1; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--blue); color: #fff;
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 18px; font: inherit; font-weight: 600; font-size: 14.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn-light { background: #fff; color: var(--navy); border-color: var(--line-2); }
.btn-light:hover { background: #f1f5f9; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #a61f1f; }
.btn-small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-small .ic { width: 15px; height: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
form.inline { display: inline; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { background: #f8fafc; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .2px; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap-text { white-space: normal; min-width: 180px; }
td.num { font-variant-numeric: tabular-nums; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-inline-start: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-inline-end: 20px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; direction: ltr; unicode-bidi: isolate; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; border: 1px solid; }
.flash .ic { width: 20px; height: 20px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe5cb; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f5c2c0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-reserved { background: var(--info-bg); color: var(--info); }
.badge-registered { background: var(--warn-bg); color: var(--warn); }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-cancelled { background: var(--gray-bg); color: var(--muted); }
.badge-off { background: var(--err-bg); color: var(--err); }
.count-low { color: var(--err); font-weight: 700; }
.count-mid { color: var(--warn); font-weight: 700; }
.qr-preview { width: 150px; height: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; flex: 0 0 auto; }
.qr-preview svg { width: 100%; height: 100%; display: block; }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 0; font-size: 14px; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; font-weight: 600; color: var(--navy); word-break: break-word; }
.split { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.split > dl { flex: 1; min-width: 240px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px; padding-inline-start: 22px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .s { font-size: 12.5px; color: var(--muted); }

/* ---------- Login ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy) 0%, #12365c 55%, var(--blue) 140%); }
.auth-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 28px 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand img { width: 230px; max-width: 100%; height: auto; }
.auth-brand span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.auth-box h1 { font-size: 20px; justify-content: center; margin-bottom: 18px; }
.auth-box .btn { width: 100%; padding: 11px; margin-top: 4px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 16px; }

@media (max-width: 560px) {
  .stats { gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .stat-ic { width: 38px; height: 38px; border-radius: 10px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 12.5px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
