/* RMO — مساعد المحاسب. نهاري، مسطّح، طبقات زجاجية فوق المحتوى فقط، بلا تدرّجات. */

/* رمز الريال الجديد ⃁ (U+20C1) — خط مضمَّن (OFL، fonts/riyal-OFL.txt) لأن خطوط الأجهزة لم تحمله بعد */
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: block; src: url(fonts/riyal-400.woff2) format("woff2"); unicode-range: U+20C1; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: block; src: url(fonts/riyal-400.woff2) format("woff2"); unicode-range: U+20C1; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: block; src: url(fonts/riyal-700.woff2) format("woff2"); unicode-range: U+20C1; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: block; src: url(fonts/riyal-700.woff2) format("woff2"); unicode-range: U+20C1; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-ar-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/plex-ar-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-ar-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-ar-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-ar-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/plex-ar-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-ar-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-ar-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --dim: #6e6e73;
  --faint: #8e8e93;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: #d2d2d7;
  --fill: rgba(118, 118, 128, 0.12);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --ok: #1a7f37;
  --ok-soft: rgba(52, 199, 89, 0.14);
  --warn: #a64b00;
  --warn-soft: rgba(255, 149, 0, 0.14);
  --bad: #c9001a;
  --bad-soft: rgba(255, 59, 48, 0.1);
  --glass: rgba(250, 250, 252, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --r1: 10px;
  --r2: 14px;
  --r3: 22px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.035);
  --shadow-2: 0 12px 48px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.05);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Plex Arabic", -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", Tahoma, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, textarea, select { font-size: 16px; }
button, a, [role="button"], .tap {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
/* الأرقام تُكتب يساراً لليمين داخلها، لكنها تصطفّ مع النص العربي يميناً أينما وُضعت — ولو صارت كتلة (بطاقات الملخّص كانت تنحاز يساراً، 13-10) */
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; display: inline-block; text-align: right; }
.dim { color: var(--dim); }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 26px; height: 26px; stroke-width: 1.7; }
.flip { transform: scaleX(-1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── أزرار ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding-inline: 18px;
  border: 0; border-radius: 12px;
  background: var(--fill); color: var(--ink);
  font-weight: 600; font-size: 15px;
  cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: transparent; color: var(--accent); padding-inline: 10px; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 34px; padding-inline: 12px; font-size: 14px; border-radius: 10px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 160ms ease;
}
.icon-btn:active { transform: scale(0.94); background: var(--fill); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { background: rgba(118, 118, 128, 0.18); }
  .btn.primary:not(:disabled):hover { background: #0077ed; }
  .btn.ghost:not(:disabled):hover { background: var(--accent-soft); }
  .btn.danger:not(:disabled):hover { background: rgba(255, 59, 48, 0.16); }
  .icon-btn:hover { background: var(--fill); }
}

/* ── بوابة الدخول ── */
.gate {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: calc(24px + var(--safe-t)) 16px calc(20px + var(--safe-b));
}
.gate-card {
  display: flex; flex-direction: column; align-items: center;
  width: min(360px, 100%);
}
.gate-logo { width: 64px; height: auto; margin-bottom: 22px; }
.gate-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.gate-sub { color: var(--dim); font-size: 15px; margin-top: 4px; margin-bottom: 36px; }
.gate-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.gate-form label { font-size: 14px; font-weight: 600; color: var(--ink-2); padding-inline: 4px; }
.gate-field {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding-inline: 16px 6px;
  border-radius: 16px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1);
  transition: box-shadow 160ms ease;
}
.gate-field:focus-within { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft), var(--shadow-1); }
.gate-field.bad { box-shadow: 0 0 0 1px var(--bad), 0 0 0 4px var(--bad-soft); }
.gate-field .i { color: var(--faint); }
.gate-field input {
  flex: 1; width: 0; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  font-size: 22px; font-weight: 600; letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums; direction: ltr; text-align: left;
}
.gate-field input::placeholder { color: #c7c7cc; letter-spacing: 0.3em; font-weight: 500; }
.gate-go {
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; cursor: pointer;
  transition: transform 120ms var(--ease-out), opacity 160ms ease;
}
.gate-go:active { transform: scale(0.95); }
.gate-go:disabled { opacity: 0.3; cursor: default; }
.gate-err { min-height: 22px; font-size: 13px; color: var(--bad); padding-inline: 4px; }
.gate-foot { color: var(--faint); font-size: 12px; }
.shake { animation: shake 360ms var(--ease-out); }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* ── الهيكل ── */
.top {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-t);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--line);
}
.top-in {
  max-width: 1080px; margin: 0 auto; height: 56px;
  display: flex; align-items: center; gap: 12px; padding-inline: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand img { width: 22px; height: auto; }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: 0.02em; }
.brand span { color: var(--dim); font-size: 14px; }
.top .spacer { flex: 1; }
.page { max-width: 1080px; margin: 0 auto; padding: 28px 16px calc(120px + var(--safe-b)); }
.crumb { display: flex; align-items: center; gap: 4px; margin-bottom: 18px; }
.crumb .btn.ghost { padding-inline: 6px 10px; height: 34px; }
.h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.lead { color: var(--dim); margin-top: 6px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 4px 12px; }
.section-h h2 { font-size: 13px; font-weight: 600; color: var(--dim); }

