:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --ink: #141b2d;
  --ink-2: #525d73;
  --ink-3: #8590a5;
  --line: #e0e5ee;
  --brand: #2346d6;
  --brand-ink: #ffffff;
  --brand-soft: #e8eeff;
  --danger: #b4372f;
  --danger-soft: #fbe9e7;
  --warn: #9a6400;
  --warn-soft: #fbf1dc;
  --ok: #1f7a4a;
  --ok-soft: #e4f4ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
  color-scheme: light;
}
/* النظام أبيض دائمًا حتى لو الجهاز على الوضع الداكن (طلب المستخدم). الداكن متاح فقط لو انضبط data-theme="dark" صراحة */
:root[data-theme="dark"] {
  --bg: #0f131c; --surface: #161c28; --surface-2: #1e2533; --ink: #e7ebf3; --ink-2: #a8b1c2; --ink-3: #7b8496;
  --line: #2a3242; --brand: #7aa2ff; --brand-ink: #0a1230; --brand-soft: #1b2850;
  --danger: #f08178; --danger-soft: #3a2220; --warn: #e2b04a; --warn-soft: #362c18; --ok: #6fd09a; --ok-soft: #1b3326;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 "IBM Plex Sans Arabic", system-ui, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: left; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- التخطيط ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink-2); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* الهيكل: شريط علوي، وقائمة جانبية على اليمين، والمحتوى */
.shell {
  --side-w: 264px; --top-h: 58px;
  /* القائمة الجانبية بلون الهوية (أزرق وزنة)، والصفحة بيضاء */
  --side-bg: #2346d6; --side-2: #1d3cbf; --side-3: #1833a6; --side-ink: #ffffff; --side-dim: #c7d3ff;
  display: grid; min-height: 100vh;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "top top" "side main";
}
.shell.side-closed, .shell.no-side { grid-template-columns: 0 minmax(0, 1fr); }
.shell.side-closed .side, .shell.no-side .side { display: none; }

.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.top-btn { border: 0; background: transparent; color: var(--ink-2); padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.top-btn:hover { background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: block; flex: none; }
.top-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; background: var(--surface); white-space: nowrap; color: var(--ink); }
.chip.company { padding: 0; }
.chip.company select { border: 0; background: transparent; padding: 5px 10px; font-size: 13px; max-width: 220px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.side {
  grid-area: side; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h));
  overflow-y: auto; background: linear-gradient(180deg, #2a4fe0, var(--side-bg) 40%); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 12px 0 16px;
}
.side-search { padding: 0 12px 10px; display: block; }
.side-search input { background: rgba(255,255,255,.16); border-color: transparent; color: #fff; border-radius: 999px; padding: 7px 14px; }
.side-search input::placeholder { color: var(--side-dim); }
.side-search input:focus { outline: 2px solid rgba(255,255,255,.55); outline-offset: -1px; border-color: transparent; background: rgba(255,255,255,.22); }
.demo-note { margin: auto 16px 0; padding-top: 16px; font-size: 12px; color: var(--side-dim); }

/* القائمة المتداخلة */
#nav ul { list-style: none; margin: 0; padding: 0; }
#nav .m-li > ul { display: none; }
#nav .m-li.open > ul, #nav.searching .m-li.m-found > ul { display: block; }
#nav .m-hidden { display: none; }
.m-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  font: inherit; font-size: 14px; color: var(--side-ink); background: transparent; border: 0; cursor: pointer;
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.m-item:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.m-ico { width: 17px; height: 17px; fill: currentColor; flex: none; opacity: .9; }
.m-t { flex: 1; min-width: 0; }
.m-sign::before { content: "+"; font-weight: 700; font-size: 16px; line-height: 1; }
.m-li.open > .m-group > .m-sign::before, #nav.searching .m-found > .m-group > .m-sign::before { content: "−"; }
.m0 > .m-li > .m-item { font-weight: 600; }
.m1 { background: var(--side-2); }
.m1 > .m-li > .m-item { padding-inline-start: 30px; }
.m2 { background: var(--side-3); }
.m2 > .m-li > .m-item { padding-inline-start: 44px; font-size: 13.5px; }
.m3 > .m-li > .m-item { padding-inline-start: 58px; font-size: 13px; }
.m1 .m-item::before, .m2 .m-item::before { content: "‹"; color: var(--side-dim); font-size: 13px; }
.m-item.soon { color: var(--side-dim); }
.m-soon { font-size: 10.5px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 0 7px; color: var(--side-dim); }
.m-item.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: inset -4px 0 0 #f2a516; }
.m-item.active::before { color: var(--brand); }

.side-scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(10, 20, 16, .35); z-index: 14; }

.main { grid-area: main; min-width: 0; padding: 0 24px 48px; }
.view { max-width: 1240px; container-type: inline-size; }
.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; margin: 14px 0 16px; max-width: 1240px;
}
.crumbs a { color: var(--brand); }
.crumb-home { display: grid; place-items: center; }
.crumb-home .m-ico { width: 15px; height: 15px; fill: var(--brand); }
.crumb-sep { color: var(--ink-3); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .shell.side-closed { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(300px, 86vw); height: auto; z-index: 15; transform: translateX(100%); transition: transform .2s ease; }
  .shell.side-open .side { transform: none; }
  .shell.side-closed .side { display: flex; }
  .main { padding: 0 16px 40px; }
  .brand-name { display: none; }
  #fyChip .muted { display: none; }
  .chip.user span { display: none; }
}
@media (max-width: 520px) {
  #fyChip { display: none !important; }
  .chip.company select { max-width: 150px; }
}

