/* ==========================================================================
   حوالة برو — إدارة الحوالات · نظام التصميم
   خط IBM Plex Sans Arabic (رخصة SIL OFL 1.1 — public/fonts/OFL.txt)
   ========================================================================== */

@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/plex-arabic-arabic-400.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/plex-arabic-arabic-500.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/plex-arabic-arabic-700.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/plex-arabic-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/plex-arabic-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/plex-arabic-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font: "Plex Arabic", "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  /* أساس */
  --bg: #f5f2ec; --bg-2: #efeae1; --card: #ffffff; --card-2: #fbf9f5;
  --text: #17202e; --text-2: #3a4556; --muted: #6c7482; --line: #e6e0d5; --line-2: #d8d0c2;
  /* هوية */
  --ink: #0f1b2d; --ink-2: #16263d; --ink-3: #213553; --on-ink: #e9e4d8; --on-ink-muted: #9aa5b7;
  --gold: #b48a3c; --gold-2: #cfab62; --gold-soft: #f4ead6; --gold-ink: #7a5a1e;
  --primary: #1b3a63; --primary-2: #132b4b; --link: #1f4f8a;
  --primary-hi: #23467a; --primary-hi-2: #1e3e6c; --primary-rgb: 19, 43, 75;
  --gold-rgb: 207, 171, 98; --gold-light: #ecd39b; --hero-glow: #2a4a78;
  --thead-bg: #f7f4ee; --row-hover: #fbf8f2;
  --login-1: #13223a; --login-2: #0b1424; --login-3: rgba(33, 53, 83, .9);
  /* الشريط الجانبي */
  --nav-bg: var(--ink); --nav-bg-2: var(--ink-2); --nav-glow: #1d3252; --nav-avatar: var(--ink-3);
  --nav-text: #c9d1de; --nav-text-2: var(--on-ink); --nav-strong: #fff; --nav-muted: var(--on-ink-muted); --nav-tint-rgb: 255, 255, 255;
  --focus: rgba(180, 138, 60, .45);
  /* حالات */
  --danger: #b42318; --warn: #a15c07; --ok: #0f7a4f;
  --gray-bg: #eef0f3; --gray-fg: #4a5361;
  --blue-bg: #e3eefc; --blue-fg: #1d4f9c;
  --amber-bg: #fdf1d3; --amber-fg: #8a5100;
  --orange-bg: #fde6d6; --orange-fg: #a8400f;
  --red-bg: #fbe5e3; --red-fg: #a11d14;
  --green-bg: #dcf2e6; --green-fg: #0b6b44;
  --purple-bg: #ece6fb; --purple-fg: #5b3aa8;
  /* شكل */
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(23, 32, 46, .05), 0 1px 1px rgba(23, 32, 46, .03);
  --shadow-2: 0 1px 2px rgba(23, 32, 46, .04), 0 6px 20px -6px rgba(23, 32, 46, .10);
  --shadow-3: 0 24px 60px -18px rgba(15, 27, 45, .35), 0 4px 14px rgba(15, 27, 45, .08);
  --nav-w: 264px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-soft); color: var(--text); }
h1 { font-size: 1.6rem; line-height: 1.3; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; letter-spacing: -.01em; color: var(--text); }
h2 { font-size: 1.12rem; font-weight: 700; margin: 0 0 .9rem; color: var(--text); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: 1rem; font-weight: 700; margin: 1.1rem 0 .5rem; }
p { margin: 0 0 .8rem; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; background: var(--bg-2); padding: .05rem .35rem; border-radius: 5px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.num { text-align: left; direction: ltr; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
.danger-text { color: var(--danger); } .warn-text { color: var(--warn); }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }
.eyebrow { margin: 0 0 .15rem; font-size: .82rem; color: var(--gold-ink); font-weight: 500; letter-spacing: .02em; }

/* ---------- الهيكل: شريط جانبي على اليمين ---------- */
.topbar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--nav-w); z-index: 40;
  display: flex; flex-direction: column; gap: 0;
  background: radial-gradient(120% 60% at 100% 0%, var(--nav-glow) 0%, transparent 60%), linear-gradient(180deg, var(--nav-bg-2), var(--nav-bg));
  color: var(--nav-text-2); border-inline-end: 1px solid rgba(var(--gold-rgb), .18);
}
.topbar::after { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 1px; background: linear-gradient(180deg, rgba(var(--gold-rgb), 0), rgba(var(--gold-rgb), .45), rgba(var(--gold-rgb), 0)); }
.topbar a { color: var(--nav-text-2); }
.topbar-head { display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.25rem 1.1rem; }
.topbar .brand { display: flex; align-items: center; gap: .75rem; color: var(--nav-strong); text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
  font-weight: 700; font-size: 1.45rem; line-height: 1; color: var(--ink); padding-bottom: 4px;
  background: linear-gradient(145deg, var(--gold-light) 0%, var(--gold-2) 40%, var(--gold) 100%);
  box-shadow: inset 0 1px 0 rgba(var(--nav-tint-rgb), .55), inset 0 -2px 6px rgba(122, 90, 30, .35), 0 6px 16px -6px rgba(180, 138, 60, .7);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 1.15rem; color: var(--nav-strong); letter-spacing: .02em; }
.brand-text small { font-size: .78rem; color: var(--gold-2); font-weight: 500; }
.nav-toggle { display: none; }
.navbody { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.topbar nav { display: flex; flex-direction: column; gap: 2px; padding: .4rem .8rem; flex: 1; overflow-y: auto; }
.navlabel { font-size: .72rem; color: var(--nav-muted); padding: 1rem .8rem .35rem; letter-spacing: .06em; }
.topbar nav a {
  position: relative; display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 10px;
  color: var(--nav-text); font-weight: 500; font-size: .95rem; transition: background .15s, color .15s;
}
.topbar nav a svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.topbar nav a:hover { background: rgba(var(--nav-tint-rgb), .06); color: var(--nav-strong); text-decoration: none; }
.topbar nav a.on { background: linear-gradient(90deg, rgba(var(--gold-rgb), .06), rgba(var(--gold-rgb), .16)); color: var(--nav-strong); font-weight: 700; }
.topbar nav a.on svg { color: var(--gold-2); opacity: 1; }
.topbar nav a.on::before { content: ""; position: absolute; inset-inline-start: -.8rem; top: 22%; bottom: 22%; width: 3px; border-radius: 3px 0 0 3px; background: var(--gold-2); }
.topbar .me { display: flex; align-items: center; gap: .5rem; margin: .8rem; padding: .7rem; border-radius: 14px; background: rgba(var(--nav-tint-rgb), .05); border: 1px solid rgba(var(--nav-tint-rgb), .07); }
.me-name { display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 0; text-decoration: none !important; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--nav-avatar); color: var(--gold-2); font-weight: 700; border: 1px solid rgba(var(--gold-rgb), .4); }
.me-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-text > span { color: var(--nav-strong); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--nav-muted); font-size: .75rem; }
.topbar .me .link { color: var(--nav-muted); display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .5rem; border-radius: 8px; font-size: .85rem; }
.topbar .me .link:hover { color: var(--nav-strong); background: rgba(var(--nav-tint-rgb), .08); }
.topbar .me .link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar .me .link span { display: none; }

main { max-width: 1320px; margin: 0 auto; padding: 2rem 2.2rem 4rem; }
body.has-nav main { margin-inline-start: var(--nav-w); margin-inline-end: 0; max-width: none; padding-inline: max(2.2rem, calc((100vw - var(--nav-w) - 1320px) / 2)); }

main.center { text-align: start; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 2rem 1rem; flex-direction: column; }
body.no-nav {
  background: radial-gradient(80% 60% at 85% 0%, rgba(var(--gold-rgb), .22), rgba(var(--gold-rgb), 0) 60%),
              radial-gradient(70% 70% at 0% 100%, var(--login-3), transparent 70%),
              linear-gradient(160deg, var(--login-1) 0%, var(--login-2) 100%);
  background-attachment: fixed; min-height: 100vh;
}
body.no-nav main.center > .flash { width: 420px; max-width: 100%; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.card .pagehead { align-items: center; margin-bottom: 1rem; }
.card .pagehead h2 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions select { width: auto; min-width: 180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-2); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cardhead h2 { margin: 0; }
.count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .45rem; border-radius: 99px; background: var(--bg-2); color: var(--text-2); font-size: .8rem; font-weight: 700; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; }
.cols > .card { margin-bottom: 0; }
.cols + * { margin-top: 1.25rem; }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--text); cursor: pointer; font: inherit; font-weight: 500; line-height: 1.4;
  box-shadow: var(--shadow-1); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--card-2); border-color: var(--gold-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--primary-hi), var(--primary)); border-color: var(--primary-2); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 14px -6px rgba(var(--primary-rgb), .55); }