/* ── الصفحة الرئيسية ── */
.feature {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 22px; border: 0; border-radius: var(--r3);
  background: var(--surface); box-shadow: var(--shadow-1);
  text-align: start; cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 200ms ease;
}
.feature:active { transform: scale(0.985); }
.feature-ic {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--ink); color: #fff;
}
.feature-t { flex: 1; min-width: 0; }
.feature-t b { display: block; font-size: 18px; font-weight: 700; }
.feature-t span { color: var(--dim); font-size: 14px; }
.feature .chev { color: var(--faint); }
@media (hover: hover) and (pointer: fine) {
  .feature:hover { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 28px rgba(0, 0, 0, 0.07); }
}

.list { background: var(--surface); border-radius: var(--r2); box-shadow: var(--shadow-1); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 12px 16px;
  border: 0; background: transparent; text-align: start; cursor: pointer;
  transition: background-color 160ms ease;
}
.row + .row { box-shadow: inset 0 0.5px 0 var(--line); }
.row:active { background: rgba(0, 0, 0, 0.035); }
@media (hover: hover) and (pointer: fine) { .row:hover { background: rgba(0, 0, 0, 0.025); } }
.row-ic {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--fill); color: var(--ink-2);
}
.row-t { flex: 1; min-width: 0; }
.row-t > b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-t > span { display: block; color: var(--dim); font-size: 13px; }
.row .chev { color: var(--line-2); }
.empty { padding: 28px 16px; text-align: center; color: var(--faint); font-size: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 26px; padding-inline: 10px; border-radius: 13px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--ink-2);
}
.pill .i { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }

/* ── اختيار النوع ── */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 24px; border: 0; border-radius: var(--r3);
  background: var(--surface); box-shadow: var(--shadow-1);
  text-align: start; cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 200ms ease;
}
.mode:active { transform: scale(0.985); }
.mode .feature-ic { width: 48px; height: 48px; border-radius: 13px; background: var(--fill); color: var(--ink); }
.mode b { font-size: 17px; font-weight: 700; }
.mode span { color: var(--dim); font-size: 14px; margin-top: -8px; }
@media (hover: hover) and (pointer: fine) {
  .mode:hover { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-1); }
}
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } }

