/* واجهة التطبيق — تتبع ثيم تليجرام تلقائياً (فاتح/داكن) */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f3f6);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #13161b);
  --muted: var(--tg-theme-hint-color, #6b7380);
  --accent: var(--tg-theme-button-color, #2f6fd6);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --line: color-mix(in srgb, var(--text) 10%, transparent);
  --track: color-mix(in srgb, var(--text) 12%, transparent);
  --soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --press: color-mix(in srgb, var(--text) 6%, transparent);
  --review: #a86a00;
  --ok: #1d8a52;
  --bad: #c4321f;
  --unknown: var(--muted);
  --radius: 16px;
  --radius-sm: 12px;
  --gutter: 16px;
  --shadow: 0 1px 2px color-mix(in srgb, #000 6%, transparent), 0 4px 16px color-mix(in srgb, #000 4%, transparent);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --bottom: env(safe-area-inset-bottom, 0px);
}
:root[data-scheme="dark"] { --review: #e5a94a; --ok: #55c78a; --bad: #f38a7e; --shadow: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) { --review: #e5a94a; --ok: #55c78a; --bad: #f38a7e; --shadow: none; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.65 "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { max-width: 600px; margin-inline: auto; min-height: 100vh; display: flex; flex-direction: column; }
.wrap.has-tabs { padding-bottom: calc(68px + var(--bottom)); }
.wrap.has-dock { padding-bottom: calc(96px + var(--bottom)); }

/* ---------- الترويسة ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 8px var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.bar-title { flex: 1; min-width: 0; }
.bar-title h1 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  appearance: none; display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--accent); cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s var(--ease), background .15s;
}
.icon-btn:active { transform: scale(.92); background: var(--soft); }
.progress { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: var(--track); }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; transition: width .35s var(--ease); margin-inline-start: 0; }

main { flex: 1; padding: 6px var(--gutter) 12px; }
main.enter-fwd { animation: inFwd .28s var(--ease) both; }
main.enter-back { animation: inBack .28s var(--ease) both; }
main.enter-fade { animation: fade .22s ease both; }
@keyframes inFwd { from { opacity: 0; transform: translateX(-22px); } }
@keyframes inBack { from { opacity: 0; transform: translateX(22px); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- بطاقات وقوائم ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; margin-bottom: 12px; }
.card h2, .section-label { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--muted); }
.section-label { display: block; margin: 18px 4px 8px; }
.stack { display: grid; gap: 10px; }
.list { overflow: hidden; }
.tap { appearance: none; border: 0; cursor: pointer; text-align: start; transition: transform .16s var(--ease), background .16s; }
.tap:active { transform: scale(.985); }
.row {
  display: block; width: 100%; padding: 14px 16px; background: none; color: inherit;
  border-bottom: 1px solid var(--line);
}
.list .row:last-child { border-bottom: 0; }
.list .row.tap:active { background: var(--press); transform: none; }
.card.row { border-bottom: 0; padding: 16px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.name { font-size: 15.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.chev { width: 18px; height: 18px; color: var(--muted); opacity: .7; }
.row-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.after-list { margin-top: 14px; }

/* ---------- الحالة ---------- */
.s-review { --st: var(--review); } .s-accepted, .s-delivery, .s-collect { --st: var(--ok); }
.s-rejected, .s-handed { --st: var(--bad); }  .s-unknown { --st: var(--unknown); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--st);
  background: color-mix(in srgb, var(--st) 13%, transparent);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tracker { margin-top: 14px; }
.segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.seg { height: 5px; border-radius: 3px; background: var(--track); }
.seg.on { background: var(--accent); }
.seg.on.final { background: var(--st); }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.labels span.now { color: var(--text); font-weight: 500; }

/* ---------- صفحة الملف ---------- */
.hero-file { padding: 18px 16px; margin-bottom: 12px; }
.big-name { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.big-status { margin: 12px 0 0; font-size: 24px; font-weight: 600; color: var(--st); line-height: 1.3; }
.quote {
  margin: 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.7;
  background: var(--press); border-radius: var(--radius-sm);
  unicode-bidi: plaintext; text-align: start; overflow-wrap: anywhere; white-space: pre-line;
}
dl { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; padding-bottom: 0; } .kv:first-child { padding-top: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: end; }
.code { direction: ltr; unicode-bidi: isolate; letter-spacing: .03em; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { position: relative; padding-inline-start: 22px; padding-bottom: 16px; }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ""; position: absolute; inset-inline-start: 3.5px; top: 10px; bottom: -4px; width: 1.5px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl::after { content: ""; position: absolute; inset-inline-start: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--muted); }
.tl.latest::after { background: var(--st); border-color: var(--st); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 18%, transparent); }
.tl-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.tl-head b { font-weight: 600; color: var(--st); }
.tl-head time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tl .quote { margin-top: 6px; font-size: 12.5px; }

/* ---------- أزرار وتنبيهات ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-sm); padding: 11px 20px; cursor: pointer; min-height: 46px;
  background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600;
  transition: transform .16s var(--ease), opacity .2s, filter .2s;
}
.btn:active { transform: scale(.975); filter: brightness(.95); }
.btn.ghost { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.btn.wide { display: flex; width: 100%; }
.support-btn { margin-top: 12px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-row.stack-sm { margin-top: 16px; }
.btn-row.stack-sm .btn { flex: 1; }
.notice {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; padding: 12px 14px;
  font-size: 13.5px; line-height: 1.7; border-radius: var(--radius-sm);
  --nc: var(--accent); color: var(--text);
  background: color-mix(in srgb, var(--nc) 10%, var(--surface));
  white-space: pre-line; overflow-wrap: anywhere;
}
.notice > .ic { color: var(--nc); margin-top: 2px; }
.notice > span { flex: 1; min-width: 0; }
.notice.ok { --nc: var(--ok); }
.notice.warn { --nc: var(--review); }
.notice.big { font-size: 14.5px; padding: 14px 16px; }

.state { text-align: center; padding: 48px 20px; color: var(--muted); }
.state-ic { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; background: var(--soft); color: var(--accent); }
.state-ic .ic { width: 30px; height: 30px; }
.state h2 { margin: 0 0 6px; color: var(--text); font-size: 18px; font-weight: 600; }
.state p { margin: 0 auto 22px; max-width: 34ch; font-size: 14px; white-space: pre-line; }
.channels { display: grid; gap: 8px; max-width: 320px; margin: 0 auto 16px; }
.channels .btn { width: 100%; }

/* ---------- الشريط السفلي ---------- */
.tabs, .dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 6;
  max-width: 600px; margin-inline: auto;
  padding: 8px var(--gutter) calc(8px + var(--bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding-top: 6px; padding-bottom: calc(6px + var(--bottom)); }
.tab {
  appearance: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  color: var(--muted); font-size: 11.5px; font-weight: 500; transition: color .2s, background .2s;
}
.tab .ic { width: 23px; height: 23px; transition: transform .2s var(--ease); }
.tab.on { color: var(--accent); }
.tab.on .ic { transform: translateY(-1px) scale(1.06); }
.tab:active { background: var(--press); }
.dock { animation: dockIn .3s var(--ease) both; }
@keyframes dockIn { from { transform: translateY(100%); } }
.dock-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.dock-note.bad { color: var(--bad); }

/* ---------- نموذج الإضافة ---------- */
.form { display: grid; gap: 0; }
.fields { display: grid; gap: 14px; }
.fields h2 { margin-bottom: -4px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13.5px; font-weight: 500; }
.field input, .field select {
  appearance: none; width: 100%; min-height: 48px; padding: 11px 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.field select {
  padding-inline-end: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: left 16px center, left 21px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.field select:disabled { opacity: .6; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--bad); }
.field input.code { text-align: left; text-transform: uppercase; }
/* ---------- منتقي التاريخ ---------- */
.date-btn {
  appearance: none; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 11px 14px;
  font: inherit; font-size: 16px; color: var(--text); text-align: start; cursor: pointer;
  background: var(--bg); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.date-btn .ic { color: var(--accent); }
.date-btn.empty .date-text { color: var(--muted); }
.date-btn:active { transform: scale(.985); }
.date-btn:focus-visible { outline: none; border-color: var(--accent); background: var(--surface); }
.date-btn[aria-invalid="true"] { border-color: var(--bad); }
.date-text { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
body.no-scroll { overflow: hidden; }

.ds-backdrop {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: color-mix(in srgb, #000 40%, transparent); animation: dsFade .2s ease both;
}
.ds-backdrop.out { animation: dsFade .2s ease reverse both; }
.ds-backdrop.out .ds-sheet { animation: dsPop .18s var(--ease) reverse both; }
.ds-sheet {
  width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 14px var(--gutter) 18px;
  background: var(--surface); border-radius: 22px; animation: dsPop .24s var(--ease) both;
  box-shadow: 0 12px 40px color-mix(in srgb, #000 25%, transparent);
}
@keyframes dsFade { from { opacity: 0; } }
@keyframes dsPop { from { opacity: 0; transform: scale(.92); } }
.ds-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 17px; }
.ds-close { appearance: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--bg); color: var(--muted); cursor: pointer; }
.ds-crumbs { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; margin-bottom: 14px; }
.ds-chip {
  appearance: none; min-height: 40px; padding: 6px 8px; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  background: var(--bg); font-size: 14.5px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s;
}
.ds-chip.on { border-color: var(--accent); background: var(--soft); color: var(--accent); }
.ds-chip:disabled { color: var(--muted); cursor: default; }
.ds-body.swap { animation: dsSwap .22s var(--ease) both; }
@keyframes dsSwap { from { opacity: 0; transform: translateY(6px); } }
.ds-decades { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 4px; scrollbar-width: none; direction: ltr; }
.ds-decades::-webkit-scrollbar { display: none; }
.ds-dec {
  appearance: none; flex: none; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--bg);
  font-size: 14px; cursor: pointer; transition: background .15s, color .15s;
}
.ds-dec.on { background: var(--accent); color: var(--on-accent); }
.ds-q { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.ds-grid { display: grid; gap: 8px; }
.ds-grid.y { grid-template-columns: repeat(5, 1fr); direction: ltr; }
.ds-grid.m { grid-template-columns: repeat(3, 1fr); }
.ds-grid.d { grid-template-columns: repeat(7, 1fr); gap: 6px; direction: ltr; }
.ds-cell {
  appearance: none; display: grid; place-items: center; gap: 0; min-height: 48px; padding: 6px 2px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm); background: var(--bg);
  font-size: 16px; font-weight: 500; cursor: pointer; transition: transform .12s var(--ease), background .15s;
}
.ds-grid.m .ds-cell { min-height: 58px; }
.ds-grid.d .ds-cell { min-height: 44px; font-size: 15px; }
.ds-cell small { font-size: 11.5px; font-weight: 400; color: var(--muted); line-height: 1.3; }
.ds-cell:active { transform: scale(.94); }
.ds-cell.now { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ds-cell.sel { background: var(--accent); color: var(--on-accent); }
.ds-cell.sel small { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
.ds-cell:disabled { opacity: .3; cursor: default; transform: none; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.55; }
.form-error { margin: 0 4px 8px; font-size: 13.5px; color: var(--bad); }
.form-error:empty { display: none; }

.skel { padding: 16px; border-bottom: 1px solid var(--line); }
.skel:last-child { border-bottom: 0; }
.skel i { display: block; height: 12px; border-radius: 6px; background: var(--track); margin-bottom: 10px; animation: pulse 1.4s ease-in-out infinite; }
.skel i:nth-child(1) { width: 40%; height: 16px; } .skel i:nth-child(2) { width: 25%; } .skel i:nth-child(3) { width: 100%; height: 5px; margin-top: 18px; }
@keyframes pulse { 50% { opacity: .45; } }
footer { padding: 14px var(--gutter) 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* ============================================================ الأوراق المطلوبة */
.hero {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 16px; margin-top: 4px;
  border-radius: var(--radius); color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface));
  box-shadow: var(--shadow);
}
.hero-ic { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--accent); color: var(--on-accent); }
.hero-ic .ic { width: 24px; height: 24px; }
.lead { margin: 0 0 4px; font-size: 15px; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.hero .lead { margin: 0; }
main > .lead { margin: 4px 4px 14px; color: var(--text); }

.choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; color: inherit; }
.home-choices { margin-top: 14px; }
.home-choices .emo { width: 52px; height: 52px; font-size: 26px; border-radius: 15px; }
.choice.soft { margin-top: 10px; background: var(--soft); box-shadow: none; }
.choice.off { opacity: .55; box-shadow: none; }
.emo {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 13px;
  background: var(--bg); font-size: 22px; line-height: 1;
}
.emo.ic-wrap { color: var(--accent); background: var(--surface); }
.emo.sm { width: 36px; height: 36px; font-size: 18px; border-radius: 11px; }
.choice-text { display: grid; flex: 1; min-width: 0; }
.choice-text b { font-weight: 600; font-size: 15.5px; }
.choice-text small { color: var(--muted); font-size: 12.5px; line-height: 1.5; white-space: pre-line; }
.visa-row { display: flex; align-items: center; gap: 12px; }
.visa-row .name { flex: 1; font-weight: 500; white-space: normal; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 99px; font-weight: 500; }
.chip.yes { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.chip.cond { color: var(--review); background: color-mix(in srgb, var(--review) 13%, transparent); }
.chip.no { color: var(--muted); background: var(--press); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.q-title { margin: 4px 0 0; font-size: 20px; font-weight: 600; line-height: 1.5; color: var(--text); white-space: pre-line; }
.q { margin: 10px 4px 16px; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 16px; color: inherit; border: 1.5px solid transparent; }
.option-text { flex: 1; font-size: 15px; font-weight: 500; line-height: 1.55; }
.radio { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--track); transition: all .18s var(--ease); }
.radio .ic { width: 14px; height: 14px; stroke-width: 3; color: var(--on-accent); opacity: 0; transform: scale(.4); transition: all .18s var(--ease); }
.option.picked { border-color: var(--accent); background: var(--soft); }
.option.picked .radio { background: var(--accent); border-color: var(--accent); }
.option.picked .radio .ic { opacity: 1; transform: none; }
.options.locked .option:not(.picked) { opacity: .5; transition: opacity .2s; }

.answered { display: grid; gap: 2px; margin: 8px 4px 14px; }
.answered small { color: var(--muted); font-size: 12.5px; }
.answered b { font-weight: 600; font-size: 15.5px; }

.step-head { margin: 10px 4px 4px; }
.list-head { display: flex; align-items: center; justify-content: space-between; }
.list-head .section-label { margin-inline-end: 0; }
.count { margin: 18px 4px 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 1px 10px; border-radius: 99px; background: var(--press); transition: all .2s; }
.count.full { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.checklist { margin-bottom: 12px; }
.check-row {
  appearance: none; display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px 16px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; cursor: pointer; color: inherit;
  transition: background .15s;
}
.check-row:last-child { border-bottom: 0; }
.check-row:active { background: var(--press); }
.box { display: grid; place-items: center; width: 24px; height: 24px; flex: none; margin-top: 1px; border-radius: 8px; border: 2px solid var(--track); transition: all .2s var(--ease); }
.box .ic { width: 15px; height: 15px; stroke-width: 3; color: #fff; opacity: 0; transform: scale(.3) rotate(-20deg); transition: all .2s var(--ease); }
.check-row.on .box { background: var(--ok); border-color: var(--ok); }
.check-row.on .box .ic { opacity: 1; transform: none; }
.check-text { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; transition: color .2s; }
.check-row.on .check-text { color: var(--muted); }

.tips { padding: 14px 16px; margin-bottom: 12px; background: color-mix(in srgb, var(--review) 8%, var(--surface)); }
.tips h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; }
.tip { display: flex; gap: 10px; margin: 0; padding: 6px 0; font-size: 14px; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.tip .ic { color: var(--review); margin-top: 3px; width: 18px; height: 18px; }
.tip span { flex: 1; min-width: 0; }
.note { background: var(--surface); box-shadow: var(--shadow); }

.lnk {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; vertical-align: bottom;
  padding: 1px 8px; margin: 1px 0; border-radius: 8px; color: var(--link); text-decoration: none; font-weight: 500;
  background: color-mix(in srgb, var(--link) 10%, transparent); unicode-bidi: isolate;
}
.lnk .ic { width: 14px; height: 14px; }
.lnk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.end-hero { text-align: center; padding: 22px 12px 18px; }
.end-ic { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); animation: pop .5s var(--ease) both; }
.end-ic .ic { width: 38px; height: 38px; stroke-width: 2; }
.end-hero h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.end-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.end-line { font-size: 14px; line-height: 1.8; white-space: pre-line; overflow-wrap: anywhere; }
.end .list { margin-bottom: 12px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } }

/* زر «رجوع» داخل الصفحة: لو اختار المستخدم شي غلط */
.back-inline {
  appearance: none; display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin: 18px 0 4px; padding: 12px 16px; min-height: 46px; cursor: pointer;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent); font-size: 14.5px; font-weight: 600;
  transition: transform .16s var(--ease), background .16s;
}
.back-inline .ic { width: 18px; height: 18px; }
.back-inline:active { transform: scale(.98); background: var(--soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- الإدارة ---------- */
.adm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.adm-stat { display: grid; padding: 10px 6px; text-align: center; }
.adm-stat b { font-size: 20px; font-weight: 600; line-height: 1.2; }
.adm-stat span { font-size: 12px; color: var(--muted); }
/* أدوات البحث تبقى ظاهرة تحت الترويسة أثناء التمرير */
.adm-tools {
  position: sticky; top: 58px; z-index: 4; display: grid; gap: 8px;
  margin: 0 calc(-1 * var(--gutter)) 6px; padding: 8px var(--gutter) 2px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.adm-search-wrap { position: relative; display: flex; align-items: center; }
.adm-search-wrap > .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.adm-search {
  appearance: none; width: 100%; min-height: 46px; padding: 10px 42px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1.5px solid transparent; border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.adm-search::-webkit-search-cancel-button { display: none; }
.adm-search:focus { outline: none; border-color: var(--accent); }
.adm-clear {
  position: absolute; inset-inline-end: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--bg); color: var(--muted); font-size: 13px; cursor: pointer;
}
.adm-clear[hidden] { display: none; }
.adm-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-sm); background: var(--track); }
.adm-seg button { appearance: none; min-height: 36px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
.adm-seg button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.adm-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
.adm-chips::-webkit-scrollbar { display: none; }
.adm-chip {
  appearance: none; flex: none; min-height: 36px; padding: 6px 13px; border: 1.5px solid transparent; border-radius: 999px; scroll-snap-align: start;
  background: var(--surface); font-size: 13px; cursor: pointer; box-shadow: var(--shadow); --st: var(--accent);
}
.adm-chip b { font-weight: 600; color: var(--st); }
.adm-chip.on { border-color: var(--st); background: color-mix(in srgb, var(--st) 12%, var(--surface)); }
.adm-row { padding: 14px; }
.adm-row .meta { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-user { display: flex; align-items: center; gap: 5px; }
.adm-user .ic { width: 15px; height: 15px; flex: none; }
.adm-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.adm-dates span { display: grid; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-size: 13.5px; font-weight: 500; }
.adm-dates small { font-size: 11px; font-weight: 400; color: var(--muted); }
.adm-row .row-foot { margin-top: 10px; }
.adm-src b { font-weight: 600; }
.adm-src .src-app { color: var(--link); }
.adm-src .src-bot { color: var(--ok); }
.adm-src .src-admin { color: var(--review); }
.adm-flag { margin: 6px 0 0; font-size: 12.5px; font-weight: 500; color: var(--bad); }
.adm-gap { margin-top: 14px; }
.adm-copy { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; direction: ltr; min-width: 0; overflow-wrap: anywhere; }
.adm-dock { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.adm-dock .btn { width: 100%; padding-inline: 8px; font-size: 14.5px; }
.adm-link { appearance: none; padding: 0; border: 0; background: none; color: var(--link); font: inherit; cursor: pointer; text-align: end; }
.adm-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.adm-st {
  appearance: none; min-height: 48px; padding: 6px 4px; border: 1.5px solid transparent; border-radius: var(--radius-sm); line-height: 1.35;
  background: color-mix(in srgb, var(--st) 10%, var(--bg)); color: var(--st); font-size: 13px; font-weight: 500; cursor: pointer;
}
.adm-st.on { border-color: var(--st); opacity: 1; }
.adm-st:disabled { cursor: default; }
.adm-switch { appearance: none; position: relative; width: 46px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: var(--track); cursor: pointer; transition: background .2s; vertical-align: middle; }
.adm-switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s var(--ease); }
.adm-switch.on { background: var(--ok); }
.adm-switch.on i { inset-inline-start: 21px; }
.adm-switch:disabled { opacity: .45; cursor: default; }
@media (max-width: 360px) {                       /* هواتف صغيرة */
  .adm-status { grid-template-columns: repeat(2, 1fr); }
  .adm-stat b { font-size: 18px; }
  .tab { font-size: 10.5px; }
}

/* ---------- تعبئة الاستمارة ---------- */
.fields .options { gap: 8px; }
.fields .option { padding: 12px 14px; background: var(--bg); box-shadow: none; }
.fields .option-text { font-size: 14.5px; }
.hint.bad { color: var(--bad); }
.date-btn[aria-invalid="true"] { border-color: var(--bad); }
.field input[dir="ltr"] { text-align: left; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; gap: 6px; }
.btn.sm .ic { width: 16px; height: 16px; }
.card.pad .row-head { margin-bottom: 10px; }
.card.pad .row-head h2 { margin: 0; }
.kvs { margin: 0; }
.kvs .kv dd { overflow-wrap: anywhere; }