.btn.primary:hover { background: linear-gradient(180deg, var(--primary-hi-2), var(--primary-2)); border-color: var(--primary-2); }
.btn.danger { background: var(--card); border-color: #eab3ad; color: var(--danger); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--danger); }
.btn.small { padding: .22rem .7rem; font-size: .84rem; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: wait; }
button.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
button.link:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ---------- نماذج ---------- */
input, select, textarea {
  font: inherit; padding: .55rem .75rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); width: 100%; color: var(--text);
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input:hover, select:hover, textarea:hover { border-color: #c4b99f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; }
input[type=file] { padding: .45rem; background: var(--card-2); border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); padding: .25rem .8rem; margin-inline-end: .7rem; cursor: pointer; color: var(--text); }
select { appearance: none; -webkit-appearance: none; padding-inline-end: .75rem; padding-inline-start: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236c7482' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left .8rem center; }
select[multiple] { background-image: none; padding-inline-start: .75rem; }
label { display: block; margin-bottom: .85rem; font-size: .9rem; color: var(--text-2); font-weight: 500; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; }
label.check { display: flex; gap: .55rem; align-items: center; font-weight: 400; }
label.check input { margin: 0; }
.inline-label { display: inline-flex; gap: .4rem; align-items: center; margin: 0 .3rem; }
.inline-label input { width: auto; }
.small-input { width: auto; padding: .2rem .4rem; font-size: .85rem; border-radius: 7px; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 1.2rem; padding: 1rem 1.2rem .4rem; background: var(--card-2); min-width: 0; }
.form legend { font-weight: 700; padding: 0 .5rem; color: var(--gold-ink); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 1rem; align-items: start; }
.row label.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); }
.form.narrow { max-width: 480px; }
.checks { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem 1rem; margin-bottom: 1rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 0 .9rem; align-items: end; padding-bottom: .5rem; }
.filters label { margin-bottom: .8rem; }
.filter-actions { margin-bottom: .85rem; display: flex; gap: .4rem; }
.bankrow { border-bottom: 1px dashed var(--line-2); padding: .6rem 0; }

/* ---------- الدخول ---------- */
.login-wrap { width: 100%; display: flex; justify-content: center; }
.login { width: 420px; max-width: 100%; padding: 2.2rem 2.2rem 1.6rem; border-radius: 22px; border: 1px solid rgba(var(--gold-rgb), .35); box-shadow: var(--shadow-3); position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold)); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding-bottom: 1.3rem; margin-bottom: 1.3rem; border-bottom: 1px solid var(--line); text-align: center; }
.logo-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 2.2rem; padding-bottom: 6px; }
.login-title { font-weight: 700; font-size: 1.2rem; color: var(--text); margin-top: .3rem; }
.login-sub { font-size: .82rem; color: var(--gold-ink); }
.login h1 { justify-content: center; font-size: 1.25rem; }
.login p { text-align: center; }
.login .btn { width: 100%; padding: .75rem; margin-top: .4rem; font-size: 1rem; }
.login-foot { color: var(--muted); margin: 1.1rem 0 0; }
.errorpage { max-width: 560px; margin: 4rem auto; text-align: center; padding: 2.5rem 2rem; }
.errorpage h1 { justify-content: center; }
.errorpage .actions { justify-content: center; margin-top: 1.2rem; }
.error-mark { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); margin-bottom: 1rem; }

