/* منظومة شركة الإرث — الواجهة */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/cairo-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-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, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/cairo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/cairo-latin.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 {
  --paper: #f8fafd;
  --surface: #fff;
  --ink: #202124;
  --ink-2: #4b5563;
  --line: #dce2eb;
  --line-soft: #edf1f6;
  --blue: #0b57d0;
  --blue-dark: #08439e;
  --blue-tint: #d3e3fd;
  --green: #137333;
  --green-tint: #e3f3e8;
  --red: #b3261e;
  --red-tint: #fce8e6;
  --amber: #825800;
  --amber-tint: #fef3cd;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px #20212412, 0 3px 8px #2021240d;
  --nav-w: 244px;
  --content-w: 1470px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Cairo, "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.65;
}
h1, h2, h3, p, dl, dd, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
bdi, .amt { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.icon { flex: none; }
.muted { color: var(--ink-2); }
.block { display: block; }
small { font-size: .82em; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav {
  background: var(--paper); border-inline-end: 1px solid var(--line-soft); padding: 20px 12px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark, .topbar-mark {
  flex: none; object-fit: contain; border-radius: 13px; background: white; border: 1px solid var(--line);
}
.brand-mark-lg { border-radius: 22px; box-shadow: var(--shadow); }
.brand-text { display: flex; flex-direction: column; line-height: 1.4; }
.brand-text strong { font-size: 19px; font-weight: 800; }
.brand-text small { color: var(--ink-2); font-size: 11.5px; }
.nav-group { padding: 0 16px; margin: 17px 0 6px; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; margin-bottom: 2px;
  border-radius: 999px; color: var(--ink); font-size: 14px; font-weight: 600; min-height: 42px;
}
.nav-link .icon { color: var(--ink-2); }
.nav-link:hover { background: #eaf0f8; text-decoration: none; }
.nav-link.is-active { background: var(--blue-tint); color: #041e49; font-weight: 800; }
.nav-link.is-active .icon { color: var(--blue); }
.nav-scrim, .topbar-mark { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; min-height: 69px; }
.page-title { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 6px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 10px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 999px; font-weight: 700; color: var(--ink);
}
.user-chip:hover { background: var(--blue-tint); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-tint); color: #041e49; display: grid; place-items: center; font-weight: 800; }
.icon-btn.nav-toggle { display: none; }
.content { padding: 4px 28px 48px; max-width: var(--content-w); width: 100%; margin-inline: auto; }

/* ---------- العناصر ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card.narrow { max-width: 700px; }
.card.center { text-align: center; margin-inline: auto; }
.card h2 { font-size: 18px; font-weight: 750; overflow-wrap: anywhere; }
.card > h2 { margin-bottom: 6px; }
.card > h2 + .muted { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumb { margin-bottom: 10px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 20px;
  border: 1px solid transparent; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, box-shadow .12s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); box-shadow: var(--shadow); }
.btn-tonal { background: var(--blue-tint); color: var(--blue-dark); }
.btn-tonal:hover { background: #d8e5f6; }
.btn-text { background: transparent; color: var(--blue-dark); padding-inline: 12px; }
.btn-text:hover { background: var(--blue-tint); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-text { background: transparent; color: var(--red); padding-inline: 12px; }
.btn-danger-text:hover { background: var(--red-tint); }
.btn-sm { min-height: 34px; padding: 4px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--line-soft); }
.inline-form { display: inline; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-paid, .badge-act-create { background: var(--green-tint); color: var(--green); }
.badge-partial, .badge-act-update { background: var(--amber-tint); color: var(--amber); }
.badge-unpaid { background: var(--blue-tint); color: var(--blue-dark); }
.badge-cancelled, .badge-act-cancel { background: var(--red-tint); color: var(--red); }
.badge-kind-in { background: var(--green-tint); color: var(--green); }
.badge-kind-out { background: var(--line-soft); color: var(--ink); }
.pill { display: inline-block; background: var(--paper); border-radius: 999px; padding: 0 10px; }

.money { white-space: nowrap; }
.money .cur { color: var(--ink-2); font-size: .86em; }
.money.strong .amt { font-weight: 700; }
.amt-in .amt { color: var(--green); }
.amt-out .amt { color: var(--red); }

/* ---------- الرسائل ---------- */
.flashes { padding: 0 28px; width: 100%; max-width: var(--content-w); margin-inline: auto; }
.flashes:empty { display: none; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--green-tint); color: #0f5236; border-color: #bfe2cf; }
.flash-error { background: var(--red-tint); color: #8a2a1e; border-color: #f2c7c0; }
.flash-info { background: var(--blue-tint); color: var(--blue-dark); border-color: #c9daf1; }
.flash-close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; display: grid; }
.form-error { background: var(--red-tint); color: #8a2a1e; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; }
.notice { background: var(--amber-tint); color: #6d4706; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.empty { color: var(--ink-2); padding: 22px 4px; text-align: center; }

/* ---------- الرئيسية ---------- */
.dashboard-lead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 3px 0 19px; }
.dashboard-lead h2 { font-size: clamp(25px, 2.5vw, 36px); font-weight: 800; line-height: 1.35; }
.dashboard-lead p { color: var(--ink-2); margin-top: 4px; font-size: 14px; }
.date-chip {
  flex: none; align-items: center; display: inline-flex; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; color: var(--ink-2); font-size: 13px;
}
.date-chip .icon { width: 16px; height: 16px; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.quick-action {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; min-height: 53px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-weight: 750;
  font-size: 14.5px; transition: border-color .12s, box-shadow .12s;
}
.quick-action:hover { text-decoration: none; border-color: var(--blue); box-shadow: var(--shadow); }
.quick-action .icon { width: 34px; height: 34px; padding: 7px; border-radius: 50%; }
.qa-in .icon { background: var(--green-tint); color: var(--green); }
.qa-out .icon { background: var(--red-tint); color: var(--red); }
.qa-pay .icon { background: var(--blue-tint); color: var(--blue); }
.qa-swap .icon { background: var(--amber-tint); color: var(--amber); }

.vault-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.vault-card {
  --vault-accent: var(--blue); --vault-tint: #e8f0fe;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 15px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.vault-card.vault-2 { --vault-accent: var(--green); --vault-tint: var(--green-tint); }
.vault-card.vault-3 { --vault-accent: var(--amber); --vault-tint: var(--amber-tint); }
.vault-card:hover { text-decoration: none; background: var(--vault-tint); border-color: var(--vault-accent); }
.vault-heading { display: flex; align-items: center; gap: 8px; color: var(--ink-2); min-width: 0; }
.vault-heading > .icon { margin-inline-start: auto; width: 15px; height: 15px; }
.vault-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--vault-tint); color: var(--vault-accent); flex: none; }
.vault-icon .icon { width: 19px; height: 19px; }
.vault-name { font-weight: 700; overflow-wrap: anywhere; }
.vault-balance { font-size: clamp(24px, 2.7vw, 37px); font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.vault-balance small { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.vault-open { font-size: 12.5px; color: var(--ink-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 500; background: var(--surface); }
.chip:hover { text-decoration: none; background: var(--paper); }
.chip.is-on { background: var(--blue-tint); border-color: var(--blue-tint); color: var(--blue-dark); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; }
.stat { padding: 16px 18px; border-inline-end: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); margin: 0 -1px -1px 0; }
.stat h3 { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.stat h3 .icon { width: 16px; height: 16px; color: var(--blue); }
.stat-value { font-size: 20px; font-weight: 600; line-height: 1.5; }
.stat-note, .stat-line { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.stat-line { font-size: 13.5px; color: var(--ink); }

.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.feed li:first-child { border-top: 0; }
.dir { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.dir-in { background: var(--green-tint); color: var(--green); }
.dir-out { background: var(--red-tint); color: var(--red); }
.feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.feed-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.feed-side { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.5; font-weight: 600; }
.feed-side .muted { font-size: 12.5px; font-weight: 400; }

/* ---------- النماذج ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 14.5px; }
.optional { color: var(--ink-2); font-weight: 400; font-size: 12.5px; }
.control { position: relative; display: flex; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #aeb8c5; border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%; min-height: 44px;
}
input[dir="ltr"] { text-align: right; }
input[data-money], input[data-rate] { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 17px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.suffix { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-size: 14px; pointer-events: none; }
.control:has(.suffix) input { padding-inline-end: 62px; }
.hint { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.field-error { color: var(--red); font-size: 13.5px; font-weight: 500; margin-top: 4px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); background: #fffafa; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 2px; margin-bottom: 14px; }
.group legend { padding: 0 8px; font-weight: 600; font-size: 14.5px; }
.calc { background: #eef4ff; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }
.calc strong { font-size: 18px; }
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.day-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.day-pick span { display: inline-block; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; }
.day-pick input:checked + span { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.day-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.inv-summary, .summary-3 { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.inv-summary > div, .summary-3 > div { padding: 10px 14px; display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); }
.inv-summary > div:last-child, .summary-3 > div:last-child { border-inline-end: 0; }
.inv-summary span:first-child, .summary-3 > div > span:first-child { color: var(--ink-2); font-size: 13px; }
.summary-3 .money .amt, .inv-summary strong { font-size: 18px; font-weight: 600; }
.is-key { background: #eef4ff; }
.summary-3 { margin-bottom: 14px; }

.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.filters input, .filters select { min-height: 38px; padding: 5px 10px; font-size: 14.5px; min-width: 120px; }
.filters .grow { flex: 1; min-width: 180px; }
.filters .btn { min-height: 38px; }
.inline-add { display: grid; grid-template-columns: 130px 1fr 1fr 1.5fr auto; gap: 0 10px; align-items: start; margin-bottom: 8px; }
.inline-add .btn { margin-top: 29px; }

.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { font-weight: 500; text-align: end; }
.kv-row { display: flex; flex-wrap: wrap; gap: 6px 32px; }
.kv-row > div { border: 0; padding: 0; justify-content: flex-start; gap: 8px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.kv-grid > div:nth-child(2) { border-top: 0; }
.kv-grid .span-2 { grid-column: span 2; }

.disclosure { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.disclosure summary { cursor: pointer; color: var(--blue-dark); font-weight: 600; margin-bottom: 10px; }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.big-balance { font-size: 36px; font-weight: 700; line-height: 1.3; }
.big-balance small { font-size: 17px; font-weight: 500; color: var(--ink-2); }

/* ---------- التبويبات والجداول ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 22px; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.tab:hover { text-decoration: none; background: var(--line-soft); }
.tab.is-active { color: var(--blue-dark); border-bottom-color: var(--blue); }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; font-weight: 600; color: var(--ink-2); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:hover { background: #f9fbfd; }
.table .num { text-align: end; }
.table .actions { text-align: end; white-space: nowrap; }
.table tfoot th, .table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; padding-top: 12px; font-size: 14.5px; color: var(--ink); }
.link-strong { font-weight: 600; }
.is-cancelled td { color: #8b96a6; }
.is-cancelled .money .amt { text-decoration: line-through; color: inherit; }
.changes li { display: flex; flex-wrap: wrap; gap: 2px 8px; line-height: 1.6; }
.ch-label { color: var(--ink-2); }
.ch-label::after { content: ":"; }
.ch-old { text-decoration: line-through; color: #8b96a6; }
.ch-arrow { color: var(--ink-2); }
.ch-new { font-weight: 600; }
.table-log td:nth-child(4) { min-width: 220px; }
.table-log td:nth-child(5) { min-width: 310px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------- نافذة التأكيد ---------- */
dialog.confirm { border: 0; border-radius: var(--radius); padding: 24px; max-width: min(420px, 92vw); box-shadow: 0 12px 40px rgba(20, 48, 79, .25); color: var(--ink); font: inherit; }
dialog.confirm::backdrop { background: rgba(20, 48, 79, .4); }
dialog.confirm p { font-weight: 500; font-size: 16.5px; margin-bottom: 18px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- صفحات الدخول ---------- */
.auth-body { display: grid; place-items: center; min-height: 100dvh; padding: 36px 16px; }
.auth-wrap { width: 100%; max-width: 455px; }
.auth-wrap:has(.auth-card-wide) { max-width: 640px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.auth-brand h1 { font-size: clamp(20px, 5vw, 26px); font-weight: 800; line-height: 1.5; }
.auth-wrap .flashes { padding: 0; }
.auth-card { padding: 28px; box-shadow: var(--shadow); border-radius: 26px; }
.auth-card h2 { margin-bottom: 14px; font-size: 19px; }
.auth-card h2 + .muted { margin-top: -8px; }

/* ---------- الهاتف ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(280px, 84vw); z-index: 30; visibility: hidden; transform: translateX(100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-open .nav { visibility: visible; transform: none; box-shadow: 0 0 40px rgba(20, 48, 79, .3); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(20, 48, 79, .4); z-index: 20; }
  .icon-btn.nav-toggle { display: grid; }
  .topbar-mark { display: block; }
  .user-chip { padding: 0; border: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 17px; }
  .stat-transfer { grid-column: span 2; }
  .topbar { padding: 10px 14px; position: sticky; top: 0; background: var(--paper); z-index: 10; gap: 6px; }
  .page-title { font-size: 19px; }
  .user-name, .topbar-user .btn span { display: none; }
  .topbar-user .btn { padding-inline: 8px; }
  .content { padding: 4px 14px 40px; }
  .flashes { padding: 0 14px; }
  .card { padding: 16px; }
  .quick { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick-action { padding: 8px 10px; font-size: 13.5px; gap: 7px; }
  .vault-grid { grid-template-columns: 1fr; }
  .vault-balance { font-size: 30px; }
  .inline-add { grid-template-columns: 1fr 1fr; }
  .inline-add .btn { margin-top: 0; grid-column: span 2; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv-grid > div:nth-child(2) { border-top: 1px solid var(--line-soft); }
  .kv-grid .span-2 { grid-column: auto; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .filters label { flex: 1 1 44%; }
  .filters .grow { flex-basis: 100%; }
  .filters input, .filters select { min-width: 0; }
  .inv-summary, .summary-3 { grid-template-columns: 1fr; }
  .inv-summary > div, .summary-3 > div { border-inline-end: 0; border-bottom: 1px solid var(--line); flex-direction: row; justify-content: space-between; align-items: center; }
  .inv-summary > div:last-child, .summary-3 > div:last-child { border-bottom: 0; }
  /* الجداول تتحول إلى بطاقات */
  .table-wrap { margin: 0; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tfoot, .table tr, .table td, .table th { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; margin-bottom: 10px; }
  .table td, .table tfoot th { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border: 0; text-align: end; }
  .table td::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; flex: none; text-align: start; }
  .table td:empty, .table td.actions:empty { display: none; }
  .table td.actions { justify-content: flex-end; }
  .table td.actions::before { content: none; }
  .table tfoot tr { background: var(--paper); }
  .table tfoot td, .table tfoot th { border: 0; padding-top: 5px; }
  .table-log td:nth-child(4), .table-log td:nth-child(5) { min-width: 0; }
  .table td { padding: 3px 0; }
  .changes li { justify-content: flex-end; }
  .feed-side .muted { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* المتابعة المالية */
.analytics-bar, .analytics-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.analytics-bar { margin-bottom: 10px; }
.analytics-bar h2 { font-size: 20px; font-weight: 800; }
.analytics-controls { position: relative; justify-content: flex-end; }
.dashboard-filters > summary { list-style: none; }
.dashboard-filters > summary::-webkit-details-marker { display: none; }
.dashboard-filters > .filters {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); position: absolute; z-index: 4;
  inset-inline-end: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 28px)); padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px #20212424;
}
.dashboard-filters .head-actions { grid-column: 1 / -1; }
.dashboard-filters .filters input, .dashboard-filters .filters select { min-width: 0; }
.dashboard-context { margin: -5px 0 11px; font-size: 13px; }
.dashboard-visuals { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(265px, 1fr); gap: 14px; align-items: start; }
.dashboard-visuals .card { min-width: 0; }
.dashboard-visuals h3 { font-size: 17px; font-weight: 800; }
.chart-period { font-size: 12px; }
.chart-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.chart-switch button {
  border: 0; padding: 4px 12px; min-height: 34px; background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.chart-switch button + button { border-inline-start: 1px solid var(--line); }
.chart-switch button[aria-pressed="true"] { background: var(--blue-tint); color: #041e49; }
.chart-switch button:focus-visible { outline-offset: -2px; }
.chart-legend { display: flex; gap: 15px; flex-wrap: wrap; margin: 0 0 13px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-in, .chart-in { background: #4285f4; }
.legend-out, .chart-out { background: #34a853; }
.cash-chart {
  --plot-height: 142px;
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px;
  align-items: start; position: relative; padding-top: 3px; min-height: calc(var(--plot-height) + 28px);
}
.chart-ticks {
  display: flex; flex-direction: column; justify-content: space-between; height: calc(var(--plot-height) + 14px);
  position: relative; top: -7px; color: var(--ink-2); font-size: 10px; font-variant-numeric: tabular-nums;
}
.chart-ticks span { height: 14px; line-height: 14px; }
.chart-track {
  display: grid; grid-template-columns: repeat(var(--buckets), minmax(36px, 1fr)); position: relative;
  overflow-x: auto; min-width: 0; min-height: calc(var(--plot-height) + 23px);
  background: linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px) 0 0 / 100% calc(var(--plot-height) / 4);
}
.chart-track::before { content: ""; position: absolute; inset-inline: 0; top: var(--plot-height); border-top: 1px solid var(--line); }
.chart-group { text-align: center; z-index: 1; }
.chart-group small { white-space: nowrap; color: var(--ink-2); font-size: 10px; }
.chart-pair { display: flex; justify-content: center; align-items: end; gap: 3px; height: var(--plot-height); padding-inline: 4px; }
.chart-bar { width: min(18px, 43%); height: var(--bar); border-radius: 5px 5px 0 0; }
.chart-empty-label {
  position: absolute; inset-inline-start: 50%; top: 40%; transform: translate(50%, -50%);
  z-index: 2; text-align: center; font-size: 13px; width: max-content; max-width: 85%;
  padding: 5px 11px; border-radius: 999px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.chart-data summary { cursor: pointer; color: var(--blue); font-size: 12.5px; }
.chart-data .table-wrap { margin-top: 6px; }
.due-card > .card-head { margin-bottom: 4px; }
.due-card > .card-head .icon { color: var(--blue); }
.due-measure { margin: 16px 0; }
.due-measure > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 5px 12px; font-size: 13px; }
.measure-track { margin-top: 7px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line-soft); }
.measure-track span { display: block; height: 100%; border-radius: inherit; }
.measure-in { background: #4285f4; }
.measure-out { background: #fbbc05; }
.due-actions { margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* الحسابات والعمليات */
.heading-icon, .field-link { display: inline-flex; align-items: center; gap: 6px; }
.heading-icon .icon, .field-link .icon { color: var(--blue); width: 17px; height: 17px; }
.field-link { font-size: 13px; font-weight: 700; margin: -7px 0 13px; }
.category-list { display: flex; flex-wrap: wrap; gap: 8px; }
.category-list li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.balance-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.payment-context { margin: 0 0 15px; }
.password-toggle { position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; }
.password-toggle[aria-pressed="true"] { color: var(--blue); background: var(--blue-tint); }
.control:has(.password-toggle) input { padding-inline-end: 47px; }
.statement-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.statement-brand img { flex: none; border-radius: 12px; border: 1px solid var(--line); }
.statement-brand p { font-size: 12.5px; }
.statement-overview .head-actions { margin-top: 14px; }
.statement-overview .filters { margin: 14px 0 0; }
.balance-label { background: var(--blue-tint); color: #041e49; border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.statement-prior { background: var(--paper); }
.statement-currency > .hint { margin-top: 10px; }
.filters label, .filters select { max-width: 100%; }
.filters select { text-overflow: ellipsis; }
td, dd { overflow-wrap: anywhere; }

@media (max-width: 1110px) {
  .dashboard-visuals { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 720px) {
  .vault-row { grid-template-columns: 1fr; gap: 8px; }
  .vault-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 10px 12px; }
  .vault-heading > .icon { display: none; }
  .vault-name { font-size: 13px; }
  .vault-balance { font-size: 22px; text-align: end; }
  .vault-open { grid-column: 1 / -1; font-size: 11px; }
  .dashboard-lead { align-items: start; }
  .dashboard-lead p { font-size: 12.5px; }
  .date-chip { display: none; }
  .dashboard-filters > .filters { width: min(360px, calc(100vw - 28px)); }
  .analytics-controls { width: 100%; justify-content: space-between; }
  .analytics-controls .chips { gap: 4px; }
  .analytics-controls .chip { padding-inline: 8px; }
  .chart-track { grid-template-columns: repeat(var(--buckets), minmax(33px, 1fr)); }
  .statement-table tbody td { align-items: baseline; }
  .statement-table td[data-label="البيان"] { display: block; }
  .statement-table td[data-label="البيان"]::before { display: block; }
  .statement-table td[data-label="البيان"] .block { font-size: 11px; }
  .statement-table tfoot td { border-bottom: 1px solid var(--line); }
  .statement-table .statement-total-title { display: none; }
}
@media (max-width: 380px) {
  .quick-action { font-size: 12.5px; }
  .quick-action .icon { width: 29px; height: 29px; padding: 6px; }
  .stat-value { font-size: 15px; }
  .analytics-controls .chip { font-size: 12px; padding: 4px 8px; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; color: #111; }
  .nav, .nav-scrim, .topbar-user, .quick, .filters, .actions, .btn, .screen-only, dialog { display: none !important; }
  .shell { display: block; }
  body:has(.statement) .topbar, body:has(.statement) .flashes { display: none !important; }
  body:has(.statement) .content { padding: 0; }
  .statement .card { border: 0; margin: 0 0 14px; padding: 0; }
  .statement-overview, .statement-currency .card-head { break-inside: avoid; }
  .statement-currency .card-head { break-after: avoid; }
  .statement .table-wrap { overflow: visible; margin: 0; }
  .statement .table { display: table; font-size: 11px; }
  .statement .table thead { display: table-header-group; }
  .statement .table tbody, .statement .table tfoot { display: table-row-group; }
  .statement .table tr { display: table-row; break-inside: avoid; }
  .statement .table td, .statement .table th {
    display: table-cell; width: auto; padding: 5px 7px; border-bottom: 1px solid #ddd; text-align: start; font-size: 11px;
  }
  .statement .table .num { text-align: end; }
  .statement .statement-total-title { display: table-cell; }
  .statement .table td::before { content: none; }
  .statement a { color: inherit; }
}
