:root {
  --bg: #f3f1ec;
  --surface: #fffcf8;
  --ink: #1c1915;
  --muted: #6e685f;
  --line: #e3ddd3;
  --side: #1c2430;
  --side-soft: #2a3444;
  --side-text: #e7e2d8;
  --side-dim: #b7b1a6;
  --brass: #8c6b3e;
  --green: #1d7a4a;
  --green-bg: #e7f5ee;
  --red: #b42318;
  --red-bg: #fdeceb;
  --amber: #9a6700;
  --amber-bg: #fbf3df;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  font-family: "IBM Plex Sans Arabic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-brand {
  background: var(--side);
  color: var(--side-text);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand h1 { font-family: "Noto Naskh Arabic", serif; font-size: 48px; font-weight: 700; margin: 12px 0; }
.login-brand p { color: var(--side-dim); line-height: 1.8; max-width: 420px; }
.mark { color: #d7c4a4; letter-spacing: 0.08em; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card h2 { margin: 0 0 6px; font-size: 28px; }
.card .hint { color: var(--muted); margin: 0 0 22px; }
label { display: block; margin-bottom: 14px; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
input, select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  padding: 11px 12px;
}
.btn {
  border: 0;
  background: var(--side);
  color: var(--side-text);
  padding: 11px 16px;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.full { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.shell { min-height: 100vh; }
.topbar {
  background: var(--side);
  color: var(--side-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
}
.brand strong { display: block; font-size: 22px; font-weight: 600; }
.brand span { color: var(--side-dim); font-size: 13px; }
.who { display: flex; align-items: center; gap: 12px; color: var(--side-dim); font-size: 14px; }
.who .btn.ghost { color: var(--side-text); border-color: #3c4656; }
.menubar { background: var(--side); display: flex; gap: 6px; padding: 0 22px; }
.menubar button {
  background: transparent;
  color: var(--side-text);
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
}
.menubar button.on { border-bottom-color: #d7c4a4; color: #fff; }
.subnav {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 8px 22px;
}
.subnav button {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
}
.subnav button.on { color: var(--ink); background: var(--bg); }
.main { padding: 28px 32px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 32px; font-weight: 600; margin-top: 4px; }
.chart { display: flex; align-items: flex-end; gap: 16px; height: 230px; margin-top: 12px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar i { display: block; width: 100%; max-width: 48px; background: #1c2430; }
.bar b { font-size: 14px; margin-bottom: 6px; }
.bar span, .bar small { color: var(--muted); font-size: 13px; }
.bar small { margin-top: 2px; }
.stat span, .muted { color: var(--muted); }
.split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 12px; }
.panel { padding: 16px 18px 8px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.rowline, .event {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: transparent;
  width: 100%;
  text-align: right;
  cursor: pointer;
  border-left: 0; border-right: 0; border-bottom: 0;
}
.tools { display: flex; gap: 8px; margin-bottom: 12px; }
.tools input, .tools select { width: auto; background: var(--surface); }
.tools input { min-width: 240px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: right; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 500; }
th { color: var(--muted); font-size: 13px; font-weight: 500; background: #faf8f4; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #faf8f4; }
.pill { display: inline-block; padding: 2px 8px; font-size: 13px; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.wait { background: var(--amber-bg); color: var(--amber); }
.tabs { display: flex; gap: 6px; margin: 8px 0 16px; }
.tabs button { background: transparent; border: 1px solid transparent; padding: 8px 12px; cursor: pointer; }
.tabs button.on { border-color: var(--line); background: var(--surface); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; padding: 8px 0 16px; }
.kv span { color: var(--muted); }
.back { background: none; border: 0; color: var(--brass); cursor: pointer; padding: 0 0 8px; }
.form-grid { display: grid; gap: 12px; max-width: 560px; }
@media (max-width: 980px) {
  .login, .stats, .split, .grid-2 { grid-template-columns: 1fr; }
  .topbar, .menubar, .subnav { flex-wrap: wrap; }
}
