/* مطاعم صابحة — أخضر غامق، أبيض، ذهبي. بدون أي حركة (لا animations ولا transitions). */

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

:root {
  --g-950: #04231a;
  --g-900: #063326;
  --g-850: #08402f;
  --g-800: #0b4d39;
  --g-700: #11634a;
  --g-600: #187a5e;
  --gold-700: #8d6a1f;
  --gold-600: #a8832f;
  --gold-500: #c9a24a;
  --gold-400: #d9b865;
  --gold-300: #e8d196;
  --gold-200: #f1e2b8;
  --cream: #fbf8ef;
  --cream-2: #f4efe0;
  --white: #ffffff;
  --ink: #12231c;
  --muted: #5d6f66;
  --line: #e2d9bd;
  --credit: #0d8a4d;      /* دائن / داخل / زيادة */
  --credit-bg: #e4f5ea;
  --debit: #c62828;       /* مدين / خارج / سالب / عجز */
  --debit-bg: #fbe7e7;
  --warn: #b26a00;
  --warn-bg: #fff2d9;
  --radius: 16px;
  --shadow: 0 2px 0 rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.18);
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --brand: 'Reem Kufi', 'Cairo', sans-serif;
  --nav-w: 270px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--g-900);
  /* خلفية ثابتة: زخرفة هندسية خفيفة جدًا (لا تتحرك) */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23c9a24a' stroke-opacity='.10' stroke-width='1'%3E%3Cpath d='M60 6 L114 60 L60 114 L6 60 Z'/%3E%3Cpath d='M60 26 L94 60 L60 94 L26 60 Z'/%3E%3Ccircle cx='60' cy='60' r='9'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--g-900) 0%, var(--g-950) 100%);
  background-attachment: fixed, fixed;
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-block; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hide-sm { }
.only-sm { display: none !important; }

