/* قوّة 2 — خرسانة، خشب البارالتس، وأخضر صنوبري */
:root {
  --bg: #ECEEEA;
  --surface: #F8F9F6;
  --ink: #1C2320;
  --muted: #59635D;
  --line: #D3D8D1;
  --wood: #9A6631;        /* نص وأزرار */
  --wood-soft: #E7D3BA;
  --pine: #2E5B4E;
  --pine-soft: #D5E3DC;
  --danger: #A3261D;
  --radius: 14px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121715; --surface: #1A211E; --ink: #E5E9E4; --muted: #9CA69F; --line: #2B3430;
    --wood: #D39B5E; --wood-soft: #3A2D1F; --pine: #7DB8A3; --pine-soft: #1F3730; --danger: #F08A80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121715; --surface: #1A211E; --ink: #E5E9E4; --muted: #9CA69F; --line: #2B3430;
  --wood: #D39B5E; --wood-soft: #3A2D1F; --pine: #7DB8A3; --pine-soft: #1F3730; --danger: #F08A80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.65 var(--font);
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
}
h1, h2 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 .6em; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--wood); outline-offset: 2px; border-radius: 6px; }
.noscript { padding: 24px; }

/* العلامة: الكلمة فوق عارضة بارالتس */
.mark { font-weight: 700; font-size: 3.4rem; letter-spacing: 0; line-height: 1; }
.mark.sm { font-size: 1.5rem; }
.brand { display: inline-flex; flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 18px; }
.brand .bar { height: 10px; border-radius: 5px; background: var(--wood); position: relative; }
.brand .bar::before, .brand .bar::after {
  content: ""; position: absolute; top: 10px; width: 8px; height: 16px; background: var(--wood); border-radius: 0 0 3px 3px;
}
.brand .bar::before { right: 14%; } .brand .bar::after { left: 14%; }

/* الدخول */
.auth { max-width: 420px; margin: 0 auto; padding: 12vh 16px 32px; }
.lead { color: var(--muted); margin-bottom: 20px; }
.form label { display: block; font-weight: 500; margin-bottom: 14px; }
input, select {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%; margin-top: 6px;
}
input:focus, select:focus { border-color: var(--wood); outline: none; box-shadow: 0 0 0 3px var(--wood-soft); }
.hint { color: var(--muted); font-size: .9rem; }
.err { color: var(--danger); min-height: 1.4em; font-weight: 500; }

/* أزرار */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); width: 100%; padding: 13px; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* الهيكل */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.sync { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .85rem; color: var(--muted);
  background: none; border: 0; cursor: pointer; padding: 6px 4px; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: var(--pine); }
.sync.wait i { background: var(--wood); }
.sync.bad i { background: var(--danger); }
.sync.busy i { background: var(--wood); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.view { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
.pagetitle { margin: 6px 0 16px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; text-decoration: none;
  color: var(--muted); font-size: .75rem; font-weight: 500; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); }
.tabs a.on svg { stroke: var(--wood); stroke-width: 2.2; }

/* بطاقات */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.soon { display: inline-block; margin: 4px 0 0; font-size: .85rem; font-weight: 600; color: var(--pine);
  background: var(--pine-soft); padding: 3px 10px; border-radius: 99px; }

/* اليوم: المراحل على شكل قضبان بارالتس */
.hero { padding: 8px 0 22px; }
.hero .date { color: var(--muted); margin-bottom: 2px; }
.hero h1 { font-size: 2.6rem; margin-bottom: 6px; }
.hero .sub { color: var(--muted); max-width: 34em; }
.rails { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.rail { position: relative; padding-top: 22px; font-size: .8rem; color: var(--muted); }
.rail::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 10px; border-radius: 5px; background: var(--line); }
.rail.past::before { background: var(--pine); }
.rail.now::before { background: var(--wood); }
.rail.now { color: var(--ink); font-weight: 600; }

.empty { padding: 14vh 8px; text-align: center; color: var(--muted); }
.empty h1 { color: var(--ink); }

/* الإعدادات */
.toggles { list-style: none; margin: 8px 0 0; padding: 0; }
.toggles li + li { border-top: 1px solid var(--line); }
.tog { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; cursor: pointer; }
.tog b { display: block; font-weight: 600; }
.tog small { display: block; color: var(--muted); font-size: .85rem; }
.tog input { position: absolute; inset: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tog i { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .2s; }
.tog i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.tog input:checked + i { background: var(--pine); }
.tog input:checked + i::after { transform: translateX(-18px); }
.tog input:disabled + i { opacity: .55; }
.tog input:focus-visible + i { outline: 3px solid var(--wood); outline-offset: 2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row select { width: auto; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { cursor: pointer; position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg span { display: block; padding: 8px 16px; }
.seg input:checked + span { background: var(--ink); color: var(--bg); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--wood); outline-offset: -3px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 6px 0 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

.update { position: fixed; inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; }
.update[hidden] { display: none; }
.update .btn { background: var(--wood); color: #fff; border: 0; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
