/* ==========================================================================
   شركة ميزاب الفندقية - الهوية البصرية
   Navy / White / Blue / Gold accent · RTL · Cairo local
   ========================================================================== */
@font-face {
  font-family: 'Cairo';
  src: url('../fonts/Cairo-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../fonts/Cairo-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0b2b46;
  --navy-2: #0e3a5c;
  --navy-3: #071e32;
  --blue: #0a6fd1;
  --blue-2: #e8f2fc;
  --blue-3: #f4f9ff;
  --gold: #b38b3d;
  --gold-2: #f7f1e3;
  --green: #0b8f68;
  --green-2: #e6f7f1;
  --red: #c93c4b;
  --red-2: #fdecef;
  --orange: #c47a16;
  --orange-2: #fdf3e3;
  --purple: #6b4fbb;
  --purple-2: #f1ecfc;
  --ink: #17344d;
  --muted: #6f8296;
  --muted-2: #93a4b5;
  --line: #dfe8f1;
  --line-2: #edf3f8;
  --bg: #f2f6fa;
  --white: #ffffff;
  --shadow: 0 8px 30px rgba(11, 43, 70, 0.06);
  --shadow-lg: 0 22px 60px rgba(7, 30, 50, 0.22);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Cairo', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: #cfe6fb; }

/* ---------------------------------- الهيكل ---------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 262px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 48%, var(--navy-3) 100%);
  color: #c8daea;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo {
  width: 120px;
  height: 46px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}
.brand-logo img { width: auto; height: auto; max-width: 100%; max-height: 46px; object-fit: contain; display: block; }
.brand-logo .logo-fallback { font-size: 11px; color: #d9c07a; font-weight: 700; text-align: center; }
.brand-text b { display: block; color: #fff; font-size: 12.5px; line-height: 1.5; }
.brand-text small { color: #8fb0c9; font-size: 10.5px; display: block; line-height: 1.5; }
.nav-label {
  font-size: 10.5px;
  color: #7fa2bd;
  padding: 20px 12px 8px;
  letter-spacing: .2px;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  border-radius: 9px;
  color: #c4d8e9;
  font-size: 12.8px;
  transition: background .16s, color .16s, transform .16s;
  position: relative;
}
.nav button .ico { width: 20px; height: 20px; display: inline-grid; place-items: center; opacity: .88; flex-shrink: 0; }
.nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.active {
  background: linear-gradient(90deg, #0a78d8, #0b5eae);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 20, 40, .28);
}
.nav button.active .ico { opacity: 1; }
.nav .badge { margin-right: auto; }
.side-foot {
  margin-top: auto;
  padding: 16px 8px 2px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #dbeaff; color: #0b5793;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.side-foot b { display: block; font-size: 11px; color: #fff; line-height: 1.4; }
.side-foot small { color: #8fb0c9; font-size: 10px; line-height: 1.4; }
.sidebar-note {
  margin: 14px 4px 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 10.5px;
  color: #9db9cf;
  line-height: 1.7;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 72px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-logo { height: 36px; width: auto; max-width: 110px; object-fit: contain; display: block; }
.crumb { color: var(--muted-2); font-size: 10.5px; line-height: 1.5; }
.topbar h2 { font-size: 16.5px; line-height: 1.5; color: var(--navy); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}
.pill.status { color: var(--green); background: var(--green-2); border-color: #c6ebdf; }
.pill.status.demo { color: var(--orange); background: var(--orange-2); border-color: #f2dfbd; }
.menu-toggle { display: none; }
.content { padding: 24px 26px 34px; width: 100%; max-width: 1560px; margin: 0 auto; }
.footer-note {
  margin-top: auto;
  padding: 13px 26px 18px;
  font-size: 10.5px;
  color: var(--muted-2);
  text-align: center;
  border-top: 1px solid var(--line-2);
}

/* ---------------------------------- الشبكة ---------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; color: var(--navy); line-height: 1.5; }
.page-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.metric::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent, var(--blue));
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}
.metric-icon {
  width: 31px; height: 31px; border-radius: 9px;
  background: var(--tint, var(--blue-2));
  color: var(--accent, var(--blue));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.metric strong {
  display: block;
  font-size: 20px;
  color: var(--navy);
  line-height: 1.5;
  margin-top: 6px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric small { display: block; color: var(--muted-2); font-size: 10.5px; line-height: 1.5; margin-top: 1px; }
.metric .metric-link { font-size: 10.5px; color: var(--blue); margin-top: 8px; display: inline-block; }
.metric.gold { --accent: var(--gold); --tint: var(--gold-2); }

/* ---------------------------------- اللوحات ---------------------------------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 13.5px; color: var(--navy); line-height: 1.5; }
.panel-head .sub { font-size: 10.5px; color: var(--muted-2); }
.report-head-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-logo { height: 42px; width: auto; max-width: 130px; object-fit: contain; flex-shrink: 0; display: block; }
.panel-body { padding: 16px 17px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 11px 17px; border-top: 1px solid var(--line-2); background: #fbfdff; font-size: 11px; color: var(--muted); }

/* ---------------------------------- الأزرار ---------------------------------- */
.btn, .primary, .secondary, .danger, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 11.8px;
  font-weight: 700;
  line-height: 1.6;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  white-space: nowrap;
}
.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(10,111,209,.18); }
.primary:hover { background: #0861b8; }
.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.secondary:hover { border-color: #c6d6e5; background: #f8fbfe; }
.ghost { background: transparent; color: var(--blue); }
.ghost:hover { background: var(--blue-2); }
.danger { background: var(--red); color: #fff; }
.danger:hover { background: #b02f3e; }
.danger-soft { background: var(--red-2); color: var(--red); border-color: #f4c6cd; }
.success-soft { background: var(--green-2); color: var(--green); border-color: #c6ebdf; }
.btn-sm { padding: 5px 9px; font-size: 10.5px; border-radius: 7px; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 29px; height: 29px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  transition: .15s;
}
.icon-btn:hover { color: var(--blue); border-color: #bcd7ef; background: var(--blue-3); }
.icon-btn.danger:hover { color: var(--red); border-color: #efc3c9; background: var(--red-2); }
.actions { display: flex; gap: 5px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.link-btn { color: var(--blue); font-size: 11px; font-weight: 700; padding: 2px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------- الشارات ---------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10.3px;
  font-weight: 700;
  line-height: 1.8;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.draft { background: #f0f4f8; color: #5c7186; border-color: #e2eaf1; }
.badge.review { background: var(--orange-2); color: var(--orange); border-color: #f0ddba; }
.badge.approved { background: var(--blue-2); color: var(--blue); border-color: #cfe5fa; }
.badge.posted { background: var(--green-2); color: var(--green); border-color: #c6ebdf; }
.badge.rejected { background: var(--red-2); color: var(--red); border-color: #f4c6cd; }
.badge.cancelled { background: #eef1f4; color: #7a8b9a; border-color: #e0e6ec; }
.badge.reversed { background: var(--purple-2); color: var(--purple); border-color: #ddd1f6; }
.badge.active, .badge.issued, .badge.settled { background: var(--green-2); color: var(--green); border-color: #c6ebdf; }
.badge.inactive, .badge.partial { background: var(--orange-2); color: var(--orange); border-color: #f0ddba; }
.badge.main { background: var(--gold-2); color: #8a6822; border-color: #eadbb9; }
.badge.neutral { background: var(--blue-2); color: var(--blue); }
.badge b { font-weight: 700; }

/* ---------------------------------- الجداول ---------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 720px; }
table.data thead th {
  background: #f7fafd;
  color: #5b7187;
  font-weight: 700;
  font-size: 10.8px;
  text-align: right;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  color: var(--ink);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fbfdff; }
table.data .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .money { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--muted); font-size: 11px; }
table.data .center { text-align: center; }
table.data .total-row td { background: #f7fafd; font-weight: 700; border-top: 1px solid var(--line); }
table.data .small { font-size: 10.5px; }
.money.green, .green { color: var(--green); }
.money.red, .red { color: var(--red); }
.money.blue { color: var(--blue); }
.money.gold { color: #8a6822; }

.empty {
  text-align: center;
  padding: 42px 16px;
  color: var(--muted);
  font-size: 12px;
}
.empty .empty-icon {
  width: 46px; height: 46px; margin: 0 auto 10px;
  border-radius: 14px; background: var(--blue-2); color: var(--blue);
  display: grid; place-items: center;
}
.empty b { display: block; color: var(--ink); margin-bottom: 2px; }

/* ---------------------------------- أدوات التصفية ---------------------------------- */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.search-box { position: relative; min-width: 210px; flex: 1; max-width: 360px; }
.search-box .ico {
  position: absolute; inset-inline-start: 10px; top: 50%;
  transform: translateY(-50%); color: var(--muted-2); pointer-events: none;
}
.search-box input { padding-inline-start: 33px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d6e1eb;
  border-radius: 9px;
  background: #fff;
  padding: 8px 10px;
  font-size: 12.3px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 37px;
}
input:focus, select:focus, textarea:focus {
  border-color: #77b4e8;
  box-shadow: 0 0 0 3px rgba(10,111,209,.1);
}
input[disabled], textarea[disabled], select[disabled] { background: #f5f8fb; color: var(--muted); }
textarea { resize: vertical; min-height: 84px; line-height: 1.8; }
label { display: block; font-size: 11.5px; color: #4e6479; font-weight: 700; margin-bottom: 5px; }
label .req { color: var(--red); }
.hint { font-size: 10.3px; color: var(--muted-2); margin-top: 3px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.full { grid-column: 1 / -1; }
.form-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 14px; margin-top: 15px;
  border-top: 1px solid var(--line-2);
}
.form-actions .spacer { flex: 1; }
.form-section {
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 13px 14px 15px;
  margin-bottom: 13px;
  background: #fcfdff;
}
.form-section > h4 {
  font-size: 12px; color: var(--navy); margin-bottom: 11px;
  display: flex; align-items: center; gap: 7px;
}
.form-section > h4 .step-no {
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--blue-2); color: var(--blue);
  display: inline-grid; place-items: center; font-size: 10px;
}
.filter-bar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
  margin-bottom: 15px; box-shadow: var(--shadow);
}
.filter-bar .field { min-width: 135px; flex: 1; max-width: 210px; }
.filter-bar .field.wide { max-width: 280px; }
.filter-bar .field.narrow { max-width: 110px; }
.filter-bar .filter-actions { display: flex; gap: 7px; margin-inline-start: auto; }
.quick-ranges { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font-size: 10.5px; font-weight: 700;
}
.chip:hover, .chip.active { background: var(--blue-2); color: var(--blue); border-color: #cfe5fa; }

/* ---------------------------------- التنبيهات ---------------------------------- */
.notice {
  display: flex; gap: 9px; align-items: flex-start;
  border-radius: 10px; padding: 10px 13px;
  font-size: 11.5px; line-height: 1.8;
  background: var(--blue-3); color: #315a7c; border: 1px solid #d6e9fa;
  margin-bottom: 14px;
}
.notice .ico { flex-shrink: 0; margin-top: 2px; }
.notice.warn { background: var(--orange-2); color: #8a5a10; border-color: #f0ddba; }
.notice.danger { background: var(--red-2); color: #9c2f3b; border-color: #f4c6cd; }
.notice.success { background: var(--green-2); color: #0a6b50; border-color: #c6ebdf; }
.notice.info { background: var(--blue-3); color: #315a7c; border-color: #d6e9fa; }
.notice.compact { padding: 7px 11px; font-size: 10.8px; margin-bottom: 10px; }
.notice b { font-weight: 700; }

/* ---------------------------------- القوائم المالية ---------------------------------- */
.balance-list { display: flex; flex-direction: column; }
.balance-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-2);
}
.balance-row:last-child { border-bottom: 0; }
.cash-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cash-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--blue-2); color: var(--blue);
  display: grid; place-items: center; flex-shrink: 0;
}
.cash-icon.main { background: var(--gold-2); color: #8a6822; }
.cash-name b { display: block; font-size: 12px; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cash-name small { display: block; font-size: 10px; color: var(--muted-2); line-height: 1.5; }
.balance-row .money { font-weight: 700; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-inline-end: 4px; }

/* مخططات مشتقة من البيانات */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 150px; padding: 10px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 118px; width: 100%; justify-content: center; }
.chart-bar { width: 38%; max-width: 18px; min-height: 2px; border-radius: 4px 4px 0 0; }
.chart-bar.in { background: linear-gradient(180deg, #16b98d, #0b8f68); }
.chart-bar.out { background: linear-gradient(180deg, #5aa9ef, #0a6fd1); }
.chart-col span { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; }
.chart-legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--muted); padding-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: 4px; }

/* ---------------------------------- السندات والوثائق ---------------------------------- */
.doc-preview { background: #eef3f8; border-radius: 10px; padding: 14px; max-height: 68vh; overflow: auto; }
.voucher-doc {
  background: #fff; color: #17344d; width: 100%; max-width: 820px; margin: 0 auto;
  padding: 26px 30px; border: 1px solid #dbe5ee; border-radius: 4px;
  font-size: 12px; position: relative; overflow: hidden;
}
.voucher-doc .doc-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 14px;
}
.voucher-doc .doc-brand { display: flex; align-items: center; gap: 12px; }
.voucher-doc .doc-brand img { max-height: 58px; max-width: 150px; width: auto; object-fit: contain; }
.voucher-doc .doc-brand .logo-fallback {
  width: 140px; height: 52px; display: grid; place-items: center;
  border: 1px dashed #c9d7e3; border-radius: 8px; color: #7c8fa1; font-size: 10px;
}
.voucher-doc .doc-brand h2 { font-size: 15px; color: var(--navy); line-height: 1.6; }
.voucher-doc .doc-brand p { font-size: 10px; color: #6f8296; }
.voucher-doc .doc-id { text-align: left; min-width: 150px; }
.voucher-doc .doc-id .doc-type {
  display: inline-block; background: var(--navy); color: #fff;
  border-radius: 5px; padding: 3px 12px; font-size: 12px; font-weight: 700;
}
.voucher-doc .doc-id .doc-num { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-top: 6px; direction: ltr; text-align: left; }
.voucher-doc .doc-id small { display: block; font-size: 10px; color: #6f8296; }
.voucher-doc .doc-meta {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0; border: 1px solid #dbe5ee; border-radius: 6px; overflow: hidden;
  margin-bottom: 13px;
}
.voucher-doc .meta-cell { padding: 8px 10px; border-inline-end: 1px solid #e5edf5; border-bottom: 1px solid #e5edf5; }
.voucher-doc .meta-cell:nth-child(4n) { border-inline-end: 0; }
.voucher-doc .meta-cell:nth-last-child(-n+4) { border-bottom: 0; }
.voucher-doc .meta-cell span { display: block; font-size: 9.5px; color: #7b8ea3; }
.voucher-doc .meta-cell b { display: block; font-size: 11.5px; color: #17344d; margin-top: 1px; }
.voucher-doc .doc-statement { border: 1px solid #dbe5ee; border-radius: 6px; padding: 10px 12px; margin-bottom: 13px; }
.voucher-doc .doc-statement span { font-size: 9.5px; color: #7b8ea3; display: block; margin-bottom: 2px; }
.voucher-doc .doc-statement p { font-size: 12px; line-height: 1.9; }
.voucher-doc .doc-amount {
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  background: #f7fafd; border: 1px solid #dbe5ee; border-radius: 6px;
  padding: 10px 13px; margin-bottom: 8px;
}
.voucher-doc .doc-amount .figures small { display: block; font-size: 9.5px; color: #7b8ea3; }
.voucher-doc .doc-amount .figures b { font-size: 17px; color: var(--navy); white-space: nowrap; }
.voucher-doc .doc-amount .words { font-size: 11px; line-height: 1.9; color: #315a7c; background: #fff; border: 1px dashed #c9d9e7; border-radius: 5px; padding: 6px 10px; flex: 1; }
.voucher-doc .doc-notes { font-size: 10.5px; color: #566d82; margin: 7px 0 12px; }
.voucher-doc .doc-signatures {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  margin-top: 22px; page-break-inside: avoid; break-inside: avoid;
}
.voucher-doc .sign-box { text-align: center; font-size: 10.5px; color: #566d82; }
.voucher-doc .sign-line { border-bottom: 1px dashed #aebfce; height: 34px; margin-bottom: 5px; }
.voucher-doc .doc-footer {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 1px solid #dbe5ee; margin-top: 18px; padding-top: 7px;
  font-size: 9px; color: #7b8ea3;
}
.voucher-doc .doc-watermark {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 74px; font-weight: 700; color: rgba(10,111,209,.055);
  transform: rotate(-24deg); pointer-events: none; letter-spacing: 6px;
}
.voucher-doc.report-doc { max-width: none; }
.report-doc table.data { min-width: 0; font-size: 10.5px; }
.report-doc table.data thead th { background: #eef4fa; position: static; }
.report-doc .report-title { text-align: center; margin: 4px 0 14px; }
.report-doc .report-title h3 { font-size: 17px; color: var(--navy); }
.report-doc .report-title p { font-size: 10px; color: #6f8296; }
.report-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10px; color: #566d82; border: 1px solid #dbe5ee; border-radius: 6px; padding: 7px 10px; margin-bottom: 12px; }
.report-meta b { color: #17344d; }

/* ---------------------------------- التبويبات ---------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 15px; overflow-x: auto; }
.tabs button {
  padding: 9px 14px; font-size: 12px; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 700;
}
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------------------------------- النوافذ ---------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7, 22, 36, .55);
  backdrop-filter: blur(2px); z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
  padding: 26px 16px; overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: 15px; width: 100%; max-width: 920px;
  box-shadow: var(--shadow-lg); margin: auto 0; overflow: hidden;
  animation: modalIn .16s ease-out;
}
.modal.sm { max-width: 500px; }
.modal.md { max-width: 680px; }
.modal.lg { max-width: 1080px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: #fbfdff; position: sticky; top: 0; z-index: 2;
}
.modal-top h3 { font-size: 14.5px; color: var(--navy); line-height: 1.5; }
.modal-top .sub { font-size: 10.5px; color: var(--muted); }
.modal-close {
  width: 31px; height: 31px; border-radius: 8px; color: var(--muted);
  display: grid; place-items: center; background: #f3f7fb; flex-shrink: 0;
}
.modal-close:hover { background: var(--red-2); color: var(--red); }
.modal-content { padding: 18px; }
.modal-foot {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 13px 18px;
  border-top: 1px solid var(--line-2); background: #fbfdff;
}
.modal-foot .spacer { flex: 1; }

/* ---------------------------------- التفاصيل ---------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.detail-item { border-bottom: 1px dashed var(--line); padding-bottom: 7px; min-width: 0; }
.detail-item span { display: block; font-size: 10px; color: var(--muted-2); }
.detail-item b { display: block; font-size: 12px; color: var(--ink); word-break: break-word; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item .money { font-size: 14px; color: var(--navy); }
.status-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 13px; border-radius: 10px; background: var(--blue-3);
  border: 1px solid #d6e9fa; margin-bottom: 14px; flex-wrap: wrap;
}
.status-banner .status-title { font-size: 11px; color: var(--muted); }
.status-banner strong { font-size: 14px; color: var(--navy); }
.timeline { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.timeline-item { display: flex; gap: 10px; position: relative; padding-bottom: 14px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 25px; height: 25px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue-2); color: var(--blue);
  display: grid; place-items: center; font-size: 10px; z-index: 1;
}
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; top: 25px; inset-inline-start: 12px;
  width: 1px; bottom: 0; background: var(--line);
}
.timeline-body { min-width: 0; }
.timeline-body b { display: block; font-size: 11.5px; }
.timeline-body small { display: block; font-size: 10px; color: var(--muted-2); }
.timeline-body p { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attachment {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f6f9fc; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 8px; font-size: 10.5px; color: var(--ink);
}
.attachment:hover { border-color: #bcd7ef; background: var(--blue-3); }

/* ---------------------------------- التنبيهات العائمة ---------------------------------- */
#toastRoot {
  position: fixed; inset-inline-start: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; border-radius: 10px;
  padding: 9px 15px; font-size: 12px; box-shadow: 0 14px 34px rgba(7,30,50,.3);
  animation: toastIn .2s ease-out; max-width: 92vw;
}
.toast.success { background: #0a7357; }
.toast.error { background: #a92f3d; }
.toast.warn { background: #9a6414; }
.toast .ico { flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------- الإعدادات ---------------------------------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 11.5px;
}
.setting-row:last-child { border-bottom: 0; }
.readiness { display: flex; flex-direction: column; gap: 0; }
.readiness-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 11.5px; }
.readiness-row:last-child { border-bottom: 0; }
.logo-preview {
  background: #f7fafd; border: 1px dashed #c9d9e7; border-radius: 10px;
  padding: 12px; display: grid; place-items: center; min-height: 92px; margin-bottom: 10px;
}
.logo-preview img { max-height: 68px; max-width: 230px; object-fit: contain; }
details.advanced { border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; margin-top: 10px; background: #fcfdff; }
details.advanced summary { cursor: pointer; padding: 9px 0; font-size: 11.5px; font-weight: 700; color: var(--navy); }
details.advanced .form-grid { padding-bottom: 12px; }
.code { direction: ltr; display: inline-block; background: #f3f7fb; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 10.5px; font-family: Consolas, monospace; }

/* ---------------------------------- الطباعة ---------------------------------- */
#printRoot { display: none; }
@page { size: A4; margin: 11mm; }
@media print {
  html, body { background: #fff !important; font-size: 11px; }
  body > .app, body > #toastRoot, body > .modal-backdrop { display: none !important; }
  #printRoot { display: block !important; }
  .print-page { width: 100%; }
  .voucher-doc { border: 0 !important; max-width: none !important; padding: 0 !important; box-shadow: none !important; border-radius: 0; font-size: 10.5px; }
  .voucher-doc .doc-footer { position: running(footer); }
  .voucher-doc .doc-signatures, .voucher-doc .doc-top { break-inside: avoid; page-break-inside: avoid; }
  .voucher-doc .doc-amount { break-inside: avoid; }
  .report-doc table.data { font-size: 9.5px; }
  .report-doc table.data thead { display: table-header-group; }
  .report-doc table.data tr { break-inside: avoid; page-break-inside: avoid; }
  .report-doc .doc-footer { break-inside: avoid; }
  a { color: inherit; }
  .no-print { display: none !important; }
}

/* ---------------------------------- الاستجابة ---------------------------------- */
@media (max-width: 1250px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .sidebar { width: 232px; }
  .content { padding: 20px 18px 30px; }
  .topbar { padding: 0 18px; }
  .grid-main { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .sidebar {
    position: fixed; inset-inline-start: 0; top: 0; bottom: 0;
    transform: translateX(100%); transition: transform .22s ease;
    width: 262px; height: 100vh; z-index: 60;
  }
  .sidebar.open { transform: none; box-shadow: -18px 0 50px rgba(0,0,0,.3); }
  .menu-toggle { display: inline-grid; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(7,22,36,.45); z-index: 55; display: none;
  }
  .sidebar-overlay.show { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-logo { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 13px; }
  .content { padding: 15px 12px 26px; }
  .topbar { height: 62px; padding: 0 12px; }
  .topbar h2 { font-size: 14px; }
  .crumb { font-size: 9.5px; }
  .top-actions .pill:not(.status) { display: none; }
  .page-head h1 { font-size: 19px; }
  .page-head p { font-size: 11.5px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { padding: 12px 12px 11px; }
  .metric strong { font-size: 16px; }
  .metric-icon { width: 27px; height: 27px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .filter-bar .field { max-width: none; flex: 1 1 45%; }
  .filter-bar .filter-actions { margin-inline-start: 0; width: 100%; }
  .filter-bar .filter-actions .btn, .filter-bar .filter-actions .primary, .filter-bar .filter-actions .secondary { flex: 1; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 15px 15px 0 0; max-height: 94vh; overflow-y: auto; margin: 0; }
  .modal-content { padding: 14px; }
  .modal-top { padding: 12px 14px; }
  .doc-preview { padding: 6px; }
  .voucher-doc { padding: 16px 14px; }
  .voucher-doc .doc-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .voucher-doc .doc-id { text-align: right; }
  .voucher-doc .doc-id .doc-num { text-align: right; }
  .voucher-doc .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voucher-doc .meta-cell:nth-child(4n) { border-inline-end: 1px solid #e5edf5; }
  .voucher-doc .meta-cell:nth-child(2n) { border-inline-end: 0; }
  .voucher-doc .meta-cell:nth-last-child(-n+4) { border-bottom: 1px solid #e5edf5; }
  .voucher-doc .meta-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .voucher-doc .doc-amount { flex-direction: column; align-items: stretch; }
  .voucher-doc .doc-signatures { grid-template-columns: 1fr; gap: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.full { grid-column: auto; }
  .balance-row { gap: 8px; }
  .balance-row .money { font-size: 11.5px; }
  .top-actions { gap: 5px; }
  .pill { padding: 5px 8px; }
  #toastRoot { bottom: 14px; }
}
@media (max-width: 430px) {
  .metrics { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .primary, .page-actions .secondary { flex: 1; }
  .filter-bar .field { flex: 1 1 100%; }
}

/* ==========================================================================
   المصادقة وشاشات الإقلاع
   ========================================================================== */
.side-foot { gap: 9px; }
.side-user { min-width: 0; flex: 1; }
.side-user b, .side-user small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.side-signout {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #cfe0ee; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.side-signout:hover { background: rgba(201,60,75,.24); color: #fff; border-color: rgba(201,60,75,.5); }

.pill.status.live { color: var(--green); background: var(--green-2); border-color: #c6ebdf; }

.app.is-locked { filter: blur(7px); pointer-events: none; user-select: none; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(10,111,209,.35), transparent 60%),
    radial-gradient(700px 460px at 100% 110%, rgba(179,139,61,.28), transparent 62%),
    linear-gradient(135deg, #071e32, #0b2b46 55%, #0e3a5c);
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: 100%;
  max-width: 396px;
  background: #fff;
  border-radius: 18px;
  padding: 30px 28px 24px;
  box-shadow: 0 30px 70px rgba(2, 16, 30, .45);
  text-align: center;
}
.auth-logo {
  height: 58px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin: 0 auto 16px;
  display: block;
}
.auth-card h1 { font-size: 18px; color: var(--navy); line-height: 1.6; margin-bottom: 4px; }
.auth-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }
.auth-card .field { text-align: right; margin-bottom: 13px; }
.auth-card .field label { font-size: 12px; }
.auth-card .field input { text-align: left; }
.auth-btn { width: 100%; justify-content: center; padding: 11px 16px; font-size: 13.5px; margin-top: 4px; }
.auth-error {
  margin-top: 13px;
  background: var(--red-2);
  border: 1px solid #f2c8ce;
  color: #9d2431;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
}
.auth-error[hidden] { display: none; }
.auth-foot { margin-top: 18px; color: var(--muted-2); font-size: 11px; line-height: 1.8; }
.auth-steps { margin: 14px 0 0; padding-inline-start: 20px; font-size: 13px; line-height: 2; color: var(--ink); }
.auth-steps li { margin-bottom: 2px; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #071e32, #0b2b46 55%, #0e3a5c);
}
.boot-screen[hidden] { display: none; }
.boot-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  color: #e8f2fb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.boot-card b { font-size: 14.5px; }
.boot-card span { font-size: 12px; color: #a9c4d9; line-height: 1.8; }
.boot-card .secondary { margin-top: 6px; }
.boot-spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: #7cc0ff;
  animation: bootSpin .8s linear infinite;
  margin-bottom: 4px;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }

.auth-setup {
  margin-top: 14px;
  text-align: right;
  background: var(--orange-2);
  border: 1px solid #f2dfbd;
  color: #8a5a10;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11.5px;
  line-height: 1.9;
}
.auth-setup[hidden] { display: none; }
.auth-setup b { display: block; font-size: 12.5px; margin-bottom: 2px; color: #7a4e0b; }
.auth-setup .code { font-size: 10.5px; }