/* ───────── الإطار العام ───────── */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  background: linear-gradient(180deg, var(--g-950), #031a13);
  border-inline-end: 2px solid var(--gold-600);
  color: var(--gold-200);
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand { padding: 22px 18px 16px; text-align: center; border-bottom: 1px solid rgba(201,162,74,.35); }
.brand .logo { width: 74px; height: 74px; margin: 0 auto 8px; display: block; }
.brand .name { font-family: var(--brand); font-size: 1.55rem; color: var(--gold-400); line-height: 1.2; }
.brand .sub { font-size: .85rem; color: var(--gold-300); opacity: .85; }
.nav { padding: 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a, .nav .nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: 12px;
  color: #eadfbc; text-decoration: none; font-weight: 600; font-size: 1.02rem; border: 1px solid transparent; background: none; width: 100%; text-align: start;
}
.nav a:hover { background: rgba(201,162,74,.12); }
.nav a.active { background: linear-gradient(90deg, rgba(201,162,74,.28), rgba(201,162,74,.08)); border-color: rgba(201,162,74,.6); color: #fff; }
.nav .sep { height: 1px; background: rgba(201,162,74,.25); margin: 8px 6px; }
.nav .group { padding: 8px 14px 2px; font-size: .78rem; color: var(--gold-500); letter-spacing: .02em; }
.nav .soon { opacity: .45; cursor: default; }
.nav .soon:hover { background: none; }
.nav .pill { margin-inline-start: auto; font-size: .7rem; padding: 1px 8px; border-radius: 99px; border: 1px solid rgba(201,162,74,.5); color: var(--gold-300); }
.nav .badge { margin-inline-start: auto; }
.sidebar .foot { padding: 12px 14px 18px; border-top: 1px solid rgba(201,162,74,.25); font-size: .85rem; color: var(--gold-300); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  background: linear-gradient(180deg, rgba(4,35,26,.98), rgba(6,51,38,.96)); border-bottom: 1px solid rgba(201,162,74,.45);
  color: var(--gold-200);
}
.topbar .title { font-family: var(--brand); font-size: 1.35rem; color: var(--gold-400); }
.content { padding: 18px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; }
.bottomnav { display: none; }

.icon { width: 1.25em; height: 1.25em; flex: 0 0 auto; vertical-align: -0.2em; }
.icon-lg { width: 1.7em; height: 1.7em; }

/* ───────── البطاقات ───────── */
.card {
  background: var(--cream); border: 1px solid var(--gold-400); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: linear-gradient(180deg, var(--g-800), var(--g-850)); color: var(--gold-300); font-weight: 700; font-size: 1.08rem; border-bottom: 2px solid var(--gold-500); }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-h h1 { margin: 0; font-family: var(--brand); font-size: 1.7rem; color: var(--gold-400); flex: 1 1 auto; line-height: 1.3; }
.page-h .sub { color: var(--gold-200); opacity: .85; font-size: .95rem; flex-basis: 100%; margin-top: -8px; }

.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; background: var(--cream); border: 1px solid var(--gold-400); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; position: relative; }
.stat .lbl { color: var(--muted); font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.stat .val { font-size: 1.85rem; font-weight: 800; line-height: 1.2; }
.stat .hint { color: var(--muted); font-size: .85rem; }
.stat.dark { background: linear-gradient(160deg, var(--g-700), var(--g-800)); border-color: var(--gold-500); color: #fff; }
.stat.dark .lbl, .stat.dark .hint { color: var(--gold-200); }
.stat.dark .val { color: var(--gold-300); }
.stat.dark .val.cr { color: #7df0b0; } .stat.dark .val.dr { color: #ff9a9a; }
.stat .bar { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 6px; height: 100%; background: var(--gold-500); }

/* ───────── الأزرار الكبيرة ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 10px 24px; border-radius: 14px;
  border: 2px solid var(--g-800); background: linear-gradient(180deg, var(--g-700), var(--g-800)); color: #fff; font-weight: 800; font-size: 1.08rem; text-decoration: none; line-height: 1.2;
  box-shadow: 0 3px 0 rgba(0,0,0,.25); user-select: none;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn.gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); border-color: var(--gold-700); color: var(--g-950); }
.btn.green { background: linear-gradient(180deg, #14a05d, var(--credit)); border-color: #086a3a; color: #fff; }
.btn.red { background: linear-gradient(180deg, #dd3b3b, var(--debit)); border-color: #911c1c; color: #fff; }
.btn.ghost { background: transparent; border-color: var(--gold-500); color: var(--g-800); box-shadow: none; }
.btn.ghost.on-dark { color: var(--gold-300); }
.btn.light { background: var(--white); border-color: var(--gold-400); color: var(--g-800); box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.btn.sm { min-height: 44px; padding: 6px 16px; font-size: .98rem; border-radius: 12px; }
.btn.xs { min-height: 38px; padding: 4px 12px; font-size: .9rem; border-radius: 10px; box-shadow: none; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { background: none; border: 0; color: inherit; width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.icon-btn:hover { background: rgba(201,162,74,.18); }

/* ───────── النماذج ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl-t { font-weight: 700; color: var(--g-800); font-size: .98rem; }
.field .help { color: var(--muted); font-size: .85rem; }
.field .err { color: var(--debit); font-weight: 700; font-size: .9rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 54px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); font-size: 1.1rem;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 3px solid rgba(201,162,74,.55); border-color: var(--gold-500); }
.input.money { font-weight: 800; font-size: 1.25rem; direction: ltr; text-align: end; }
.input.invalid { border-color: var(--debit); background: #fff6f6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 700; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--g-700); flex: 0 0 auto; }
.seg { display: inline-flex; border: 2px solid var(--gold-500); border-radius: 12px; overflow: hidden; background: var(--white); flex-wrap: nowrap; }
.field > .seg, .field > .btn { align-self: flex-start; }
.fig { border: 2px solid var(--gold-400); border-radius: 14px; background: var(--white); padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.fig-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; color: var(--g-800); border-bottom: 2px solid var(--gold-500); padding-bottom: 6px; }
.seg button { min-height: 48px; padding: 6px 16px; border: 0; background: transparent; font-weight: 700; color: var(--g-800); border-inline-start: 1px solid var(--line); }
.seg button:first-child { border-inline-start: 0; }
.seg button.on { background: var(--g-800); color: var(--gold-300); }

/* ───────── الجداول ───────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 1rem; }
.tbl th { background: var(--g-800); color: var(--gold-300); text-align: start; padding: 11px 12px; font-weight: 700; white-space: nowrap; position: sticky; top: 0; border-bottom: 2px solid var(--gold-500); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) { background: var(--cream-2); }
.tbl tbody tr:hover { background: #f1e8c9; }
.tbl tfoot td { background: var(--g-850); color: var(--gold-200); font-weight: 800; border-top: 2px solid var(--gold-500); }
.tbl .r { text-align: end; }
.tbl .c { text-align: center; }
.tbl .act { white-space: nowrap; width: 1%; }
.tbl tr.neg td { background: var(--debit-bg); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 3rem; height: 3rem; color: var(--gold-500); display: block; margin: 0 auto 8px; }

/* ───────── الألوان المحاسبية: أخضر = دائن/داخل، أحمر = مدين/خارج/سالب ───────── */
.cr { color: var(--credit); font-weight: 800; }
.dr { color: var(--debit); font-weight: 800; }
.zero { color: var(--muted); font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border-radius: 99px; font-weight: 700; font-size: .85rem; border: 1px solid transparent; white-space: nowrap; }
.chip.cr { background: var(--credit-bg); border-color: #b9e3c9; color: var(--credit); }
.chip.dr { background: var(--debit-bg); border-color: #f1bcbc; color: var(--debit); }
.chip.gold { background: #f6ecd0; border-color: var(--gold-400); color: var(--gold-700); }
.chip.gray { background: #ece9df; border-color: #d8d2bd; color: var(--muted); }
.chip.green { background: #dcefe6; border-color: #a9d3bf; color: var(--g-700); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--debit); color: #fff; font-size: .75rem; font-weight: 800; }
.badge.abs { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; border: 2px solid; font-weight: 600; }
.alert.red { background: var(--debit-bg); border-color: var(--debit); color: #8c1b1b; }
.alert.green { background: var(--credit-bg); border-color: var(--credit); color: #0a5f35; }
.alert.gold { background: var(--warn-bg); border-color: var(--gold-500); color: #6d4a00; }
.alert .icon { margin-top: 3px; }

/* ───────── نوافذ وإشعارات ───────── */
.modal-back { position: fixed; inset: 0; background: rgba(2,18,13,.78); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.modal { background: var(--cream); border: 2px solid var(--gold-500); border-radius: 18px; width: 100%; max-width: 640px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal.wide { max-width: 920px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: linear-gradient(180deg, var(--g-800), var(--g-850)); color: var(--gold-300); font-weight: 800; font-size: 1.15rem; border-radius: 16px 16px 0 0; border-bottom: 2px solid var(--gold-500); }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; background: var(--cream-2); border-radius: 0 0 16px 16px; }
.toasts { position: fixed; inset-block-end: 16px; inset-inline: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; padding: 14px 18px; border-radius: 14px; font-weight: 700; border: 2px solid var(--gold-500); background: var(--g-950); color: #fff; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast.ok { border-color: #34c27a; } .toast.err { border-color: #ff6b6b; background: #3b0f0f; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; }
.tabs a, .tabs button { min-height: 50px; padding: 8px 18px; border-radius: 12px 12px 0 0; border: 2px solid transparent; border-bottom: 0; background: rgba(251,248,239,.1); color: var(--gold-200); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tabs a.on, .tabs button.on { background: var(--cream); color: var(--g-800); border-color: var(--gold-500); }

.statusbar { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px; border-radius: 99px; font-size: .85rem; font-weight: 700; border: 1px solid; }
.statusbar.ok { background: rgba(52,194,122,.14); border-color: rgba(52,194,122,.6); color: #8ff0bc; }
.statusbar.off { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.6); color: #ffb0b0; }
.statusbar.busy { background: rgba(201,162,74,.16); border-color: rgba(201,162,74,.6); color: var(--gold-300); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ───────── صفحة الدخول ───────── */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 460px; background: var(--cream); border: 2px solid var(--gold-500); border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.55); overflow: hidden; }
.auth-head { background: linear-gradient(180deg, var(--g-800), var(--g-950)); padding: 26px 20px 20px; text-align: center; border-bottom: 3px solid var(--gold-500); }
.auth-head .logo { width: 92px; height: 92px; margin: 0 auto 8px; display: block; }
.auth-head .name { font-family: var(--brand); font-size: 2rem; color: var(--gold-400); line-height: 1.2; }
.auth-head .sub { color: var(--gold-200); opacity: .9; }
.auth-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

/* ───────── الوردية والنماذج الخاصة ───────── */
.diffbox { border-radius: 14px; padding: 12px 16px; border: 2px solid var(--line); background: var(--white); font-weight: 800; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.diffbox.cr { border-color: var(--credit); background: var(--credit-bg); color: var(--credit); }
.diffbox.dr { border-color: var(--debit); background: var(--debit-bg); color: var(--debit); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; font-weight: 700; }
.line-sum { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); gap: 10px; }
.line-sum.total { font-size: 1.2rem; font-weight: 800; border-bottom: 0; border-top: 2px solid var(--gold-500); margin-top: 6px; padding-top: 12px; }
.att-grid { border-collapse: collapse; font-size: .9rem; }
.att-grid th, .att-grid td { border: 1px solid var(--line); text-align: center; min-width: 38px; padding: 4px 2px; }
.att-grid th { background: var(--g-800); color: var(--gold-300); position: sticky; top: 0; }
.att-grid td.name { text-align: start; min-width: 130px; padding-inline: 10px; background: var(--cream); position: sticky; inset-inline-start: 0; font-weight: 700; }
.att-grid td.cell { cursor: pointer; font-weight: 800; background: var(--white); }
.att-grid td.cell.a0 { background: var(--debit-bg); color: var(--debit); }
.att-grid td.cell.a1 { background: var(--credit-bg); color: var(--credit); }
.att-grid td.cell.aX { background: #fff2cf; color: var(--warn); }
.att-grid td.cell.fri { box-shadow: inset 0 0 0 2px var(--gold-300); }
.att-grid td.cell.none { color: #bbb; }
.audit-row { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.audit-row:nth-child(even) { background: var(--cream-2); }
.audit-changes { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--white); border: 1px dashed var(--line); font-size: .9rem; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notif.unread { background: #fff7e0; }
.notif .ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--debit-bg); color: var(--debit); }
.notif .ic.gold { background: var(--warn-bg); color: var(--warn); }
.notif .ic.green { background: var(--credit-bg); color: var(--credit); }
.bar-chart { width: 100%; height: auto; display: block; }
.search { position: relative; }
.search .icon { position: absolute; inset-inline-start: 14px; inset-block-start: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-inline-start: 44px; }
.pager { display: flex; justify-content: center; padding: 14px; }
.demo-banner { background: linear-gradient(90deg, #7a5a16, var(--gold-600)); color: #fff; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-weight: 700; text-align: center; }
.update-banner { background: var(--gold-500); color: var(--g-950); padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; font-weight: 800; flex-wrap: wrap; }
.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--gold-300); font-size: 1.2rem; font-weight: 700; flex-direction: column; gap: 10px; text-align: center; padding: 20px; }

/* ───────── الموبايل ───────── */
@media (max-width: 920px) {
  :root { --nav-w: 0px; }
  .sidebar { display: none; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-block-end: 0; inset-inline: 0; z-index: 40;
    background: linear-gradient(180deg, var(--g-900), var(--g-950)); border-top: 2px solid var(--gold-600); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; color: #d9cba0; text-decoration: none; font-size: .78rem; font-weight: 700; background: none; border: 0; position: relative; }
  .bottomnav a.active { color: var(--gold-300); background: rgba(201,162,74,.16); }
  .bottomnav .icon { width: 1.5em; height: 1.5em; }
  .content { padding: 12px 12px 96px; }
  .topbar { padding: 8px 12px; }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none !important; }
  .only-sm { display: inline-flex !important; }
  .page-h h1 { font-size: 1.4rem; }
  .stat .val { font-size: 1.5rem; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .grid.c2, .grid.c3, .grid.c4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid.c2.keep, .grid.c4.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 94dvh; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .modal-h { border-radius: 18px 18px 0 0; }
  .modal-f .btn { flex: 1 1 140px; }
  .btn { padding-inline: 16px; }
  /* الجداول تتحول إلى بطاقات */
  table.tbl.cards, table.tbl.cards tbody, table.tbl.cards tr, table.tbl.cards td { display: block; width: 100%; }
  table.tbl.cards thead { display: none; }
  table.tbl.cards tr { border: 1px solid var(--line); border-radius: 12px; margin: 10px 10px; width: auto; background: var(--white) !important; padding: 6px 4px; }
  table.tbl.cards td { border: 0; padding: 6px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: end; align-items: center; }
  table.tbl.cards td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: start; flex: 0 0 auto; }
  table.tbl.cards td.act { width: 100%; justify-content: flex-end; }
  table.tbl.cards td.act::before, table.tbl.cards td[data-label=""]::before { content: none; }
  table.tbl.cards tfoot { display: block; }
  table.tbl.cards tfoot tr { display: block; margin: 10px; border-radius: 12px; background: var(--g-850) !important; border: 0; }
  table.tbl.cards tfoot td { color: var(--gold-200); }
  table.tbl.cards tfoot td::before { color: var(--gold-300); }
}

/* ───────── الطباعة ───────── */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; color: #000; font-size: 12pt; }
  .sidebar, .topbar, .bottomnav, .toasts, .no-print, .demo-banner, .update-banner, .btn-row, .tabs { display: none !important; }
  .app, .main { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #999; break-inside: auto; }
  .stat { break-inside: avoid; box-shadow: none; }
  .tbl tr { break-inside: avoid; }
  .tbl thead { display: table-header-group; }
  .tbl tfoot { display: table-row-group; }
  .card-h, .tbl th, .tbl tfoot td { background: #eee !important; color: #000 !important; border-color: #999 !important; }
  .page-h h1 { color: #000; }
  .tbl-wrap { overflow: visible; }
  .tbl tbody tr:nth-child(even) { background: #fafafa; }
  .modal-back { position: static; background: none; padding: 0; display: block; }
  .modal { max-height: none; box-shadow: none; border: 0; }
}

/* قوالب الطباعة/PDF: ألوان صريحة بدون متغيرات (لتوافق html2canvas) */
.pdf-page { width: 794px; min-height: 1123px; background: #ffffff; color: #12231c; padding: 40px 44px; font-family: 'Cairo', sans-serif; direction: rtl; position: relative; box-sizing: border-box; }
.pdf-page.land { width: 1123px; min-height: 794px; }
.pdf-page .ph { display: flex; align-items: center; justify-content: space-between; border-bottom: 4px solid #c9a24a; padding-bottom: 14px; margin-bottom: 18px; }
.pdf-page .ph .rn { font-family: 'Reem Kufi', 'Cairo', sans-serif; font-size: 30px; color: #0b4d39; line-height: 1.2; }
.pdf-page .ph .rt { font-size: 20px; font-weight: 800; color: #8d6a1f; }
.pdf-page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pdf-page th { background: #0b4d39; color: #e8d196; padding: 8px 10px; text-align: right; font-weight: 700; }
.pdf-page td { padding: 7px 10px; border-bottom: 1px solid #e2d9bd; }
.pdf-page .neg { color: #c62828; font-weight: 800; }
.pdf-page .pos { color: #0d8a4d; font-weight: 800; }
.pdf-page .box { border: 2px solid #c9a24a; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.pdf-page .sig { display: flex; justify-content: space-between; margin-top: 60px; font-size: 14px; }
.pdf-page .sig div { width: 40%; border-top: 1px solid #555; text-align: center; padding-top: 6px; }

/* تقويم الحضور */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .h { text-align: center; font-weight: 800; font-size: .85rem; color: var(--g-800); padding: 4px 0; }
.cal .d { min-height: 68px; border: 2px solid var(--line); border-radius: 12px; padding: 4px 6px; background: var(--white); display: flex; flex-direction: column; justify-content: space-between; text-align: center; font: inherit; color: inherit; }
.cal .d .n { font-size: .8rem; color: var(--muted); text-align: start; }
.cal .d .u { font-size: 1.35rem; font-weight: 800; }
.cal .d.a1 { background: var(--credit-bg); border-color: #9fd9b8; color: var(--credit); }
.cal .d.a0 { background: var(--debit-bg); border-color: #efb1b1; color: var(--debit); }
.cal .d.aX { background: #fff2cf; border-color: #e9c869; color: var(--warn); }
.cal .d.none { background: #f6f3ea; color: #b9b19a; }
.cal .d.fut { opacity: .45; }
.cal .d.fri { border-color: var(--gold-500); }
.cal .d.empty { visibility: hidden; }
.cal button.d { cursor: pointer; }
@media (max-width: 640px) { .cal { gap: 3px; } .cal .d { min-height: 56px; padding: 2px 3px; border-radius: 8px; } .cal .d .u { font-size: 1.1rem; } .cal .h { font-size: .7rem; } }

/* طباعة القسائم والكشوف (نافذة العرض فقط) */
@page land { size: A4 landscape; margin: 8mm; }
@media print {
  body.printing-doc .app { display: none !important; }
  body.printing-doc .modal-back { position: static; background: none; padding: 0; display: block; overflow: visible; }
  body.printing-doc .modal { max-height: none; border: 0; box-shadow: none; max-width: none; background: #fff; border-radius: 0; }
  body.printing-doc .modal-h, body.printing-doc .modal-f { display: none !important; }
  body.printing-doc .modal-b { padding: 0; overflow: visible; }
  body.printing-doc .modal-b > div { overflow: visible !important; background: none !important; padding: 0 !important; }
  body.printing-doc [style*="zoom"] { zoom: 1 !important; width: auto !important; }
  body.printing-doc .pdf-page { width: 100% !important; min-height: 0 !important; padding: 0 !important; page-break-after: always; }
  body.printing-doc .pdf-page.land { page: land; }
}

.att-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.att-btns { display: flex; gap: 6px; flex-wrap: nowrap; }
@media (max-width: 640px) {
  .att-btns { flex: 1 1 100%; }
  .att-btns .btn { flex: 1 1 0; min-width: 0 !important; padding-inline: 2px !important; }
  .demo-banner { padding: 6px 10px; font-size: .85rem; gap: 8px; flex-wrap: nowrap; justify-content: space-between; text-align: start; }
  .demo-banner .btn { flex: 0 0 auto; }
  .stat { padding: 12px 14px; }
  .stat .val { font-size: 1.35rem; }
}
