/* اتجاه «زليج» نفسه الذي في التطبيق: كتل لونية مسطّحة، وزوايا سخية، وخط
   عريض ودود، واللازورد هو اللون الحاكم للأفعال. القيم مأخوذة من
   web/style.css لتكون اللوحة والتطبيق شيئاً واحداً في العين. */
:root {
  --indigo: #3B4CA8;
  --indigo-ink: #FFFFFF;
  --hero-bg: #3B4CA8;
  --hero-ink: #FFFFFF;
  --brass: #C9A227;
  --clay: #C0613C;
  --bg: #F1F4F9;
  --card: #FFFFFF;
  --line: #E2E7F0;
  --soft: #E7EAF8;
  --text: #14171E;
  --muted: #5A6373;
  --warn: #B3261E;
  --shadow: 0 8px 22px rgba(20, 25, 45, .10);
  --shadow-s: 0 3px 12px rgba(20, 25, 45, .06);
  --sans: 'Tajawal', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --indigo: #8E9BF0;
    --indigo-ink: #11142A;
    --hero-bg: #232A52;
    --brass: #A98A2E;
    --clay: #E8936C;
    --bg: #0F1220;
    --card: #181C2B;
    --line: #262C40;
    --soft: #222844;
    --text: #ECEEF6;
    --muted: #99A1B5;
    --warn: #F2B8B5;
    --shadow: 0 8px 22px rgba(0, 0, 0, .40);
    --shadow-s: 0 3px 12px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 14px; line-height: 1.6; min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { font-weight: 800; }
.muted { color: var(--muted); }

/* ───── الدخول ───── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
/* display في القاعدة أعلاه يغلب [hidden]، فلا يختفي اللوح إلا بهذه */
.gate[hidden] { display: none; }
.gate form {
  width: 100%; max-width: 340px; background: var(--card); padding: 26px 22px;
  border-radius: 18px; box-shadow: var(--shadow);
}
.gate small { font-size: 12px; color: var(--clay); font-weight: 700; display: block; }
.gate h1 { margin: 4px 0 22px; font-size: 24px; }
.gate label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.gate input {
  width: 100%; height: 46px; padding: 0 14px; border: 0; border-radius: 13px;
  background: var(--bg); color: inherit; font: inherit; outline: none;
}
.gate input:focus { box-shadow: 0 0 0 2px var(--indigo); }
.go {
  width: 100%; min-height: 50px; margin-top: 22px; border: 0; border-radius: 13px;
  background: var(--indigo); color: var(--indigo-ink); font-size: 15px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(59, 76, 168, .26);
}
.go[disabled] { opacity: .55; cursor: default; box-shadow: none; }
.error { color: var(--warn); margin: 14px 0 0; font-size: 13px; }

/* ───── الرأس ───── */
main { max-width: 820px; margin: 0 auto; padding-bottom: 40px; }
.top {
  display: flex; align-items: flex-start; gap: 16px; justify-content: space-between;
  background: var(--hero-bg); color: var(--hero-ink);
  padding: calc(20px + env(safe-area-inset-top)) 20px 26px;
  border-bottom: 3px solid var(--brass);
}
.top small { font-size: 12px; opacity: .72; display: block; }
.top h1 { margin: 6px 0 4px; font-size: 20px; line-height: 1.35; }
.top p { margin: 0; font-size: 12px; opacity: .78; }
.top .plain { background: rgba(255, 255, 255, .16); color: inherit; box-shadow: none; }

.plain {
  border: 0; border-radius: 11px; background: var(--card); color: inherit;
  padding: 8px 13px; font-size: 13px; font-weight: 500; white-space: nowrap;
  box-shadow: var(--shadow-s);
}
.plain[disabled] { opacity: .4; cursor: default; }

.bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 20px 0; }
.note {
  margin: 16px 20px 0; padding: 12px 14px; border-radius: 13px; font-size: 13px;
  background: var(--soft); color: var(--indigo); font-weight: 500;
}
.note.bad { background: var(--card); color: var(--warn); box-shadow: var(--shadow-s); }

/* ───── قائمة الفقرات ───── */
.list { list-style: none; margin: 16px 0 0; padding: 0 20px; display: grid; gap: 10px; }
.row { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-s); }
.row.live { box-shadow: 0 0 0 2px var(--indigo), var(--shadow-s); }
.row-main { display: flex; gap: 12px; align-items: flex-start; }
.num {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--bg); color: var(--muted);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.row.live .num { background: var(--indigo); color: var(--indigo-ink); }
.row-text { flex: 1; min-width: 0; }
.row-text b { font-weight: 700; display: block; }
.row-text span { font-size: 12px; color: var(--muted); }
.row-when {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; padding-top: 3px;
}
.row.live .row-when { color: var(--indigo); font-weight: 700; }
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 7px;
  background: var(--soft); color: var(--indigo); white-space: nowrap;
}
.acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.acts .plain { background: var(--bg); box-shadow: none; padding: 7px 12px; }
.acts .danger { color: var(--warn); }

/* ───── لوح الاستبدال والبحث ───── */
.panel { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--bg); }
.panel h2 { margin: 0 0 2px; font-size: 14px; }
.panel > p { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input {
  flex: 1; min-width: 0; height: 42px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--card); color: inherit; font: inherit; outline: none;
  box-shadow: var(--shadow-s);
}
.search input:focus { box-shadow: 0 0 0 2px var(--indigo); }
.cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cands li {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 12px; padding: 10px 12px;
}
.cands .t { flex: 1; min-width: 0; }
.cands .t b { font-weight: 700; display: block; }
.cands .t span { font-size: 12px; color: var(--muted); }
.pick {
  border: 0; border-radius: 11px; background: var(--indigo); color: var(--indigo-ink);
  padding: 8px 13px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.more { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.more .plain { background: var(--card); }
.empty { font-size: 12px; color: var(--muted); padding: 6px 0; margin: 0; }

/* ───── سجلّ التعديلات ───── */
.edits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.edits li {
  background: var(--card); border-radius: 12px; padding: 11px 13px; font-size: 13px;
  box-shadow: var(--shadow-s);
}
.edits time { color: var(--muted); font-size: 12px; display: block; }