/* ── الرفع ── */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-top: 24px; padding: 44px 20px;
  border-radius: var(--r3);
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  text-align: center; cursor: pointer;
  transition: box-shadow 160ms ease, background-color 160ms ease, transform 200ms var(--ease-out);
}
.drop .ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.drop b { font-size: 17px; font-weight: 600; }
.drop span { color: var(--dim); font-size: 14px; }
.drop small { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.drop.compact { flex-direction: row; justify-content: center; gap: 14px; padding: 18px 20px; margin-top: 28px; }
.drop.compact .ic { width: 40px; height: 40px; margin: 0; }
.drop.compact .ic .i { width: 20px; height: 20px; }
.drop.compact > span:not(.ic), .drop.compact small { display: none; }
.drop.compact b { font-size: 15px; }
.drop.over { box-shadow: inset 0 0 0 2px var(--accent); background: #fafcff; transform: scale(1.01); }
.drop:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }

.file { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.file + .file { box-shadow: inset 0 0.5px 0 var(--line); }
.file-t { flex: 1; min-width: 0; }
.file-t b { display: block; font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-st { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.file-st .i { width: 14px; height: 14px; }
.file-st.ok { color: var(--ok); }
.file-st.warn { color: var(--warn); }
.file-st.bad { color: var(--bad); }
.bar { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; margin-top: 8px; }
.bar i {
  display: block; height: 100%; width: 100%;
  background: var(--accent); border-radius: inherit;
  transform-origin: right center; transform: scaleX(0);
  transition: transform 240ms linear;
}
.file-acts { display: flex; gap: 6px; align-items: center; flex: none; }

/* ── شريط الإجراء السفلي ── */
.dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 -0.5px 0 var(--line);
  transform: translateY(0);
  transition: transform 260ms var(--ease-drawer), opacity 200ms ease;
}
.dock.hide { transform: translateY(110%); opacity: 0; pointer-events: none; }
.dock-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.dock-note { flex: 1; min-width: 0; color: var(--dim); font-size: 13px; display: flex; align-items: center; gap: 8px; }

/* ── التحليل ── */
.status-card {
  display: flex; gap: 16px; align-items: flex-start;
  margin-top: 24px; padding: 20px; border-radius: var(--r3);
  background: var(--surface); box-shadow: var(--shadow-1);
}
.status-card .ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.status-card b { display: block; font-size: 16px; font-weight: 600; }
.status-card p { color: var(--dim); font-size: 14px; margin-top: 2px; }
.status-card .grow { flex: 1; min-width: 0; }
.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── النتائج ── */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.stat { padding: 18px 20px; border-radius: var(--r2); background: var(--surface); box-shadow: var(--shadow-1); }
.stat > span { display: block; color: var(--dim); font-size: 13px; }
.stat b { display: block; font-size: 30px; font-weight: 700; line-height: 1.25; margin-top: 4px; letter-spacing: -0.01em; }
.stat.ok b { color: var(--ok); }
.stat.warn b { color: var(--warn); }
.stat.cost b { font-size: 24px; line-height: 1.55; }
.stat small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
@media (max-width: 760px) { .summary { grid-template-columns: 1fr 1fr; } }

.callout {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 14px; padding: 14px 16px; border-radius: var(--r2);
  background: var(--warn-soft); color: #6b3100; font-size: 14px;
}
.callout .i { color: var(--warn); margin-top: 1px; }

.seg {
  display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill);
}
.seg button {
  height: 30px; padding-inline: 14px; border: 0; border-radius: 8px;
  background: transparent; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }

.inv { display: grid; grid-template-columns: 64px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.inv .conf { font-weight: 700; font-size: 15px; text-align: start; }
.conf.ok { color: var(--ok); }
.conf.warn { color: var(--warn); }
.conf.bad { color: var(--bad); }
.inv .money { text-align: start; }
.inv .money b { font-weight: 600; font-size: 14.5px; }
.inv .money > span { font-size: 12px; color: var(--faint); }
@media (max-width: 760px) {
  .inv { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .inv .hide-sm { display: none; }
}

.tchip {
  display: inline-block; margin-inline-end: 6px; padding: 0 7px; border-radius: 6px;
  background: var(--fill); color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 19px;
}
.row-t > .miss { display: flex; align-items: center; gap: 5px; color: var(--warn); font-size: 12.5px; margin-top: 2px; }
.miss .i { width: 14px; height: 14px; }
.types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding-inline: 12px;
  border: 0; border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-1);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
  transition: transform 120ms var(--ease-out), box-shadow 160ms ease;
}
.tbtn b { font-weight: 700; color: var(--ink); }
.tbtn:active { transform: scale(0.97); }
.tbtn[aria-pressed="true"] { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-1); color: var(--accent); }
.callout.blue { background: var(--accent-soft); color: #003d7a; }
.callout.blue .i { color: var(--accent); }
.callout.okc { background: var(--ok-soft); color: #0f4d21; }
.callout.okc .i { color: var(--ok); }
.alt.fixalt { background: var(--accent-soft); }
.alt.fixalt em { color: var(--accent); }
select.inp { appearance: none; -webkit-appearance: none; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ── ورقة المراجعة ── */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.32);
  animation: fade 200ms ease both;
}
.sheet {
  position: fixed; z-index: 41;
  inset: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-rows: auto 1fr auto;
  border-radius: var(--r3);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-2), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: sheet-in 300ms var(--ease-drawer) both;
}
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; box-shadow: 0 0.5px 0 var(--line); }
.sheet-h .t { flex: 1; min-width: 0; }
.sheet-h .t b { display: block; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-h .t span { color: var(--dim); font-size: 13px; }
.sheet-b { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); min-height: 0; }
.viewer { position: relative; background: #e8e8ed; min-height: 0; overflow: auto; overscroll-behavior: contain; container-type: size; }
/* «كامل»: كل صفحة تُرى كلها في الإطار بلا تمرير (الصور الطولية)، والتكبير يعيدها لعرض الإطار × التكبير */
.viewer-pages img { display: block; width: auto; max-width: 100%; max-height: calc(100cqh - 32px); margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12); }
.viewer.zoomed .viewer-pages img { width: calc(100% * var(--zoom, 1)); max-width: none; max-height: none; }
.viewer-pages { padding: 16px; }
.viewer.focus { overflow: hidden; }
.viewer.focus .viewer-pages, .viewer.full .stage, .viewer.full .stage-note { display: none; }
/* «محدد»: الحقل في المنتصف بإطار، وحجم خطّه ثابت على الشاشة أياً كان بُعد التصوير */
.stage { position: absolute; inset: 0; overflow: hidden; direction: ltr; cursor: grab; touch-action: none; background: #d9d9de; }
.stage.dragging { cursor: grabbing; }
.stage-bg, .plate { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.stage-bg { filter: blur(22px) saturate(0.9); opacity: 0.55; }
.plate img { display: block; width: 100%; height: 100%; background: #fff;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 2%, #000 98%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 2%, #000 98%, transparent);
  mask-composite: intersect; }
.spot { position: absolute; left: 0; top: 0; border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 200vmax rgba(28, 28, 30, 0.22); }
.spot.warn { box-shadow: 0 0 0 2px #ff9500, 0 0 0 200vmax rgba(28, 28, 30, 0.22); }
.stage-note { position: absolute; inset-inline: 0; bottom: 14px; z-index: 2; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto;
  padding: 7px 12px; border-radius: 10px; font-size: 13px; color: var(--ink-2);
  background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.08); }
@media (prefers-reduced-motion: no-preference) {
  .plate, .stage-bg, .spot { transition: transform 320ms var(--ease-out), width 320ms var(--ease-out), height 320ms var(--ease-out); }
  .stage.instant .plate, .stage.instant .stage-bg, .stage.instant .spot { transition: none; }
}
.viewer-tools .seg { margin-inline-end: 4px; }
.viewer-tools .seg button { height: 30px; padding-inline: 12px; }
.viewer-tools {
  position: sticky; top: 12px; z-index: 2; float: left; margin: 12px;
  display: flex; gap: 2px; padding: 3px; border-radius: 12px;
  background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.08);
}
.viewer-tools .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.form { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px 24px; background: var(--surface); }
.issues { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.issue { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); }
.issue .i { color: var(--warn); width: 16px; height: 16px; margin-top: 3px; }
.issue.soft { background: var(--fill); }
.issue.soft .i { color: var(--dim); }
.issue.okk { background: var(--ok-soft); }
.issue.okk .i { color: var(--ok); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.fgrid .wide { grid-column: 1 / -1; }
.f label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--dim); margin-bottom: 6px; padding-inline: 2px; }
.f label .tag { font-weight: 500; color: var(--faint); }
.f label .i { width: 14px; height: 14px; }
.f label .st-agree { color: var(--ok); }
.f label .st-warn { color: var(--warn); }
.inp {
  width: 100%; height: 42px; padding-inline: 12px;
  border: 0; border-radius: 10px; outline: 0;
  background: #f2f2f7; color: var(--ink);
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}
.inp:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.inp.ltr { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.f.dispute .inp { background: #fff7ed; box-shadow: inset 0 0 0 1px rgba(255, 149, 0, 0.55); }
.alts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.alt {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding-inline: 10px; border: 0; border-radius: 8px;
  background: var(--fill); font-size: 12.5px; cursor: pointer;
  transition: background-color 160ms ease, transform 120ms var(--ease-out);
}
.alt:active { transform: scale(0.96); }
.alt em { font-style: normal; color: var(--dim); }
@media (hover: hover) and (pointer: fine) { .alt:hover { background: rgba(118, 118, 128, 0.2); } }
.items { margin-top: 22px; }
.items-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.items-h b { font-size: 14px; }
.itbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.itbl th { font-size: 12px; font-weight: 600; color: var(--dim); text-align: start; padding: 0 4px; }
.itbl td { padding: 0 2px; }
.itbl .inp { height: 38px; font-size: 14px; padding-inline: 8px; }
.itbl td:first-child { width: 46%; }
.sheet-f { display: flex; align-items: center; gap: 10px; padding: 12px 16px; box-shadow: 0 -0.5px 0 var(--line); background: var(--glass-strong); }
.sheet-f .grow { flex: 1; }
@media (max-width: 860px) {
  .sheet { inset: calc(8px + var(--safe-t)) 0 0; border-radius: var(--r3) var(--r3) 0 0; }
  .sheet-b { grid-template-columns: 1fr; overflow: auto; overscroll-behavior: contain; }
  .viewer { height: 36dvh; position: sticky; top: 0; z-index: 3; box-shadow: 0 0.5px 0 var(--line); } /* تبقى الصورة ظاهرة فوق الخانة وأنت تكتب */
  .form .f, .form .items { scroll-margin-top: calc(36dvh + 12px); }
  .form { overflow: visible; }
  .fgrid { grid-template-columns: 1fr; }
  .sheet-f { padding-bottom: calc(12px + var(--safe-b)); }
}

/* ── التنقّل والرئيسية ── */
.topnav { display: flex; gap: 4px; margin-inline-start: 18px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 12px; border-radius: 9px;
  color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background-color 160ms ease;
}
.topnav a.on { background: var(--fill); color: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .topnav a:hover { background: var(--fill); } }
@media (max-width: 560px) { .brand span { display: none; } .topnav { margin-inline-start: 6px; } }
@media (max-width: 420px) { .topnav a span { display: none; } .topnav a { padding-inline: 10px; } }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } }
.feature-ic.soft { background: var(--fill); color: var(--ink); }
.page.wide { max-width: 1400px; }
.head-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
button.callout { width: 100%; border: 0; text-align: start; font: inherit; cursor: pointer; }

