/* ميزان — نظام الفاتورة الضريبية المبسطة */
:root {
  --bg: #f4f2ed;
  --bg-2: #ece9e2;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1a2523;
  --ink-2: #3c4946;
  --muted: #7b8784;
  --line: #e6e1d7;
  --line-2: #efebe4;
  --brand: #0f6e5f;
  --brand-600: #0b594d;
  --brand-50: #e7f2ee;
  --brand-100: #cbe5dc;
  --ring: rgba(15, 110, 95, .14);
  --gold: #a5803f;
  --gold-50: #f6efe1;
  --ok: #1d7a4c;
  --ok-50: #e4f3ea;
  --warn: #a2690f;
  --warn-50: #fbf1dd;
  --danger: #b6463a;
  --danger-50: #f9e8e5;
  --sidebar-bg: #0e2824;
  --sidebar-ink: #d6e5e0;
  --sidebar-muted: #84a29b;
  --shadow: 0 1px 2px rgba(26, 37, 35, .04), 0 10px 28px -16px rgba(26, 37, 35, .16);
  --shadow-lg: 0 30px 70px -24px rgba(10, 35, 30, .45);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1513; --bg-2: #131e1b; --surface: #15201d; --surface-2: #18241f;
    --ink: #e6eeeb; --ink-2: #c3d0cc; --muted: #84948f; --line: #24332f; --line-2: #1e2b28;
    --brand: #2fa58f; --brand-600: #3bb79f; --brand-50: #15312b; --brand-100: #1f4a40; --ring: rgba(47, 165, 143, .2);
    --gold: #d2ae6d; --gold-50: #2c2618;
    --ok: #4cc28a; --ok-50: #16302a; --warn: #e0a64a; --warn-50: #30281a; --danger: #ec7d70; --danger-50: #35201d;
    --sidebar-bg: #0a1311; --sidebar-ink: #d6e5e0; --sidebar-muted: #7b958f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1513; --bg-2: #131e1b; --surface: #15201d; --surface-2: #18241f;
  --ink: #e6eeeb; --ink-2: #c3d0cc; --muted: #84948f; --line: #24332f; --line-2: #1e2b28;
  --brand: #2fa58f; --brand-600: #3bb79f; --brand-50: #15312b; --brand-100: #1f4a40; --ring: rgba(47, 165, 143, .2);
  --gold: #d2ae6d; --gold-50: #2c2618;
  --ok: #4cc28a; --ok-50: #16302a; --warn: #e0a64a; --warn-50: #30281a; --danger: #ec7d70; --danger-50: #35201d;
  --sidebar-bg: #0a1311; --sidebar-ink: #d6e5e0; --sidebar-muted: #7b958f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 18px; height: 18px; flex: none; }
.n, .money, .num { font-variant-numeric: tabular-nums; }
::selection { background: var(--brand-100); }

/* ───── الهيكل ───── */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 22px 16px 18px;
  isolation: isolate; overflow: hidden;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='18' y='18' width='20' height='20'/%3E%3Crect x='18' y='18' width='20' height='20' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
}
.sidebar::after {
  content: ""; position: absolute; z-index: -1; width: 360px; height: 360px; bottom: -200px; inset-inline-start: -120px;
  background: radial-gradient(circle, rgba(210, 174, 109, .18), transparent 65%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 24px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg, #1d5248, #0b2f29);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 20px -10px rgba(0, 0, 0, .6);
  color: #d9b77a;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 700; color: #fff; line-height: 1.2; }
.brand p { margin: 2px 0 0; font-size: 11.5px; color: var(--sidebar-muted); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 11px; letter-spacing: .02em; color: var(--sidebar-muted); padding: 12px 12px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px; color: var(--sidebar-ink);
  text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav a .ico { width: 19px; height: 19px; opacity: .75; }
.nav a:hover { background: rgba(255, 255, 255, .05); }
.nav a.active { background: rgba(217, 183, 122, .13); color: #fff; }
.nav a.active .ico { opacity: 1; color: #e2c48c; }
.nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -16px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 3px; background: #d9b77a;
}
.nav a.nav-new { margin: 2px 0 6px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.nav a.nav-new .plus { margin-inline-start: auto; font-size: 11px; color: var(--sidebar-muted); }

.side-foot { margin-top: auto; padding-top: 16px; }
.sync {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: start;
  padding: 12px; border-radius: 13px; cursor: pointer;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); color: var(--sidebar-ink);
  transition: background .15s;
}
.sync:hover { background: rgba(255, 255, 255, .08); }
.sync .ico { width: 20px; height: 20px; color: var(--sidebar-muted); }
.sync span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sync b { font-weight: 600; font-size: 13px; }
.sync small { color: var(--sidebar-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: #7d8f8a; flex: none; }
.sync.ok .dot { background: #4cc28a; box-shadow: 0 0 0 4px rgba(76, 194, 138, .16); }
.sync.ok .ico { color: #7fd6ac; }
.sync.warn .dot { background: #e0a64a; box-shadow: 0 0 0 4px rgba(224, 166, 74, .16); }
.sync.danger .dot { background: #ec7d70; }
.sync.busy .dot { background: #d9b77a; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 26px 40px 6px; flex-wrap: wrap; }
.page-title h2 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.005em; }
.page-title p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.date-pill {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35;
  padding: 6px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.date-pill b { font-size: 13px; font-weight: 600; }
.date-pill small { font-size: 11.5px; color: var(--gold); }
#view { padding: 20px 40px 56px; width: 100%; max-width: 1360px; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ───── عناصر ───── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.h-ico { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.h-ico .ico { width: 17px; height: 17px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 20px; }
.card-f { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--brand-100); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 18px -10px var(--brand); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.soft { background: var(--brand-50); border-color: transparent; color: var(--brand); }
.btn.soft:hover { background: var(--brand-100); }
.btn.gold { background: var(--gold-50); border-color: transparent; color: var(--gold); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-50); border-color: transparent; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 48px; font-size: 15px; font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn.del:hover { background: var(--danger-50); color: var(--danger); }
.icon-btn .ico { width: 17px; height: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field.full { grid-column: 1 / -1; }
.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 11px; outline: none;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; line-height: 1.7; }
select.input { cursor: pointer; }
.input:hover { border-color: var(--brand-100); }
.input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--ring); }
.input[readonly] { background: var(--bg-2); color: var(--muted); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.hint { font-size: 12px; color: var(--muted); }
.hint.err { color: var(--danger); }
.hint.good { color: var(--ok); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: inset-inline-start .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { inset-inline-start: 19px; }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px var(--ring); }

.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.seg button {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.seg button .ico { width: 20px; height: 20px; color: var(--muted); }
.seg button:hover { border-color: var(--brand-100); }
.seg button.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand); }
.seg button.on .ico { color: var(--brand); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--gold-50); color: var(--gold); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; background: var(--bg-2); color: var(--ink-2); }

/* ───── الجداول ───── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: start; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .n { text-align: left; white-space: nowrap; }
.table th.n { text-align: left; }
.table .c { text-align: center; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table td.acts { white-space: nowrap; text-align: left; width: 1%; }
.table .strong { font-weight: 600; }
.table .sub { display: block; font-size: 12px; color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.inv-no { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search .ico { position: absolute; inset-inline-start: 13px; top: 12px; color: var(--muted); }
.search .input { padding-inline-start: 40px; background: var(--surface); }
.toolbar select.input { width: auto; min-width: 150px; background: var(--surface); }
.toolbar .end { margin-inline-start: auto; display: flex; gap: 10px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .e-ico { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.empty .e-ico .ico { width: 28px; height: 28px; }
.empty h4 { margin: 0 0 4px; color: var(--ink); font-size: 16px; }
.empty p { margin: 0 0 18px; }

.notice { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; background: var(--gold-50); color: var(--ink); margin-bottom: 20px; border: 1px solid color-mix(in srgb, var(--gold) 25%, transparent); }
.notice .ico { color: var(--gold); width: 22px; height: 22px; }
.notice div { flex: 1; }
.notice b { display: block; }
.notice span { font-size: 13px; color: var(--ink-2); }

/* ───── لوحة التحكم ───── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.kpi { padding: 20px; position: relative; overflow: hidden; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .k-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi .k-icon .ico { width: 21px; height: 21px; }
.kpi .k-label { color: var(--muted); font-size: 13px; margin-top: 16px; }
.kpi .k-value { font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.hero { background: linear-gradient(155deg, #12735f 0%, #0b463d 100%); border-color: transparent; color: #fff; }
.kpi.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='18' y='18' width='20' height='20'/%3E%3Crect x='18' y='18' width='20' height='20' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
}
.kpi.hero .k-icon { background: rgba(255, 255, 255, .12); color: #e7cb93; }
.kpi.hero .k-label, .kpi.hero .k-sub, .kpi.hero .k-value small { color: rgba(255, 255, 255, .72); }
.kpi .k-icon.gold { background: var(--gold-50); color: var(--gold); }
.kpi .k-icon.warn { background: var(--warn-50); color: var(--warn); }
.dash { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.chart { padding: 8px 18px 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand); opacity: .85; transition: opacity .15s; }
.chart .bar:hover { opacity: 1; }
.chart .bar.today { fill: var(--gold); opacity: 1; }
.chart .grid-line { stroke: var(--line-2); }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.split { display: grid; gap: 14px; padding: 20px; }
.split-row { display: grid; gap: 7px; }
.split-row .top { display: flex; justify-content: space-between; font-size: 13px; }
.split-row .top b { font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.meter.gold i { background: var(--gold); }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 20px 20px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 500; transition: border-color .15s, background .15s; }
.quick a:hover { border-color: var(--brand-100); background: var(--brand-50); }
.quick a .ico { color: var(--brand); }

/* ───── محرر الفاتورة ───── */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ed-main { display: grid; gap: 20px; min-width: 0; }
.items th { padding: 10px 8px; }
.items td { padding: 6px 6px; border-bottom: 1px dashed var(--line-2); }
.items .idx { width: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.items .in {
  width: 100%; height: 38px; border-radius: 9px; padding: 0 10px;
  border: 1px solid transparent; background: transparent; outline: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.items .in:hover { background: var(--surface-2); border-color: var(--line); }
.items .in:focus { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.items .in.num { text-align: center; font-variant-numeric: tabular-nums; }
.items select.in { cursor: pointer; padding: 0 4px; }
.items .lt { text-align: left; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; padding-inline-end: 4px; }
.items .w-qty { width: 78px; } .items .w-price { width: 112px; } .items .w-disc { width: 96px; } .items .w-vat { width: 82px; } .items .w-tot { width: 112px; }

.summary { position: sticky; top: 20px; overflow: hidden; }
.summary .s-head { padding: 18px 20px 14px; background: linear-gradient(160deg, var(--brand-50), transparent); }
.summary .s-head small { color: var(--muted); font-size: 12px; }
.summary .s-head .chip { margin-top: 6px; }
.s-rows { padding: 6px 20px 4px; }
.s-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 13.5px; color: var(--ink-2); }
.s-row b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.s-row.vat b { color: var(--gold); }
.s-grand { margin: 8px 20px 0; padding: 16px; border-radius: 14px; background: var(--brand); color: #fff; display: flex; flex-direction: column; gap: 2px; }
.s-grand small { opacity: .8; font-size: 12px; }
.s-grand b { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.s-grand b span { font-size: 14px; font-weight: 500; opacity: .8; margin-inline-start: 4px; }
.s-pay { padding: 16px 20px 6px; display: grid; gap: 10px; }
.s-pay .s-row { padding: 2px 0; }
.s-acts { padding: 14px 20px 20px; display: grid; gap: 8px; }
.s-acts .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ───── النوافذ ───── */
.modal-back {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(8, 24, 21, .48); backdrop-filter: blur(4px); animation: fade .15s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: min(1000px, 100%); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 22px; overflow: auto; }
.modal-f { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); flex-wrap: wrap; align-items: center; }
.modal-f .end { margin-inline-start: auto; display: flex; gap: 10px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

#toasts { position: fixed; bottom: 22px; left: 22px; z-index: 80; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 13px; min-width: 240px; max-width: 380px;
  background: #13302b; color: #e9f3f0; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .2s ease;
}
.toast .ico { color: #7fd6ac; }
.toast.danger .ico { color: #ff9a8d; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .25s; }

/* ───── الإعدادات ───── */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.settings .wide-col { grid-column: 1 / -1; }
.logo-box { display: flex; align-items: center; gap: 14px; }
.logo-prev { width: 72px; height: 72px; border-radius: 14px; border: 1px dashed var(--line); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.db-state { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.db-state .big { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.db-state .big .ico { width: 24px; height: 24px; }
.db-state.warn .big { background: var(--warn-50); color: var(--warn); }
.db-state.danger .big { background: var(--danger-50); color: var(--danger); }
.db-state b { display: block; }
.db-state span { font-size: 13px; color: var(--muted); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; font-size: 13.5px; color: var(--ink-2); }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--gold-50); color: var(--gold); }
.steps code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; direction: ltr; unicode-bidi: embed; }
.zone-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }

/* ───── التقارير ───── */
.presets { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.presets button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.presets button.on { background: var(--brand); color: #fff; }
.rep-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.rep-card { padding: 16px 18px; }
.rep-card small { color: var(--muted); font-size: 12.5px; }
.rep-card b { display: block; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.rep-card.accent { background: var(--brand-50); border-color: var(--brand-100); }
.rep-card.accent b { color: var(--brand); }
.rep-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

/* ───── معاينة الورقة ───── */
.paper-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.paper-wrap { background: #e8e5de; border-radius: 14px; padding: 26px; display: flex; justify-content: center; overflow: auto; }
.paper { background: #fff; color: #1a2523; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .35); border-radius: 4px; }
.paper.a4 { width: 794px; flex: none; min-height: 1060px; padding: 46px 50px; }
.paper.t80 { width: 302px; flex: none; padding: 16px 12px; }

/* ───── مستند الفاتورة (ألوان ثابتة للطباعة) ───── */
.doc { font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; color: #1a2523; line-height: 1.55; }
.doc * { box-sizing: border-box; }
.doc-a4 { font-size: 12.5px; }
.doc-a4 .d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid #0f6e5f; position: relative; }
.doc-a4 .d-head::after { content: ""; position: absolute; bottom: -2px; inset-inline-start: 0; width: 90px; height: 2px; background: #a5803f; }
.doc-a4 .d-brand { display: flex; gap: 14px; align-items: center; }
.doc-a4 .d-brand img { width: 74px; height: 74px; object-fit: contain; }
.doc-a4 .d-brand h1 { margin: 0; font-size: 20px; color: #0b4a41; }
.doc-a4 .d-brand p { margin: 1px 0 0; color: #5c6a67; font-size: 12px; }
.doc-a4 .d-title { text-align: left; }
.doc-a4 .d-title h2 { margin: 0; font-size: 19px; color: #0f6e5f; }
.doc-a4 .d-title span { display: block; color: #8a7350; font-size: 12px; letter-spacing: .04em; direction: ltr; text-align: left; }
.doc-a4 .d-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 20px 0; border: 1px solid #e3ddd1; border-radius: 10px; overflow: hidden; }
.doc-a4 .d-meta div { padding: 9px 12px; border-inline-start: 1px solid #ece7dd; border-top: 1px solid #ece7dd; }
.doc-a4 .d-meta div:nth-child(4n+1) { border-inline-start: 0; }
.doc-a4 .d-meta div:nth-child(-n+4) { border-top: 0; }
.doc-a4 .d-meta small { display: block; color: #7b8784; font-size: 10.5px; }
.doc-a4 .d-meta b { font-weight: 600; font-size: 12.5px; }
.doc-a4 table.d-items { width: 100%; border-collapse: collapse; }
.doc-a4 .d-items th { background: #0f6e5f; color: #fff; font-weight: 500; font-size: 11.5px; padding: 8px 10px; text-align: start; }
.doc-a4 .d-items th:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }
.doc-a4 .d-items th:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.doc-a4 .d-items th small { display: block; font-size: 9.5px; opacity: .75; font-weight: 400; }
.doc-a4 .d-items td { padding: 9px 10px; border-bottom: 1px solid #ece7dd; }
.doc-a4 .d-items tr:nth-child(even) td { background: #faf8f4; }
.doc .n { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc .c { text-align: center; }
.doc-a4 .d-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 20px; align-items: flex-start; }
.doc-a4 .d-qr { text-align: center; }
.doc-a4 .d-qr img { width: 128px; height: 128px; image-rendering: pixelated; border: 1px solid #ece7dd; border-radius: 8px; padding: 6px; }
.doc-a4 .d-qr small { display: block; color: #7b8784; font-size: 10.5px; margin-top: 4px; }
.doc-a4 .d-notes { flex: 1; color: #3c4946; font-size: 12px; }
.doc-a4 .d-notes b { color: #1a2523; }
.doc-a4 table.d-tot { width: 300px; border-collapse: collapse; }
.doc-a4 .d-tot td { padding: 7px 12px; }
.doc-a4 .d-tot tr + tr td { border-top: 1px solid #ece7dd; }
.doc-a4 .d-tot small { display: block; color: #8a9592; font-size: 10px; }
.doc-a4 .d-tot .grand td { background: #0f6e5f; color: #fff; font-weight: 700; font-size: 14px; border: 0; }
.doc-a4 .d-tot .grand td:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }
.doc-a4 .d-tot .grand td:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.doc-a4 .d-tot .grand small { color: rgba(255, 255, 255, .75); }
.doc-a4 .d-tot .soft td { color: #5c6a67; font-size: 12px; }
.doc-a4 .d-foot { margin-top: 34px; padding-top: 14px; border-top: 1px dashed #d9d2c4; display: flex; justify-content: space-between; color: #7b8784; font-size: 11px; gap: 16px; }
.doc-a4 .d-foot b { color: #0f6e5f; font-weight: 600; }
.doc-a4 .stamp { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 11px; font-weight: 600; margin-top: 6px; }
.stamp.paid { background: #e4f3ea; color: #1d7a4c; }
.stamp.partial { background: #fbf1dd; color: #a2690f; }
.stamp.unpaid { background: #f9e8e5; color: #b6463a; }

.doc-80 { font-size: 11.5px; color: #000; text-align: center; }
.doc-80 img.logo { width: 64px; height: 64px; object-fit: contain; }
.doc-80 h1 { font-size: 15px; margin: 4px 0 0; }
.doc-80 p { margin: 0; }
.doc-80 .t-title { margin: 8px 0; padding: 5px 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; font-weight: 700; }
.doc-80 .t-title small { display: block; font-weight: 400; font-size: 10px; }
.doc-80 .kv { display: flex; justify-content: space-between; gap: 8px; text-align: start; }
.doc-80 .kv span:last-child { font-variant-numeric: tabular-nums; }
.doc-80 .sep { border-top: 1px dashed #000; margin: 7px 0; }
.doc-80 .it { text-align: start; padding: 3px 0; }
.doc-80 .it b { display: block; font-weight: 600; }
.doc-80 .it .kv { color: #222; }
.doc-80 .grand { font-size: 14px; font-weight: 700; }
.doc-80 img.qr { width: 150px; height: 150px; image-rendering: pixelated; margin-top: 8px; }
.doc-80 .foot { margin-top: 6px; font-size: 10.5px; }

.doc-report { font-size: 12px; }
.doc-report h1 { font-size: 18px; margin: 0; color: #0b4a41; }
.doc-report h3 { font-size: 13.5px; margin: 22px 0 8px; color: #0f6e5f; }
.doc-report .r-head { display: flex; justify-content: space-between; border-bottom: 2px solid #0f6e5f; padding-bottom: 12px; }
.doc-report table { width: 100%; border-collapse: collapse; }
.doc-report th { background: #eef5f2; color: #0b4a41; font-weight: 600; padding: 7px 9px; text-align: start; font-size: 11px; }
.doc-report td { padding: 7px 9px; border-bottom: 1px solid #ece7dd; }
.doc-report tfoot td { font-weight: 700; border-top: 1.5px solid #0f6e5f; }
.doc-report .r-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.doc-report .r-cards div { border: 1px solid #e3ddd1; border-radius: 8px; padding: 8px 10px; }
.doc-report .r-cards small { display: block; color: #7b8784; font-size: 10.5px; }
.doc-report .r-cards b { font-size: 14px; }

#print-root { display: none; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-root.print-80 .doc-80 { width: 72mm; margin: 0 auto; }
}

/* ───── الشاشات الصغيرة ───── */
@media (max-width: 1180px) {
  .kpis, .rep-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash, .rep-grid { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; }
  .brand { padding: 0; }
  .brand p, .nav-label, .side-foot .sync span { display: none; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1; }
  .nav a { padding: 8px 10px; white-space: nowrap; font-size: 13px; }
  .nav a.active::before { display: none; }
  .nav a.nav-new { margin: 0; }
  .nav a.nav-new .plus { display: none; }
  .side-foot { margin: 0; padding: 0; }
  .sync { padding: 8px; }
  .topbar { padding: 18px 16px 4px; }
  #view { padding: 14px 16px 40px; }
  .settings, .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .date-pill { display: none; }
}
@media (max-width: 560px) {
  .kpis, .rep-cards { grid-template-columns: 1fr; }
  .seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav a span { display: none; }
}
.db-path { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-2); background: var(--bg-2); padding: 2px 8px; border-radius: 6px; direction: ltr; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.split-box { margin-top: 12px; padding: 14px; border-radius: 13px; background: var(--brand-50); border: 1px dashed var(--brand-100); animation: rise .2s ease; }
.split-box[hidden] { display: none; }
.split-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.split-grid label { display: flex; align-items: center; gap: 6px; }
.split-grid label .ico { width: 15px; height: 15px; color: var(--brand); }
.split-grid .input { background: var(--surface); text-align: center; }
.split-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
@media (max-width: 760px) { .split-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ───── بطاقات الأصناف ونقطة البيع ───── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chips:empty { display: none; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 6px 14px; border-radius: 99px; cursor: pointer; font-size: 13px; transition: all .15s; }
.chips button:hover { border-color: var(--brand-100); }
.chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.presets button .ico { width: 16px; height: 16px; vertical-align: -3px; }
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; }
.ptile {
  position: relative; display: flex; flex-direction: column; text-align: center; padding: 8px 8px 12px; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  cursor: pointer; color: var(--ink); transition: transform .12s, border-color .15s, box-shadow .15s; user-select: none;
}
.ptile:hover { border-color: var(--brand-100); transform: translateY(-2px); }
.ptile:active { transform: scale(.97); }
.ptile.in { border-color: var(--brand); box-shadow: 0 0 0 2px var(--ring), var(--shadow); }
.ptile.bump { animation: bump .28s ease; }
@keyframes bump { 40% { transform: scale(.94); } }
.pimg { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; width: 100%; border-radius: 11px; overflow: hidden; background: var(--surface-2); }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: hsl(var(--h) 45% 32%); background: linear-gradient(150deg, hsl(var(--h) 55% 92%), hsl(calc(var(--h) + 30) 50% 84%)); }
:root[data-theme="dark"] .ph { color: hsl(var(--h) 60% 80%); background: linear-gradient(150deg, hsl(var(--h) 30% 22%), hsl(calc(var(--h) + 30) 30% 16%)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ph { color: hsl(var(--h) 60% 80%); background: linear-gradient(150deg, hsl(var(--h) 30% 22%), hsl(calc(var(--h) + 30) 30% 16%)); } }
.pname { font-weight: 600; font-size: 14px; line-height: 1.4; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.pprice { font-weight: 700; font-size: 16px; color: var(--brand); font-variant-numeric: tabular-nums; }
.pprice small { font-size: 11px; font-weight: 500; color: var(--muted); }
.pqty { position: absolute; top: 8px; inset-inline-start: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; box-shadow: 0 4px 10px -4px rgba(0,0,0,.4); }
.pcat { position: absolute; bottom: 6px; inset-inline-end: 6px; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: rgba(255,255,255,.88); color: #1a2523; }
.pacts { position: absolute; top: 12px; inset-inline-end: 12px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.pacts .icon-btn { background: var(--surface); box-shadow: var(--shadow); }
.ptile:hover .pacts { opacity: 1; }
.ptile.add { border-style: dashed; box-shadow: none; background: transparent; justify-content: center; }
.ptile.add .pimg { background: var(--brand-50); color: var(--brand); }
.ptile.add .pimg .ico { width: 34px; height: 34px; }
.prow { display: inline-flex; align-items: center; gap: 10px; }
.pmini { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: none; display: grid; }
.pmini img { width: 100%; height: 100%; object-fit: cover; }
.pmini .ph { font-size: 13px; }
.pf-img { display: flex; gap: 16px; align-items: center; }
.pf-prev { width: 120px; height: 120px; border-radius: 14px; overflow: hidden; border: 1px dashed var(--line); background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--muted); }
.pf-prev img { width: 100%; height: 100%; object-fit: cover; }
.pf-prev span { display: grid; justify-items: center; gap: 4px; font-size: 12px; }
.pf-prev .ico { width: 30px; height: 30px; }

.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; }
.pos .ptiles { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); }
.cart { position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); overflow: hidden; }
.cart-body { flex: 1; overflow: auto; min-height: 120px; }
.cart-items { display: grid; }
.citem { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); animation: rise .18s ease; }
.cinfo { min-width: 0; display: grid; }
.cinfo b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinfo small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ctot { font-variant-numeric: tabular-nums; min-width: 64px; text-align: left; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.stepper button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { background: var(--brand-50); color: var(--brand); }
.stepper button .ico { width: 15px; height: 15px; }
.stepper span { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; color: var(--muted); text-align: center; }
.cart-empty .ico { width: 36px; height: 36px; opacity: .6; }
.cart-empty p { margin: 0; font-size: 13px; }
.cart-foot { border-top: 1px solid var(--line-2); padding: 12px 16px 16px; display: grid; gap: 10px; }
.cart-foot .s-row { padding: 0; }
.cart-foot .s-grand { margin: 2px 0; padding: 12px 14px; }
.cart-foot .s-grand b { font-size: 26px; }
.cart-foot .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pos-pay { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pos-pay button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.pos-pay button .ico { width: 16px; height: 16px; }
.pos-pay button.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand); }
.recv { display: grid; gap: 4px; }
.recv span { font-size: 13px; color: var(--ink-2); }
.recv span b { color: var(--ok); font-size: 15px; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } .cart { position: static; max-height: none; } }
@media (max-width: 560px) { .ptiles, .pos .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ───── شاشة الدخول والمستخدمون ───── */
#lock { display: none; }
body.locked .app { display: none; }
body.locked #lock {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 55; padding: 20px; overflow: auto;
  background: radial-gradient(circle at 20% 110%, rgba(210, 174, 109, .22), transparent 45%), linear-gradient(160deg, #123c35, #0a211d 70%);
}
body.locked #lock::before {
  content: ""; position: fixed; inset: 0; opacity: .06; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='18' y='18' width='20' height='20'/%3E%3Crect x='18' y='18' width='20' height='20' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
}
.lock-card { position: relative; width: min(420px, 100%); background: var(--surface); border-radius: 24px; padding: 30px 28px 22px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7); animation: pop .3s ease; }
.lock-brand { text-align: center; margin-bottom: 22px; }
.lock-brand .brand-mark { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 10px; display: grid; place-items: center; background: linear-gradient(150deg, #1d5248, #0b2f29); color: #d9b77a; }
.lock-brand .brand-mark svg { width: 34px; height: 34px; }
.lock-brand h1 { margin: 0; font-size: 24px; }
.lock-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.lk-users { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lk-user { display: grid; justify-items: center; gap: 2px; width: 104px; padding: 12px 6px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; color: var(--ink); transition: all .15s; }
.lk-user b { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-user small { font-size: 11px; color: var(--muted); }
.lk-user.on { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 14px; background: linear-gradient(150deg, #d9b77a, #a5803f); color: #10302a; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.lock-link { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; background: transparent; color: var(--brand); cursor: pointer; font-size: 13px; }
.lock-link .ico, .lock-note .ico, .lock-foot .ico { width: 16px; height: 16px; }
.lock-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.lock-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px 0 0; color: var(--muted); font-size: 11.5px; }
.ucard { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 6px; margin-bottom: 8px; border-radius: 13px; background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); }
.ucard .uinfo { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.ucard b { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucard small { color: #d9b77a; font-size: 11.5px; }
.ucard .icon-btn { color: var(--sidebar-muted); width: 30px; height: 30px; }
.ucard .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.seg button b { font-weight: 600; }
.seg button small { font-size: 11px; color: var(--muted); font-weight: 400; }
.perm-table .yes { color: var(--ok); } .perm-table .no { color: var(--danger); opacity: .7; }
.perm-table .ico { width: 18px; height: 18px; }
.hint.full { grid-column: 1 / -1; }
@media (max-width: 900px) { .side-foot { display: flex; gap: 6px; align-items: center; } .ucard { margin: 0; padding: 4px; } .ucard .uinfo, .ucard .avatar { display: none; } }

/* ───── المرتجعات وإعادة الطباعة ───── */
.ret-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ret-head div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; }
.ret-head small { color: var(--muted); font-size: 11.5px; } .ret-head b { font-variant-numeric: tabular-nums; }
.ret-table .stepper .rq { width: 52px; border: 0; background: transparent; text-align: center; font-weight: 700; outline: none; }
.ret-sum { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 10px; margin-top: 16px; }
.ret-sum div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); display: grid; }
.ret-sum small { color: var(--muted); font-size: 12px; } .ret-sum b { font-size: 18px; font-variant-numeric: tabular-nums; }
.ret-sum .big { background: var(--danger-50); } .ret-sum .big b { color: var(--danger); font-size: 22px; }
.pos-pay button:disabled { opacity: .4; cursor: not-allowed; }
.ret-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--danger-50); color: var(--ink); font-size: 13px; }
.ret-note .ico { color: var(--danger); } .ret-note .tag { cursor: pointer; border: 0; }
.doc-a4 .d-tot .grand.ret td { background: #b6463a; }
.copy-mark { margin: -2px 0 8px; padding: 3px; border: 1.5px dashed #000; font-weight: 700; font-size: 12px; }
.fi-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.fi-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.fi-row > div { flex: 1; min-width: 160px; display: grid; }
@media (max-width: 700px) { .ret-head { grid-template-columns: 1fr 1fr; } .ret-sum { grid-template-columns: 1fr 1fr; } .ret-sum .big { grid-column: 1 / -1; } #rt-refund { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }

/* ───── تحسينات الجوال ───── */
.pos-mbar { display: none; }
@media (max-width: 1100px) {
  .pos-mbar:not([hidden]) {
    display: flex; align-items: center; gap: 10px; position: fixed; bottom: 14px; left: 14px; right: 14px; z-index: 40;
    padding: 14px 18px; border: 0; border-radius: 16px; background: var(--brand); color: #fff; cursor: pointer;
    box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .5); font: inherit; animation: rise .2s ease;
  }
  .pos-mbar b { margin-inline-start: auto; font-size: 17px; font-variant-numeric: tabular-nums; }
  .pos-mbar em { font-style: normal; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; background: rgba(255,255,255,.16); font-size: 13px; font-weight: 600; }
  .pos { padding-bottom: 80px; }
}
@media (max-width: 900px) {
  .sidebar { flex-wrap: wrap; row-gap: 8px; }
  .side-foot { margin-inline-start: auto; }
  .nav { order: 3; flex: 0 0 100%; margin: 0 -4px; padding-bottom: 2px; }
  .nav a span { display: inline !important; }
}

/* ───── العملاء: السيارة والصور ───── */
.form-sec { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--brand); font-weight: 600; font-size: 13.5px; }
.form-sec .ico { width: 18px; height: 18px; }
.plate { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1.5px solid var(--ink-2); border-radius: 6px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 13px; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plate.sm { font-size: 11.5px; padding: 0 7px; border-width: 1px; }
.plate-in { font-weight: 700; letter-spacing: .05em; }
.cf-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.cf-ph { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in; }
.cf-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-ph .rm { position: absolute; top: 5px; inset-inline-start: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.cf-ph .rm .ico { width: 14px; height: 14px; }
.cf-add { aspect-ratio: 1 / 1; border-radius: 12px; border: 1.5px dashed var(--brand-100); background: var(--brand-50); color: var(--brand); display: grid; place-items: center; align-content: center; gap: 4px; cursor: pointer; font-size: 12px; font-weight: 600; }
.cf-add .ico { width: 26px; height: 26px; }
.cf-add.busy { opacity: .6; pointer-events: none; }
.car-cell { display: grid; gap: 4px; justify-items: start; }
.car-cell small { color: var(--muted); font-size: 12px; }
.ph-count { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }
.ph-count .ico { width: 15px; height: 15px; }
.cnote { display: block; max-width: 260px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox { display: grid; gap: 12px; }
.lightbox img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: #000; }
.lightbox .row { justify-content: center; }

/* ───── الملاحظات الجاهزة ───── */
.note-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.note-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); overflow: hidden; transition: all .15s; }
.note-chip button { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; }
.note-chip button .ico { width: 15px; height: 15px; color: var(--brand); }
.note-chip:hover { border-color: var(--brand-100); }
.note-chip.on { border-color: var(--brand); background: var(--brand-50); }
.note-chip.on button { color: var(--brand); font-weight: 600; }
.note-chip .nc-del { padding: 0 10px; border-inline-start: 1px solid var(--line); color: var(--muted); }
.note-chip .nc-del:hover { background: var(--danger-50); color: var(--danger); }
.note-chip .nc-del .ico { color: inherit; width: 13px; height: 13px; }

/* ───── الإصدار والتحديثات ───── */
.brand .ver { margin-top: 4px; padding: 1px 9px; border-radius: 99px; border: 1px solid rgba(217, 183, 122, .35); background: rgba(217, 183, 122, .1); color: #e2c48c; font-size: 11px; cursor: pointer; font-variant-numeric: tabular-nums; }
.brand .ver:hover { background: rgba(217, 183, 122, .2); }
#update-bar:empty { display: none; }
#update-bar { padding: 10px 40px 0; }
.upd-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--ink); font-size: 13.5px; animation: rise .25s ease; }
.upd-bar > .ico { color: var(--brand); }
.upd-bar > span { flex: 1; min-width: 200px; }
.upd-bar .meter { flex: 0 0 160px; }
.upd-bar.ready { background: var(--gold-50); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.upd-bar.ready > .ico { color: var(--gold); }
.upd-bar.done > .ico { color: var(--ok); }
.changelog { display: grid; gap: 12px; }
.cl-item { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); }
.cl-item.cur { border-color: var(--brand-100); background: var(--brand-50); }
.cl-head { display: flex; align-items: center; gap: 10px; }
.cl-head .hint { margin-inline-start: auto; }
.cl-item ul, .cl-mini { margin: 8px 0 0; padding-inline-start: 20px; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }
.cl-mini { margin-top: 14px; }
@media (max-width: 900px) { #update-bar { padding: 10px 16px 0; } .brand .ver { display: none; } }

/* ───── قفل الأمان ───── */
.pin-box { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 4px 0 6px; }
.pin-box.shake { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-ico { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--gold-50); color: var(--gold); margin-bottom: 4px; }
.pin-ico .ico { width: 28px; height: 28px; }
.pin-box b { font-size: 16px; }
.pin-box p { margin: 0; color: var(--muted); font-size: 13px; }
.pin-dots { display: flex; gap: 12px; direction: ltr; margin: 14px 0 4px; min-height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); transition: all .15s; }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); transform: scale(1.08); }
.pin-hidden { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; margin-top: 10px; direction: ltr; }
.pin-pad button { height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 22px; font-weight: 600; cursor: pointer; display: grid; place-items: center; transition: background .12s, transform .05s; font-variant-numeric: tabular-nums; }
.pin-pad button:hover { background: var(--brand-50); border-color: var(--brand-100); }
.pin-pad button:active { transform: scale(.95); }
.pin-pad button .ico { width: 22px; height: 22px; }
.pin-pad button.ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.pin-in { letter-spacing: .4em; text-align: center; font-size: 18px; }
.pin-card .db-state { flex-wrap: wrap; }
.pin-ops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
@media (max-width: 700px) { .pin-ops { grid-template-columns: 1fr; } }

/* ───── معاينة الطباعة ───── */
.pv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.pv-paper .paper-wrap { max-height: 68vh; padding: 18px; }
.pv-paper .paper.a4 { zoom: .72; }
.pv-side { display: grid; gap: 14px; position: sticky; top: 0; }
.pv-copies { width: 100%; justify-content: space-between; padding: 4px; }
.pv-copies input { width: 60px; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 16px; outline: none; color: var(--ink); }
@media (max-width: 760px) { .pv-grid { grid-template-columns: 1fr; } .pv-paper .paper.a4 { zoom: .42; } }

/* ───── محاذاة أعمدة جدول الأصناف في الفاتورة (كل قيمة تحت عنوانها) ───── */
.doc-a4 table.d-items { table-layout: fixed; }
.doc-a4 .d-items th, .doc-a4 .d-items td { text-align: center; vertical-align: middle; }
.doc-a4 .d-items th:nth-child(2), .doc-a4 .d-items td:nth-child(2) { text-align: start; width: 28%; padding-inline-start: 12px; }
.doc-a4 .d-items th:first-child, .doc-a4 .d-items td:first-child { width: 5%; }
.doc-a4 .d-items td { font-variant-numeric: tabular-nums; }
.doc-a4 .d-items td + td { border-inline-start: 1px solid #efe9df; }
.doc-a4 .d-items th + th { border-inline-start: 1px solid rgba(255, 255, 255, .14); }
.doc-a4 .d-items td:last-child { font-weight: 700; }
.doc-a4 .d-items th { white-space: normal; line-height: 1.3; padding: 8px 4px; }
.doc-a4 .d-items td { padding: 9px 4px; }
.doc-a4 .d-items th:nth-child(2), .doc-a4 .d-items td:nth-child(2) { width: 24%; padding-inline-start: 10px; }
.doc-a4 .d-items th:first-child, .doc-a4 .d-items td:first-child { width: 4%; }

/* ───── شعار الساخن ───── */
.brand-mark.flame svg { width: 30px; height: 30px; }
.lock-brand .brand-mark.flame svg { width: 38px; height: 38px; }
.brand-mark.flame svg { width: 34px; height: 34px; }
.lock-brand .brand-mark.flame svg { width: 48px; height: 48px; }

.sync.file-warn { margin-top: 8px; border-color: rgba(236, 125, 112, .45); background: rgba(236, 125, 112, .1); }
.sync.file-warn .ico { color: #ec7d70; }

/* ───── قفل الأسعار في الفاتورة ───── */
.items tr.locked [data-f="price"], .items tr.locked [data-f="discount"], .items tr.locked [data-f="vatRate"] { color: var(--muted); cursor: not-allowed; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(165, 128, 63, .06) 6px 12px); }
.items tr.locked [data-f="price"]:hover, .items tr.locked [data-f="discount"]:hover { border-color: transparent; }
.lock-chip { color: var(--gold); background: var(--gold-50); border-color: transparent; }
.lock-chip .ico, #price-lock .badge .ico { width: 15px; height: 15px; }
#price-lock:empty { display: none; }

.save-bar { justify-content: space-between; }
.save-bar .btn { min-width: 220px; }

/* ───── استيراد وتصدير الأصناف ───── */
.io-group { display: inline-flex; gap: 6px; padding: 3px; border-radius: 13px; border: 1px dashed var(--line); }
.io-group .btn { height: 36px; border-color: transparent; background: transparent; }
.io-group .btn:hover { background: var(--surface-2); }
.im-preview { max-height: 46vh; overflow: auto; border: 1px solid var(--line-2); border-radius: 12px; }
@media (max-width: 760px) { .io-group { width: 100%; justify-content: space-between; } }

/* ───── فحص قاعدة البيانات ───── */
.health { display: grid; gap: 6px; margin-top: 14px; }
.h-row { display: grid; grid-template-columns: 22px minmax(160px, auto) 1fr; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); }
.h-row .ico { width: 18px; height: 18px; }
.h-row span { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.h-row.ok .ico { color: var(--ok); }
.h-row.warn { background: var(--warn-50); } .h-row.warn .ico { color: var(--warn); }
.h-row.bad { background: var(--danger-50); } .h-row.bad .ico { color: var(--danger); }

textarea.notes-locked { cursor: default; background: var(--bg-2); color: var(--ink); }
textarea.notes-locked:focus { box-shadow: none; border-color: var(--line); }

.cnote .ico { width: 13px; height: 13px; vertical-align: -2px; color: var(--gold); }

/* ───── باركود العميل في الفاتورة ───── */
.doc .bc-a4 { margin-bottom: 10px; }
.doc .bc-a4 svg { max-width: 260px; height: auto; display: block; }
.doc-80 .bc80 { margin: 6px 0 2px; text-align: center; }
.doc-80 .bc80 svg { max-width: 100%; height: auto; }

/* ═════════════ التجاوب: جوال / آيباد / كمبيوتر ═════════════ */
.modal { min-width: 0; max-width: 100%; }
.modal-b { min-width: 0; }
.paper-wrap { max-width: 100%; }
img, svg { max-width: 100%; }

/* آيباد (أفقي وعمودي) */
@media (max-width: 1180px) and (min-width: 901px) {
  .app { grid-template-columns: 230px minmax(0, 1fr); }
  .topbar { padding: 22px 28px 6px; }
  #view { padding: 18px 28px 48px; }
  #update-bar { padding: 10px 28px 0; }
  .settings { grid-template-columns: 1fr; }
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .paper-wrap .paper.a4 { zoom: .82; }
}
@media (max-width: 1100px) and (min-width: 901px) { .pos { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .paper-wrap .paper.a4 { zoom: .72; }
  .modal.wide { width: 100%; }
  .modal-back { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px; }
  .topbar { gap: 10px; }
  .page-title h2 { font-size: 21px; }
  .kpi .k-value { font-size: 23px; }
  .rep-cards { gap: 10px; }
  .rep-card b { font-size: 18px; }
  .ret-head { grid-template-columns: 1fr 1fr; }
}

/* جوال */
@media (max-width: 640px) {
  .topbar { padding: 14px 14px 2px; }
  #view { padding: 12px 12px 90px; }
  #update-bar { padding: 8px 12px 0; }
  .card-b { padding: 16px; }
  .card-h { padding: 14px 16px; }
  .modal-b { padding: 16px; }
  .modal-h { padding: 14px 16px; }
  .modal-f { padding: 12px 16px; }
  .modal-f .end { width: 100%; }
  .modal-f .end .btn, .modal-f > .btn { flex: 1; }
  .paper-wrap { padding: 10px; }
  .paper-wrap .paper.a4 { zoom: .44; }
  .pv-paper .paper.a4 { zoom: .42; }
  .toolbar { gap: 8px; }
  .toolbar .search { min-width: 100%; max-width: none; }
  .toolbar select.input { flex: 1; min-width: 0; }
  .toolbar .end { width: 100%; margin: 0; flex-wrap: wrap; }
  .toolbar .end > .btn, .toolbar .end > label.btn { flex: 1; }
  .presets { flex-wrap: wrap; }
  .kpis { gap: 10px; }
  .kpi { padding: 16px; }
  .split-row .top { font-size: 12.5px; }
  .s-acts .two, .cart-foot .two { grid-template-columns: 1fr; }
  .pos-pay { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lk-user { width: 92px; }
  .note-chip button { padding: 6px 11px; font-size: 12.5px; }
  .io-group { flex-wrap: wrap; }
  .h-row { grid-template-columns: 22px 1fr; }
  .h-row span { grid-column: 2; }

  /* الجداول ← بطاقات */
  .table.resp:not(.items) thead { display: none; }
  .table.resp:not(.items), .table.resp:not(.items) tbody, .table.resp:not(.items) tfoot { display: block; width: 100%; }
  .table.resp:not(.items) tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px;
    padding: 14px 16px; border-bottom: 1px solid var(--line-2);
  }
  .table.resp:not(.items) td { display: block; padding: 0; border: 0; text-align: start !important; min-width: 0; white-space: normal; }
  .table.resp:not(.items) td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 1px; }
  .table.resp:not(.items) td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .table.resp:not(.items) td:first-child::before { display: none; }
  .table.resp:not(.items) td:empty, .table.resp:not(.items) td.acts:empty { display: none; }
  .table.resp:not(.items) td.acts { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-start; width: auto; padding-top: 4px; border-top: 1px dashed var(--line-2); }
  .table.resp:not(.items) td.acts::before { display: none; }
  .table.resp:not(.items) td.acts .icon-btn { width: 40px; height: 40px; background: var(--surface-2); }
  .table.resp:not(.items) tfoot tr { background: var(--surface-2); }
  .table.resp:not(.items) tfoot td { font-weight: 700; }
  .table.resp:not(.items) tr.click:hover td { background: transparent; }
  .table-wrap { overflow-x: visible; }
  .im-preview .table-wrap, .im-preview { overflow: auto; }

  /* أصناف الفاتورة ← بطاقة لكل صنف */
  .items thead { display: none; }
  .items, .items tbody { display: block; width: 100%; }
  .items tr {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 8px; position: relative;
    padding: 12px 14px 12px 48px; border-bottom: 1px dashed var(--line);
  }
  .items td { display: block; padding: 0; border: 0; width: auto !important; }
  .items td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .items td.idx { display: none; }
  .items td:nth-child(2) { grid-column: 1 / -1; }
  .items td:nth-child(2)::before { display: none; }
  .items td:nth-child(2) .in { font-size: 15px; font-weight: 600; background: var(--surface-2); border-color: var(--line); }
  .items .in { height: 40px; background: var(--surface-2); border-color: var(--line); }
  .items .in.num { text-align: center; }
  .items td.lt { grid-column: 1 / -1; text-align: start; font-size: 16px; padding-top: 2px; }
  .items td.lt::before { display: inline !important; margin-inline-end: 8px; }
  .items td:last-child { position: absolute; top: 12px; inset-inline-end: 6px; }
  .items td:last-child::before { display: none; }
}

/* ═════════════ الوضع الليلي: تحسين التباين ═════════════ */
:root[data-theme="dark"] .pcat { background: rgba(0, 0, 0, .55); color: #f3f3f3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pcat { background: rgba(0, 0, 0, .55); color: #f3f3f3; } }
:root[data-theme="dark"] .paper-wrap { background: #1f2a27; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .paper-wrap { background: #1f2a27; } }
:root[data-theme="dark"] .plate { background: #0f1a18; }

/* آيباد عمودي: الجداول العريضة ← بطاقات بأربعة أعمدة */
@media (max-width: 900px) and (min-width: 641px) {
  .table.resp:not(.items):not(.perm-table) thead { display: none; }
  .table.resp:not(.items):not(.perm-table), .table.resp:not(.items):not(.perm-table) tbody, .table.resp:not(.items):not(.perm-table) tfoot { display: block; width: 100%; }
  .table.resp:not(.items):not(.perm-table) tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
  .table.resp:not(.items):not(.perm-table) td { display: block; padding: 0; border: 0; text-align: start !important; min-width: 0; white-space: normal; }
  .table.resp:not(.items):not(.perm-table) td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 1px; }
  .table.resp:not(.items):not(.perm-table) td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .table.resp:not(.items):not(.perm-table) td:first-child::before { display: none; }
  .table.resp:not(.items):not(.perm-table) td:empty { display: none; }
  .table.resp:not(.items):not(.perm-table) td.acts { grid-column: 1 / -1; display: flex; gap: 6px; width: auto; padding-top: 6px; border-top: 1px dashed var(--line-2); }
  .table.resp:not(.items):not(.perm-table) td.acts::before { display: none; }
  .table.resp:not(.items):not(.perm-table) td.acts .icon-btn { width: 40px; height: 40px; background: var(--surface-2); }
  .table.resp:not(.items):not(.perm-table) tfoot tr { background: var(--surface-2); }
  .table.resp:not(.items):not(.perm-table) tfoot td { font-weight: 700; }
}
/* جدول الصلاحيات يبقى جدولاً صغيراً دائماً */
@media (max-width: 640px) {
  .perm-table.resp thead { display: table-header-group !important; }
  .perm-table.resp { display: table !important; }
  .perm-table.resp tbody { display: table-row-group !important; }
  .perm-table.resp tr { display: table-row !important; padding: 0 !important; }
  .perm-table.resp td { display: table-cell !important; padding: 10px 8px !important; }
  .perm-table.resp td::before { display: none !important; }
}

/* آيباد أفقي / لابتوب صغير: جداول أضيق بدون تمرير أفقي */
@media (max-width: 1280px) and (min-width: 901px) {
  .table th, .table td { padding: 10px 9px; }
  .table td.acts { white-space: normal; }
  .table td.acts .icon-btn { width: 30px; height: 30px; }
  .table td.acts .icon-btn .ico { width: 15px; height: 15px; }
  .table .badge { padding: 2px 8px; font-size: 11.5px; }
  .table td:has(> .badge + .badge) { white-space: normal; }
  .inv-no { font-size: 13px; }
}
@media (max-width: 1280px) and (min-width: 901px) {
  .table td.acts { white-space: nowrap; }
  .table td.acts .icon-btn { width: 27px; height: 27px; }
  .inv-no { white-space: nowrap; }
  .table th, .table td { padding: 10px 7px; }
}

/* ───── ترويسة A4: الاسم يمين — الشعار في المنتصف — عنوان الفاتورة يسار ───── */
.doc-a4 .d-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.doc-a4 .d-brand { justify-self: start; }
.doc-a4 .d-logo { justify-self: center; display: grid; place-items: center; }
.doc-a4 .d-logo img { width: 96px; height: 96px; object-fit: contain; display: block; }
.doc-a4 .d-logo:empty { width: 0; }
.doc-a4 .d-title { justify-self: end; }

/* ───── بيانات التواصل أسفل يسار الترويسة ───── */
.doc-a4 .d-contact { margin-top: 10px; text-align: left; }
.doc-a4 .d-contact p { margin: 1px 0 0; color: #5c6a67; font-size: 12px; direction: rtl; text-align: left; }

/* ───── بيانات التواصل في تذييل الفاتورة (يسار) ───── */
.doc-a4 .d-foot { align-items: flex-start; }
.doc-a4 .d-foot .d-contact { margin: 0; }
.doc-a4 .d-foot .d-contact p { font-size: 11.5px; }

/* ═════════════ ثيم سراميك برو: أسود + وردي (2.5.0) ═════════════ */
:root:not([data-theme="light"]) {
  --bg: #0a0a0b; --bg-2: #0f0f11; --surface: #121215; --surface-2: #17171b;
  --ink: #f4f4f6; --ink-2: #cfcfd6; --muted: #8d8d96; --line: #26262c; --line-2: #1d1d22;
  --brand: #e6007e; --brand-600: #ff2b95; --brand-50: #2a0c1c; --brand-100: #4a1232; --ring: rgba(230, 0, 126, .22);
  --gold: #ff5fae; --gold-50: #2a0c1c;
  --ok: #4cc28a; --ok-50: #10261c; --warn: #e0a64a; --warn-50: #2a2213; --danger: #ff6b6b; --danger-50: #2e1416;
  --sidebar-bg: #0c0c0e; --sidebar-ink: #e4e4ea; --sidebar-muted: #85858f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -16px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .85);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --brand: #d4006f; --brand-600: #b8005f; --brand-50: #fde7f2; --brand-100: #f9c6df; --ring: rgba(212, 0, 111, .15);
  --gold: #d4006f; --gold-50: #fde7f2;
  --bg: #f6f5f7; --bg-2: #eeedf0; --line: #e6e3e8; --line-2: #efedf1;
  --sidebar-bg: #0c0c0e; --sidebar-ink: #e4e4ea; --sidebar-muted: #85858f;
}
:root:not([data-theme="light"]) .sidebar { border-inline-end: 1px solid #1d1d22; }
.sidebar::after, body.locked #lock { background-image: none; }
.sidebar::after { background: radial-gradient(circle, rgba(230, 0, 126, .14), transparent 65%); }
.brand-mark, .lock-brand .brand-mark { background: linear-gradient(150deg, #2a0c1c, #120509); color: #ff3fa4; box-shadow: inset 0 0 0 1px rgba(230, 0, 126, .35), 0 8px 20px -10px rgba(230, 0, 126, .5); }
.brand h1 { background: linear-gradient(90deg, #ff3fa4, #e6007e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a.active { background: rgba(230, 0, 126, .12); color: #fff; box-shadow: inset 0 0 0 1px rgba(230, 0, 126, .45); }
.nav a.active .ico { color: #ff3fa4; }
.nav a.active::before { background: #e6007e; }
.sync.busy .dot { background: #ff3fa4; }
.ucard small { color: #ff6fb8; }
.avatar { background: linear-gradient(150deg, #ff3fa4, #b8005f); color: #fff; }
.brand .ver { border-color: rgba(230, 0, 126, .4); background: rgba(230, 0, 126, .1); color: #ff6fb8; }
.brand .ver:hover { background: rgba(230, 0, 126, .2); }
body.locked #lock { background: radial-gradient(circle at 20% 110%, rgba(230, 0, 126, .22), transparent 45%), linear-gradient(160deg, #141417, #050506 70%); }
.btn.primary { background: linear-gradient(150deg, #ff2b95, #e6007e); border-color: #e6007e; box-shadow: 0 8px 22px -10px rgba(230, 0, 126, .8); }
.btn.primary:hover { background: linear-gradient(150deg, #ff4aa5, #f0058a); border-color: #ff2b95; }
:root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .kpi { border: 1px solid var(--line); }
:root:not([data-theme="light"]) .paper-wrap { background: #18181c; }
:root:not([data-theme="light"]) .plate { background: #0d0d10; }
::selection { background: rgba(230, 0, 126, .35); }
.kpi.hero { background: linear-gradient(155deg, #ff2b95 0%, #a8005a 100%); border-color: transparent; box-shadow: 0 18px 40px -22px rgba(230, 0, 126, .9); }
.kpi.hero .k-icon { color: #fff; }

/* ───── شريط التواصل أسفل الفاتورة (نمط سراميك برو) ───── */
.doc-a4 .d-band { margin-top: 14px; padding: 18px 16px 16px; border-radius: 12px; background: #1b1b1d; color: #fff; text-align: center; break-inside: avoid; }
.doc-a4 .d-band-logo { display: block; max-height: 46px; max-width: 160px; margin: 0 auto 14px; object-fit: contain; }
.doc-a4 .d-band-row { display: flex; justify-content: center; align-items: flex-start; gap: 10px 28px; flex-wrap: wrap; }
.doc-a4 .d-band-row > div { flex: 1 1 0; min-width: 110px; max-width: 200px; display: grid; justify-items: center; gap: 6px; }
.doc-a4 .d-band-row span { color: #e6007e; }
.doc-a4 .d-band-row span .ico { width: 22px; height: 22px; }
.doc-a4 .d-band-row b { font-size: 11.5px; font-weight: 600; line-height: 1.45; color: #fff; word-break: break-word; }
.doc-a4 .d-band-row > div { max-width: 230px; }
.doc-a4 .d-band-row b { word-break: normal; overflow-wrap: break-word; }
.doc-a4 .d-band-row b[dir="ltr"] { white-space: nowrap; }

/* ───── قائمة الضمان في الإعدادات ───── */
.wty-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.wty-head label { margin: 0; }
.wty-list { display: grid; gap: 8px; }
.wty-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.wty-item > span { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.wty-item > span .ico { color: var(--brand); width: 16px; height: 16px; }
.wty-item .icon-btn { color: var(--danger); }

/* ═════════════ الفاتورة A4 بألوان سراميك برو: أسود + وردي (2.5.3) ═════════════ */
.doc-a4 { color: #111114; }
.doc-a4 .d-head { border-bottom: 2px solid #e6007e; }
.doc-a4 .d-head::after { background: #111114; width: 120px; }
.doc-a4 .d-brand h1 { color: #111114; font-size: 22px; }
.doc-a4 .d-title h2 { color: #e6007e; font-size: 21px; }
.doc-a4 .d-title span { color: #8d8d96; }
.doc-a4 .stamp.paid { background: #fde7f2; color: #c2006a; }
.doc-a4 .d-meta { border: 1px solid #e4e2e8; border-radius: 14px; }
.doc-a4 .d-meta div { border-color: #ecebef; }
.doc-a4 .d-meta small { color: #8d8d96; }
.doc-a4 .d-items th { background: #121215; color: #fff; border-bottom: 2px solid #e6007e; }
.doc-a4 .d-items th small { color: rgba(255, 255, 255, .6); }
.doc-a4 .d-items th + th { border-inline-start-color: rgba(255, 255, 255, .1); }
.doc-a4 .d-items td { border-bottom-color: #ecebef; }
.doc-a4 .d-items td + td { border-inline-start-color: #f0eef2; }
.doc-a4 .d-items tr:nth-child(even) td { background: #faf9fb; }
.doc-a4 .d-qr img { border-color: #ecebef; }
.doc-a4 .d-notes b { color: #e6007e; }
.doc-a4 .d-tot tr + tr td { border-top-color: #ecebef; }
.doc-a4 .d-tot .grand:not(.ret) td { background: #121215; color: #fff; }
.doc-a4 .d-tot .grand:not(.ret) td:first-child { border-inline-start: 4px solid #e6007e; }
.doc-a4 .d-tot .grand:not(.ret) td:last-child { color: #ff3fa4; }
.doc-a4 .d-foot { border-top-color: #e4e2e8; }
.doc-a4 .d-foot b { color: #e6007e; }
.doc-a4 .d-band { background: #121215; border: 1px solid #e6007e; }
/* رأس الجدول وصندوق الإجمالي: وردي مثل زر «الفواتير» (2.5.4) */
.doc-a4 .d-items th { background: #e6007e; color: #fff; border-bottom: 0; }
.doc-a4 .d-items th small { color: rgba(255, 255, 255, .8); }
.doc-a4 .d-items th + th { border-inline-start-color: rgba(255, 255, 255, .22); }
.doc-a4 .d-tot .grand:not(.ret) td { background: #e6007e; color: #fff; }
.doc-a4 .d-tot .grand:not(.ret) td:first-child { border-inline-start: 0; }
.doc-a4 .d-tot .grand:not(.ret) td:last-child { color: #fff; }
.doc-a4 .d-tot .grand:not(.ret) small { color: rgba(255, 255, 255, .85); }
.doc-a4 .d-band-row { justify-content: space-around; gap: 10px 18px; flex-wrap: nowrap; }
.doc-a4 .d-band-row > div { flex: 0 1 auto; min-width: 0; max-width: 34%; }
.doc-a4 .d-band-row b { white-space: nowrap; }
.doc-a4 .d-band-row > div:nth-child(2) b { white-space: normal; }
/* شريط التواصل: أبيض بدون شعار (2.5.6) */
.doc-a4 .d-band { background: #fff; color: #111114; border: 1px solid #e6007e; }
.doc-a4 .d-band-row b { color: #111114; }
/* شعار الترويسة: يدعم الشعار العرضي (2.5.8) */
.doc-a4 .d-logo img { width: auto; height: auto; max-width: 260px; max-height: 90px; }

/* ───── الضمان تحت رمز QR (2.6.1) ───── */
.doc-a4 .d-qr { max-width: 230px; }
.doc-a4 .d-wty { margin-top: 10px; text-align: start; font-size: 12px; color: #3c3c44; line-height: 1.6; }
.doc-a4 .d-wty b { color: #e6007e; }

#wty-chips { margin-bottom: 12px; }
/* الطباعة: هوامش الورقة بيضاء حتى مع الوضع الداكن (2.6.3) */
@media print { :root, :root[data-theme="dark"], :root:not([data-theme="light"]) { color-scheme: light !important; background: #fff !important; } }

/* ───── شريط التواصل: أعمدة مرتبة بفواصل (2.6.4) ───── */
.doc-a4 .d-band { padding: 16px 8px; }
.doc-a4 .d-band-row { display: flex; flex-wrap: nowrap; justify-content: stretch; align-items: stretch; gap: 0; }
.doc-a4 .d-band-row > .bi { flex: 1 1 0; min-width: 0; max-width: none; padding: 0 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.doc-a4 .d-band-row > .bi + .bi { border-inline-start: 1px solid #f6cfe3; }
.doc-a4 .d-band-row > .bi-phone { flex-grow: .75; }
.doc-a4 .d-band-row > .bi-pin { flex-grow: 1.1; }
.doc-a4 .d-band-row > .bi-clock { flex-grow: 1.35; }
.doc-a4 .d-band-row > .bi-mail { flex-grow: 1.25; }
.doc-a4 .d-band-row > .bi span { width: 34px; height: 34px; border-radius: 50%; background: #fde7f2; display: grid; place-items: center; color: #e6007e; }
.doc-a4 .d-band-row > .bi span .ico { width: 18px; height: 18px; }
.doc-a4 .d-band-row > .bi b { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; font-weight: 500; line-height: 1.5; color: #2a2a30; white-space: normal !important; overflow-wrap: anywhere; }
.doc-a4 .d-band-row > .bi b i { font-style: normal; display: block; unicode-bidi: plaintext; }
.doc-a4 .d-band-row > .bi b[dir="rtl"] i { unicode-bidi: isolate; direction: rtl; }
.doc-a4 .d-band-row > .bi b i.l1 { font-weight: 700; color: #111114; }
.doc-a4 .d-band-row > .bi-clock b i:not(.l1) { font-size: 11px; }
.doc-a4 .d-band-row > .bi-clock b i:last-child:not(.l1) { color: #e6007e; font-weight: 600; }
.doc-a4 .d-band-row > .bi-mail b, .doc-a4 .d-band-row > .bi-phone b { font-weight: 700; color: #111114; }
/* ───── الفاتورة تملأ صفحة A4 كاملة: التذييل وشريط التواصل في أسفل الورقة (2.6.5) ───── */
.paper.a4 { min-height: 1123px; display: flex; flex-direction: column; }
.paper.a4 > .doc-a4 { flex: 1; }
.doc-a4 { display: flex; flex-direction: column; }
.doc-a4 > .d-foot { margin-top: auto; padding-top: 14px; }
.doc-a4 > * { flex: none; }
.doc-a4 > .d-foot { margin-top: auto; }
@media print {
  #print-root.print-a4 .doc-a4 { min-height: calc(297mm - 24mm - 2mm); }
}
.doc-a4 > .d-bottom { margin-bottom: 30px; }

/* ───── معاينة الطباعة: A4 كاملة، خلفية بيضاء، حدود الطباعة (2.6.6) ───── */
.paper.a4 { width: 794px; min-height: 1123px; padding: 45px; } /* 210×297 ملم بهامش 12 ملم = نفس الطباعة */
.modal.pv-modal { width: min(1320px, 96vw); max-height: 96vh; }
.pv-modal .modal-b { padding: 16px; }
.pv-modal .pv-grid { grid-template-columns: minmax(0, 1fr) 250px; }
.pv-modal .pv-paper .paper-wrap { height: calc(96vh - 120px); max-height: none; padding: 18px; background: #fff !important; border: 1px solid var(--line); align-items: flex-start; overflow: auto; }
.pv-modal .pv-paper .paper { box-shadow: 0 0 0 1px #e4e2e8, 0 12px 30px -12px rgba(0, 0, 0, .25); border-radius: 0; position: relative; }
.pv-modal .pv-paper .paper.a4::after { content: ""; position: absolute; inset: 45px; border: 1px dashed rgba(230, 0, 126, .35); pointer-events: none; }
@media (max-width: 760px) {
  .pv-modal .pv-grid { grid-template-columns: 1fr; }
  .pv-modal .pv-paper .paper-wrap { height: 62vh; }
}
@media print { #print-root .doc-a4 { background: #fff; } }
/* الطباعة تملأ ورقة الطابعة كاملة أياً كان مقاسها، بهامش 10 ملم (2.6.7) */
@media print { #print-root.print-a4 .doc-a4 { min-height: calc(100vh - 1px) !important; } }
.paper.a4 { padding: 38px; }
.pv-modal .pv-paper .paper.a4::after { inset: 38px; }
/* رأس جدول الأصناف: خط أغمق (2.6.8) */
.doc-a4 .d-items th { font-weight: 700; font-size: 12.5px; }
.doc-a4 .d-items th small { color: #fff; font-weight: 700; opacity: .95; }

/* ───── A4 دائماً وفي ورقة واحدة (2.7.0) ───── */
.doc-a4 { zoom: var(--fit, 1); }
@media print {
  #print-root.print-a4 .doc-a4 { min-height: calc((277mm - 1px) / var(--fit, 1)) !important; }
  #print-root.print-a4 { break-inside: avoid; }
}
.paper.a4 > .doc-a4 { min-height: calc((1123px - 76px) / var(--fit, 1)); }
@media print { #print-root.print-a4 .doc-a4 { width: calc(190mm / var(--fit, 1)); } }
.paper.a4 > .doc-a4 { width: calc((794px - 76px) / var(--fit, 1)); flex: none; }

/* القياس والطباعة بنفس القواعد: العرض الكامل بعد التصغير */
#print-root.print-a4 .doc-a4 { width: calc(190mm / var(--fit, 1)); }
#print-root.measuring .doc-a4 { min-height: 0 !important; }

/* ═════════════ صفحة شروط وتعليمات الضمان (2.7.1) ═════════════ */
#pv-wrap { flex-direction: column; align-items: center; gap: 22px; }
.doc-terms { font-size: 11.5px; line-height: 1.65; color: #1c1c22; }
#print-root .doc-terms { break-before: page; page-break-before: always; }
.doc-terms ul { margin: 0; padding: 0; list-style: none; }
.doc-terms li { position: relative; padding-inline-start: 14px; }
.doc-terms li::before { content: ""; position: absolute; inset-inline-start: 0; top: .62em; width: 6px; height: 6px; border-radius: 2px; background: #e6007e; }
.doc-terms .t-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid #e6007e; position: relative; }
.doc-terms .t-head::after { content: ""; position: absolute; bottom: -2px; inset-inline-start: 0; width: 120px; height: 2px; background: #111114; }
.doc-terms .t-title { display: flex; align-items: center; gap: 12px; }
.doc-terms .t-title h2 { margin: 0; font-size: 22px; color: #e6007e; }
.doc-terms .t-badge { width: 42px; height: 42px; border-radius: 50%; background: #fde7f2; color: #e6007e; display: grid; place-items: center; }
.doc-terms .t-badge svg { width: 26px; height: 26px; }
.doc-terms .t-ref { display: grid; justify-items: end; gap: 4px; text-align: left; }
.doc-terms .t-ref img { max-height: 40px; max-width: 160px; object-fit: contain; }
.doc-terms .t-ref span { font-size: 10.5px; color: #6b6b75; }
.doc-terms .t-ref span b { color: #111114; }
.doc-terms .t-cards { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 10px; margin: 14px 0 12px; }
.doc-terms .t-card { border: 1px solid #f3c2dc; border-radius: 12px; overflow: hidden; break-inside: avoid; }
.doc-terms .t-card h4 { margin: 0; padding: 7px 12px; background: #e6007e; color: #fff; font-size: 12px; font-weight: 700; }
.doc-terms .t-card ul { padding: 8px 12px 10px; }
.doc-terms .t-main { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; }
.doc-terms .t-h { display: inline-block; margin: 6px 0 6px; padding: 4px 14px; border-radius: 99px; background: #111114; color: #fff; font-size: 12px; font-weight: 700; }
.doc-terms .t-h.out { margin-top: 12px; background: #e6007e; }
.doc-terms .t-intro { margin: 0 0 4px; font-weight: 600; }
.doc-terms .t-list li { margin-bottom: 1px; }
.doc-terms .t-list.out li::before { background: #111114; }
.doc-terms .t-maint { border: 1px solid #e4e2e8; border-radius: 12px; padding: 10px 12px; align-self: start; break-inside: avoid; }
.doc-terms .t-maint h4 { margin: -10px -12px 10px; padding: 7px 12px; background: #111114; color: #fff; font-size: 12px; border-radius: 12px 12px 0 0; text-align: center; }
.doc-terms .t-line { display: flex; align-items: flex-end; gap: 8px; height: 26px; }
.doc-terms .t-line span { width: 18px; height: 18px; border-radius: 50%; background: #fde7f2; color: #e6007e; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.doc-terms .t-line i { flex: 1; border-bottom: 1px dashed #c9c6cf; height: 1px; }
.doc-terms .t-bottom { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; margin-top: auto; padding-top: 14px; break-inside: avoid; }
.doc-terms .t-note { border: 1px dashed #e6007e; border-radius: 12px; padding: 10px 14px; background: #fff7fb; font-size: 10.8px; }
.doc-terms .t-note b { color: #e6007e; display: block; margin-bottom: 4px; }
.doc-terms .t-sign { display: flex; flex-direction: column; gap: 6px; }
.doc-terms .t-sign b { font-size: 13px; }
.doc-terms .t-box { flex: 1; min-height: 70px; border: 1.5px solid #111114; border-radius: 12px; }
.doc-terms { font-size: 12.5px; line-height: 1.75; }
.doc-terms .t-card h4, .doc-terms .t-h, .doc-terms .t-maint h4 { font-size: 13px; }
.doc-terms .t-line { height: 30px; }
