:root {
  --bg: #121c19;
  --bg2: #172420;
  --card: #1a2925;
  --line: rgba(232, 213, 163, 0.12);
  --gold: #c9a35a;
  --gold2: #dcc896;
  --text: #ece7dc;
  --muted: #9aa8a2;
  --danger: #d9786c;
  --ok: #74c496;
  --wait: #d4b56a;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Cairo", system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

.app { max-width: 920px; margin: 0 auto; min-height: 100dvh; padding-bottom: 76px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  background: var(--bg);
}
.brand { display: flex; gap: 8px; align-items: center; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  object-fit: cover; display: block; background: #1a3a32;
}
.brand h1 { font-size: 14px; margin: 0; font-weight: 700; }
.brand p { margin: 0; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.bell-btn {
  position: relative; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg2); color: var(--gold2);
}
.bell-btn.on { border-color: var(--gold); }
.bell-ico { font-size: 15px; }
.bell-count {
  position: absolute; top: -5px; left: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}
.bell-panel { margin: 0 14px 8px; max-height: 50dvh; overflow: auto; z-index: 25; position: relative; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #101916;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}
.nav button {
  background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 10px; min-width: 56px;
}
.nav button.active { color: var(--gold2); }
.nav .ico { font-size: 16px; }

.wrap { padding: 4px 14px 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }

.btn {
  background: var(--gold); color: #13251f; border: 0;
  border-radius: 9px; padding: 7px 11px; font-weight: 700; font-size: 13px;
}
.btn.secondary { background: transparent; color: var(--gold2); border: 1px solid var(--gold); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn.wide { width: 100%; }

input, select, textarea {
  width: 100%;
  background: #13201c;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 10px;
  margin: 4px 0 8px;
  font-size: 16px;
  line-height: 1.35;
}
textarea { min-height: 64px; resize: vertical; }
label { font-size: 12px; color: var(--muted); }

.chip {
  display: inline-flex; border-radius: 999px; padding: 1px 7px; font-size: 11px;
  background: rgba(201,163,90,0.14); color: var(--gold2);
}
.chip.wait { background: rgba(212,181,106,0.16); color: var(--wait); }
.chip.ok { background: rgba(116,196,150,0.16); color: var(--ok); }
.chip.bad { background: rgba(217,120,108,0.16); color: var(--danger); }

.table-scroll { overflow-x: auto; }
.day-grid {
  display: grid;
  grid-template-columns: 3.6rem repeat(calc(var(--cols) - 1), minmax(110px, 1fr));
  min-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.day-h, .day-time, .day-cell {
  padding: 6px 6px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 12px;
}
.day-h {
  background: var(--bg2); color: var(--gold2); font-weight: 700; text-align: center; font-size: 12px;
}
.day-time {
  font-weight: 700; color: var(--gold2); direction: ltr; unicode-bidi: isolate;
  text-align: center; background: #15231f;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.day-cell { min-height: 40px; }
.slot-item { margin: 0 0 4px; }
.slot-item:last-child { margin: 0; }
.slot-item b { display: block; font-size: 12px; font-weight: 600; }
.slot-item .muted { display: none; }
.slot-item .chip { display: none; }
.sched-actions { margin-top: 4px; }

.sched-row {
  display: grid; grid-template-columns: 3.6rem minmax(0, 1fr);
  gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line);
}
.sched-row:last-child { border-bottom: 0; }
.sched-time {
  font-weight: 700; font-size: 12px; color: var(--gold2);
  direction: ltr; unicode-bidi: isolate; text-align: center;
  padding: 5px 0; background: #15231f; border-radius: 8px;
}

.list-item { padding: 8px 0; border-bottom: 1px solid var(--line); }

.unread { border-right: 2px solid var(--gold); padding-right: 8px; }
.days .chip-check { font-size: 12px; }
.chip-check { display: inline-flex; gap: 4px; align-items: center; background: #13201c; padding: 5px 8px; border-radius: 999px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; overflow: auto; }
.tabs button {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap; font-size: 12px;
}
.tabs button.on { background: var(--gold); color: #13251f; border-color: var(--gold); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); }
.login .hero { text-align: center; margin-bottom: 12px; }
.login .hero .logo { width: 132px; height: 132px; margin: 0 auto 10px; border-radius: 20px; }
.login h2 { font-size: 18px; margin: 0 0 4px; }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #0c1c18; border: 1px solid var(--gold);
  padding: 8px 14px; border-radius: 999px; z-index: 50; font-size: 13px;
}
.empty { text-align: center; color: var(--muted); padding: 12px 6px; font-size: 13px; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60;
  display: grid; place-items: center; padding: 14px;
}
.modal { width: min(480px, 100%); max-height: 88dvh; overflow: auto; }
.more-link, button.more-link, button.person {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: inherit; font: inherit; text-align: right;
}
.tiny { font-size: 11px; color: var(--muted); margin: 0 0 8px; }
.hub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 0 10px;
}
.hub-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--gold2);
  font-weight: 700;
  font-size: 15px;
  min-height: 92px;
  padding: 16px 10px;
}
.pct { color: var(--gold2); font-size: 18px; }
.prog {
  height: 8px; background: #13201c; border-radius: 99px; overflow: hidden; margin: 6px 0 4px;
}
.prog-bar { height: 100%; background: var(--ok); border-radius: 99px; }