/* شريط الأدوات في صفحات المستندات والبيانات */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tb-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tb-btn {
  font: inherit; font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  background: #33413b; color: #fff;
}
.tb-btn:hover { filter: brightness(1.15); text-decoration: none; }
.tb-btn.primary { background: var(--brand); }
.tb-btn.danger { background: var(--danger); }
.tb-btn.icon { padding: 6px 11px; font-size: 16px; line-height: 1; background: #33413b; }
.tb-btn.disabled { opacity: .35; cursor: default; filter: none; }
.tb-pos { font-size: 13px; color: var(--ink-2); padding: 0 6px; }
:root[data-theme="dark"] .tb-btn:not(.primary):not(.danger) { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-btn:not(.primary):not(.danger) { background: var(--surface-2); color: var(--ink); border-color: var(--line); } }

/* عنوان المستند وحقول الرأس بثلاثة أعمدة */
.doc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-title h1 { font-size: 19px; }
.fields-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; }
.fields-grid > div { display: grid; gap: 3px; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; min-width: 0; }
.fields-grid > div > span { font-size: 12px; color: var(--ink-3); }
.fields-grid > div > b { font-weight: 600; overflow-wrap: anywhere; }
.fields-grid > .wide { grid-column: span 2; }
@media (max-width: 760px) { .fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .fields-grid { grid-template-columns: 1fr; } .fields-grid > .wide { grid-column: auto; } }
.static { padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; min-height: 36px; }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; }

