/* ميزان — نظام محاسبي سحابي | واجهة عربية RTL */
:root {
  --ink: #0f1f2b;
  --ink-2: #3c4d5a;
  --muted: #74838f;
  --line: #e3e8ec;
  --line-2: #eef2f4;
  --bg: #f4f6f7;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-2: #0b5c56;
  --brand-soft: #e6f4f2;
  --side: #0c2a2f;
  --side-2: #12373d;
  --side-ink: #b9cfd0;
  --gold: #b88a1e;
  --red: #c2410c;
  --red-soft: #fdeee6;
  --green: #15803d;
  --green-soft: #e7f6ec;
  --amber: #a16207;
  --amber-soft: #fdf5dc;
  --blue: #1d5fbf;
  --blue-soft: #e8f0fc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 31, 43, .05), 0 1px 3px rgba(15, 31, 43, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; direction: ltr; text-align: left; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.right { text-align: right; } .left { text-align: left; } .center { text-align: center; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.hidden { display: none !important; }

/* ───────── Layout ───────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  position: fixed; inset: 0 0 0 auto; overflow-y: auto; z-index: 40;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; color: #fff; font-weight: 800; font-size: 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 65%, #fff), var(--brand)); color: #fff; font-size: 17px;
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--side-ink); }
.brand.has-logo { padding-block: 14px; }
.brand-logo { max-height: 44px; max-width: 190px; width: auto; height: auto; display: block; }
.nav { padding: 6px 12px 20px; }
.nav-title { font-size: 11px; letter-spacing: .3px; color: #6f9196; padding: 14px 10px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); font-weight: 600; font-size: 13.5px;
}
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
/* Accordion groups */
.nav a.nav-top { margin-bottom: 2px; }
.nav-group { margin-top: 2px; }
.nav-head {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--side-ink); font-weight: 700; font-size: 13.5px; font-family: inherit;
}
.nav-head span { flex: 1; }
.nav-head:hover, .nav-head:focus-visible { background: var(--side-2); color: #fff; }
.nav-head.current { color: #fff; }
.nav-head .chev { width: 15px; height: 15px; opacity: .6; transition: transform .18s; }
.nav-group.open > .nav-head .chev { transform: rotate(-90deg); }
.nav-group.open > .nav-head { color: #fff; }
.nav-sub { display: none; padding: 2px 0 6px; margin-right: 18px; border-right: 1px solid var(--side-2); }
.nav-group.open > .nav-sub { display: block; }
.nav-sub a { padding: 6px 12px; font-size: 13px; font-weight: 500; border-radius: 0 8px 8px 0; margin-right: -1px; border-right: 2px solid transparent; }
.nav-sub a.active { background: var(--side-2); color: #fff; border-right-color: var(--brand); font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--side-2); font-size: 12px; }
.sidebar-foot .plan { color: #fff; font-weight: 700; }

.main { flex: 1; margin-right: 248px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .company { font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.menu-btn { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.trial-bar { background: var(--amber-soft); color: var(--amber); padding: 8px 24px; font-size: 13px; font-weight: 600; border-bottom: 1px solid #f3e3b0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ───────── Cards ───────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 800; }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card, .dash-search > .card + .card { margin-top: 0; }
.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)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .hint { font-size: 12px; color: var(--muted); }
.stat.accent { border-top: 3px solid var(--brand); }

/* ───────── Tables ───────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); background: #fafbfc; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fbfcfc; }
.table tfoot td { font-weight: 800; background: #fafbfc; border-top: 2px solid var(--line); }
.table .group td { background: #f7f9fa; font-weight: 700; }
.table td.actions-cell { white-space: nowrap; text-align: left; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ───────── Forms ───────── */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.field .req { color: var(--red); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid #cfd8de; border-radius: 8px;
  font: inherit; color: var(--ink); background: #fff; transition: border .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .14); }
.input.sm { height: 34px; padding: 0 8px; font-size: 13px; }
.input[readonly] { background: #f6f8f9; }
.field .error, .error-text { color: var(--red); font-size: 12px; margin-top: 4px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-start; padding-top: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { margin: 0; min-width: 150px; }
.filters .field label { font-size: 12px; margin-bottom: 4px; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-light { background: #fff; color: var(--ink); border-color: #cfd8de; }
.btn-light:hover { background: #f5f7f8; }
.btn-danger { background: #fff; color: var(--red); border-color: #f1c7b4; }
.btn-danger:hover { background: var(--red-soft); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 32px; padding: 0; }
.btn-link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-weight: 700; padding: 0; }
form.inline { display: inline; }

/* ───────── Badges & alerts ───────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-gray { background: #eef1f3; color: #55636e; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; border: 1px solid; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: #bfe5cb; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: #f4cdb9; }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: #c9dbf7; }
.alert ul { margin: 4px 0 0; padding-right: 18px; }

/* ───────── Tabs ───────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; }
.tabs a { padding: 12px 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ───────── Document editor ───────── */
.lines-table td { padding: 6px 6px; border-bottom: 1px solid var(--line-2); }
.lines-table th { padding: 8px 6px; }
.lines-table .input { height: 36px; }
.lines-table .col-desc { min-width: 220px; }
.lines-table .col-num { width: 110px; }
.lines-table .col-tax { width: 90px; }
.lines-table .col-total { width: 120px; font-weight: 700; }
.totals { width: 100%; max-width: 360px; margin-right: auto; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.totals .grand { font-size: 17px; font-weight: 800; border-bottom: 0; padding-top: 10px; }
.product-pick { position: relative; }
.suggest { position: absolute; top: 100%; right: 0; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1); z-index: 20; max-height: 240px; overflow: auto; }
.suggest div { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.suggest div:hover, .suggest div.on { background: var(--brand-soft); }

/* ───────── Tree (chart of accounts) ───────── */
.tree td:first-child { white-space: nowrap; }
.tree .lvl-0 td { font-weight: 800; background: #f6f8f9; }
.tree .lvl-1 td:first-child { padding-right: 34px; }
.tree .lvl-2 td:first-child { padding-right: 54px; }
.tree .lvl-3 td:first-child { padding-right: 74px; }
.tree .lvl-4 td:first-child { padding-right: 94px; }
.tree .is-group td { font-weight: 700; }

/* ───────── Chart bars ───────── */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 10px 6px 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar span.fill { width: 100%; max-width: 46px; background: var(--brand); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 55%, #fff), var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.bars .bar small { color: var(--muted); font-size: 11.5px; }
.bars .bar b { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ───────── Report ───────── */
.report { max-width: 900px; }
.report-title { text-align: center; padding: 18px; border-bottom: 1px solid var(--line); }
.report-title h2 { font-size: 18px; }
.report-section td { background: #f3f7f7; font-weight: 800; color: var(--brand-2); }
.report .total-row td { font-weight: 800; border-top: 2px solid var(--ink); }
.report .grand-row td { font-weight: 800; font-size: 15px; background: var(--brand-soft); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ───────── Auth & landing ───────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--side); color: #d6e6e6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { color: #fff; font-size: 30px; font-weight: 800; margin: 18px 0 10px; }
.auth-side ul { padding: 0; list-style: none; margin: 24px 0 0; }
.auth-side li { padding: 8px 0; display: flex; gap: 10px; align-items: center; }
.auth-side li::before { content: "✓"; color: color-mix(in srgb, var(--brand) 50%, #fff); font-weight: 800; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }

.land-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 40px; background: #fff; border-bottom: 1px solid var(--line); }
.land-nav .brand { color: var(--ink); padding: 0; }
.hero { background: var(--side); color: #cfe2e2; padding: 80px 40px; text-align: center; }
.hero h1 { color: #fff; font-size: 40px; font-weight: 800; max-width: 760px; margin: 0 auto 14px; }
.hero p { font-size: 17px; max-width: 640px; margin: 0 auto 28px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1150px; margin: -40px auto 0; padding: 0 24px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.feature h3 { font-size: 16px; margin: 10px 0 6px; }
.feature p { color: var(--muted); margin: 0; font-size: 13.5px; }
.feature .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.pricing { max-width: 1150px; margin: 60px auto; padding: 0 24px; }
.pricing h2 { text-align: center; font-size: 28px; font-weight: 800; margin-bottom: 26px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; }
.plan-card.featured { border: 2px solid var(--brand); }
.plan-card h3 { font-size: 18px; }
.plan-card .price { font-size: 32px; font-weight: 800; margin: 10px 0; }
.plan-card .price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.plan-card ul { list-style: none; padding: 0; margin: 10px 0 20px; flex: 1; }
.plan-card li { padding: 5px 0; font-size: 13.5px; }
.plan-card li::before { content: '✓  '; color: var(--brand); font-weight: 800; }

/* ───────── Info list ───────── */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 8px 0; display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line-2); }
.check-list .ok { color: var(--green); font-weight: 800; }
.check-list .no { color: var(--red); font-weight: 800; }

.pagination-wrap { padding: 12px 18px; }
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; min-width: 34px; height: 34px; line-height: 34px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; color: var(--ink); }
.pagination .active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled span { color: #b5bec5; }

details.collapse summary { cursor: pointer; font-weight: 700; color: var(--brand); padding: 8px 0; }
pre.code { background: #0f1f2b; color: #d1e7e6; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12px; direction: ltr; text-align: left; max-height: 420px; }

/* ───────── Dashboard ───────── */
.zatca-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 16px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--brand-soft), #fff); border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff); }
.zatca-banner .zb-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; flex-shrink: 0; }
.zatca-banner .zb-icon svg { width: 22px; height: 22px; }
.zatca-banner .zb-text { flex: 1; min-width: 0; }
.zatca-banner .zb-text strong { display: block; font-size: 14.5px; }
.zatca-banner .zb-text span { color: var(--ink-2); font-size: 13px; }
.dash-search { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.search-card { padding: 14px 16px; margin: 0 !important; }
.search-card label { display: block; font-weight: 800; font-size: 13.5px; margin-bottom: 8px; }
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px 8px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); font-weight: 700; font-size: 13px; transition: border-color .15s, transform .15s; }
.tile:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-1px); }
.tile-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.tile-ic svg { width: 21px; height: 21px; }
.tile-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tile-primary .tile-ic { background: rgba(255,255,255,.18); color: #fff; }
.trend { font-weight: 700; font-size: 12px; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); }
.dash-head { flex-wrap: wrap; }
.seg { display: flex; gap: 4px; background: var(--line-2); padding: 3px; border-radius: 9px; flex-wrap: wrap; }
.seg button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); font-family: inherit; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--card); color: var(--brand); box-shadow: 0 1px 2px rgba(15,31,43,.12); }
.seg button:focus-visible { outline: 2px solid var(--brand); }
.seg .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; text-align: center; }
[data-tabs] .pane { display: none; }
[data-tabs] .pane.active { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend i, .donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.chart-wrap { overflow-x: auto; }
.chart-svg { display: block; width: 100%; min-width: 520px; height: auto; font-family: inherit; }
.chart-svg .grid { stroke: var(--line-2); stroke-width: 1; }
.chart-svg .axis0 { stroke: var(--line); stroke-width: 1.2; }
.chart-svg .tick { fill: var(--muted); font-size: 11.5px; }
.chart-svg .hover-band { fill: transparent; }
.chart-svg .bar-g:hover .hover-band { fill: rgba(15,31,43,.04); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mini-stats > div { background: var(--line-2); border-radius: 8px; padding: 10px 12px; }
.mini-stats span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.mini-stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.mini-stats small { margin-right: 6px; }
.donut-body { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-svg .donut-big { font-size: 22px; font-weight: 800; fill: var(--ink); font-family: inherit; }
.donut-svg .donut-small { font-size: 12px; fill: var(--muted); font-family: inherit; }
.donut-legend { list-style: none; margin: 0; padding: 0; width: 100%; }
.donut-legend li { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.donut-legend li:last-child { border-bottom: 0; }
.donut-legend span { flex: 1; }
.donut-legend b { font-variant-numeric: tabular-nums; }
.donut-legend small { color: var(--muted); min-width: 36px; text-align: left; }
.spark-box { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px 0; }
.spark-svg { display: block; width: 100%; height: 70px; margin-top: 6px; }
.spark-area { fill: color-mix(in srgb, var(--brand) 14%, transparent); }
.spark-line { fill: none; stroke: var(--brand); stroke-width: 2; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line-2); color: var(--ink); }
a.list-row:hover { background: var(--line-2); text-decoration: none; }
.list-row small { display: block; color: var(--muted); font-size: 12px; }
.split > div > .card + .card, .split > div > .stat + .card { margin-top: 16px; }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  html, body { overflow-x: hidden; overflow-x: clip; }
  .grid-2, .grid-3, .grid-4 { min-width: 0; }
  .grid > *, .form-grid > * { min-width: 0; overflow-wrap: anywhere; }
  .card:has(table):not(:has(.suggest)) { overflow-x: auto; }
  .card-head { flex-wrap: wrap; }
  .card-head .actions, .page-head .actions { flex-wrap: wrap; }
  .card-head .actions .input { min-width: 0; flex: 1 1 130px; }
  .table th, .table td { white-space: nowrap; }
  .send-pop { left: auto; right: 0; width: min(320px, calc(100vw - 32px)); }
  .sidebar { transform: translateX(100%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .2s; box-shadow: -10px 0 40px rgba(0,0,0,.25); }
  .main { margin-right: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .hero h1 { font-size: 28px; }
  .features { grid-template-columns: 1fr; margin-top: 20px; }
  .land-nav { padding: 14px 16px; }
  .topbar .company { display: none; }
}

@media (max-width: 480px) {
  .stat .value { font-size: 20px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px 4px; font-size: 12px; }
  .zatca-banner { flex-wrap: wrap; }
  .page-head h1 { font-size: 19px; }
}

/* ───────── Print ───────── */
@media print {
  .sidebar, .topbar, .no-print, .trial-bar { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* Send-by-email popover */
details.send-box { position: relative; }
details.send-box summary { list-style: none; }
details.send-box summary::-webkit-details-marker { display: none; }
.send-pop { position: absolute; top: calc(100% + 6px); left: 0; width: 320px; max-width: 90vw; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.12); z-index: 25; }
