/* منصة متابعة الإحصائيات — one stylesheet, no build step.
   Colours from the Public Prosecution identity: teal #00706A and gold #A8864A. */

/* خط ثمانية: Sans للنصوص والحقول، وSerif Display للعناوين مع «الحروف المرسلة» (swsh) */
@font-face { font-family: Thmanyah; src: url(/fonts/thmanyahsans-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Thmanyah; src: url(/fonts/thmanyahsans-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: ThmanyahSerif; src: url(/fonts/thmanyahserifdisplay-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* Speed first: no page-entrance motion, no blur, no endless animations — only short transitions
   on transform/opacity, which the phone's GPU handles without repainting. */

:root {
  color-scheme: light;
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f6f9f8;
  --glass: rgba(255, 255, 255, .72);
  --ink: #0d1f1d;
  --ink-2: #485c59;
  --ink-3: #879895;
  --line: #e2e9e7;
  --brand: #00706a;
  --brand-600: #005a55;
  --brand-700: #003f3b;
  --brand-soft: #e2f2f0;
  --brand-ink: #00625d;
  --gold: #a8864a;
  --gold-soft: #f6efe1;
  --late: #d0423c;
  --late-soft: #fdecea;
  --today: #c27f12;
  --today-soft: #fcf1dc;
  --soon: #0d7d88;
  --soon-soft: #e1f3f5;
  --done: #23935a;
  --done-soft: #e3f5eb;
  --wa: #1fae55;
  --wa-600: #178a43;
  --shadow-sm: 0 1px 2px rgba(13, 31, 29, .06), 0 1px 1px rgba(13, 31, 29, .04);
  --shadow: 0 10px 30px -12px rgba(0, 63, 59, .22), 0 2px 6px rgba(13, 31, 29, .05);
  --shadow-lg: 0 30px 60px -20px rgba(0, 63, 59, .35);
  --r: 18px;
  --r-sm: 12px;
  --side: 268px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #081211;
    --surface: #0f1c1b;
    --surface-2: #142423;
    --glass: rgba(15, 28, 27, .72);
    --ink: #e7f0ee;
    --ink-2: #a5b8b5;
    --ink-3: #6c817e;
    --line: #20322f;
    --brand: #23a99e;
    --brand-600: #1b8f85;
    --brand-soft: rgba(35, 169, 158, .14);
    --brand-ink: #5fd0c5;
    --gold: #d3b073;
    --gold-soft: rgba(211, 176, 115, .13);
    --late: #f06a63;
    --late-soft: rgba(240, 106, 99, .13);
    --today: #eaa43c;
    --today-soft: rgba(234, 164, 60, .14);
    --soon: #4cc3cf;
    --soon-soft: rgba(76, 195, 207, .12);
    --done: #4cc684;
    --done-soft: rgba(76, 198, 132, .13);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081211; --surface: #0f1c1b; --surface-2: #142423; --glass: rgba(15, 28, 27, .72);
  --ink: #e7f0ee; --ink-2: #a5b8b5; --ink-3: #6c817e; --line: #20322f;
  --brand: #23a99e; --brand-600: #1b8f85; --brand-soft: rgba(35, 169, 158, .14); --brand-ink: #5fd0c5;
  --gold: #d3b073; --gold-soft: rgba(211, 176, 115, .13);
  --late: #f06a63; --late-soft: rgba(240, 106, 99, .13); --today: #eaa43c; --today-soft: rgba(234, 164, 60, .14);
  --soon: #4cc3cf; --soon-soft: rgba(76, 195, 207, .12); --done: #4cc684; --done-soft: rgba(76, 198, 132, .13);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3); --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; /* the page does not jump sideways when a scrollbar appears */ }
body {
  margin: 0; min-height: 100dvh; font-family: Thmanyah, "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.7;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; touch-action: manipulation; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; touch-action: manipulation; }
h1, h2, h3, h4 { margin: 0; line-height: 1.45; font-weight: 700; }
h1, .page-head h1, .hero h1, .login-card .title h1, .err-page .code { font-family: ThmanyahSerif, Thmanyah, serif; font-feature-settings: "swsh" 1; }
p { margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }

/* ---------- entrance motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, var(--late)) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(30px, -40px) scale(1.08); } 66% { transform: translate(-25px, 25px) scale(.95); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.rise { /* kept as a hook; pages appear at once */ }

/* ---------- shell: sidebar (desktop) / top bar + bottom nav (phone) ---------- */
.shell { min-height: 100dvh; }
.side {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); z-index: 30; display: flex; flex-direction: column;
  padding: 22px 16px; color: #fff; overflow: hidden;
  background: linear-gradient(165deg, var(--brand-700) 0%, #00534e 55%, #00706a 100%);
}
.side::after { /* palm watermark */
  content: ""; position: absolute; inset-inline-end: -70px; bottom: -40px; width: 300px; height: 300px; opacity: .07;
  background: url(/images/mark.png) center / contain no-repeat; filter: brightness(0) invert(1); pointer-events: none;
}
.side .brand { display: block; padding: 6px 8px 22px; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: 14px; }
.side .brand img { height: 58px; width: auto; }
.side .brand small { display: block; margin-top: 10px; font-size: 13px; color: rgba(255, 255, 255, .78); letter-spacing: .2px; }
.nav { display: grid; gap: 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px;
  color: rgba(255, 255, 255, .8); transition: background .25s, color .25s, transform .25s var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(-3px); }
.nav a.on { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -16px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav .count { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; font-size: 12px; display: grid; place-items: center; background: var(--late); color: #fff; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, .16); position: relative; z-index: 1; }
.side .me b { display: block; font-size: 14px; line-height: 1.3; }
.side .me small { color: rgba(255, 255, 255, .65); font-size: 12px; }
.side .me form { margin-inline-start: auto; }
.side .me button { background: none; border: 0; color: rgba(255, 255, 255, .75); cursor: pointer; padding: 6px; border-radius: 9px; }
.side .me button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.avatar {
  position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: end center; flex: none; overflow: visible;
  background: linear-gradient(150deg, #e3c68c 0%, var(--gold) 55%, #8d6c35 100%); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px -2px rgba(0, 0, 0, .25);
}
.avatar > .ic { width: 74%; height: 74%; margin-bottom: -1px; fill: rgba(255, 255, 255, .95); }
.avatar.alt { background: linear-gradient(150deg, #2fbfb2 0%, var(--brand) 60%, var(--brand-700) 100%); }
.av-badge { position: absolute; bottom: -4px; inset-inline-start: -4px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); border: 2px solid var(--surface); }
.av-badge .ic { width: 10px; height: 10px; fill: #fff; }
.side .av-badge { border-color: #004b46; }

.main { margin-inline-start: var(--side); padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: calc(1180px + var(--side)); }
.topbar { display: none; }
.bottom-nav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(22px, 2.6vw, 28px); }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; margin-bottom: 8px; }
.crumb:hover { color: var(--brand-ink); }

@media (max-width: 900px) {
  .side { display: none; }
  .main { margin: 0; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .topbar .mark { width: 36px; height: 36px; border-radius: 10px; }
  .topbar .t { line-height: 1.25; }
  .topbar .t b { display: block; font-size: 15px; }
  .topbar .t small { color: var(--ink-3); font-size: 12px; }
  .topbar .avatar { margin-inline-start: auto; width: 36px; height: 36px; }
  .bottom-nav {
    position: fixed; z-index: 40; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); display: grid;
    grid-template-columns: repeat(var(--n, 4), 1fr); padding: 6px; border-radius: 22px; background: var(--surface);
    border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  }
  .bottom-nav a { position: relative; display: grid; justify-items: center; gap: 1px; padding: 7px 2px 5px; border-radius: 16px; font-size: 11px; color: var(--ink-3); }
  .bottom-nav a .ic { width: 23px; height: 23px; transition: transform .15s; }
  .bottom-nav a.on { color: var(--brand-ink); background: var(--brand-soft); }
  .bottom-nav a:active .ic { transform: scale(.88); }
  .bottom-nav .count { position: absolute; top: 3px; inset-inline-end: calc(50% - 22px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--late); color: #fff; font-size: 10px; display: grid; place-items: center; }
  .page-head { margin-bottom: 16px; }
}

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 9px; }
.card-head h2 .ic { color: var(--brand-ink); }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--surface); --f: var(--ink); position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 13px; border: 1px solid var(--line); background: var(--b); color: var(--f); font-weight: 700; font-size: 14.5px;
  cursor: pointer; white-space: nowrap; user-select: none; transition: transform .12s, opacity .2s;
}
@media (hover: hover) { .btn:hover { filter: brightness(1.04); } }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { --b: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 100%); --f: #fff; border-color: transparent; background: var(--b); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-gold { background: linear-gradient(135deg, #b8955a, var(--gold)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--gold) 80%, transparent); }
.btn-wa { background: linear-gradient(135deg, #25d366, var(--wa-600)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(31, 174, 85, .7); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-danger { color: var(--late); }
.btn-danger:hover { background: var(--late-soft); border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn-sm.btn-icon { width: 36px; min-height: 36px; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-wa):not(.btn-gold).loading::after { border-color: var(--line); border-top-color: var(--brand); }
.link { color: var(--brand-ink); font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
.link:disabled { color: var(--ink-3); cursor: default; text-decoration: none; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip .ic { width: 14px; height: 14px; }
.badge { --c: var(--brand); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.badge.late { --c: var(--late); }
.badge.today { --c: var(--today); }
.badge.soon { --c: var(--soon); }
.badge.later { --c: var(--ink-3); }
.badge.done { --c: var(--done); }
.badge.gold { --c: var(--gold); }

/* ---------- hero & KPIs ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 26px 26px 22px; color: #fff; margin-bottom: 18px;
  background: linear-gradient(130deg, var(--brand-700) 0%, #00605a 45%, #0a8a80 100%); box-shadow: var(--shadow-lg);
}
.hero::before { /* static glow (a gradient, not a blurred element: no repaint cost) */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(260px 200px at 0% 0%, rgba(201, 163, 94, .35), transparent 70%), radial-gradient(240px 180px at 70% 120%, rgba(47, 209, 193, .28), transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero .hi { font-size: 14px; color: rgba(255, 255, 255, .8); display: flex; align-items: center; gap: 8px; }
.hero h1 { font-size: clamp(22px, 3vw, 30px); margin: 4px 0 2px; }
.hero .date { color: rgba(255, 255, 255, .85); font-size: 14px; }
.hero .date b { color: #f0d9a8; font-weight: 700; }
.hero .palm { position: absolute; inset-inline-end: 18px; top: 50%; width: 150px; transform: translateY(-50%) rotate(-8deg); opacity: .12; filter: brightness(0) invert(1); pointer-events: none; z-index: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }
.kpi {
  --c: #fff; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; color: #fff;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
}
.kpi:active { background: rgba(255, 255, 255, .16); }
.kpi .ring {
  --p: 0; width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .16) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.kpi .ring-wrap { position: relative; width: 46px; height: 46px; flex: none; }
.kpi .ring-wrap .ic { position: absolute; inset: 0; margin: auto; width: 19px; height: 19px; color: var(--c); }
.kpi b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi small { color: rgba(255, 255, 255, .78); font-size: 12.5px; }
.kpi.late { --c: #ff9a93; } .kpi.today { --c: #ffd27a; } .kpi.soon { --c: #8ff0e6; } .kpi.total { --c: #f0d9a8; }
@media (max-width: 900px) {
  .hero { padding: 20px 18px 16px; border-radius: 22px; }
  .hero .palm { width: 110px; top: 30px; transform: rotate(-8deg); }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 16px; }
  .kpi { padding: 10px; gap: 10px; }
  .kpi b { font-size: 21px; }
}

/* ---------- due groups & cards ---------- */
.group { margin-top: 22px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.group-head h2 { font-size: 17px; }
.group-head .n { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--c, var(--brand)); }
.group-head .line { flex: 1; height: 1px; background: linear-gradient(to left, var(--line), transparent); }
.group.late { --c: var(--late); } .group.today { --c: var(--today); } .group.soon { --c: var(--soon); } .group.later { --c: var(--ink-3); }
.due-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }

.due {
  --c: var(--brand); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.due::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--c); }
@media (hover: hover) { .due:hover { border-color: color-mix(in srgb, var(--c) 35%, var(--line)); } }
.due.late { --c: var(--late); } .due.today { --c: var(--today); } .due.soon { --c: var(--soon); } .due.later { --c: var(--ink-3); }
.due-top { display: flex; align-items: flex-start; gap: 12px; }
.due-when {
  flex: none; width: 58px; padding: 6px 0 5px; border-radius: 14px; text-align: center; line-height: 1.15;
  background: color-mix(in srgb, var(--c) 11%, transparent); color: var(--c);
}
.due-when b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.due-when small { font-size: 11.5px; font-weight: 700; }
.due-title { min-width: 0; flex: 1; }
.due-title a { font-weight: 700; font-size: 16px; line-height: 1.45; display: block; }
.due-title a:hover { color: var(--brand-ink); }
.due-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.due-info { display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); }
.due-info div { display: flex; align-items: center; gap: 7px; min-width: 0; }
.due-info .ic { width: 15px; height: 15px; color: var(--ink-3); }
.due-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.due-foot .note { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.due-foot .note .ic { width: 14px; height: 14px; }
.due-foot .note.sent { flex-basis: 100%; padding: 6px 10px; border-radius: 10px; background: var(--late-soft); color: var(--late); font-weight: 700; }
.due-foot .btns { margin-inline-start: auto; display: flex; gap: 6px; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 38px 20px; color: var(--ink-2); }
.empty .art { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center; background: var(--done-soft); color: var(--done); }
.empty .art .ic { width: 38px; height: 38px; }
.empty h3 { color: var(--ink); font-size: 18px; margin-bottom: 4px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; min-width: 0; /* a grid item may otherwise grow wider than the phone screen */ }
.form-grid > *, .grid > *, .grid-2 > *, .stack > *, .list > *, .office > *, .due > *, .sheet-body > * { min-width: 0; }
.grow, .who, .due-title, .tl-body, .kv dd { overflow-wrap: anywhere; } /* long emails and names wrap instead of widening the page */
/* iOS Safari gives date/time inputs their own minimum width and ignores width:100% */
input[type="date"].input, input[type="time"].input { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: right; }
input[type="date"].input::-webkit-date-and-time-value, input[type="time"].input::-webkit-date-and-time-value { text-align: right; }
.field > label, .label { font-weight: 700; font-size: 14px; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; max-width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface);
  outline: none; transition: border-color .15s; font-size: 16px; /* 16px: iOS does not zoom */
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.8; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.input::placeholder { color: var(--ink-3); }
.field.err .input, .input.err { border-color: var(--late); }
.ferr { color: var(--late); font-size: 13px; font-weight: 700; animation: fade .3s; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2387989a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 40px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.phone-wrap { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--surface); transition: border-color .2s, box-shadow .2s; direction: ltr; }
.phone-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.phone-wrap span { display: grid; place-items: center; padding: 0 14px; background: var(--surface-2); color: var(--ink-2); font-weight: 700; border-right: 1.5px solid var(--line); }
.phone-wrap input { flex: 1; border: 0; outline: 0; background: transparent; padding: 12px 14px; font-size: 18px; letter-spacing: 1px; min-width: 0; }

/* segmented choice (frequency) */
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.seg label { position: relative; cursor: pointer; }
.seg input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; } /* not the «يوم آخر» number field */
.seg span {
  display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: 14px; text-align: center; min-width: 0;
}
.seg span .ic { width: 22px; height: 22px; color: var(--ink-3); }
.seg span small { font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.seg input:checked + span .ic { color: var(--brand-ink); }
.seg span .input { width: 100%; min-width: 0; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg.days { grid-template-columns: repeat(7, 1fr); gap: 6px; }
.seg.days span { padding: 10px 2px; font-size: 13px; }
.seg.months { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.seg.months span { padding: 8px 2px; font-size: 12.5px; }
@media (max-width: 520px) { .seg.days { grid-template-columns: repeat(4, 1fr); } .seg.months { grid-template-columns: repeat(4, 1fr); } }
.reveal > div { min-width: 0; }
.reveal.closed { display: none; }

/* switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--line); transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch .txt b { display: block; font-size: 14.5px; }
.switch .txt small { color: var(--ink-3); font-size: 12.5px; }
.checks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.check { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; transition: all .2s; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* preview of next due dates in the form */
.preview { display: flex; flex-wrap: wrap; gap: 8px; }
.preview .pd { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.preview .pd b { display: block; font-size: 14px; color: var(--brand-ink); }

/* ---------- tables / lists ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
@media (hover: hover) { a.list-item:hover { background: var(--surface-2); } }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; }
.list-item .grow small { color: var(--ink-3); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 700; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

.timeline { position: relative; display: grid; gap: 0; }
.tl { position: relative; display: flex; gap: 14px; padding: 10px 0; }
.tl::before { content: ""; position: absolute; inset-inline-start: 15px; top: 40px; bottom: -10px; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .tl-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand-ink)); z-index: 1; }
.tl .tl-ic .ic { width: 16px; height: 16px; }
.tl.done { --c: var(--done); --c-soft: var(--done-soft); }
.tl.skip { --c: var(--ink-3); --c-soft: var(--surface-2); }
.tl.wa { --c: var(--wa); --c-soft: color-mix(in srgb, var(--wa) 12%, transparent); }
.tl .tl-body { flex: 1; min-width: 0; font-size: 14px; }
.tl .tl-body small { color: var(--ink-3); display: block; }

/* office cards */
.office { position: relative; padding: 18px; display: grid; gap: 14px; }
.office.off { opacity: .6; }
.office h3 { font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.person .avatar { width: 40px; height: 40px; font-size: 13px; }
.person.alt .avatar { background: linear-gradient(135deg, var(--brand), #0aa093); }
.person .who { flex: 1; min-width: 0; line-height: 1.35; }
.person .who small { display: block; color: var(--ink-3); font-size: 12px; }
.person .who b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who .ltr { font-size: 13px; color: var(--ink-2); }

/* ---------- modal / bottom sheet ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal .scrim { position: absolute; inset: 0; background: rgba(4, 18, 17, .55); animation: fade .15s; }
.modal .sheet {
  position: relative; width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); animation: sheetIn .2s ease-out;
}
.modal.wide .sheet { width: min(720px, 100%); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 18px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head h3 { font-size: 17px; flex: 1; }
.sheet-body { padding: 20px; display: grid; gap: 16px; }
.sheet-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
@media (max-width: 640px) {
  .modal { place-items: end stretch; padding: 0; }
  .modal .sheet { width: 100%; max-height: 92dvh; border-radius: 26px 26px 0 0; animation: sheetUp .22s ease-out; }
  .modal .sheet::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 9px auto -4px; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
}

/* WhatsApp sheet */
.wa-msg { white-space: pre-wrap; padding: 14px 16px; border-radius: 16px 16px 4px 16px; background: #dcf8c6; color: #111b21; font-size: 14.5px; line-height: 1.9; position: relative; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .wa-msg { background: #005c4b; color: #e9edef; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-msg { background: #005c4b; color: #e9edef; } }
.wa-bg { padding: 16px; border-radius: 18px; background: #efeae2 radial-gradient(rgba(0, 0, 0, .04) 1px, transparent 1px) 0 0 / 14px 14px; }
:root[data-theme="dark"] .wa-bg { background-color: #0b141a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-bg { background-color: #0b141a; } }
.pick { display: grid; gap: 10px; }
.pick label { cursor: pointer; }
.pick input { position: absolute; opacity: 0; }
.pick .person { border: 1.5px solid transparent; }
.pick input:checked + .person { border-color: var(--wa); background: color-mix(in srgb, var(--wa) 10%, var(--surface)); }
.pick .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; transition: all .25s var(--spring); }
.pick .tick .ic { width: 14px; height: 14px; stroke-width: 3; transform: scale(0); transition: transform .3s var(--spring); }
.pick input:checked + .person .tick { background: var(--wa); border-color: var(--wa); }
.pick input:checked + .person .tick .ic { transform: scale(1); }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 100; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 28px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 16px; background: #0f2624; color: #fff; box-shadow: var(--shadow-lg); font-weight: 700; font-size: 14.5px; pointer-events: auto; animation: toastIn .25s ease-out both; }
.toast .ic { color: #6ee7d8; }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) scale(.96); } }
#confetti { position: fixed; inset: 0; z-index: 99; pointer-events: none; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .search { position: relative; flex: 1 1 220px; }
.filters .search .ic { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; }
.filters .search .input { padding-inline-start: 40px; }
.filters select.input { flex: 1 1 150px; width: auto; min-width: 0; }
.tabs { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.tabs a { padding: 7px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); transition: all .25s; }
.tabs a.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

/* ---------- install banner ---------- */
/* floats above the bottom bar instead of pushing the page down after it has loaded */
.install { position: fixed; z-index: 45; inset-inline: 10px; bottom: calc(88px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow-lg); animation: fade .2s; }
@media (min-width: 901px) { .install { left: 24px; right: auto; bottom: 24px; width: 380px; } }
.install img { width: 42px; height: 42px; border-radius: 11px; }
.install .t { flex: 1; font-size: 13.5px; line-height: 1.5; }
.install .t b { display: block; font-size: 14.5px; }

/* ---------- login ---------- */
.login {
  position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); overflow: hidden;
  background: linear-gradient(150deg, #002b28 0%, var(--brand-700) 35%, #00635d 70%, #0a8a80 100%);
}
.login .orb { position: absolute; border-radius: 50%; pointer-events: none; }
.login .o1 { width: 520px; height: 520px; background: radial-gradient(closest-side, rgba(201, 163, 94, .35), transparent); top: -200px; right: -180px; }
.login .o2 { width: 480px; height: 480px; background: radial-gradient(closest-side, rgba(34, 200, 184, .3), transparent); bottom: -220px; left: -160px; }
.login .o3 { display: none; }
.login .grid-bg { position: absolute; inset: 0; opacity: .12; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .25) 1px, transparent 1px); background-size: 46px 46px; -webkit-mask: radial-gradient(ellipse at center, #000 10%, transparent 70%); mask: radial-gradient(ellipse at center, #000 10%, transparent 70%); }
.login .palm-bg { position: absolute; width: min(70vw, 620px); opacity: .05; filter: brightness(0) invert(1); pointer-events: none; }
.login-wrap { position: relative; width: min(430px, 100%); }
.login-card {
  position: relative; width: 100%; padding: 30px 22px 24px; border-radius: 28px; color: var(--ink);
  background: var(--surface); border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55);
}
.login-card .logo { height: 66px; width: auto; margin: 0 auto 6px; }
.login-card .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login-card .logo { display: none; } :root:not([data-theme="light"]) .login-card .logo-dark { display: block; } }
.login-card .title { text-align: center; margin: 14px 0 20px; }
.login-card .title h1 { font-size: 21px; }
.login-card .title p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.steps-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.steps-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); }
.steps-dots i.on { width: 26px; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.step { display: grid; gap: 16px; min-width: 0; }
.step h2 { font-size: 18px; text-align: center; }
.step .sub { text-align: center; color: var(--ink-2); font-size: 14px; margin-top: -10px; }
.sent-to { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; text-align: center; }
.sent-to.warn { background: var(--today-soft); color: var(--today); }
.login-hint { text-align: center; font-size: 13.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.login-foot { position: relative; margin-top: 18px; text-align: center; color: rgba(255, 255, 255, .7); font-size: 12.5px; }
.method { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 10px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; }
.method:hover, .method:active { border-color: var(--brand); }
.method.last { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.method .m-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.method .m-t { flex: 1; min-width: 0; line-height: 1.4; }
.method .m-t b { display: block; font-size: 15px; }
.method .m-t small { color: var(--ink-3); font-size: 12.5px; }
.method .m-last { display: none; position: absolute; top: -9px; inset-inline-end: 12px; padding: 0 8px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #fff; background: var(--gold); }
.method.last .m-last { display: block; }
.big-ic { width: 76px; height: 76px; margin: 4px auto; border-radius: 24px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); position: relative; }
.big-ic .ic { width: 36px; height: 36px; }
/* OTP boxes: they share the width they are given (fixed 48px boxes overflowed the card on phones) */
.otp { display: flex; justify-content: center; gap: 6px; direction: ltr; width: 100%; }
.otp input {
  flex: 1 1 0; min-width: 0; max-width: 52px; height: 56px; padding: 0; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface); text-align: center;
  font-size: 22px; font-weight: 700; outline: none; caret-color: var(--brand); font-variant-numeric: tabular-nums;
}
.otp input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.otp input.filled { border-color: var(--brand); background: var(--brand-soft); }
.otp.err input { border-color: var(--late); animation: shake .4s; }
.qr { display: grid; place-items: center; padding: 14px; border-radius: 16px; background: #fff; width: max-content; max-width: 100%; margin: 0 auto; }
.qr svg { width: 180px; height: 180px; max-width: 100%; }
.secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; direction: ltr; text-align: center; padding: 10px; border-radius: 12px; background: var(--surface-2); font-size: 14px; word-break: break-all; user-select: all; }

.placeholders { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholders button { cursor: pointer; }
.placeholders button:hover { border-color: var(--brand); color: var(--brand-ink); }

/* error pages */
.err-page { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.err-page .code { font-size: 90px; font-weight: 700; line-height: 1; background: linear-gradient(135deg, var(--brand), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print { .side, .topbar, .bottom-nav, .btn { display: none !important; } .main { margin: 0; } }