/* أقسام النماذج والتقارير */
.sec { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sec + .sec { margin-top: 14px; }
.sec-head { font-size: 14px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 9px 14px; border-inline-start: 4px solid var(--brand); margin: 0; }
.sec-body { padding: 14px; display: grid; gap: 12px; }
.form-page { display: grid; gap: 0; }
.form-page .form-err { margin-top: 12px; }
.report-opts { padding: 0; overflow: hidden; margin-bottom: 16px; }
.report-opts .sec-head { border-radius: 0; }
.opts-grid { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; padding: 14px; }
.opts-grid .field { min-width: 170px; }
.opts-grid .field.wide { flex: 1; min-width: 240px; }
.opts-actions { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* صفحة البيانات الرئيسية: شجرة ونموذج */
.master { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.master-tree { padding: 12px; position: sticky; top: calc(var(--top-h) + 12px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; }
.master-form { min-height: 200px; }
.tree-search { display: block; margin-bottom: 10px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-inline-start: 16px; display: none; }
.tree .t-li.open > ul, .tree.searching .t-found > ul { display: block; }
.tree .t-hidden { display: none; }
.t-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.t-row.sel { background: var(--brand-soft); }
.t-row.sel .t-link { color: var(--brand); font-weight: 600; }
.t-tog, .t-tog-sp { width: 22px; height: 22px; flex: none; }
.t-tog { border: 0; background: transparent; cursor: pointer; color: var(--ink-3); border-radius: 5px; }
.t-tog::before { content: "+"; font-weight: 700; }
.t-li.open > .t-row .t-tog::before, .tree.searching .t-found > .t-row .t-tog::before { content: "−"; }
.t-tog:hover { background: var(--surface-2); }
.t-link { display: flex; gap: 8px; align-items: baseline; padding: 4px 6px; color: var(--ink); font-size: 14px; flex: 1; min-width: 0; border-radius: 6px; }
.t-link:hover { background: var(--surface-2); text-decoration: none; }
.t-link.grp { font-weight: 600; }
.t-link.inactive { color: var(--ink-3); text-decoration: line-through; }
.t-link .code { font-size: 12px; }
.t-name { overflow-wrap: anywhere; }
.item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.item-list .t-link.sel { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.item-qty { margin-inline-start: auto; font-size: 12px; color: var(--ink-2); }
.item-qty.low { color: var(--danger); font-weight: 600; }
.inv-lines .desc-cell select[name="item"] { margin-bottom: 4px; font-size: 13px; }
@container (max-width: 720px) {
  .master { grid-template-columns: minmax(0, 1fr); }
  .master-tree { position: static; max-height: 360px; }
}

/* ---------- العناصر ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }

.btn {
  font: inherit; font-size: 14px; font-weight: 500; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { font: inherit; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { font: inherit; border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0; }
.link-btn.danger { color: var(--danger); }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input.num { text-align: left; }
input[type="checkbox"] { width: auto; accent-color: var(--brand); }
.field { display: grid; gap: 4px; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { width: auto; min-width: 150px; }
.filters .field.wide { flex: 1; min-width: 220px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.posted { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.reversed { background: var(--surface-2); color: var(--ink-2); }
.badge.off { background: var(--surface-2); color: var(--ink-3); }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--danger-soft); color: var(--danger); }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 600; font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.grp td { font-weight: 600; }
tr.sub td { font-weight: 600; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
tr.total td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--ink-3); }
tr.grand td { font-weight: 700; font-size: 15px; background: var(--brand-soft); color: var(--ink); }
tr.inactive td { color: var(--ink-3); }
tfoot td { font-weight: 700; background: var(--surface-2); }
.code { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dc { font-size: 11px; color: var(--ink-3); margin-inline-start: 4px; }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-2); }
.empty .actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------- لوحة المتابعة ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 13px; color: var(--ink-2); }
.kpi .k-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.kpi .k-note { font-size: 12px; color: var(--ink-3); }
.kpi.neg .k-value { color: var(--danger); }

/* ---------- نموذج القيد ---------- */
.entry-lines td { padding: 6px 6px; }
.entry-lines th { padding: 8px 6px; }
.entry-lines select[name="account"] { min-width: 200px; }
.entry-lines select[name="branch"] { min-width: 110px; }
.entry-lines input[name="desc"] { min-width: 130px; }
.entry-lines input.num { width: 115px; }
.entry-lines select[name="contact"] { display: block; margin-top: 4px; font-size: 12px; padding: 4px 8px; color: var(--ink-2); min-width: 200px; }
.entry-lines select[name="contact"][hidden] { display: none; }
/* مركز التكلفة الإلزامي (الحساب «يدعم مركز التكلفة»): يتلوّن لين يُختار */
.entry-lines select[name="cc"] { min-width: 150px; }
.entry-lines select[name="cc"][required] { border-color: var(--brand); }
.entry-lines select[name="cc"][required]:invalid { border-color: var(--danger); background: var(--danger-soft); }
.cc-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 14px 0 0; }
.cc-box legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.inv-lines .desc-cell { min-width: 230px; }
.inv-lines .desc-cell select { margin-top: 4px; font-size: 12px; padding: 4px 8px; color: var(--ink-2); }
.inv-lines input[name="qty"] { width: 80px; }
.inv-lines input[name="price"] { width: 105px; }
.inv-lines select[name="tax"] { width: 105px; }
.entry-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); }
.totals { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.totals b { font-variant-numeric: tabular-nums; }
.diff-ok { color: var(--ok); font-weight: 600; }
.diff-bad { color: var(--danger); font-weight: 600; }
.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.meta-list div span { display: block; font-size: 12px; color: var(--ink-3); }

.badge.due { background: var(--danger-soft); color: var(--danger); }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.tabs a:hover { text-decoration: none; background: var(--surface-2); }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.inline-field { display: flex; gap: 6px; align-items: end; }
.inline-field .field { flex: 1; }

/* ---------- الفاتورة ---------- */
.invoice-doc { display: grid; gap: 18px; }
.inv-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.inv-head .seller { display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.inv-head .seller h2 { color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.inv-title { display: flex; gap: 14px; align-items: flex-start; }
.inv-title .t { display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.inv-title h1 { color: var(--ink); margin-bottom: 4px; }
.qr { width: 120px; height: 120px; background: #fff; border-radius: 6px; padding: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
.party { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.party b { color: var(--ink); font-size: 15px; }
.inv-totals { margin-inline-start: auto; min-width: min(340px, 100%); display: grid; gap: 4px; }
.inv-totals div { display: flex; justify-content: space-between; gap: 18px; padding: 4px 0; }
.inv-totals .grand { border-top: 2px solid var(--ink-3); padding-top: 8px; font-weight: 700; font-size: 16px; }
input.bad { border-color: var(--danger); outline-color: var(--danger); }
.perm-list { display: grid; gap: 2px; max-height: 52vh; overflow-y: auto; padding-inline-end: 4px; }
.perm-grp { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-top: 10px; }
.perm-row { justify-content: space-between; padding: 6px 8px; border-radius: 6px; }
.perm-row:hover { background: var(--surface-2); }
.perm-row > span:first-of-type { flex: 1; }
button.chip { font: inherit; cursor: pointer; }
button.chip:hover { border-color: var(--brand); }
/* القائمة بمربع بحث بدل المنسدلة */
.combo { position: relative; display: block; min-width: 0; width: 100%; }
.combo[hidden] { display: none; }
.combo .combo-input { width: 100%; padding-inline-end: 28px; text-overflow: ellipsis; }
.combo::after { content: ''; position: absolute; inset-inline-end: 11px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); pointer-events: none; }
.combo select.combo-native { position: absolute; inset-inline-start: 0; bottom: 0; width: 1px !important; min-width: 0 !important; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; margin: 0; }
.combo-list { position: fixed; z-index: 1000; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); padding: 4px; }
.combo-opt { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.combo-opt:hover { background: var(--surface-2); }
.combo-opt.active { background: var(--brand-soft); color: var(--brand); }
.combo-opt[aria-selected="true"] { font-weight: 600; }
.combo-grp { padding: 8px 10px 3px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.combo-empty { padding: 10px; font-size: 13px; color: var(--ink-3); }
.with-btns .combo { flex: 1; min-width: 0; }
.inline-field .combo { flex: 1; }
/* حقل التاريخ dd/mm/yyyy مع زر التقويم */
.date-field { position: relative; display: flex; min-width: 0; width: 100%; }
.date-field .date-text { flex: 1; min-width: 0; padding-inline-end: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.date-field .date-text.bad { border-color: var(--danger); outline-color: var(--danger); }
.date-field .date-btn { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 4px 6px;
  color: var(--ink-2); cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.date-field .date-btn:hover { background: var(--surface-2); color: var(--brand); }
.date-field .date-btn:disabled { opacity: .4; cursor: default; }
.date-field .date-native { position: absolute; inset-inline-end: 0; bottom: 0; width: 34px; height: 100%; opacity: 0; pointer-events: none; padding: 0; border: 0; }
/* ترويسة المستند: عناوين أفقية في ثلاثة أعمدة مثل سماك */
.hform { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 10px 28px; margin-top: 6px; }
.hform .col { display: grid; gap: 9px; align-content: start; min-width: 0; }
.hrow { display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: center; gap: 10px; }
.hrow[hidden] { display: none; }
.hrow > span:first-child { font-size: 14px; color: var(--ink-2); }
.hrow input[readonly], .hrow textarea[readonly] { background: var(--surface-2); color: var(--ink-2); }
.hrow textarea { resize: vertical; min-height: 54px; }
.with-btns { display: flex; gap: 6px; min-width: 0; }
.with-btns select { flex: 1; min-width: 0; }
.btn.icon-only { padding: 6px 10px; flex: none; }
/* الموازنة: جدول الأشهر، وشلال الانحرافات، وشريط الاستهلاك */
.budget-grid { font-size: 13px; }
.budget-grid td, .budget-grid th { padding: 4px 4px; white-space: nowrap; }
.budget-grid td:first-child, .budget-grid th:first-child { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; min-width: 200px; white-space: normal; }
.budget-grid tr.grp td { background: var(--brand-soft); color: var(--brand); position: static; }
.budget-grid input { width: 92px; padding: 5px 6px; font-size: 13px; }
.budget-grid input.btotal { width: 108px; font-weight: 600; }
.budget-grid input[readonly] { background: transparent; border-color: transparent; }
.budget-grid tfoot td { font-weight: 600; }
tr.acc-row td { font-size: 13px; color: var(--ink-2); padding-top: 4px; padding-bottom: 4px; }
tr.acc-row td:first-child { padding-inline-start: 28px; }
.waterfall { width: 100%; height: auto; display: block; max-height: 340px; }
.waterfall .wf-base { stroke: var(--line); stroke-width: 1; }
.waterfall .wf-conn { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.waterfall .wf-up { fill: var(--ok); }
.waterfall .wf-down { fill: var(--danger); }
.waterfall .wf-total { fill: var(--ink-3); }
.waterfall .wf-bar:hover rect { opacity: .82; }
.waterfall .wf-val { fill: var(--ink); font-size: 12px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; }
.waterfall .wf-lbl { fill: var(--ink-2); font-size: 11px; text-anchor: middle; }
.var-note { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.var-note:last-child { border-bottom: 0; }
.var-inputs { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.print-only { display: none; }
.meter { position: relative; display: inline-block; vertical-align: middle; width: 110px; height: 8px; border-radius: 999px; background: var(--surface-2); margin-inline-end: 6px; }
.meter .m-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; }
.meter .m-fill.ok { background: var(--ok); }
.meter .m-fill.warn { background: var(--warn); }
.meter .m-fill.err { background: var(--danger); }
.meter .m-fill.brand { background: var(--brand); }
.nowrap { white-space: nowrap; }
tr.row-err td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
textarea.bad { color: var(--danger); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.img-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.img-box { aspect-ratio: 1; display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.img-box img { width: 100%; height: 100%; object-fit: cover; }
.img-meta { font-size: 13px; }
.img-actions { display: flex; gap: 8px; align-items: center; }
.logo-box { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-box img, .inv-logo { max-height: 70px; max-width: 200px; object-fit: contain; }
.inv-banner, .inv-footer { text-align: center; font-size: 13px; color: var(--muted, #666); }
.inv-note { font-size: 13px; border-top: 1px dashed var(--line); padding-top: 8px; white-space: pre-line; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.auth-brand .muted { margin-inline-start: auto; }
.print-foot { display: none; }
.ph-logo { max-height: 56px; max-width: 180px; object-fit: contain; display: block; margin: 0 auto 6px; }
@media print { .print-foot { display: block; position: fixed; bottom: 6mm; inset-inline: 0; text-align: center; font-size: 9pt; color: #555; } }
.desc-cell .unit-box select { width: 100%; }
.desc-cell .batch-box { display: flex; gap: 6px; }
.desc-cell .batch-box[hidden], .desc-cell .unit-box[hidden] { display: none; }
.desc-cell .batch-box input { flex: 1; min-width: 0; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.pos-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pos-bar input[type=search] { flex: 1; min-width: 160px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pos-item { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 10px; min-height: 76px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: start; font: inherit; }
.pos-item:hover { border-color: var(--brand); }
.pos-item[hidden] { display: none; }
.pi-name { font-weight: 600; font-size: 14px; }
.pi-price { color: var(--brand); }
.pi-offer { font-size: 11px; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 1px 6px; }
.pos-cart { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; }
.pos-lines { display: flex; flex-direction: column; gap: 6px; max-height: 42vh; overflow: auto; }
.pl { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font-size: 14px; }
.pl-qty { display: inline-flex; align-items: center; gap: 6px; }
.pl-qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pos-tot > div { display: flex; justify-content: space-between; padding: 3px 0; }
.pos-tot .grand { font-size: 18px; border-top: 1px solid var(--line); padding-top: 6px; }
.pos-pay { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.pos-pay .btn { padding: 12px; font-size: 16px; }
@media (max-width: 900px) { .pos { grid-template-columns: 1fr; } .pos-cart { position: static; } }
.bc-sheet { display: grid; gap: 2mm; margin-top: 8px; justify-content: start; }
.bc-label { box-sizing: border-box; border: 1px dashed var(--line); background: #fff; color: #000; padding: 1.5mm; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; text-align: center; gap: 0.5mm; }
.bc-label .bc-svg { max-width: 100%; max-height: 60%; }
.bc-name { font-size: 9pt; font-weight: 600; line-height: 1.1; }
.bc-co { font-size: 7pt; }
.bc-price { font-size: 9pt; font-weight: 700; }
@media print { .bc-label { border: 0; break-inside: avoid; } }
@media print { .invoice-doc.thermal { width: 74mm; font-size: 11px; padding: 0; } .invoice-doc.thermal .inv-head { flex-direction: column; } }
td.num .meter { width: 70px; margin-inline-end: 8px; }
.meter .m-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
td.ck-ok, td.ck-warn, td.ck-err { white-space: nowrap; }
.rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .rec-grid { grid-template-columns: minmax(0, 1fr); } }
.rec-grid .table-wrap { max-height: 460px; overflow: auto; }
.rec-stmt { width: 100%; border-collapse: collapse; background: var(--surface-2); border-radius: 8px; }
.rec-stmt td { padding: 7px 12px; border: 0; }
.rec-stmt tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.rec-stmt tr.spacer td { color: transparent; }
.sel-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: flex-end;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.amt-in { color: var(--ok); }
.amt-out { color: var(--danger); }
.rule { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.flag { font-size: 12px; color: var(--warn); }
.small-btn { padding: 4px 10px; font-size: 13px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.ck-icon { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.ck-ok .ck-icon { background: var(--ok-soft); color: var(--ok); }
.ck-err { color: var(--danger); }
.ck-err .ck-icon { background: var(--danger-soft); color: var(--danger); }
.ck-warn .ck-icon { background: var(--warn-soft); color: var(--warn); }
.fs-table td:first-child { min-width: 240px; }
.fs-table td.num, .fs-table th.num { min-width: 110px; }
.vat-box td:first-child { color: var(--ink-3); width: 44px; }
.vat-box tr.na td { color: var(--ink-3); }
.vat-box tr.part td { font-size: 13px; color: var(--ink-2); }

/* ---------- الإعداد الأول ---------- */
.setup { max-width: 560px; margin: 6vh auto 0; }
.setup h1 { margin-bottom: 6px; }
.setup .or { text-align: center; color: var(--ink-3); margin: 14px 0; font-size: 13px; }

/* ---------- النوافذ والتنبيهات ---------- */
.dlg { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.dlg::backdrop { background: rgba(15, 22, 19, .4); }
.dlg-form { padding: 20px; display: grid; gap: 14px; }
.dlg-body { display: grid; gap: 12px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-start; }
.form-err { margin: 0; color: var(--danger); font-size: 14px; }

.toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 80; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- الطباعة ---------- */
.print-head { display: none; }
@media print {
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  .no-print, .side, .filters, .page-head .actions { display: none !important; }
  .shell { display: block; }
  .crumbs, .toolbar, .report-opts { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table-wrap { overflow: visible; }
  /* هامش الصفحة صفر: المتصفح ما يلقى مكان يطبع فيه رابط الموقع والتاريخ ورقم الصفحة (رؤوس وتذييلات المتصفح).
     والهامش الفعلي داخل الصفحة نفسها، ويتكرر في كل صفحة (box-decoration-break) */
  @page { margin: 0; }
  .main { padding: 10mm 12mm 16mm !important; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  /* ترويسة مدمجة: الشركة وشعارها في جهة، واسم المستند ورقمه في الجهة الثانية */
  .print-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1.5px solid #222; }
  .ph-co { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .ph-co b { display: block; font-size: 13px; }
  .ph-co span, .ph-doc span { display: block; font-size: 10px; color: #444; }
  .ph-doc { text-align: end; }
  .ph-doc b { display: block; font-size: 13px; }
  .print-head .ph-logo { max-height: 54px; max-width: 140px; margin: 0; object-fit: contain; }
  .ph-co span + span { margin-top: 1px; }
  /* المستند نفسه: عنوانه في الترويسة، والحقول سطور مدمجة بدون خلفيات */
  .doc-title { margin-bottom: 6px; }
  .main:has(.print-head) .doc-title h1, .main:has(.print-head) .page-head h1 { display: none; }
  .main:has(.print-head) .page-head:not(:has(> :not(h1, .actions))) { display: none; }
  .fields-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 14px; margin-bottom: 4px; }
  .fields-grid > div { display: block; padding: 2px 0; background: none; border-radius: 0; border-bottom: 1px dotted #bbb; }
  .fields-grid > div > span { font-size: 10px; color: #555; }
  .fields-grid > div > span::after { content: ': '; }
  .fields-grid > div > b { font-size: 11px; }
  .stack { gap: 8px; }
  table th, table td { padding-block: 4px; font-size: 11px; }
  thead th { background: #eef0f4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table td .small, table td small, table td .muted { font-size: 10px; }
  tr { break-inside: avoid; }
}

/* ===== الاشتراك ولوحة إدارة المنصة ===== */
.sub-banner { max-width: 1240px; margin-bottom: 12px; }
.sub-alert { margin: 0; }
.sub-alert a { font-weight: 600; color: inherit; text-decoration: underline; }
.chip.admin-chip { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.chip.admin-chip:hover { text-decoration: none; filter: brightness(.97); }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-head h1 { margin: 0; }
.admin-tabs { margin-bottom: 16px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
@container (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.rev-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 160px; padding-top: 8px; }
.rev-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.rev-bar i { display: block; width: 100%; max-width: 28px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.rev-bar span { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.rev-bar b { font-size: 10px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.badge.trial { background: var(--brand-soft); color: var(--brand); }
.badge.stop { background: var(--danger-soft); color: var(--danger); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.plan-card.hl { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-card.current { background: var(--brand-soft); }
.plan-card h3 { margin: 0; font-size: 17px; }
.plan-card .price { font-size: 22px; font-weight: 700; }
.plan-card .price small { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.plan-card ul { margin: 0; padding-inline-start: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 3px; }
.plan-card .actions { margin-top: auto; padding-top: 6px; }
.sub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0; }
.sub-facts div { display: grid; gap: 2px; }
.sub-facts dt { font-size: 13px; color: var(--ink-2); }
.sub-facts dd { margin: 0; font-weight: 600; }
.pre-wrap { white-space: pre-wrap; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-row input[type=search] { min-width: 220px; flex: 1; max-width: 360px; }

/* ===== التصنيع ===== */
.prod-steps { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.prod-check { align-self: end; padding-bottom: 8px; }
.price-change { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); }
.price-change .field { min-width: 180px; }
tr.sel-row td { background: var(--brand-soft); }

/* ===== صفحات الدخول: صورة كاملة والبطاقة في النص ===== */
.auth-page { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px 16px 56px; overflow-y: auto; background: #f4f6fb; color-scheme: light; }
.auth-art { position: fixed; inset: 0; z-index: 0; }
.auth-art svg { width: 100%; height: 100%; display: block; filter: blur(3px) saturate(.9); transform: scale(1.04); animation: auth-pan 30s ease-in-out infinite alternate; }
/* الصورة خلفية خفيفة جدًا تحت طبقة بيضاء، والبطاقة بيضاء في النص */
.auth-art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(55% 65% at 50% 50%, rgba(255, 255, 255, .9), rgba(244, 246, 251, .82)); }
@keyframes auth-pan { from { transform: scale(1.04) translateX(0); } to { transform: scale(1.1) translateX(-1.5%); } }
.auth-steam path { animation: auth-steam 4s ease-in-out infinite; }
.auth-steam path + path { animation-delay: 1.5s; }
@keyframes auth-steam { 0%, 100% { opacity: 0; transform: translateY(10px); } 50% { opacity: .5; transform: translateY(-8px); } }
.auth-card { position: relative; z-index: 1; width: min(420px, 100%); color: #141b2d; background: #fff; border: 1px solid #e3e8f2; border-radius: 18px; padding: 28px 26px 24px;
  box-shadow: 0 1px 2px rgba(16, 32, 80, .05), 0 18px 48px rgba(16, 32, 80, .12); animation: auth-in .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .muted { color: #5b6680; text-align: center; margin: 6px 0 0; }
.auth-logo { display: grid; justify-items: center; gap: 2px; margin-bottom: 8px; }
.auth-logo .brand-mark { width: 64px; height: 64px; border-radius: 18px; display: block; box-shadow: 0 10px 24px rgba(35, 70, 214, .28); margin-bottom: 6px; }
.auth-logo b { font-size: 24px; letter-spacing: .3px; color: #0a1633; }
.auth-logo small { color: #b07a0c; font-size: 13px; }
.auth-card .field > span { color: #3a4560; }
.auth-card input { background: #fff; color: #141b2d; border: 1px solid #d5dbe7; border-radius: 9px; padding: 11px 12px; font-size: 15px; }
.auth-card input:focus { outline: none; border-color: #2346d6; box-shadow: 0 0 0 3px rgba(35, 70, 214, .15); }
.auth-card .btn.primary { padding: 12px; font-size: 16px; background: #2346d6; border-color: #2346d6; color: #fff; }
.auth-card .btn.primary:hover { background: #1a37b3; }
.auth-card a { color: #2346d6; }
.auth-card .form-err { background: #fbe9e7; color: #9c2f28; border-radius: 8px; padding: 8px 10px; margin: 0; }
.auth-card .alert.ok { background: #e4f4ea; color: #1f6b42; }
.auth-card .small, .auth-card p.muted.small { color: #5b6680; text-align: start; }
.auth-switch { text-align: center; margin: 4px 0 0; color: #3a4560; font-size: 14px; }
.auth-switch a { font-weight: 600; }
.auth-foot { position: fixed; bottom: 14px; inset-inline: 0; z-index: 1; text-align: center; color: #6b7690; font-size: 12.5px; margin: 0; }
.auth-foot a { color: #2346d6; }
@media (prefers-reduced-motion: reduce) { .auth-art svg, .auth-steam path, .auth-card { animation: none; } }
.code-box { font-size: 34px; font-weight: 700; letter-spacing: 8px; text-align: center; padding: 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.auth-card input.auth-code { font-size: 20px; letter-spacing: 6px; text-align: center; font-weight: 600; }
.auth-card input.auth-code::placeholder { letter-spacing: 0; font-size: 15px; font-weight: 400; }
.owner-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; }
.owner-code > div { display: grid; }
.owner-code b { font-size: 24px; letter-spacing: 5px; color: var(--brand); }

/* أزرار الاختصارات في القوائم: فتح وتعديل وطباعة */
.row-acts { white-space: nowrap; text-align: end; width: 1%; }
.row-acts .icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--ink-2); vertical-align: middle; }
.row-acts .icon-btn:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.row-acts .icon-btn.off { visibility: hidden; }

/* تحريك السطور: مقبض سحب وأسهم أعلى وأسفل في أول خلية */
.ln-move-th { width: 1%; }
.ln-move { width: 1%; white-space: nowrap; padding-inline: 2px !important; }
.ln-move .drag { cursor: grab; color: var(--ink-3); font-size: 14px; letter-spacing: -2px; padding: 4px 3px; user-select: none; vertical-align: middle; }
.ln-move .mv-btns { display: inline-flex; flex-direction: column; vertical-align: middle; }
.ln-move .mv { border: 0; background: transparent; color: var(--ink-3); font-size: 9px; line-height: 1; padding: 2px 4px; cursor: pointer; border-radius: 4px; }
.ln-move .mv:hover, .ln-move .drag:hover { color: var(--brand); background: var(--brand-soft); }
tr.dragging { opacity: .5; background: var(--brand-soft); }