/* ── جدول المستندات (على نسق قوائم أتمال) ── */
.dt { margin-top: 26px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding-inline: 12px;
  border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
  transition: transform 120ms var(--ease-out), box-shadow 160ms ease, color 160ms ease;
}
.chip b { font-weight: 700; color: var(--ink); }
.chip.warn b { color: var(--warn); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-1); color: var(--accent); }
.chip[aria-pressed="true"] b { color: var(--accent); }
.chip-sep { width: 1px; height: 20px; background: var(--line-2); margin-inline: 4px; }
.dt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 10px; }
.dt-search {
  flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding-inline: 12px;
  border-radius: 11px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--faint);
  transition: box-shadow 160ms ease;
}
.dt-search:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.dt-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.dt-wrap {
  overflow-x: auto; overscroll-behavior-x: contain;
  border-radius: var(--r2); background: var(--surface); box-shadow: var(--shadow-1);
}
.dt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 1180px; }
.dt-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 10px; text-align: start; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--dim);
  background: #fafafc; box-shadow: inset 0 -0.5px 0 var(--line);
  cursor: pointer; user-select: none;
}
.dt-table th .i { vertical-align: -3px; margin-inline-start: 2px; color: var(--accent); }
.dt-table td { padding: 10px; vertical-align: middle; white-space: nowrap; box-shadow: inset 0 -0.5px 0 var(--line); }
.dt-table tbody tr { cursor: pointer; transition: background-color 120ms ease; }
.dt-table tbody tr:nth-child(even) td { background: #fcfcfd; }
.dt-table tbody tr.on td { background: var(--accent-soft); }
@media (hover: hover) and (pointer: fine) { .dt-table tbody tr:hover td { background: #f5f8fe; } }
.dt-table .ck { width: 40px; text-align: center; cursor: default; }
.dt-table .ck input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
/* محاذاة واحدة لكل الأعمدة (بداية السطر = يمين): المبالغ بأرقام جدولية وكسرين فتصطفّ منازلها */
.dt-table td, .dt-table .money, .dt-table .pct { text-align: start; }
.dt-table .pct { font-weight: 700; }
.dt-table td.vendor { white-space: normal; min-width: 200px; }
.dt-table td.vendor b { display: block; font-weight: 600; }
.gist {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 340px; font-size: 12.5px; color: var(--dim); margin-top: 2px; line-height: 1.4;
}
.issue .more { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-2); opacity: 0.85; }
.gist.warn { color: var(--warn); }
.dt-table tfoot td { background: #fafafc; font-weight: 600; box-shadow: none; padding-block: 12px; cursor: default; }
.dt-table td.empty { text-align: center; color: var(--faint); padding: 28px; }
.files-fold { margin-top: 26px; }
.files-fold summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; margin-bottom: 10px;
  font-size: 13px; font-weight: 600; color: var(--dim); cursor: pointer; list-style: none;
}
.files-fold summary::-webkit-details-marker { display: none; }
.files-fold summary .i { transition: transform 200ms var(--ease-out); }
.files-fold[open] summary .i { transform: rotate(-90deg); }

/* ── الإعدادات ── */
.sheet.narrow { max-width: 620px; grid-template-rows: auto 1fr; }
.set-body { overflow: auto; overscroll-behavior: contain; padding: 6px 18px 24px; }
.set-h { font-size: 13px; font-weight: 600; color: var(--dim); margin: 22px 4px 8px; }
.set-p { font-size: 13.5px; color: var(--dim); margin: -2px 4px 10px; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; cursor: pointer; }
.set-row + .set-row { box-shadow: inset 0 0.5px 0 var(--line); }
.set-row.off .row-t > b { color: var(--faint); }
.row-t > b.wrap { white-space: normal; font-weight: 500; font-size: 14px; line-height: 1.5; }
.lessons .set-row { cursor: default; }
.lesson-add { display: flex; gap: 8px; margin-bottom: 10px; }
.lesson-add .inp { flex: 1; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sw {
  appearance: none; -webkit-appearance: none; flex: none;
  position: relative; width: 46px; height: 28px; border-radius: 14px; margin: 0;
  background: #e5e5ea; cursor: pointer; transition: background-color 200ms ease;
}
.sw::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 240ms var(--ease-out);
}
.sw:checked { background: #34c759; }
.sw:checked::after { transform: translateX(-18px); }
[dir="ltr"] .sw:checked::after { transform: translateX(18px); }
.sw:disabled { opacity: 0.4; cursor: default; }
.btn.primary.confirm { background: #c25700; }
.tag.warn { color: var(--warn); }

/* ── تنبيه عابر ── */
#toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(96px + var(--safe-b));
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 14px;
  background: rgba(29, 29, 31, 0.92); color: #fff; font-size: 14px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  opacity: 0; transform: translate(-50%, 12px);
  transition: opacity 200ms ease, transform 260ms var(--ease-out);
  pointer-events: none;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── الدخول للعرض ── */
.enter { animation: enter 260ms var(--ease-out) both; }
/* الحركة للعرض الأول فقط (stagger-on يُضاف عند الدخول ويبقى مع الترقيع، فلا تتكرّر مع كل تحديث) */
.stagger-on > * { animation: enter 260ms var(--ease-out) both; }
.stagger-on > *:nth-child(2) { animation-delay: 40ms; }
.stagger-on > *:nth-child(3) { animation-delay: 80ms; }
.stagger-on > *:nth-child(4) { animation-delay: 120ms; }
.stagger-on > *:nth-child(5) { animation-delay: 160ms; }
.stagger-on > *:nth-child(n + 6) { animation-delay: 200ms; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.985); } }

@media (prefers-reduced-motion: reduce) {
  .enter, .stagger-on > *, .sheet { animation: fade 200ms ease both; }
  .shake { animation: none; }
  .spin { animation-duration: 2.4s; }
  .btn:active, .feature:active, .mode:active, .icon-btn:active, .alt:active, .gate-go:active { transform: none; }
  .drop.over { transform: none; }
  .cam, .cam-th, .cam-flash.go { animation: none; }
  .cam-shutter:active i { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .top, .dock, .sheet, .sheet-f, .viewer-tools { background: #fbfbfd; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* التكلفة في الإعدادات */
.cost-n { cursor: default; }
.cost-n .inp { width: 120px; flex: none; text-align: center; height: 38px; }
.cost-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 14px 8px; }
.cost-total b { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.cost-total > span { color: var(--dim); font-size: 13px; }
.cost-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px; font-size: 13.5px; color: var(--dim); }
.cost-line:last-child { padding-bottom: 14px; }
.cost-spent { cursor: default; }

.cur { font-weight: 500; color: var(--dim); }
th .cur { color: inherit; }

/* إضافة الفواتير: تصوير + ملفات (الجوال) */
/* السحب من رابط: سطر هادئ تحت منطقة الإضافة */
.link-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 10px 12px;
  border: 0; border-radius: 12px; background: none; color: var(--dim); font: inherit; font-size: 14px; cursor: pointer; }
.link-add .i { color: var(--accent); flex: none; }
.link-add b { color: var(--ink-2); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .link-add:hover { background: var(--accent-soft); color: var(--ink-2); } }
.link-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.add.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.add.two .drop { margin-top: 0; }
.add.two { margin-top: 28px; }
.add.two .drop:not(.compact) { padding-inline: 14px; }
.cam-tile { border: 0; font: inherit; color: inherit; width: 100%; }
.cam-tile .ic { background: #1d1d1f; color: #fff; }
.add.two .drop.compact { flex-direction: column; gap: 8px; padding: 16px 12px; }
.add.two .drop small { display: none; }
@media (pointer: coarse) {
  .inp, input, select, textarea { font-size: 16px; } /* iOS يكبّر الصفحة عند التركيز على خطّ أصغر من 16 */
}

/* الكاميرا */
.cam {
  position: fixed; inset: 0; z-index: 90; background: #000; color: #fff;
  display: grid; grid-template-rows: auto 1fr auto auto;
  animation: fade 220ms var(--ease-out);
}
.cam-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.nolive .cam-v { display: none; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: cam-flash 280ms ease-out; }
@keyframes cam-flash { from { opacity: 0.8; } to { opacity: 0; } }
.cam-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(var(--safe-t) + 12px) 16px 12px; }
.cam-ic {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  color: #fff; background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); cursor: pointer;
}
.cam-ic.on { background: #fff; color: #1d1d1f; }
.cam-ic[hidden] { visibility: hidden; display: grid; }
.cam-hint {
  min-width: 0; font-size: 13px; text-align: center; padding: 7px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: background-color 200ms ease;
}
.cam-hint.warn { background: #c25700; }
.cam-mid { position: relative; display: grid; place-items: center; padding: 16px; }
.cam-msg { max-width: 320px; text-align: center; padding: 22px 20px; border-radius: 20px; background: rgba(44, 44, 46, 0.92); }
.cam-msg .i { width: 30px; height: 30px; margin-bottom: 8px; opacity: 0.9; }
.cam-msg b { display: block; font-size: 16px; margin-bottom: 6px; }
.cam-msg p { font-size: 14px; color: rgba(255, 255, 255, 0.75); }
.cam-strip { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; min-height: 92px; align-items: center; }
.cam-strip::-webkit-scrollbar { display: none; }
.cam-th {
  position: relative; flex: none; width: 54px; height: 72px; padding: 0; border: 0; border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95); background: #222; cursor: pointer;
  animation: cam-th 240ms var(--ease-out);
}
.cam-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-th .i { position: absolute; top: 4px; inset-inline-end: 4px; width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; }
@keyframes cam-th { from { opacity: 0; transform: scale(0.6); } }
.cam-bar {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 14px 20px calc(var(--safe-b) + 18px);
  background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.cam-count { justify-self: start; font-size: 15px; font-weight: 600; }
.cam-shutter { width: 78px; height: 78px; padding: 5px; border: 4px solid #fff; border-radius: 50%; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cam-shutter i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform 120ms var(--ease-out); }
.cam-shutter:active i { transform: scale(0.86); }
.cam-done { justify-self: end; min-width: 100px; }
.cam-done:disabled { opacity: 0.4; }

/* ── التحديث: إشعار عائم (زجاج)، لا تحديث إجباري ── */
.upd {
  position: fixed; z-index: 90; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 520px; margin-inline: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px; border-radius: 18px;
  background: var(--glass-strong); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-2), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  animation: upd-in 280ms var(--ease-out) both;
}
.upd > .i { color: var(--accent); flex: none; }
.upd > span { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.35; }
.upd > span span { color: var(--dim); font-size: 12.5px; }
.upd .btn { flex: none; }
@keyframes upd-in { from { opacity: 0; transform: translateY(12px); } }

/* خلية ضُغطت في الجدول: الحقل نفسه في الورقة بإطار */
.f.ring .inp, .items.ring { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft); }
.items.ring { border-radius: 12px; }
.f.ring { animation: ring-in 420ms var(--ease-out); }
@keyframes ring-in { 0% { transform: scale(0.98); } 60% { transform: scale(1.01); } 100% { transform: none; } }

/* المؤسسات */
.dt-table tbody tr.static { cursor: default; }
.vendors-t { min-width: 760px; }
.vendors-t .gist .i { width: 13px; height: 13px; vertical-align: -2px; }

@media (prefers-reduced-motion: reduce) {
  .upd, .f.ring { animation: none; }
}
.summary.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }
.count-link { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count-link .i { width: 13px; height: 13px; }
@media (hover: hover) and (pointer: fine) { .count-link:hover { background: rgba(0, 113, 227, 0.16); } }
.ban-ip { direction: ltr; unicode-bidi: isolate; }

/* ── الشركات (13-10): بطاقات في الرئيسية، ونافذة صغيرة للإضافة والربط ── */
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.co-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%;
  padding: 16px 18px; border: 0; border-radius: var(--r3);
  background: var(--surface); box-shadow: var(--shadow-1);
  text-align: start; cursor: pointer;
  transition: transform 140ms var(--ease-out), box-shadow 200ms ease;
}
.co-card:active { transform: scale(0.985); }
.co-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.co-h .chev { color: var(--line-2); }
.co-n { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-s { color: var(--dim); font-size: 13px; }
.co-f { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; box-shadow: inset 0 0.5px 0 var(--line); color: var(--dim); font-size: 13px; }
.co-f b { color: var(--ink); font-size: 15px; font-weight: 700; }
.co-card.add { align-items: center; text-align: center; padding: 28px 18px; }
.co-card.add .row-ic { background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
@media (hover: hover) and (pointer: fine) {
  .co-card:hover { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 28px rgba(0, 0, 0, 0.07); }
}
.tiles.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .tiles.three { grid-template-columns: 1fr; } }

.co-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  height: 32px; margin-top: 10px; padding-inline: 10px 8px; border: 0; border-radius: 16px;
  background: var(--fill); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background-color 160ms ease;
}
.co-chip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-chip .i { flex: none; }
.co-chip.none { background: var(--accent-soft); color: var(--accent); }
.co-chip.static { cursor: default; padding-inline: 10px; }
@media (hover: hover) and (pointer: fine) { .co-chip:not(.static):hover { background: rgba(118, 118, 128, 0.18); } .co-chip.none:hover { background: rgba(0, 113, 227, 0.16); } }

.sheet.dlg { inset: calc(10vh + var(--safe-t)) 16px auto; max-width: 460px; max-height: 80vh; grid-template-rows: auto minmax(0, 1fr) auto; }
.sheet.dlg .set-body { padding-top: 16px; }
.dlg-err { min-height: 20px; margin-top: 10px; color: var(--bad); font-size: 13.5px; }
.set-row.pick { width: 100%; border: 0; background: transparent; text-align: start; transition: background-color 160ms ease; }
.set-row.pick .tick { color: var(--accent); }
.set-row.pick.on .row-t > b { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .set-row.pick:hover { background: rgba(0, 0, 0, 0.025); } }
@media (max-width: 760px) { .sheet.dlg { inset: auto 0 0; max-width: none; border-radius: var(--r3) var(--r3) 0 0; } .sheet.dlg .sheet-f { padding-bottom: calc(12px + var(--safe-b)); } }
@media (prefers-reduced-motion: reduce) { .co-card:active { transform: none; } }

/* ── نموذج «مشتريات» (13-10): خانة تحتاج مراجعة مؤطّرة بالبرتقالي، وزرّ «ابدأ المراجعة» ── */
.fbox {
  display: inline-block; max-width: 100%; margin: -4px -6px; padding: 3px 6px; border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px #ff9500; background: rgba(255, 149, 0, 0.08);
  transition: box-shadow 160ms ease;
}
@media (hover: hover) and (pointer: fine) { .dt-table tr:hover .fbox { box-shadow: inset 0 0 0 2px #ff9500; } }
.dt-table td.vendor .fbox { display: block; margin-inline: -6px; }
.dt-table td.notes { white-space: normal; min-width: 160px; }
.dt-table td.notes .gist { margin-top: 0; max-width: 260px; }
.chip.play { background: var(--warn); color: #fff; font-weight: 600; box-shadow: none; }
.chip.play .i { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.chip.play:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .chip.play:hover { background: #8a3e00; } }
.fextra { margin-top: 18px; }
.fextra summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; margin-bottom: 10px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none;
}
.fextra summary .dim { font-weight: 400; font-size: 12.5px; }
.fextra summary::-webkit-details-marker { display: none; }
.fextra summary .i { transition: transform 200ms var(--ease-out); }
.fextra[open] summary .i { transform: rotate(-90deg); }
.dlg .f label .i { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .chip.play:active { transform: none; } .fextra summary .i { transition: none; } }

/* ── البحث: تظليل التطابق ── */
mark { background: rgba(255, 204, 0, 0.45); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ── المؤشرات: تُخفى بزرّ يظهر بعد ثبات الماوس عليها (أو من الإعدادات) ── */
.summary.hideable { position: relative; }
.sum-hide {
  position: absolute; inset-inline-end: 10px; top: -14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding-inline: 10px;
  border: 0; border-radius: 14px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity 160ms ease;
}
.summary.hideable .stat { transition: box-shadow 200ms ease; }
@media (hover: hover) and (pointer: fine) {
  .summary.hideable:hover .sum-hide { opacity: 1; pointer-events: auto; transition-delay: 900ms; }
  .summary.hideable:hover .stat { box-shadow: 0 0 0 2px var(--accent), var(--shadow-1); transition-delay: 900ms; }
}

/* ── معلومات المستند (زرّ i في رأس الورقة) ── */
.sheet:has(.info-pane:not([hidden])) { grid-template-rows: auto auto 1fr auto; }
.info-pane { max-height: 46vh; overflow: auto; padding: 14px 16px; background: var(--surface); box-shadow: 0 0.5px 0 var(--line); animation: fade 200ms ease both; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.info-card { display: flex; gap: 12px; align-items: flex-start; }
.info-card img { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; box-shadow: 0 0 0 0.5px var(--line), 0 1px 4px rgba(0, 0, 0, 0.08); flex: none; background: #fff; }
.info-rows { flex: 1; min-width: 0; display: grid; gap: 4px; align-content: start; }
.info-r { display: flex; gap: 10px; font-size: 13px; }
.info-r > span { color: var(--dim); flex: none; min-width: 92px; }
.info-r > b { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .info-pane { animation: none; } .sum-hide, .summary.hideable .stat { transition: none; } }
/* اثنا عشر عموداً (نموذج «مشتريات» + الملاحظات والحالة) تتّسع في صفحة الكمبيوتر بلا تمرير جانبي */
.dt-table td, .dt-table th { padding-inline: 8px; }
.dt-table td.notes { min-width: 130px; }
.dt-table td.notes .gist { max-width: 190px; font-size: 12px; }
.dt-table td.vendor { min-width: 170px; }
.dt-table .pill { padding-inline: 8px; }

/* الملفات ← المستندات: سطر يشرح اختلاف العدد (13-10) */
.recon { display: flex; align-items: flex-start; gap: 6px; margin: 22px 4px -14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.recon .i { flex: none; margin-top: 3px; color: var(--accent); }
.recon.ok { color: var(--dim); }
.recon.ok .i { color: var(--ok); }
.recon a, .file-st a { color: var(--accent); }

/* ── الدخول برقم الجوال ورمز تلقرام (13-10) ── */
.gate-err.note { color: var(--accent); }
.gate-hint { font-size: 13.5px; color: var(--dim); padding-inline: 4px; margin-top: -4px; }
.gate-field input[type="tel"]::placeholder { letter-spacing: 0.04em; }
.gate-link { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 4px; }
.gate-link p { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.gate-tg { justify-content: center; height: 46px; }
.gate-wait { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; }
.gate-more { display: flex; justify-content: space-between; gap: 8px; }
.add-form { margin-top: 10px; padding: 12px; display: grid; gap: 10px; }
.af-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.af-fields.three { grid-template-columns: 1fr 1fr 1fr; }
.af-fields .inp { height: 40px; min-width: 0; }
.af-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.af-opt { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.add-form .dlg-err { margin: 0; min-height: 0; }
.add-form .dlg-err:empty { display: none; }
@media (max-width: 560px) { .af-fields, .af-fields.three { grid-template-columns: 1fr; } }

/* مقارنة بكشف حساب */
.stmts { margin-top: 18px; }
a.set-row { color: inherit; text-decoration: none; }
a.set-row > .i:last-child { color: var(--faint); flex: none; }
.stat.amt b { font-size: 22px; line-height: 1.65; }
.st-ex { margin-top: 18px; padding: 18px 20px; background: var(--surface); border-radius: var(--r2); box-shadow: var(--shadow-1); font-size: 14.5px; line-height: 1.9; }
.st-ex h2 { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.st-ex h2 .i { color: var(--accent); }
.st-ex h3 { font-size: 14px; font-weight: 700; margin-top: 12px; }
.st-ex ul, .st-ex ol { margin: 4px 0 0; padding-inline-start: 22px; }
.st-ex li::marker { color: var(--dim); }
.st-line { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.8; }
.st-line + .st-line { box-shadow: inset 0 0.5px 0 var(--line); }
.st-line .grow { flex: 1; min-width: 0; }
.st-line .st-ic { flex: none; margin-top: 4px; color: var(--dim); }
.st-line.bad .st-ic { color: var(--bad); }
.st-line.warn .st-ic { color: var(--warn); }
.st-line.ok .st-ic { color: var(--ok); }
.st-line small { display: block; color: var(--dim); font-size: 12.5px; line-height: 1.7; }
.st-line .btn { flex: none; }
@media (max-width: 560px) {
  .st-line { flex-wrap: wrap; }
  .st-line .grow { flex-basis: calc(100% - 40px); }
  .st-line .btn { margin-inline-start: 22px; }
  .stat.amt b { font-size: 18px; }
}