/* ---------- جداول ---------- */
.tablewrap { overflow: auto; max-height: 78vh; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 1.25rem; box-shadow: var(--shadow-2); }
.card .tablewrap { border: 1px solid var(--line); border-radius: var(--r); box-shadow: none; margin-bottom: 0; }
.card .tablewrap + * { margin-top: 1rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: .75rem .95rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
thead th {
  position: sticky; top: 0; z-index: 2; background: var(--thead-bg); font-weight: 700; font-size: .8rem; color: var(--muted); white-space: nowrap;
  letter-spacing: .02em; border-bottom: 1px solid var(--line-2);
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 700; }
.tablewrap td > a:first-child, .tablewrap td.small, td bdi { white-space: nowrap; }
tr.inactive { opacity: .5; }
tr.missing td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
tr.alert-danger td:first-child { box-shadow: inset -4px 0 0 var(--danger); }
tr.alert-warn td:first-child { box-shadow: inset -4px 0 0 #d18a16; }
tr.alert-info td:first-child { box-shadow: inset -4px 0 0 var(--link); }
table.grid td, table.grid th { text-align: center; }
table.grid tbody th { text-align: right; white-space: nowrap; }
table.grid thead th { white-space: normal; vertical-align: middle; }
table.grid thead th .badge { font-size: .74rem; white-space: normal; border-radius: 10px; text-align: start; line-height: 1.35; padding-block: .25rem; }
.cellnum strong { font-size: 1.1rem; }

/* جدول الفروقات */
table.diff th, table.diff td { font-size: .92rem; }
table.diff tr.changed { background: #fffaf0; }
table.diff tr.changed td:first-child { box-shadow: inset -3px 0 0 var(--gold); font-weight: 500; }
table.diff .old { color: #b2463c; text-decoration: line-through; text-decoration-color: rgba(178, 70, 60, .6); opacity: .85; }
table.diff .new { color: var(--ok); font-weight: 700; }
table.diff .old + .new, table.diff .new + .old { margin-inline-start: .5rem; }

/* ---------- شارات ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .7rem; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; line-height: 1.5; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; flex: none; }
.badge.gray { background: var(--gray-bg); color: var(--gray-fg); }
.badge.blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge.amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge.orange { background: var(--orange-bg); color: var(--orange-fg); }
.badge.red { background: var(--red-bg); color: var(--red-fg); }
.badge.green { background: var(--green-bg); color: var(--green-fg); }
.badge.purple { background: var(--purple-bg); color: var(--purple-fg); }
h1 .badge { font-size: .85rem; }
.tag { display: inline-block; font-size: .74rem; font-weight: 500; padding: .05rem .5rem; border-radius: 6px; background: var(--gray-bg); color: var(--gray-fg); margin-inline-start: .35rem; vertical-align: middle; }
.tag.gray { background: var(--gray-bg); color: var(--gray-fg); }
.tag.blue { background: var(--blue-bg); color: var(--blue-fg); }
.tag.amber { background: var(--amber-bg); color: var(--amber-fg); }
.tag.orange { background: var(--orange-bg); color: var(--orange-fg); }
.tag.red { background: var(--red-bg); color: var(--red-fg); }
.tag.green { background: var(--green-bg); color: var(--green-fg); }
.tag.purple { background: var(--purple-bg); color: var(--purple-fg); }

/* ---------- رسائل ---------- */
.flash { padding: .85rem 1.1rem; border-radius: var(--r); margin-bottom: 1.25rem; border: 1px solid; border-inline-start-width: 4px; }
.flash ul { margin: 0; padding-inline-start: 1.2rem; }
.flash.success { background: #eaf7f0; border-color: #b7e3cb; border-inline-start-color: var(--ok); color: #0a5a39; }
.flash.error { background: #fdeeed; border-color: #f3c6c1; border-inline-start-color: var(--danger); color: #8f1d14; }
.flash.info { background: #eaf1fb; border-color: #c4d8f2; border-inline-start-color: var(--link); color: #1b3f70; }
.flash a { font-weight: 700; color: inherit; text-decoration: underline; }
.checkbox { border-inline-start: 4px solid var(--gold); }
.checkbox h3:first-child { margin-top: 0; }
.checkbox ul { margin: .2rem 0 .6rem; padding-inline-start: 1.3rem; }
.checkbox li { margin-bottom: .2rem; }

dl.info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0; margin: 0; }
dl.info dt, dl.info dd { padding: .55rem 0; border-bottom: 1px solid var(--line); }
dl.info dt { color: var(--muted); font-size: .88rem; padding-inline-end: 1.4rem; }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
dl.info dt:last-of-type, dl.info dd:last-of-type { border-bottom: 0; }
dl.info dd.big { font-size: 1.35rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.big { font-size: 1.3rem; font-weight: 700; }

details.action { margin-bottom: .55rem; }
details.action summary { list-style: none; display: inline-flex; }
details.action summary::-webkit-details-marker { display: none; }
details.action[open] summary { box-shadow: 0 0 0 3px var(--focus); }
details.action form { margin-top: .7rem; padding: 1rem; background: var(--card-2); border-radius: var(--r); border: 1px solid var(--line); }

.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--line); margin-inline-start: .4rem; }
.timeline li { padding: .35rem 1.1rem .7rem; position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: .8rem; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--gold); }
.timeline li:first-child::before { background: var(--gold); }

.file { padding: .3rem 0; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.file > .small.muted:last-child { flex-basis: 100%; }
.file + .file { border-top: 1px dashed var(--line-2); }
.delivered { display: flex; gap: .4rem; align-items: center; margin-bottom: .35rem; flex-wrap: wrap; }
.upload { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: .5rem; }

.viewer { background: #3d4045; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 1rem; text-align: center; box-shadow: var(--shadow-2); }
.viewer iframe { width: 100%; height: 80vh; border: 0; display: block; background: #fff; }
.viewer img { max-width: 100%; max-height: 85vh; display: inline-block; background: #fff; }
.viewer .card { margin: 2rem auto; max-width: 420px; }
main a.on { font-weight: 700; }
.tabs { display: flex; gap: .3rem; margin-bottom: 1.25rem; padding: .3rem; background: var(--bg-2); border-radius: 12px; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.tabs a { padding: .45rem 1rem; border-radius: 9px; color: var(--muted); font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .5); }
.tabs a.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: var(--shadow-1); }

/* ---------- مؤشرات (KPI) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi {
  --tone: var(--gold); --tone-bg: var(--gold-soft);
  position: relative; display: flex; flex-direction: column; gap: .15rem; padding: 1.05rem 1.15rem 1rem; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  color: var(--text); text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.kpi::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--tone); opacity: .9; }
.kpi::after { content: ""; position: absolute; inset-inline-end: -28px; bottom: -28px; width: 90px; height: 90px; border-radius: 50%; background: var(--tone-bg); opacity: .7; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); border-color: var(--line-2); text-decoration: none; }
.kpi > * { position: relative; z-index: 1; }
.kpi-label { font-size: .84rem; color: var(--muted); font-weight: 500; line-height: 1.4; min-height: 2.35em; }
.kpi-value { font-size: 2.1rem; font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-sub { font-size: .8rem; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.kpi.tone-gray { --tone: #98a1ae; --tone-bg: var(--gray-bg); }
.kpi.tone-blue { --tone: #3b74c4; --tone-bg: var(--blue-bg); }
.kpi.tone-amber { --tone: #d8a02b; --tone-bg: var(--amber-bg); }
.kpi.tone-orange { --tone: #e07434; --tone-bg: var(--orange-bg); }
.kpi.tone-red { --tone: #d0473c; --tone-bg: var(--red-bg); }
.kpi.tone-green { --tone: #1f9a64; --tone-bg: var(--green-bg); }
.kpi.tone-purple { --tone: #7a5bd0; --tone-bg: var(--purple-bg); }

/* قوائم الانتظار في اللوحة */
.card-highlight { border-color: rgba(122, 91, 208, .35); background: linear-gradient(180deg, #faf8ff, var(--card) 40%); box-shadow: 0 0 0 4px rgba(122, 91, 208, .07), var(--shadow-2); }
.dotmark { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--gold); }
.dotmark.purple { background: #7a5bd0; box-shadow: 0 0 0 4px rgba(122, 91, 208, .18); }
.dotmark.blue { background: #3b74c4; box-shadow: 0 0 0 4px rgba(59, 116, 196, .18); }
.dotmark.red { background: var(--danger); box-shadow: 0 0 0 4px rgba(208, 71, 60, .18); }
@media (min-width: 1101px) { .dash-queues > .card:only-child { grid-column: 1 / -1; } }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.queue li:last-child { border-bottom: 0; padding-bottom: 0; }
.queue-main { display: flex; flex-direction: column; min-width: 0; color: var(--text); }
.queue-main:hover { text-decoration: none; }
.queue-main:hover .queue-ref { text-decoration: underline; }
.queue-ref { font-weight: 700; color: var(--link); }
.queue-who { font-size: .9rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-amt { font-weight: 700; font-size: 1.02rem; align-self: start; }
.queue-meta { grid-column: 1 / -1; }
.emptystate { display: flex; align-items: center; gap: .9rem; padding: .4rem 0; color: var(--text-2); }
.emptystate p { margin: 0; }
.emptystate-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--green-bg); color: var(--ok); flex: none; }

/* ---------- مراحل الحوالة ---------- */
.stages { list-style: none; margin: 0 0 1.25rem; padding: 1.4rem 1rem 1.2rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.card .stages { border: 0; box-shadow: none; padding-inline: 0; background: none; }
.stages li { position: relative; text-align: center; padding: 2.4rem .35rem 0; min-width: 0; }
.stages li::before { content: ""; position: absolute; top: calc(.75rem - 1px); height: 2px; inset-inline-start: 50%; width: 100%; background: var(--line-2); }
.stages li:last-child::before { display: none; }
.stages li.done::before { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.stages .dot { position: absolute; top: 0; inset-inline-start: 50%; margin-inline-start: -.75rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--card); border: 2px solid var(--line-2); z-index: 1; display: grid; place-items: center; }
.stages li.done .dot { background: linear-gradient(145deg, var(--gold-2), var(--gold)); border-color: var(--gold); box-shadow: 0 2px 8px -2px rgba(180, 138, 60, .7); }
.stages li.done .dot::after { content: ""; width: .32rem; height: .6rem; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.stages li.current .dot { border-color: var(--primary); border-width: 2px; background: var(--card); box-shadow: 0 0 0 4px rgba(27, 58, 99, .14); animation: stage-pulse 2s ease-out infinite; }
.stages li.current .dot::after { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--primary); }
.stages li.todo .dot { border-style: dashed; }
.st-label { font-weight: 700; font-size: .9rem; color: var(--text); line-height: 1.35; }
.stages li.todo .st-label { color: var(--muted); font-weight: 500; }
.stages li.current .st-label { color: var(--primary); }
.st-date { font-size: .78rem; color: var(--text-2); direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.st-by { font-size: .8rem; color: var(--muted); }
.st-gap { display: inline-block; margin-top: .3rem; font-size: .72rem; color: var(--gold-ink); background: var(--gold-soft); border-radius: 99px; padding: 0 .55rem; }
@keyframes stage-pulse { 0% { box-shadow: 0 0 0 0 rgba(27, 58, 99, .35); } 70% { box-shadow: 0 0 0 10px rgba(27, 58, 99, 0); } 100% { box-shadow: 0 0 0 0 rgba(27, 58, 99, 0); } }
@media (max-width: 760px) {
  .stages { grid-auto-flow: row; grid-auto-columns: auto; padding: 1.1rem 1rem .4rem; }
  .stages li { text-align: right; padding: 0 2.6rem 1.1rem 0; min-height: 2.6rem; }
  .stages li::before { top: 1.5rem; bottom: -.1rem; height: auto; width: 2px; inset-inline-start: calc(.75rem - 1px); }
  .stages li.done::before { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
  .stages .dot { inset-inline-start: 0; margin-inline-start: 0; }
  .st-date { text-align: right; }
}

/* ---------- المساعد الذكي ---------- */
.ai-fab {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 60; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--ink);
  background: radial-gradient(circle at 30% 25%, #f3dfae, var(--gold-2) 45%, var(--gold) 100%);
  box-shadow: 0 10px 28px -8px rgba(122, 90, 30, .65), 0 0 0 4px rgba(255, 255, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .18s, box-shadow .18s;
}
.ai-fab:hover { transform: translateY(-2px) scale(1.04); }
.ai-fab-label {
  position: absolute; left: calc(100% + .7rem); top: 50%; transform: translateY(-50%) translateX(-4px); white-space: nowrap; pointer-events: none;
  background: var(--ink); color: #fff; font: 500 .82rem var(--font); padding: .35rem .75rem; border-radius: 8px; opacity: 0; transition: opacity .15s, transform .15s;
}
.ai-fab:hover .ai-fab-label, .ai-fab:focus-visible .ai-fab-label { opacity: 1; transform: translateY(-50%); }
body.ai-open .ai-fab { display: none; }
.ai-panel {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 70; width: 390px; max-width: calc(100vw - 2rem); height: min(640px, calc(100vh - 3rem));
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow-3); animation: ai-in .2s ease-out;
}
@keyframes ai-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .9rem 1rem .9rem .8rem; flex: none;
  background: linear-gradient(160deg, var(--ink-3), var(--ink)); color: #fff; border-bottom: 1px solid rgba(var(--gold-rgb), .35);
}
.ai-title { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.ai-title > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.ai-title strong { font-size: 1rem; }
.ai-title small { font-size: .74rem; color: var(--on-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; color: var(--ink); background: linear-gradient(145deg, var(--gold-light), var(--gold)); }
.ai-head-actions { display: flex; gap: .3rem; align-items: center; flex: none; }
.ai-head-actions button { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #fff; font: 500 .8rem var(--font); padding: .35rem .6rem; border-radius: 9px; cursor: pointer; }
.ai-head-actions button:hover { background: rgba(255, 255, 255, .14); }
.ai-close { padding: .35rem !important; }
.ai-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .65rem; background: linear-gradient(180deg, var(--card-2), var(--card)); overscroll-behavior: contain; }
.ai-empty { margin: auto 0; text-align: center; padding: 1rem .5rem; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.ai-empty strong { font-size: 1.05rem; color: var(--text); }
.ai-empty p { margin: 0; font-size: .9rem; color: var(--muted); max-width: 290px; }
.ai-empty .ai-off { color: var(--amber-fg); background: var(--amber-bg); border: 1px solid #f0d9a2; border-radius: 12px; padding: .75rem .9rem; max-width: 320px; margin-top: .5rem; font-size: .88rem; line-height: 1.7; }
.ai-empty-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: var(--gold); background: var(--gold-soft); margin-bottom: .3rem; }
.ai-msg { max-width: 88%; padding: .6rem .85rem; border-radius: 16px; font-size: .92rem; line-height: 1.7; overflow-wrap: anywhere; white-space: normal; }
.ai-msg.user { align-self: flex-start; background: var(--primary); color: #fff; border-start-start-radius: 5px; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-end; background: var(--card); border: 1px solid var(--line); color: var(--text); border-start-end-radius: 5px; box-shadow: var(--shadow-1); }
.ai-msg.bot.error { background: var(--red-bg); border-color: #f0c2bd; color: var(--red-fg); }
.ai-msg p { margin: 0 0 .5rem; } .ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: .2rem 0 .5rem; padding-inline-start: 1.2rem; }
.ai-msg ul:last-child, .ai-msg ol:last-child { margin-bottom: 0; }
.ai-msg li { margin-bottom: .15rem; }
.ai-msg .ai-h { font-weight: 700; color: var(--gold-ink); }
.ai-msg a { font-weight: 700; color: var(--link); text-decoration: underline; text-decoration-color: rgba(31, 79, 138, .35); }
.ai-typing { align-self: flex-end; display: inline-flex; gap: 4px; padding: .7rem .9rem; border-radius: 16px; border-start-end-radius: 5px; background: var(--card); border: 1px solid var(--line); }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: ai-dot 1.2s infinite ease-in-out; }
.ai-typing span:nth-child(2) { animation-delay: .15s; } .ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.ai-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .8rem 0; flex: none; }
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chips button { flex: 0 1 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line-2); background: var(--card); color: var(--text-2); font: 500 .8rem var(--font); padding: .35rem .75rem; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.ai-chips button:hover { border-color: var(--gold); color: var(--gold-ink); background: var(--gold-soft); }
.ai-form { display: flex; align-items: flex-end; gap: .5rem; padding: .7rem .8rem .3rem; flex: none; }
.ai-form textarea { resize: none; min-height: 44px; max-height: 160px; border-radius: 14px; padding: .6rem .8rem; line-height: 1.5; background: var(--card-2); }
.ai-send { flex: none; width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, var(--primary-hi), var(--primary)); }
.ai-send svg { transform: scaleX(-1); }
.ai-send:hover { background: var(--primary-2); }
.ai-send:disabled { opacity: .5; cursor: wait; }
.ai-foot { margin: 0; padding: .1rem 1rem .6rem; font-size: .72rem; color: var(--muted); text-align: center; flex: none; }

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 960px) {
  .topbar { position: sticky; top: 0; inset-block-end: auto; width: auto; height: auto; flex-direction: column; border-inline-end: 0; border-bottom: 1px solid rgba(var(--gold-rgb), .3); background: linear-gradient(180deg, var(--nav-bg-2), var(--nav-bg)); }
  .topbar::after { display: none; }
  .topbar-head { padding: .65rem 1rem; }
  .logo { width: 36px; height: 36px; font-size: 1.25rem; border-radius: 10px; }
  .nav-toggle { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid rgba(var(--nav-tint-rgb), .14); background: rgba(var(--nav-tint-rgb), .05); color: var(--nav-strong); cursor: pointer; }
  .navbody { display: none; max-height: calc(100vh - 62px); overflow-y: auto; border-top: 1px solid rgba(var(--nav-tint-rgb), .08); }
  body.nav-open .navbody { display: flex; }
  .topbar nav { padding: .4rem .8rem; overflow: visible; }
  .navlabel { padding-top: .6rem; }
  body.has-nav main { margin-inline-start: 0; padding-inline: 1rem; }
  main { padding: 1.25rem 1rem 6rem; }
  .topbar .me .link span { display: inline; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1.1rem 1rem; border-radius: 14px; }
  .pagehead { align-items: stretch; }
  .pagehead > .actions { width: 100%; }
  .actions select { min-width: 0; flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .kpi { padding: .85rem .9rem; border-radius: 14px; }
  .kpi-value { font-size: 1.6rem; }
  .kpi-label { font-size: .78rem; }
  dl.info { grid-template-columns: minmax(0, 1fr); }
  dl.info dt { border-bottom: 0; padding-bottom: 0; }
  th, td { padding: .6rem .7rem; }
  .tablewrap { max-height: none; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .filter-actions { grid-column: 1 / -1; }
  .tablewrap table:not(.grid) { min-width: 620px; }
  .card > table, main > table { display: block; overflow-x: auto; max-width: 100%; }
  .card > table td, .card > table th { min-width: 5.5rem; }
  .login { padding: 1.6rem 1.2rem 1.2rem; }
  .ai-fab { left: .9rem; bottom: .9rem; width: 50px; height: 50px; }
  .ai-fab svg { width: 21px; height: 21px; }
  .ai-panel { inset: 0; width: auto; max-width: none; height: auto; border-radius: 0; border: 0; }
  body.ai-open { overflow: hidden; }
  .ai-msg { max-width: 92%; }
  .ai-new span { display: none; }
}

/* ---------- طباعة ---------- */
.print-meta { display: none; }
@page { size: A4 landscape; margin: 10mm; }
@media print {
  .topbar, .actions, .filters, details.action, .upload, form, .ai-fab, .ai-panel, .nav-toggle, .print-btn, .navbody, .me { display: none !important; }
  .print-meta { display: block; font-size: 10pt; color: #333; margin: 0 0 8px; }
  html, body { font-size: 10pt; }
  main, .card, .tablewrap { max-width: none !important; width: auto !important; }
  table { width: 100% !important; min-width: 0 !important; table-layout: auto; }
  th, td { white-space: normal !important; padding: 4px 6px !important; }
  .grid, .kpis { gap: 8px !important; }
  body, body.no-nav { background: #fff; color: #000; }
  body.has-nav main { margin: 0; padding: 0; }
  .card, .tablewrap, .kpi, .stages { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .tablewrap { max-height: none; overflow: visible; }
  thead th { position: static; }
  .kpi::after { display: none; }
  .stages li.current .dot { animation: none; }
  a { color: #000; }
}

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

/* ---------- الوضع الداكن ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c1320; --bg-2: #141e2e; --card: #121b2a; --card-2: #162133;
    --text: #e8e4da; --text-2: #c3c9d4; --muted: #8e98a8; --line: #233046; --line-2: #2e3d55;
    --primary: #2f5c96; --primary-2: #264d80; --link: #8fb6ec;
    --gold-soft: rgba(var(--gold-rgb), .14); --gold-ink: #dcbd7c;
    --gray-bg: #232d3d; --gray-fg: #b5bdca;
    --blue-bg: rgba(59, 116, 196, .2); --blue-fg: #9cc2f5;
    --amber-bg: rgba(216, 160, 43, .18); --amber-fg: #f0c66b;
    --orange-bg: rgba(224, 116, 52, .18); --orange-fg: #f5a576;
    --red-bg: rgba(208, 71, 60, .18); --red-fg: #f4958c;
    --green-bg: rgba(31, 154, 100, .18); --green-fg: #74d3a5;
    --purple-bg: rgba(122, 91, 208, .22); --purple-fg: #c1aef5;
    --danger: #f08479; --warn: #e9b35a; --ok: #6fd0a2;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -10px rgba(0, 0, 0, .5);
  }
  :root { --thead-bg: #172234; --row-hover: #172235; }
  tbody tr:hover { background: var(--row-hover); }
  input:hover, select:hover, textarea:hover { border-color: #46587a; }
  .btn:hover { background: var(--card-2); }
  .flash.success { background: rgba(31, 154, 100, .12); border-color: rgba(31, 154, 100, .35); color: #9be2bf; }
  .flash.error { background: rgba(208, 71, 60, .12); border-color: rgba(208, 71, 60, .35); color: #f6b0a9; }
  .flash.info { background: rgba(59, 116, 196, .12); border-color: rgba(59, 116, 196, .35); color: #b5d0f5; }
  .card-highlight { background: linear-gradient(180deg, rgba(122, 91, 208, .12), var(--card) 45%); }
  table.diff tr.changed { background: rgba(var(--gold-rgb), .07); }
  table.diff .old { color: #f08f86; }
  .ai-empty .ai-off { border-color: rgba(216, 160, 43, .35); }
  .tabs a:hover { background: rgba(255, 255, 255, .05); }
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e98a8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
  .ai-fab { box-shadow: 0 10px 28px -8px rgba(0, 0, 0, .7), 0 0 0 4px rgba(var(--gold-rgb), .15); }
}

/* ---------- أزرار الانتظار ---------- */
.is-busy { pointer-events: none; cursor: wait; }
.btn.is-busy, button.is-busy { opacity: .85 !important; }
.is-busy::before { content: ""; display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; vertical-align: -.15em; margin-inline-end: .45rem; flex: none; }
.btn.is-busy::before { margin-inline-end: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ملاحظة المساعد ---------- */
.card.ai-note { position: relative; border-color: rgba(180, 138, 60, .35); border-inline-start: 4px solid var(--gold); padding-inline-start: 3.6rem;
  background: linear-gradient(100deg, var(--gold-soft) 0%, var(--card) 55%); }
.card.ai-note::before { content: ""; position: absolute; inset-inline-start: 1.1rem; top: 1.25rem; width: 1.6rem; height: 1.6rem; border-radius: 8px;
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l1.7 5.3L19 10l-5.3 1.7L12 17l-1.7-5.3L5 10l5.3-1.7z' fill='%23fff'/%3E%3C/svg%3E") center / 1rem no-repeat;
  box-shadow: 0 4px 10px -4px rgba(180, 138, 60, .8); }
.card.ai-note h2, .card.ai-note h3 { color: var(--gold-ink); margin-top: 0; }
.card.ai-note > :last-child { margin-bottom: 0; }

/* ---------- إجراء غير متاح ---------- */
.action.denied { display: flex; align-items: center; gap: .3rem .7rem; flex-wrap: wrap; margin-bottom: .55rem; }
.action.denied .btn, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; box-shadow: none; background: var(--bg-2); border-style: dashed; color: var(--muted); }
.action.denied > :not(.btn) { font-size: .82rem; color: var(--muted); }

/* مرحلة اختيارية تم تخطيها */
.stages li.skipped { opacity: .55; }
.stages li.skipped .dot { border-style: dashed; background: repeating-linear-gradient(45deg, var(--card), var(--card) 3px, var(--bg-2) 3px, var(--bg-2) 6px); }
.stages li.skipped .st-label { text-decoration: line-through; text-decoration-color: var(--line-2); font-style: normal; }
.stages li.skipped::before { background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 10px); }
@media (max-width: 760px) { .stages li.skipped::before { background: repeating-linear-gradient(180deg, var(--line-2) 0 6px, transparent 6px 10px); } }

.app-ver { display: block; text-align: center; color: rgba(255,255,255,.5); font-size: 11px; margin-top: 8px; }

.invoice-problems h3 { margin: 0 0 .5rem; }
.invoice-problems ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.invoice-problems li { padding: .55rem .75rem; border-radius: 10px; line-height: 1.6; }
.invoice-problems li.danger { background: rgba(220, 38, 38, .08); color: #991b1b; }
.invoice-problems li.warn { background: rgba(217, 119, 6, .09); color: #92400e; }
.invoice-problems li.info { background: rgba(37, 99, 235, .07); color: #1e3a8a; }
.invoice-problems.ok p { margin: 0; color: #166534; }
@media (prefers-color-scheme: dark) {
  .invoice-problems li.danger { color: #fca5a5; } .invoice-problems li.warn { color: #fcd34d; } .invoice-problems li.info { color: #93c5fd; } .invoice-problems.ok p { color: #86efac; }
}

input.was-changed { background: rgba(234, 179, 8, .14); border-color: #d4a017; }
label small.was { display: block; color: var(--muted); font-weight: 400; margin-top: .2rem; }
.from-invoice-box { border-style: dashed; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- تقرير كلفة الصرف حسب القناة ---------- */
.ok-text { color: var(--ok); }
.cc-sub { margin: .3rem 0 0; }
.cc-summary { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.2rem; margin-bottom: 1.25rem; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--ok); box-shadow: var(--shadow-2); }
.cc-summary.is-extra { border-inline-start-color: var(--danger); }
.cc-summary strong { font-size: 1.05rem; line-height: 1.6; }
.cc-kpi { font-size: 1.6rem; text-align: start; }
.cc-table tfoot th, .cc-table tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 700; background: var(--card-2); }
.cc-table td .badge { margin-top: .3rem; }
.cc-months thead th.cc-group { text-align: center; border-inline-start: 1px solid var(--line); }
.cc-months thead tr + tr th { top: 2.3rem; }
.cc-months thead th.cc-sub-th { font-weight: 500; font-size: .74rem; }
.cc-months tbody th { white-space: nowrap; }
.cc-table tbody > tr > :first-child, .cc-table tfoot > tr > :first-child { min-width: 9.5rem; }
@media (max-width: 640px) {
  .cc-summary { padding: .85rem .95rem; }
  .cc-summary strong { font-size: .98rem; }
  .cc-kpi { font-size: 1.25rem; }
  .cc-kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ختم الشركة والتوقيع */
.seal-card h3 { margin-top: 0; }
.seal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.seal-slot { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 12px; border: 1px dashed var(--line, #d6d9e0); border-radius: 10px; }
.seal-slot img, .seal-preview img { width: auto; height: auto; max-width: 100%; max-height: 140px; object-fit: contain; align-self: flex-start; background: repeating-conic-gradient(#f2f2f2 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: 6px; }
.seal-empty { color: var(--muted, #888); font-size: .9em; padding: 24px 0; }
.seal-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.seal-note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seal-note img { max-height: 56px; background: #fff; border-radius: 4px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .3rem 1rem; margin-bottom: 1rem; }
.custom-checks label.check { margin: .25rem 0; }

.outlook-tip { margin-top: 8px; }
.outlook-tip ol { margin: 6px 0; padding-inline-start: 20px; }

/* التقرير الشامل */
tr.total-row td { font-weight: 700; background: var(--gold-bg, #f6f1e4); }
.all-total { font-size: 1.15rem; direction: ltr; unicode-bidi: plaintext; }
.report-detail td { vertical-align: top; }
@media print { .report-company { break-inside: auto; } .report-detail { font-size: 9pt; } }
.report-detail td.phases { min-width: 170px; } .report-detail .phases div { white-space: normal; line-height: 1.5; }
.report-detail td.small { white-space: normal; }
.report-detail td:nth-child(2) { min-width: 120px; }
.report-detail th, .report-detail td { padding: .6rem .6rem; font-size: .9rem; }
.report-detail .tag { white-space: nowrap; }
.report-detail td:nth-child(5) { min-width: 120px; }

/* دليل الاستخدام */
.guide-toc ol { columns: 2; column-gap: 2rem; margin: 0; padding-inline-start: 1.4rem; line-height: 2; }
.guide h2 { margin-top: 0; }
.guide h3 { margin: 1.4rem 0 .5rem; color: var(--text-2); }
.guide p, .guide li, .guide dd { line-height: 1.9; }
.guide .steps { padding-inline-start: 1.4rem; }
.guide .steps li { margin-bottom: .35rem; }
.guide-shot { margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.guide-shot img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: cover; object-position: top; }
.guide-shot figcaption { padding: .45rem .8rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--card-2, #faf8f3); }
.guide-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1rem; align-items: start; }
.guide-pair .guide-shot { margin: 0; }
.guide-phones { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 220px)); gap: 1rem; justify-content: start; }
.guide-phones .guide-shot img { max-height: 480px; }
.faq dt { font-weight: 700; margin-top: .9rem; }
.faq dd { margin: .2rem 0 0; color: var(--text-2); }
@media (max-width: 700px) { .guide-toc ol { columns: 1; } }
@media print {
  .guide-toc ol { columns: 2; }
  .guide { break-inside: auto; }
  .guide-shot { break-inside: avoid; }
  .guide-shot img { max-height: 420px; }
  .guide-pair { grid-template-columns: 1fr 1fr; }
  .guide-phones { grid-template-columns: repeat(3, 1fr); }
}
#email-form label.check { flex-wrap: wrap; } #email-form label.check bdi { white-space: normal; overflow-wrap: anywhere; }
.card.danger-zone { border-color: #eab3ad; }
.card.danger-zone h2 { color: var(--danger); }
.nav-count { background: var(--gold, #e9c46a); color: #14213d; margin-inline-start: auto; }
.colgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .15rem 1rem; margin: .6rem 0; }
.filter-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin: .6rem 0; }
.filter-groups fieldset { margin: 0; }
.custom-report details { margin-bottom: .8rem; }
.custom-report summary { cursor: pointer; padding: .3rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .8rem; border: 1px solid var(--line, #ddd); border-radius: 99px; background: var(--bg-2); }
.report-table tfoot td { font-weight: 700; background: var(--bg-2); }
@media print { .no-print { display: none !important; } }

/* محرر نماذج البنوك */
.tpl-editor { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.tpl-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.tpl-side label { display: flex; flex-direction: column; gap: 4px; }
.tpl-side .row { display: flex; gap: 8px; }
.tpl-side .row label { flex: 1; }
.tpl-props { border-top: 1px solid var(--line, #ddd); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tpl-props h3 { margin: 0; font-size: 15px; }
.tpl-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-pages { display: flex; flex-direction: column; gap: 18px; direction: ltr; }
.tpl-page { position: relative; width: 100%; max-width: 1000px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); touch-action: none; user-select: none; }
.tpl-page img { width: 100%; height: 100%; display: block; pointer-events: auto; }
.tpl-box { position: absolute; border: 1.5px solid #1d6fd8; background: rgba(29,111,216,.12); cursor: move; box-sizing: border-box; overflow: hidden; outline: none; }
.tpl-box span { position: absolute; inset: 0; font: 11px/1.1 system-ui, sans-serif; color: #0b3d91; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: right; pointer-events: none; }
.tpl-box.seal { border-color: #b4532a; background: rgba(180,83,42,.12); }
.tpl-box.seal span { color: #8a3a17; }
.tpl-box.on { border-color: #e0a100; background: rgba(224,161,0,.22); z-index: 2; }
.tpl-handle { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; background: #1d6fd8; cursor: nwse-resize; }
.tpl-box.on .tpl-handle { background: #e0a100; }
tr.dim { opacity: .55; }
@media (max-width: 860px) { .tpl-editor { grid-template-columns: 1fr; } .tpl-side { position: static; } }

/* ---------- 1.2: الاعتمادات والقروض ---------- */
.fin-tabs { margin-bottom: 1.25rem; }
.fin-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 1.5rem; align-items: center;
  padding: 1.8rem 2rem; margin-bottom: 1.25rem; border-radius: var(--r-lg); color: var(--on-ink);
  background: radial-gradient(120% 140% at 100% 0%, var(--hero-glow) 0%, var(--ink-2) 45%, var(--ink) 100%); box-shadow: var(--shadow-3); border: 1px solid rgba(var(--gold-rgb), .35); }
.fin-hero::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold)); }
.fin-hero::after { content: ""; position: absolute; inset-inline-start: -80px; bottom: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--gold-rgb), .18), transparent 70%); pointer-events: none; }
.fin-hero-main { display: flex; flex-direction: column; gap: .3rem; position: relative; z-index: 1; }
.fin-hero-label { color: var(--gold-2); font-weight: 700; font-size: .9rem; letter-spacing: .02em; }
.fin-hero-value { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: #fff; direction: ltr; text-align: end; unicode-bidi: isolate; }
[dir=rtl] .fin-hero-value { text-align: right; }
.fin-hero-value small { font-size: .55em; color: var(--gold-2); margin-inline-end: .15em; }
.fin-hero-sub { color: var(--on-ink-muted); font-size: .82rem; }
.fin-hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; position: relative; z-index: 1; }
.fin-hero-stats a { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; border-radius: var(--r); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: var(--on-ink); transition: background .15s, transform .15s; }
.fin-hero-stats a:hover { background: rgba(255, 255, 255, .11); transform: translateY(-2px); text-decoration: none; }
.fin-hero-stats a.hot { border-color: rgba(255, 120, 100, .6); background: rgba(180, 35, 24, .22); }
.fin-hero-stats b { font-size: 1.3rem; color: #fff; font-variant-numeric: tabular-nums; }
.fin-hero-stats span { font-size: .85rem; }
.fin-hero-stats small { font-size: .75rem; color: var(--on-ink-muted); }
@media (max-width: 1100px) { .fin-hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .fin-hero { padding: 1.3rem 1.1rem; } .fin-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .kpi-value.small-val { font-size: 1.45rem; }
.kpi.tone-orange { --tone: #d0662a; --tone-bg: var(--orange-bg); }
.fin-cols { margin-bottom: 1.25rem; }
.legend { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-start: .5rem; }
.lg-lc, .fc-lc { background: linear-gradient(180deg, #3b74c4, #1b3a63); }
.lg-loan, .fc-loan { background: linear-gradient(180deg, #e2bf73, #b48a3c); }
.fin-chart { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: .45rem; align-items: end; height: 240px; padding: .5rem 0 0; border-bottom: 1px solid var(--line); }
.fc-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.fc-amt { font-size: .68rem; color: var(--muted); margin-bottom: .2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc-stack { width: 100%; max-width: 38px; min-height: 0; display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; box-shadow: 0 4px 10px -6px rgba(15, 27, 45, .5); }
.fc-stack i { display: block; min-height: 2px; }
.fc-label { font-size: .7rem; color: var(--text-2); margin-top: .35rem; text-align: center; line-height: 1.2; white-space: nowrap; }
.fc-label small { display: block; color: var(--muted); font-size: .65rem; }
.fc-col.late .fc-stack i { background: linear-gradient(180deg, #e0574a, #a11d14); }
.fc-col.late .fc-label { color: var(--danger); font-weight: 700; }
@media (max-width: 640px) { .fin-chart { gap: .15rem; height: 200px; } .fc-amt { display: none; } .fc-label { font-size: .58rem; } }
.fin-alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; max-height: 320px; overflow: auto; }
.fin-alerts li { padding: .5rem .75rem; border-radius: var(--r-sm); font-size: .86rem; border-inline-start: 3px solid; }
.fin-alerts li a { color: inherit; }
.fin-alerts li.danger { background: var(--red-bg); color: var(--red-fg); border-color: var(--danger); }
.fin-alerts li.warn { background: var(--amber-bg); color: var(--amber-fg); border-color: #d59a19; }
.fin-alerts li.info { background: var(--blue-bg); color: var(--blue-fg); border-color: #3b74c4; }
.meter-cell { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; min-width: 150px; }
.meter { flex: 1; height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--primary)); }
.fin-bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.fb-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.fb-track { display: flex; height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-bottom: .25rem; }
.fb-track i { display: block; height: 100%; }
.fb-green { background: linear-gradient(90deg, #2fa36b, #0f7a4f); }
.fb-amber { background: linear-gradient(90deg, #e9b543, #c07f0a); }
.fb-red { background: linear-gradient(90deg, #e0574a, #a11d14); }
.fin-table td.small { font-size: .8rem; }
tr.row-danger td { background: var(--red-bg); }
tr.row-warn td { background: var(--amber-bg); }
tr.group-row td { background: var(--card-2); color: var(--gold-ink); }
tr.total td { font-weight: 700; background: var(--card-2); }
.doc-actions { min-width: 180px; }
.doc-actions details.action { display: inline-block; margin: 0 .2rem .3rem 0; vertical-align: top; }
.popform { display: flex; flex-direction: column; gap: .2rem; padding: .8rem; margin-top: .4rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--card-2); min-width: 240px; box-shadow: var(--shadow-2); }
.popform.row { display: grid; }
.popform label { font-size: .82rem; }
.fin-pill { padding: .25rem .8rem; border-radius: 99px; background: var(--ink-2); color: var(--gold-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .6rem; }
.timeline-list li { padding: .5rem .8rem; border-inline-start: 3px solid var(--gold-2); background: var(--card-2); border-radius: var(--r-sm); }
.report-company { break-inside: avoid; }
@media (prefers-color-scheme: dark) {
  tr.row-danger td { background: rgba(180, 35, 24, .16); }
  tr.row-warn td { background: rgba(213, 154, 25, .12); }
  .fin-alerts li.danger { background: rgba(180, 35, 24, .16); color: #f3b4ad; }
  .fin-alerts li.warn { background: rgba(213, 154, 25, .14); color: #f2d08a; }
  .fin-alerts li.info { background: rgba(59, 116, 196, .14); color: #b5d0f5; }
}
@media print {
  .fin-hero { background: none; color: #000; box-shadow: none; border: 1px solid #999; }
  .fin-hero-value, .fin-hero-stats b, .fin-hero-stats a { color: #000; }
  .fin-tabs, .doc-actions details, .popform { display: none !important; }
}
/* 1.2.1: السقوف والمتبقي */
.fac-groups { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 1rem; }
.fac-group h3 { margin: 0 0 .6rem; }
.fac-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: .9rem; }
.fac-card { border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; background: var(--card-2); display: flex; flex-direction: column; gap: .35rem; }
.fac-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.fac-left small { display: block; color: var(--muted); font-size: .78rem; }
.fac-left b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }

/* قرض بين شركات المجموعة */
.ic-banner { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; justify-content: space-between; border-inline-start: 4px solid var(--gold); background: linear-gradient(90deg, var(--gold-soft), var(--card) 70%); }
.ic-flow { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.ic-node { display: flex; flex-direction: column; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); min-width: 150px; }
.ic-node small, .ic-sum small { color: var(--muted); font-size: .78rem; }
.ic-node strong { font-size: 1.02rem; }
.ic-arrow { display: flex; flex-direction: column; align-items: center; color: var(--gold-ink); font-size: .72rem; line-height: 1.1; }
.ic-arrow b { font-size: 1.4rem; }
.ic-sum { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.ic-sum > div { display: flex; flex-direction: column; }
.ic-sum strong { font-size: 1.25rem; }

/* التقرير التنفيذي */
:root { --c-undrawn: #2a78d6; --c-deferred: #1baf7a; --c-loans: #c98500; --c-seq: #2a78d6; --c-late: #d03b3b; --track: var(--bg-2); }
@media (prefers-color-scheme: dark) { :root { --c-undrawn: #3987e5; --c-deferred: #199e70; --c-loans: #c98500; --c-seq: #3987e5; --track: rgba(255, 255, 255, .07); } }
.sw-undrawn { background: var(--c-undrawn); } .sw-deferred { background: var(--c-deferred); } .sw-loans { background: var(--c-loans); }
.sw-seq { background: var(--c-seq); } .sw-late { background: var(--c-late); }
.exec-hero { display: grid; grid-template-columns: minmax(240px, 1fr) 2.2fr; gap: 1px; background: var(--ink-3); border-radius: var(--r-lg); overflow: hidden; margin: 0 0 1rem; box-shadow: var(--shadow-3); }
.exec-hero > div { background: linear-gradient(160deg, var(--ink), var(--ink-2)); color: var(--on-ink); }
.exec-hero-main { padding: 1.4rem 1.6rem; display: flex; flex-direction: column; justify-content: center; gap: .25rem; position: relative; }
.exec-hero-main::before { content: ""; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.exec-hero-main span { color: var(--gold-2); font-size: .9rem; }
.exec-hero-main strong { font-size: 2.3rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
.exec-hero-main small { color: var(--on-ink-muted); }
.exec-hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--ink-3) !important; }
.exec-hero-grid > div { background: linear-gradient(160deg, var(--ink), var(--ink-2)); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.exec-hero-grid span { color: var(--on-ink-muted); font-size: .78rem; }
.exec-hero-grid b { font-size: 1.25rem; font-variant-numeric: tabular-nums; color: #fff; }
.exec-hero-grid em { font-style: normal; font-size: .72rem; color: var(--gold-2); }
.exec-hero-grid .is-late b { color: #ff8a80; }
.exec-legend { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: 0 0 .7rem; font-size: .82rem; color: var(--text-2); }
.exec-legend.inline { margin: 0; }
.exec-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.exec-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.exec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.exec-grid > .card { margin: 0 0 1rem; }
.exec-card h2 { font-size: 1.05rem; }
.hbars { display: flex; flex-direction: column; gap: .7rem; }
.hbar { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: .8rem; align-items: center; }
.hbar-label { display: flex; flex-direction: column; min-width: 0; }
.hbar-label strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label small { color: var(--muted); font-size: .72rem; }
.hbar.late .hbar-label strong { color: var(--danger); }
.hbar-track { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.hbar-fill { display: flex; gap: 2px; height: 22px; min-width: 4px; }
.hbar-fill .seg, .vbar-stack .seg { display: block; min-width: 2px; min-height: 2px; position: relative; cursor: default; }
.hbar-fill .seg:first-child { border-start-start-radius: 4px; border-end-start-radius: 4px; }
.hbar-fill .seg:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }
.hbar-val { font-size: .82rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; }
.vbars { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: .5rem; height: 250px; align-items: end; border-bottom: 1px solid var(--line-2); padding-top: 1.2rem; }
.vbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.vbar-stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; gap: 2px; min-height: 0; flex-shrink: 1; }
.vbar-stack .seg:first-child { border-radius: 4px 4px 0 0; }
.vbar-val { font-size: .66rem; color: var(--text-2); margin-bottom: .25rem; white-space: nowrap; direction: ltr; font-variant-numeric: tabular-nums; }
.vbar-label { font-size: .7rem; color: var(--text-2); margin-top: .35rem; text-align: center; line-height: 1.2; white-space: nowrap; }
.vbar-label small { display: block; color: var(--muted); font-size: .62rem; }
.vbar.late .vbar-label { color: var(--danger); font-weight: 700; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; z-index: 30; bottom: calc(100% + 6px); inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; font-size: .75rem; padding: .35rem .55rem; border-radius: 6px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-2); }
.hbar-fill .seg:hover, .vbar-stack .seg:hover { filter: brightness(1.1); outline: 2px solid var(--card); }
.exec-meters { display: grid; gap: .8rem; }
.exec-meter .em-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; }
.exec-meter .em-head span { color: var(--muted); font-size: .78rem; }
.em-bar { position: relative; height: 10px; border-radius: 6px; background: var(--track); margin: .35rem 0; }
.em-bar i { display: block; height: 100%; border-radius: 6px; background: var(--c-seq); }
.exec-meter.high .em-bar i { background: var(--c-loans); }
.exec-meter.over .em-bar i { background: var(--c-late); }
.em-foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-2); }
.exec-meter.over .em-foot { color: var(--danger); }
.ic-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.ic-pair { border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; background: linear-gradient(160deg, var(--gold-soft), var(--card) 65%); display: flex; flex-direction: column; gap: .3rem; }
.ic-names { display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; }
.ic-names span { color: var(--muted); font-size: .8rem; }
.ic-amt b { font-size: 1.1rem; display: block; }
.ic-amt small { color: var(--muted); }
.ic-late { color: var(--danger); font-size: .85rem; font-weight: 600; }
.exec-chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.exec-chip { display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--card-2); }
.exec-chip b { font-size: 1.05rem; }
.exec-list { margin: 0; padding-inline-start: 1.1rem; line-height: 1.9; font-size: .9rem; }
@media (max-width: 900px) { .exec-grid { grid-template-columns: 1fr; } .exec-hero { grid-template-columns: 1fr; } .exec-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .vbars { gap: .15rem; height: 200px; } .vbar-val { display: none; } .vbar-label { font-size: .56rem; } .hbar { grid-template-columns: 1fr; gap: .25rem; } .exec-hero-main strong { font-size: 1.8rem; } }
@media print {
  .exec-hero { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .seg, .sw, .em-bar i, .exec-hero > div, .exec-hero-grid > div, .ic-pair { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .exec-grid { grid-template-columns: 1fr 1fr; }
  .exec-card { break-inside: avoid; }
  [data-tip]:hover::after { display: none; }
}
.vbar-plot { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.nowrap { white-space: nowrap; }
.tag-warn { background: #fdf1d8; color: #8a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag-warn { background: #3a2e12; color: #f0c870; } }
:root[data-theme="dark"] .tag-warn { background: #3a2e12; color: #f0c870; }

/* 1.2.9: ملف بيغطي أكتر من مستند */
.gold-ink { color: var(--gold-ink); }
details.covers { margin: .25rem 0 .1rem; }
details.covers summary { cursor: pointer; color: var(--gold-ink); }
details.covers .check-grid { margin: .4rem 0 .2rem; }

/* ==========================================================================
   أشكال البرنامج (الإعدادات ← المظهر). الافتراضي "كلاسيكي" = كحلي وذهبي فوق.
   ========================================================================== */
html[data-palette="emerald"] {
  --bg: #f2f4ef; --bg-2: #e8ece3; --card-2: #f8faf6; --line: #dde3d6; --line-2: #cdd5c4;
  --ink: #0b241d; --ink-2: #103026; --ink-3: #1a4436; --on-ink: #e5eee8; --on-ink-muted: #94aea3;
  --gold: #a9853f; --gold-2: #cba660; --gold-soft: #f1ead8; --gold-ink: #6f541c; --gold-rgb: 203, 166, 96; --gold-light: #e6cf98;
  --primary: #15573f; --primary-2: #0e4331; --primary-hi: #1c6b4f; --primary-hi-2: #175d44; --primary-rgb: 14, 67, 49; --link: #12704d;
  --focus: rgba(169, 133, 63, .45); --hero-glow: #1f5a45; --nav-glow: #18402f;
  --thead-bg: #f3f6f0; --row-hover: #f7faf4; --login-1: #10352a; --login-2: #071712; --login-3: rgba(26, 68, 54, .9);
  --text: #15201b;
}
html[data-palette="modern"] {
  --bg: #f4f6fb; --bg-2: #eceff6; --card-2: #f8f9fc; --line: #e3e7ef; --line-2: #d3d9e4;
  --ink: #1e1b4b; --ink-2: #27235f; --ink-3: #363183; --on-ink: #eceafd; --on-ink-muted: #a9a6d6;
  --gold: #0d9488; --gold-2: #14b8a6; --gold-soft: #d5f5ef; --gold-ink: #0f766e; --gold-rgb: 20, 184, 166; --gold-light: #5eead4;
  --primary: #4338ca; --primary-2: #3730a3; --primary-hi: #5148e0; --primary-hi-2: #4339c8; --primary-rgb: 55, 48, 163; --link: #4338ca;
  --focus: rgba(79, 70, 229, .4); --hero-glow: #4c45b8;
  --thead-bg: #f6f7fb; --row-hover: #f8f9fd; --login-1: #2b2672; --login-2: #14123a; --login-3: rgba(13, 148, 136, .45);
  --text: #111827; --text-2: #374151; --muted: #6b7280;
  --nav-bg: #ffffff; --nav-bg-2: #fbfcfe; --nav-glow: rgba(99, 102, 241, .08); --nav-avatar: #eef0fb;
  --nav-text: #4b5563; --nav-text-2: #1f2937; --nav-strong: #111827; --nav-muted: #8a93a3; --nav-tint-rgb: 17, 24, 39;
  --r: 10px; --r-lg: 14px;
}
html[data-palette="modern"] .topbar { box-shadow: 1px 0 0 var(--line), 8px 0 30px -20px rgba(17, 24, 39, .25); }
html[data-palette="modern"] .topbar nav a.on { background: #eef0fd; color: var(--primary); }
html[data-palette="modern"] .topbar nav a.on svg { color: var(--primary); }
html[data-palette="modern"] .topbar nav a.on::before { background: var(--primary); }
html[data-palette="modern"] .avatar { color: var(--primary); border-color: rgba(67, 56, 202, .25); }
html[data-palette="modern"] .brand-text small { color: var(--gold-ink); }
html[data-palette="modern"] .logo { color: #fff; }
html[data-palette="burgundy"] {
  --bg: #f6f1ee; --bg-2: #eee6e1; --card-2: #fbf8f6; --line: #e7ddd7; --line-2: #d9cbc3;
  --ink: #26101a; --ink-2: #341523; --ink-3: #4b1f31; --on-ink: #f2e6e4; --on-ink-muted: #b79da5;
  --primary: #7b1f38; --primary-2: #62182c; --primary-hi: #922a46; --primary-hi-2: #822440; --primary-rgb: 98, 24, 44; --link: #8a2442;
  --hero-glow: #6b2840; --nav-glow: #4f1d30;
  --thead-bg: #f8f3f0; --row-hover: #fbf7f5; --login-1: #3b1626; --login-2: #1a0a11; --login-3: rgba(75, 31, 49, .9);
  --text: #221419;
}
html[data-palette="graphite"] {
  --bg: #f3f3f2; --bg-2: #e9e9e7; --card-2: #f9f9f8; --line: #e1e1de; --line-2: #d0d0cc;
  --ink: #16171a; --ink-2: #1f2125; --ink-3: #2d3035; --on-ink: #ececea; --on-ink-muted: #9b9ea4;
  --gold: #d06d22; --gold-2: #f0883a; --gold-soft: #fdeadb; --gold-ink: #9a4810; --gold-rgb: 240, 136, 58; --gold-light: #f8b57e;
  --primary: #c45f19; --primary-2: #a34e14; --primary-hi: #dc7128; --primary-hi-2: #c86520; --primary-rgb: 163, 78, 20; --link: #b0531a;
  --focus: rgba(240, 136, 58, .45); --hero-glow: #3a3d44; --nav-glow: #2c2f35;
  --thead-bg: #f5f5f4; --row-hover: #f8f8f7; --login-1: #26282d; --login-2: #0f1012; --login-3: rgba(240, 136, 58, .25);
  --text: #18191b;
}
@media (prefers-color-scheme: dark) {
  html[data-palette="emerald"] { --bg: #08130f; --bg-2: #0f1f19; --card: #0e1c17; --card-2: #12241d; --line: #1d3329; --line-2: #284437; --text: #e4ebe6; --primary: #1f7a58; --primary-2: #1a6a4c; --primary-hi: #24885f; --primary-hi-2: #1f7a58; --link: #7fd1ad; --gold-soft: rgba(203, 166, 96, .14); --gold-ink: #dcc085; --thead-bg: #10221b; --row-hover: #12261e; }
  html[data-palette="modern"] { --bg: #0e1020; --bg-2: #161a2e; --card: #14172a; --card-2: #191d33; --line: #252a45; --line-2: #313757; --text: #e7e8f3; --text-2: #c4c7da; --muted: #9196b0; --primary: #5b52e8; --primary-2: #4c43d6; --primary-hi: #6a62f0; --primary-hi-2: #5b52e8; --link: #a5a0ff; --gold-soft: rgba(20, 184, 166, .15); --gold-ink: #5eead4; --thead-bg: #181c33; --row-hover: #1a1e36;
    --nav-bg: #12142a; --nav-bg-2: #171a33; --nav-glow: rgba(99, 102, 241, .15); --nav-avatar: #23264a; --nav-text: #b9bdd6; --nav-text-2: #e7e8f3; --nav-strong: #fff; --nav-muted: #8b90ad; --nav-tint-rgb: 255, 255, 255; }
  html[data-palette="modern"] .topbar nav a.on { background: rgba(99, 102, 241, .18); color: #fff; }
  html[data-palette="modern"] .topbar nav a.on svg { color: #a5a0ff; }
  html[data-palette="burgundy"] { --bg: #140a0e; --bg-2: #1f1016; --card: #1b0e13; --card-2: #22121a; --line: #351c26; --line-2: #472634; --text: #efe5e7; --primary: #9b2c4a; --primary-2: #86253f; --primary-hi: #ab3555; --primary-hi-2: #9b2c4a; --link: #f0a0b5; --gold-soft: rgba(207, 171, 98, .14); --gold-ink: #dcbd7c; --thead-bg: #24121a; --row-hover: #27141c; }
  html[data-palette="graphite"] { --bg: #0f1012; --bg-2: #18191c; --card: #16171a; --card-2: #1c1d21; --line: #2a2c31; --line-2: #36393f; --text: #ececea; --primary: #d06d22; --primary-2: #b85e1b; --primary-hi: #e07c30; --primary-hi-2: #d06d22; --link: #f6ad72; --gold-soft: rgba(240, 136, 58, .14); --gold-ink: #f6ad72; --thead-bg: #1d1e22; --row-hover: #202125; }
}
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; margin: 0 0 1rem; }
.palette-opt { position: relative; display: block; border: 2px solid var(--line); border-radius: var(--r); padding: .7rem; cursor: pointer; background: var(--card); transition: border-color .15s, box-shadow .15s; }
.palette-opt:hover { border-color: var(--line-2); }
.palette-opt input { position: absolute; opacity: 0; pointer-events: none; }
.palette-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.palette-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.palette-mini { display: grid; grid-template-columns: 30% 1fr; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); margin-bottom: .55rem; }
.palette-mini .pm-nav { display: flex; flex-direction: column; gap: 5px; padding: 8px 6px; }
.palette-mini .pm-nav i { display: block; height: 5px; border-radius: 3px; opacity: .55; }
.palette-mini .pm-nav i:first-child { width: 14px; height: 14px; border-radius: 4px; opacity: 1; margin-bottom: 3px; }
.palette-mini .pm-body { padding: 9px; display: flex; flex-direction: column; gap: 6px; }
.palette-mini .pm-card { flex: 1; border-radius: 5px; background: #fff; border: 1px solid rgba(0, 0, 0, .06); }
.palette-mini .pm-btn { width: 46%; height: 12px; border-radius: 4px; }
.palette-opt b { display: block; font-size: .95rem; }
.palette-opt small { color: var(--muted); font-size: .8rem; }

/* الطباعة: الجداول الطويلة بتكمل على الصفحة اللي بعدها، وكل الأعمدة بتبين */
@media print {
  .card:has(table), .tablewrap, .report-company, section:has(table) { break-inside: auto !important; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  body.print-wide { font-size: 8.5pt; }
  body.print-wide table { width: 100% !important; min-width: 0 !important; table-layout: auto; }
  body.print-wide th, body.print-wide td { min-width: 0 !important; max-width: none !important; padding: 3px 4px !important; font-size: 8pt !important; white-space: normal !important; overflow-wrap: break-word; }
  body.print-wide td.num, body.print-wide th.num { white-space: nowrap !important; overflow-wrap: normal; }
  body.print-wide .fin-table td.num, body.print-wide .fin-table td .num { white-space: normal !important; }
  body.print-wide .report-detail td.phases { min-width: 0 !important; }
  body.print-wide .report-detail .phases div, body.print-wide .nowrap-date { white-space: nowrap !important; }
  body.print-wide .tag, body.print-wide .badge { white-space: normal !important; font-size: 7.5pt; padding: 0 .35rem; }
  body.print-wide .badge::before { display: none; }
  body.print-wide .card { padding: 8px 10px; margin-bottom: 8px; border-radius: 6px; }
  body.print-wide .tablewrap { border: 0; }
  body.print-wide .fin-hero, body.print-wide .exec-hero { break-inside: avoid; }
}
.audit-confirm { border: 1px solid rgba(var(--gold-rgb), .55); background: var(--gold-soft); border-radius: var(--r); padding: .7rem .85rem; margin: .4rem 0 .7rem; }
.audit-confirm strong { display: block; color: var(--gold-ink); margin-bottom: .3rem; }
.audit-confirm label.check { align-items: flex-start; line-height: 1.7; }

/* بانتظار موافقتي */
.q-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 1.5rem; align-items: center; padding: 1.6rem 1.8rem; border-radius: var(--r-lg); margin-bottom: 1.1rem; color: var(--on-ink);
  background: radial-gradient(120% 140% at 100% 0%, var(--hero-glow) 0%, var(--ink-2) 45%, var(--ink) 100%); box-shadow: var(--shadow-3); border: 1px solid rgba(var(--gold-rgb), .35); }
.q-hero::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold)); }
.q-hero-main { display: flex; flex-direction: column; gap: .2rem; }
.q-hero-label { color: var(--gold-2); font-weight: 700; }
.q-hero-value { font-size: clamp(2.6rem, 5vw, 3.8rem); line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.q-hero-main small { color: var(--on-ink-muted); }
.q-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .7rem; }
.q-hero-stats div { display: flex; flex-direction: column; gap: .1rem; padding: .85rem 1rem; border-radius: var(--r); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.q-hero-stats b { font-size: 1.6rem; color: #fff; font-variant-numeric: tabular-nums; }
.q-hero-stats span { font-size: .82rem; color: var(--on-ink-muted); }
.q-hero-stats .ok { border-color: rgba(31, 154, 100, .55); background: rgba(31, 154, 100, .16); }
.q-hero-stats .hot { border-color: rgba(255, 120, 100, .6); background: rgba(180, 35, 24, .22); }
.q-next { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; margin-bottom: 1.1rem; border-radius: var(--r-lg); background: var(--card); border: 1px solid rgba(var(--gold-rgb), .5); box-shadow: 0 0 0 4px rgba(var(--gold-rgb), .1), var(--shadow-2); }
.q-next-text { display: flex; flex-direction: column; gap: .15rem; }
.q-next-label { color: var(--gold-ink); font-weight: 700; font-size: .85rem; }
.q-next-text strong { font-size: 1.25rem; }
.q-companies { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.q-co { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--text); transition: transform .15s, box-shadow .15s; }
.q-co:hover { transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-3); }
.q-co.clear { opacity: .75; }
.q-co-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.q-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--bg-2) 0); }
.q-ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: .72rem; font-weight: 700; }
.q-bar { height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #34c38f); border-radius: 99px; }
.q-co-nums { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); }
.q-co-nums b { font-size: 1.1rem; color: var(--text); }
.q-co-nums .ok b { color: var(--ok); }
.q-wait { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.q-wait.fresh { background: var(--green-bg); color: var(--green-fg); }
.q-wait.warm { background: var(--amber-bg); color: var(--amber-fg); }
.q-wait.late { background: var(--red-bg); color: var(--red-fg); }
tr.q-done { background: var(--green-bg) !important; }
.q-acts { white-space: nowrap; }
.ok-text { color: var(--ok); }
.q-empty { text-align: center; padding: 2.2rem 1rem; }
@media (max-width: 900px) { .q-hero { grid-template-columns: minmax(0, 1fr); } }
@media print { .q-acts, .q-next .actions { display: none !important; } .q-hero { background: none !important; color: #000; border: 1px solid #999; box-shadow: none; } .q-hero-value, .q-hero-stats b { color: #000 !important; } .q-hero-stats div { border-color: #bbb; background: none; } .q-hero-stats span, .q-hero-main small { color: #333; } }

/* 1.2.14: إيميلات البنك لكل شركة */
.bank-emails { margin: 0 0 18px; }
.bank-emails h3 { margin: 10px 0 6px; font-size: 15px; }
.bank-emails td input { width: 100%; min-width: 220px; }
.bank-emails .btn { margin-top: 8px; }

/* حوالة برو: شاشة أول تشغيل، الشعار، شريط الاشتراك */
.setup-wrap { width: 100%; max-width: 780px; margin: 24px auto; padding: 24px; background: var(--card); color: var(--text); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.setup-wrap > form.card { box-shadow: none; border: 0; padding: 0; background: transparent; }
@media (max-width: 600px) { .setup-wrap { padding: 16px; margin: 0; border-radius: 12px; } }
.setup-wrap .login-brand { margin-bottom: 18px; }
.setup-wrap h2 { margin-top: 22px; font-size: 1.05rem; }
.setup-wrap .checks { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 12px; }
.logo.logo-img { background: #fff; padding: 3px; overflow: hidden; }
.logo.logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sub-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; background: #fff6e0; color: #6b4a00; border: 1px solid #f0d58a; }
.sub-banner.ro { background: #fde8e8; color: #8a1c1c; border-color: #f3b4b4; }
.sub-banner a { color: inherit; font-weight: 700; }
.totp-qr { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; }
.totp-qr svg { width: 200px; height: 200px; display: block; }
.secret-code { font-family: ui-monospace, monospace; letter-spacing: 2px; word-break: break-all; }
@media (prefers-color-scheme: dark) {
  .sub-banner { background: #3a2f12; color: #f5dc9a; border-color: #6b5520; }
  .sub-banner.ro { background: #3d1616; color: #f6b4b4; border-color: #6e2a2a; }
}
