/* صافي — الحسابات | Accounting back-office UI */

:root {
  color-scheme: light;
  --bg: #EEF4F6;
  --bg-tint: radial-gradient(1200px 420px at 85% -120px, rgba(11, 163, 179, .10), transparent 70%), radial-gradient(900px 380px at 0% -80px, rgba(182, 227, 74, .08), transparent 70%);
  --surface: #FFFFFF;
  --surface-2: #F6F9FA;
  --surface-3: #EDF3F5;
  --hover: #F2F8F9;
  --line: #E1E9ED;
  --line-strong: #CBD7DE;
  --text: #0A2230;
  --text-2: #33505E;
  --muted: #5F7A88;
  --faint: #93A9B5;
  --primary: #098A99;
  --primary-strong: #075E6B;
  --primary-soft: #DDF6F8;
  --primary-ink: #075E6B;
  --on-primary: #FFFFFF;
  --citrus: #B6E34A;
  --citrus-soft: #F3FCD9;
  --dr: #D63A2C;
  --dr-bg: #FFECE9;
  --cr: #0F8A50;
  --cr-bg: #E2F6EB;
  --warn: #B86A00;
  --warn-strong: #E58A00;
  --warn-bg: #FFF3DC;
  --info: #2468D0;
  --info-bg: #E6F0FD;
  --violet: #6E4FD8;
  --violet-bg: #EFEAFE;
  --chart-a: #098A99;
  --chart-b: #9DB2BE;
  --grid: #E6EDF0;
  --paper: #FFFFFF;
  --sidebar: linear-gradient(165deg, #075E6B 0%, #053F48 58%, #032A31 100%);
  --overlay: rgba(4, 26, 32, .42);
  --focus: 0 0 0 3px rgba(11, 163, 179, .38);
  --shadow-card: 0 1px 2px rgba(6, 40, 52, .05), 0 1px 1px rgba(6, 40, 52, .03);
  --shadow-pop: 0 18px 44px -14px rgba(6, 40, 52, .28), 0 4px 12px -4px rgba(6, 40, 52, .10);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061820;
  --bg-tint: radial-gradient(1200px 420px at 85% -120px, rgba(56, 194, 207, .10), transparent 70%), radial-gradient(900px 380px at 0% -80px, rgba(182, 227, 74, .05), transparent 70%);
  --surface: #0B2430;
  --surface-2: #0E2B38;
  --surface-3: #123241;
  --hover: #113040;
  --line: rgba(163, 181, 192, .14);
  --line-strong: rgba(163, 181, 192, .26);
  --text: #E7F2F5;
  --text-2: #BCD0D8;
  --muted: #8AA3AF;
  --faint: #5F7C89;
  --primary: #38C2CF;
  --primary-strong: #7DDAE2;
  --primary-soft: rgba(56, 194, 207, .14);
  --primary-ink: #7DDAE2;
  --on-primary: #032A31;
  --citrus-soft: rgba(182, 227, 74, .12);
  --dr: #FF8273;
  --dr-bg: rgba(255, 92, 77, .14);
  --cr: #45D693;
  --cr-bg: rgba(18, 161, 94, .16);
  --warn: #FFB547;
  --warn-strong: #FFB547;
  --warn-bg: rgba(255, 176, 32, .14);
  --info: #7DB2FF;
  --info-bg: rgba(47, 128, 237, .16);
  --violet: #B5A1FF;
  --violet-bg: rgba(142, 108, 239, .16);
  --chart-a: #38C2CF;
  --chart-b: #4E6B79;
  --grid: rgba(163, 181, 192, .12);
  --sidebar: linear-gradient(165deg, #064450 0%, #042F37 55%, #021B20 100%);
  --overlay: rgba(0, 8, 12, .6);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 18px 44px -14px rgba(0, 0, 0, .7), 0 4px 12px -4px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #061820;
    --bg-tint: radial-gradient(1200px 420px at 85% -120px, rgba(56, 194, 207, .10), transparent 70%), radial-gradient(900px 380px at 0% -80px, rgba(182, 227, 74, .05), transparent 70%);
    --surface: #0B2430;
    --surface-2: #0E2B38;
    --surface-3: #123241;
    --hover: #113040;
    --line: rgba(163, 181, 192, .14);
    --line-strong: rgba(163, 181, 192, .26);
    --text: #E7F2F5;
    --text-2: #BCD0D8;
    --muted: #8AA3AF;
    --faint: #5F7C89;
    --primary: #38C2CF;
    --primary-strong: #7DDAE2;
    --primary-soft: rgba(56, 194, 207, .14);
    --primary-ink: #7DDAE2;
    --on-primary: #032A31;
    --citrus-soft: rgba(182, 227, 74, .12);
    --dr: #FF8273;
    --dr-bg: rgba(255, 92, 77, .14);
    --cr: #45D693;
    --cr-bg: rgba(18, 161, 94, .16);
    --warn: #FFB547;
    --warn-strong: #FFB547;
    --warn-bg: rgba(255, 176, 32, .14);
    --info: #7DB2FF;
    --info-bg: rgba(47, 128, 237, .16);
    --violet: #B5A1FF;
    --violet-bg: rgba(142, 108, 239, .16);
    --chart-a: #38C2CF;
    --chart-b: #4E6B79;
    --grid: rgba(163, 181, 192, .12);
    --sidebar: linear-gradient(165deg, #064450 0%, #042F37 55%, #021B20 100%);
    --overlay: rgba(0, 8, 12, .6);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop: 0 18px 44px -14px rgba(0, 0, 0, .7), 0 4px 12px -4px rgba(0, 0, 0, .4);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-ui); font-size: 14px; line-height: 1.55; color: var(--text);
  background: var(--bg); background-image: var(--bg-tint); background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
.num { white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[dir="rtl"] .flip { transform: scaleX(-1); }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.dr-t { color: var(--dr); }
.cr-t { color: var(--cr); }
.warn-t { color: var(--warn); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .02em; }
.code { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  background: var(--sidebar); color: #E8F7F9;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar::after {
  content: ""; position: absolute; inset-inline-end: -40px; bottom: -40px; width: 220px; height: 220px; pointer-events: none;
  background: radial-gradient(circle at 70% 70%, rgba(201, 240, 107, .16) 0 18%, transparent 19%), radial-gradient(circle at 38% 46%, rgba(255, 255, 255, .07) 0 13%, transparent 14%), radial-gradient(circle at 18% 22%, rgba(255, 255, 255, .05) 0 8%, transparent 9%);
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 20px 14px; }
.sb-brand .safy-lockup { --lk: 30px !important; }
.sb-tag {
  font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px;
  background: rgba(201, 240, 107, .14); color: #DDF79E; border: 1px solid rgba(201, 240, 107, .25); white-space: nowrap;
}
.sb-company { margin: 0 14px 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 10px; align-items: center; font-size: 12px; }
.sb-company b { display: block; font-weight: 600; font-size: 12.5px; color: #fff; }
.sb-company span { color: rgba(232, 247, 249, .62); }
.sb-company .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--citrus); box-shadow: 0 0 0 4px rgba(182, 227, 74, .18); flex-shrink: 0; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.sb-group { margin-top: 12px; }
.sb-group > span { display: block; font-size: 11px; font-weight: 500; color: rgba(232, 247, 249, .48); padding: 0 12px 6px; letter-spacing: .02em; }
.sb-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px; color: rgba(232, 247, 249, .82);
  font-size: 13.5px; position: relative; transition: background .18s, color .18s;
}
.sb-link svg { opacity: .78; width: 18px; height: 18px; }
.sb-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-link.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 500; }
.sb-link.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--citrus); }
[dir="rtl"] .sb-link.active::before { border-radius: 4px 0 0 4px; }
.sb-link.active svg { opacity: 1; color: var(--citrus); }
.sb-link .cnt { margin-inline-start: auto; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; }
.sb-link .cnt.hot { background: #FF5C4D; }
.sb-link .cnt.warn { background: #FFB020; color: #3B2600; }
.sb-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(232, 247, 249, .65); position: relative; z-index: 1; }
.sb-foot .lock { display: inline-flex; align-items: center; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.search-toggle { display: none !important; }
.search { position: relative; flex: 1; max-width: 440px; }
.search input {
  width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding-inline: 40px 64px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--primary); box-shadow: var(--focus); }
.search > svg { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--faint); }
.search kbd { position: absolute; inset-inline-end: 10px; top: 9px; font: 500 11px/20px var(--font-ui); padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); }
.search-res {
  position: absolute; top: calc(100% + 8px); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop);
  max-height: 420px; overflow-y: auto; padding: 6px; display: none; z-index: 60;
}
.search-res.open { display: block; animation: pop .16s var(--ease-out); }
.search-res .grp { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; font-weight: 500; }
.search-res button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: start; padding: 8px 10px; border: 0; background: none; border-radius: 10px; }
.search-res button:hover, .search-res button.on { background: var(--hover); }
.search-res button small { color: var(--muted); margin-inline-start: auto; }
.search-res .empty { padding: 18px; text-align: center; color: var(--muted); }
.tb-spacer { flex: 1; }
.period {
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.period button { border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.period button:hover { background: var(--hover); }
.period button.on { background: var(--primary); color: var(--on-primary); font-weight: 500; box-shadow: var(--sh-brand); }
.period-wrap { position: relative; }
.period-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, transform .15s; position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.96); }
.icon-btn .pip { position: absolute; top: 9px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: #FF5C4D; border: 2px solid var(--surface); }
.lang-btn { width: auto; padding: 0 12px; font-weight: 600; font-size: 13px; gap: 6px; display: inline-flex; align-items: center; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 4px; padding-inline-end: 10px; height: 40px; }
.user-btn:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; background: var(--grad-brand); flex-shrink: 0; }
.user-btn b { font-weight: 500; font-size: 13px; display: block; line-height: 1.2; text-align: start; }
.user-btn small { font-size: 11px; color: var(--muted); display: block; line-height: 1.2; text-align: start; }

.menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 70; display: none;
}
.menu.open { display: block; animation: pop .16s var(--ease-out); }
.menu button, .menu a { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 9px; color: var(--text); font-size: 13.5px; text-align: start; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .head { padding: 10px; display: flex; gap: 10px; align-items: center; }
.menu .head small { display: block; color: var(--muted); font-size: 12px; }
.custom-range { padding: 12px; display: grid; gap: 10px; min-width: 280px; }

.content { padding: 26px 28px 80px; max-width: 1480px; width: 100%; margin: 0 auto; }
.content.enter { animation: enter .32s var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- page header ---------- */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs svg { width: 14px; height: 14px; }
.ph h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph p { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: var(--sh-brand); }
.btn.primary:hover { background: var(--primary-strong); }
:root[data-theme="dark"] .btn.primary:hover { background: #5FD0DB; }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); }
.btn.soft:hover { filter: brightness(.97); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--dr); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn.citrus { background: var(--citrus); color: #1C3300; border-color: transparent; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 500; padding: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 15px; height: 15px; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-h h3 svg { color: var(--primary); }
.card-h .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-b { padding: 4px 18px 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 360px; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .lbl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.kpi .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.kpi .ic svg { width: 16px; height: 16px; }
.kpi .val { font-size: 24px; font-weight: 600; margin-top: 10px; letter-spacing: -.01em; }
.kpi .val small { font-size: 13px; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.kpi .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.kpi .spark { position: absolute; inset-inline-end: 14px; top: 16px; width: 86px; height: 30px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 999px; }
.delta svg { width: 13px; height: 13px; }
.delta.up { color: var(--cr); background: var(--cr-bg); }
.delta.down { color: var(--dr); background: var(--dr-bg); }
.kpi.hero { background: var(--grad-night); color: #EAF8FA; border-color: transparent; }
.kpi.hero .lbl, .kpi.hero .foot { color: rgba(234, 248, 250, .7); }
.kpi.hero .ic { background: rgba(201, 240, 107, .16); color: var(--citrus); }
.kpi.hero .val small { color: rgba(234, 248, 250, .7); }

.liq { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.liq > div { padding: 14px 18px; border-inline-start: 1px solid var(--line); }
.liq > div:first-child { border-inline-start: 0; }
.liq .t { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.liq .t svg { width: 15px; height: 15px; }
.liq .v { font-size: 18px; font-weight: 600; margin-top: 4px; }
.liq .s { font-size: 11.5px; color: var(--faint); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.chip svg { width: 13px; height: 13px; }
.chip.ok { background: var(--cr-bg); color: var(--cr); }
.chip.bad { background: var(--dr-bg); color: var(--dr); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.pri { background: var(--primary-soft); color: var(--primary-ink); }
.chip.vio { background: var(--violet-bg); color: var(--violet); }
.chip.draft { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.chip.posted { background: transparent; border: 1px solid color-mix(in srgb, var(--cr) 40%, transparent); color: var(--cr); }
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-weight: 500; white-space: nowrap; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  text-align: start; font-weight: 500; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 10px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); position: sticky; top: 0;
}
.tbl th.n, .tbl td.n { text-align: end; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.flash { animation: flash 2.2s var(--ease-out); }
@keyframes flash { 0%, 30% { background: var(--citrus-soft); } 100% { background: transparent; } }
.tbl td.n, .tbl .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.tbl tr.total td { font-weight: 600; border-top: 1.5px solid var(--text-2); border-bottom: 3px double var(--text-2); background: var(--surface-2); }
.tbl tr.sub td { font-weight: 600; background: var(--surface-2); }
.tbl tr.grp td { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 12.5px; }
.tbl tr.open-row td { color: var(--muted); font-style: normal; background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.tbl .first { padding-inline-start: 18px; }
.tbl .last { padding-inline-end: 18px; }
.tbl.compact td { padding: 8px 12px; }
.tbl.compact th { padding: 8px 12px; }
.tbl .neg { color: var(--dr); }
.tbl .zero { color: var(--faint); }
.tbl col.amt { width: 140px; }
th.dr-h { color: var(--dr); }
th.cr-h { color: var(--cr); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 12px; display: block; }
.ava { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary-ink); }
.thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.thumb svg { width: 36px; height: 36px; }
.thumb.lg { width: 52px; height: 52px; }
.thumb.lg svg { width: 48px; height: 48px; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state svg { width: 32px; height: 32px; color: var(--faint); margin-bottom: 8px; }

/* balances */
.bal { display: inline-flex; align-items: baseline; gap: 6px; justify-content: flex-end; }
.bal .side { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; }
.bal.dr .side { background: var(--dr-bg); color: var(--dr); }
.bal.cr .side { background: var(--cr-bg); color: var(--cr); }
.bal.zero { color: var(--faint); }

/* meter */
.meter { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; position: relative; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .6s var(--ease-out); }
.meter.warn > i { background: var(--warn-strong); }
.meter.bad > i { background: var(--dr); }
.meter-l { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; gap: 6px; }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.toolbar .search-sm { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .search-sm input { width: 100%; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding-inline: 34px 12px; outline: none; font-size: 13px; }
.toolbar .search-sm input:focus { border-color: var(--primary); box-shadow: var(--focus); background: var(--surface); }
.toolbar .search-sm svg { position: absolute; inset-inline-start: 10px; top: 9px; width: 17px; height: 17px; color: var(--faint); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); flex-wrap: wrap; }
.seg button { border: 0; background: none; height: 30px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button .c { font-size: 11px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-card); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .lbl-s { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A92A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir="rtl"] .select { background-position: left 10px center; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: var(--focus); }
.input.num-in { text-align: end; font-variant-numeric: tabular-nums; }
.input.big { height: 54px; font-size: 22px; font-weight: 600; }
.input.err { border-color: var(--dr); }
.input-g { position: relative; }
.input-g .unit { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }
.input-g .input { padding-inline-start: 46px; }
.fgrid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid .full { grid-column: 1 / -1; }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.choice label { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line-strong); cursor: pointer; font-size: 13px; transition: border-color .15s, background .15s; }
.choice label:hover { background: var(--hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: 500; }
.choice label:has(input:focus-visible) { box-shadow: var(--focus); }
.choice label svg { width: 18px; height: 18px; }
.switch { position: relative; width: 40px; height: 23px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease-out); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(17px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-17px); }
.switch input:focus-visible + i { box-shadow: var(--focus); }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface-2); width: 100%; }
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.file svg { width: 15px; height: 15px; color: var(--primary); }

/* ---------- journal lines editor ---------- */
.lines td { padding: 6px 8px; }
.lines td:first-child { padding-inline-start: 14px; color: var(--faint); font-size: 12px; width: 36px; }
.lines .input, .lines .select { height: 38px; border-color: var(--line); background: var(--surface-2); }
.lines .input:focus, .lines .select:focus { background: var(--surface); }
.lines .rm { width: 34px; height: 34px; border-radius: 9px; border: 0; background: none; color: var(--faint); display: grid; place-items: center; }
.lines .rm:hover { background: var(--dr-bg); color: var(--dr); }
.balance-bar { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.balance-bar .tot { display: grid; gap: 2px; }
.balance-bar .tot small { font-size: 11.5px; color: var(--muted); }
.balance-bar .tot b { font-size: 17px; font-weight: 600; }
.bal-ind { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; font-weight: 600; font-size: 13px; transition: background .25s, color .25s; }
.bal-ind.ok { background: var(--cr-bg); color: var(--cr); }
.bal-ind.bad { background: var(--dr-bg); color: var(--dr); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- tree (chart of accounts) ---------- */
.tree-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 150px 150px 80px; align-items: center; gap: 10px; padding: 0 18px; min-height: 46px; border-bottom: 1px solid var(--line); transition: background .12s; }
.tree-row:hover { background: var(--hover); }
.tree-row.head { min-height: 38px; background: var(--surface-2); font-size: 12px; color: var(--muted); font-weight: 500; position: sticky; top: 0; z-index: 1; }
.tree-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tree-name .tg { width: 26px; height: 26px; border-radius: 7px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; transition: transform .2s var(--ease-out), background .15s; }
.tree-name .tg:hover { background: var(--surface-3); }
.tree-name .tg svg { width: 16px; height: 16px; }
.tree-name .tg.open { transform: rotate(90deg); }
[dir="rtl"] .tree-name .tg { transform: scaleX(-1); }
[dir="rtl"] .tree-name .tg.open { transform: scaleX(-1) rotate(90deg); }
.tree-name .sp { width: 26px; flex-shrink: 0; display: grid; place-items: center; color: var(--faint); }
.tree-name .sp::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.tree-name .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row.l0 { background: color-mix(in srgb, var(--primary-soft) 40%, var(--surface)); }
.tree-row.l0 .nm { font-weight: 600; font-size: 14.5px; }
.tree-row.l1 .nm { font-weight: 600; }
.tree-row.l2 .nm { font-weight: 500; }
.tree-row .cls { width: 8px; height: 26px; border-radius: 3px; flex-shrink: 0; }
.tree-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .15s; }
.tree-row:hover .tree-actions, .tree-row:focus-within .tree-actions { opacity: 1; }
.tree-actions button { width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.tree-actions button:hover { background: var(--surface-3); color: var(--primary); }
.tree-actions svg { width: 16px; height: 16px; }
.tree-kids { overflow: hidden; }
.tree-kids[hidden] { display: none; }

/* ---------- aging bar ---------- */
.aging { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--surface); }
.aging > i { display: block; height: 100%; min-width: 3px; }
.ag0 { background: #38C2CF; }
.ag1 { background: #FFC24D; }
.ag2 { background: #FF8A3D; }
.ag3 { background: #E5483A; }
.aging-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.aging-legend > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.aging-legend .k { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.aging-legend .k i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.aging-legend .v { font-weight: 600; font-size: 15px; margin-top: 2px; }
.aging-legend .p { font-size: 11.5px; color: var(--faint); }

/* ---------- alerts list ---------- */
.alerts { display: grid; }
.alert { display: flex; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); align-items: flex-start; text-align: start; background: none; border-inline: 0; border-bottom: 0; width: 100%; transition: background .12s; }
.alert:hover { background: var(--hover); }
.alert .ai { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.alert .ai svg { width: 17px; height: 17px; }
.alert.bad .ai { background: var(--dr-bg); color: var(--dr); }
.alert.warn .ai { background: var(--warn-bg); color: var(--warn); }
.alert.info .ai { background: var(--info-bg); color: var(--info); }
.alert b { font-weight: 500; display: block; font-size: 13.5px; }
.alert small { color: var(--muted); font-size: 12.5px; display: block; }
.alert .go { margin-inline-start: auto; color: var(--faint); align-self: center; }

/* quick actions */
.qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 4px 18px 18px; }
.qa a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 13px; transition: transform .18s var(--ease-out), border-color .15s, background .15s; }
.qa a:hover { transform: translateY(-2px); border-color: var(--primary); background: var(--surface); }
.qa a span.i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.qa a small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* ---------- chart ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .ax { font-size: 11px; fill: var(--muted); font-family: var(--font-ui); }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: color-mix(in srgb, var(--primary) 7%, transparent); }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; min-width: 190px;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; z-index: 5;
}
.chart-tip.on { opacity: 1; transform: none; }
.chart-tip .tt { font-weight: 600; margin-bottom: 6px; }
.chart-tip .r { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .r span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; gap: 12px; }
.hbar .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 13px; }
.hbar .r .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hbar .r .bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

/* ---------- drawer / modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 80; opacity: 0; transition: opacity .22s; backdrop-filter: blur(2px); }
.overlay.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%); background: var(--surface); z-index: 90; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s var(--ease-out);
}
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.on, [dir="rtl"] .drawer.on { transform: none; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { font-size: 17px; }
.drawer-h p { font-size: 12.5px; color: var(--muted); }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
.modal {
  position: fixed; top: 50%; left: 50%; width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); z-index: 90;
  border-radius: 20px; box-shadow: var(--shadow-pop); transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .25s var(--ease-out), opacity .2s;
}
.modal.on { transform: translate(-50%, -50%); opacity: 1; }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; justify-items: center; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: #0A2230; color: #EAF6F8; box-shadow: var(--shadow-pop); font-size: 13.5px;
  animation: toastIn .3s var(--ease-spring); pointer-events: auto; width: 100%;
}
:root[data-theme="dark"] .toast { background: #E7F2F5; color: #0A2230; }
.toast .ti { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: rgba(201, 240, 107, .18); color: var(--citrus); }
:root[data-theme="dark"] .toast .ti { color: #4E7A00; background: rgba(141, 186, 31, .18); }
.toast.err .ti { background: rgba(255, 92, 77, .2); color: #FF8273; }
.toast.info .ti { background: rgba(56, 194, 207, .2); color: #7DDAE2; }
.toast small { display: block; opacity: .7; font-size: 12px; }
.toast.out { animation: toastOut .25s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- documents (invoice / vouchers) ---------- */
.paper {
  --text: #0A2230; --text-2: #33505E; --muted: #5F7A88; --faint: #93A9B5; --line: #E1E9ED; --line-strong: #CBD7DE; --surface-2: #F6F9FA; --surface-3: #EDF3F5; --primary: #098A99; --primary-ink: #075E6B; --primary-soft: #DDF6F8; --cr: #0F8A50; --cr-bg: #E2F6EB; --dr: #D63A2C; --dr-bg: #FFECE9; --warn: #B86A00; --warn-bg: #FFF3DC; --info: #2468D0; --info-bg: #E6F0FD; --hover: #F2F8F9;
  background: var(--paper); color: var(--text); border-radius: 6px; box-shadow: 0 1px 0 rgba(6, 40, 52, .04), 0 24px 50px -20px rgba(6, 40, 52, .28), 0 0 0 1px rgba(6, 40, 52, .06);
  position: relative; overflow: hidden;
}
.paper .stripe { height: 6px; background: linear-gradient(90deg, #075E6B, #0BA3B3 60%, #B6E34A); }
.doc { padding: 34px 38px 30px; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.doc-title { text-align: end; }
.doc-title h2 { font-size: 22px; font-weight: 700; color: #075E6B; }
.doc-title .en { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.doc-meta > div { padding: 10px 14px; border-inline-start: 1px solid var(--line); }
.doc-meta > div:first-child { border-inline-start: 0; }
.doc-meta small { display: block; font-size: 11px; color: var(--muted); }
.doc-meta b { font-weight: 600; font-size: 13px; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.party { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.party .pt { font-size: 11px; color: var(--primary-ink); font-weight: 600; letter-spacing: .04em; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.party b { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.party dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.party dt { color: var(--muted); }
.party dd { margin: 0; font-weight: 500; }
.doc .tbl th { background: #075E6B; color: #fff; border: 0; font-weight: 500; }
.doc .tbl th:first-child { border-start-start-radius: 10px; }
.doc .tbl th:last-child { border-start-end-radius: 10px; }
.doc-foot { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; margin-top: 18px; align-items: start; }
.totals { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.totals > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; font-size: 13px; border-top: 1px solid var(--line); }
.totals > div:first-child { border-top: 0; }
.totals .grand { background: #075E6B; color: #fff; font-weight: 700; font-size: 15px; }
.qr-box { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; border: 1px dashed var(--line-strong); }
.qr-box svg { width: 96px; height: 96px; flex-shrink: 0; }
.qr-box .u { font-size: 11px; color: var(--muted); word-break: break-all; }
.stamp { position: absolute; inset-inline-end: 40px; top: 96px; transform: rotate(-12deg); border: 3px double #0F8A50; color: #0F8A50; border-radius: 12px; padding: 6px 14px; font-weight: 700; font-size: 13px; text-align: center; opacity: .78; pointer-events: none; }
.stamp.bad { border-color: #D63A2C; color: #D63A2C; }
.stamp.info { border-color: #2468D0; color: #2468D0; }
.stamp small { display: block; font-size: 10px; font-weight: 500; }
.words { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; border-inline-start: 3px solid var(--primary); }
.sign-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 30px; font-size: 12px; color: var(--muted); text-align: center; }
.sign-row div { border-top: 1px dashed var(--line-strong); padding-top: 8px; }
.voucher .amount-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-ink); margin-top: 18px; }
.voucher .amount-box b { font-size: 26px; font-weight: 700; }
.vrow { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.vrow span { color: var(--muted); }

/* ---------- report hub ---------- */
.rep-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: transform .2s var(--ease-out), box-shadow .2s, border-color .2s; position: relative; overflow: hidden; }
.rep-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); border-color: var(--primary); }
.rep-card .ri { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; }
.rep-card .ri svg { width: 22px; height: 22px; }
.rep-card h4 { font-size: 15px; }
.rep-card p { font-size: 12.5px; color: var(--muted); }
.rep-card .fig { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.rep-card .fig b { font-size: 15px; color: var(--text); font-weight: 600; }
.rep-card .soon { position: absolute; top: 14px; inset-inline-end: 14px; }

/* statements */
.fs { font-size: 14px; }
.fs .tbl td { padding: 9px 14px; }
.fs .lvl1 td:first-child { padding-inline-start: 34px; }
.fs .lvl2 td:first-child { padding-inline-start: 54px; color: var(--text-2); }
.fs tr.hd td { font-weight: 700; color: var(--primary-ink); background: transparent; padding-top: 16px; font-size: 13.5px; border-bottom: 1px solid var(--line-strong); }
.fs tr.key td { font-weight: 700; background: var(--surface-2); }
.fs tr.grand td { font-weight: 700; font-size: 15px; border-top: 1.5px solid var(--text); border-bottom: 3px double var(--text); background: var(--primary-soft); color: var(--primary-ink); }
.balance-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: var(--cr-bg); color: var(--cr); font-weight: 600; font-size: 13px; }
.balance-check.bad { background: var(--dr-bg); color: var(--dr); }
.eq-strip { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: center; padding: 16px 18px; }
.eq-strip .op { font-size: 22px; color: var(--faint); font-weight: 300; text-align: center; }
.eq-strip .t { font-size: 12.5px; color: var(--muted); }
.eq-strip .v { font-size: 20px; font-weight: 600; }

/* settings */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 14px 12px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary-ink); border-bottom-color: var(--primary); font-weight: 500; }
.periods { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pcell { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; background: var(--surface); transition: border-color .15s, background .15s; }
.pcell.locked { background: var(--surface-2); }
.pcell.current { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pcell .m { font-weight: 600; }
.pcell .st { font-size: 11.5px; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.pcell .st svg { width: 13px; height: 13px; }
.pcell button { justify-self: start; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1.2fr); align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.map-row .ev b { font-weight: 500; display: block; }
.map-row .ev small { color: var(--muted); font-size: 12px; }
.perm { text-align: center; }
.perm input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* hub link */
.hub-link {
  position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 50; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 10px;
  border-radius: 999px; background: #0A2230; color: #EAF6F8; font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-pop); transition: transform .2s var(--ease-out);
}
.hub-link:hover { transform: translateY(-2px); }
.hub-link svg { width: 16px; height: 16px; color: var(--citrus); }
:root[data-theme="dark"] .hub-link { background: #E7F2F5; color: #0A2230; }
:root[data-theme="dark"] .hub-link svg { color: #098A99; }

/* misc */
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.dot-s { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.prog { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: end; }
.mini-stat { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.mini-stat small { color: var(--muted); font-size: 12px; display: block; }
.mini-stat b { font-size: 17px; font-weight: 600; }
.acct-card { padding: 16px 18px; display: grid; gap: 10px; position: relative; }
.acct-card .top { display: flex; align-items: center; gap: 10px; }
.acct-card .top .i { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.acct-card .top b { font-weight: 500; display: block; font-size: 13.5px; }
.acct-card .top small { font-size: 11.5px; color: var(--muted); }
.acct-card .amt { font-size: 21px; font-weight: 600; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-size: 13px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--dr-bg); color: var(--dr); }
.notice.ok { background: var(--cr-bg); color: var(--cr); }
.notice b { font-weight: 600; }
.sticky-side { position: sticky; top: 86px; }
.var-pos { color: var(--cr); }
.var-neg { color: var(--dr); }
.count-in { width: 92px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: minmax(0, 1fr) 320px; }
  .periods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(105%); transition: transform .3s var(--ease-out); box-shadow: var(--shadow-pop); z-index: 95; }
  [dir="ltr"] .sidebar { transform: translateX(-105%); }
  body.nav-open .sidebar { transform: none; }
  .icon-btn.menu-btn { display: inline-grid; }
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-label { display: none; }
}
@media (max-width: 780px) {
  .topbar { padding: 0 16px; gap: 8px; height: 60px; }
  .content { padding: 18px 16px 90px; }
  .search { display: none; }
  .search.mobile-open { display: block; position: absolute; inset-inline: 12px; top: 10px; max-width: none; z-index: 5; }
  .search-toggle { display: inline-grid !important; }
  .user-btn .ut { display: none; }
  .user-btn { padding-inline-end: 4px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .kpis.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .liq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .liq > div:nth-child(3) { border-inline-start: 0; }
  .liq > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .fgrid, .fgrid.c3 { grid-template-columns: minmax(0, 1fr); }
  .ph h1 { font-size: 20px; }
  .doc { padding: 22px 18px; }
  .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-meta > div:nth-child(3) { border-inline-start: 0; }
  .doc-meta > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .parties, .doc-foot { grid-template-columns: minmax(0, 1fr); }
  .stamp { top: 76px; inset-inline-end: 14px; font-size: 11px; }
  .aging-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tree-row { grid-template-columns: minmax(0, 1fr) 120px 44px; }
  .tree-row > .hide-m { display: none; }
  .tree-actions { opacity: 1; }
  .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eq-strip { grid-template-columns: 1fr; text-align: center; }
  .qa { grid-template-columns: minmax(0, 1fr); }
  .map-row { grid-template-columns: minmax(0, 1fr); }
  .map-row > svg { display: none; }
  .hide-m { display: none !important; }
  .period button { padding: 0 9px; font-size: 12.5px; }
  .period button .pl-long { display: none; }
  .kpi .spark { display: none; }
}
@media (max-width: 420px) {

  .lang-btn span { display: none; }
  .theme-btn { display: none; }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
[dir="ltr"] .flip-ltr { transform: scaleX(-1); }
.mny { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; white-space: nowrap; unicode-bidi: isolate; }
.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 780px) { .k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 1100px) { body.nav-open::before { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 90; } }
.skip { position: fixed; top: -60px; inset-inline-start: 12px; z-index: 200; background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; transition: top .15s; }
.skip:focus { top: 10px; }
.kpis.k5 { grid-template-columns: minmax(0, 1.3fr) repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .kpis.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.k5 > .hero { grid-column: span 3; } }
@media (max-width: 780px) { .kpis.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis.k5 > .hero { grid-column: span 2; } }
@media (max-width: 420px) { .kpis .kpi { padding: 13px 14px; } .kpis .kpi .val { font-size: 18px; } .kpis.k5 > .hero .val { font-size: 24px; } .kpi .lbl { font-size: 12px; } }
@media (max-width: 1600px) { .period-label { display: none; } }
.search { min-width: 200px; }
.kpi.hero { padding-bottom: 54px; }
.kpi.hero .spark { inset-inline: 0; top: auto; bottom: 0; width: 100%; height: 46px; opacity: .55; pointer-events: none; }
.kpi.hero .spark circle { display: none; }
.kpi > *:not(.spark) { position: relative; z-index: 1; }
.kpi:not(.hero) .spark { display: none; }
.g3 .aging-legend, .sticky-side .aging-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi .foot { flex-wrap: wrap; row-gap: 4px; }
.g-inv { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1500px) { .g-inv { grid-template-columns: minmax(0, 1fr); } .g-inv > aside.sticky-side { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }
@media (max-width: 900px) { .g-inv > aside.sticky-side { grid-template-columns: minmax(0, 1fr); } }
.hbar-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
@media (max-width: 780px) { .hbar-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .stamp { display: none; } .ph-actions { width: 100%; } }

/* ---------- phone fixes ---------- */
/* scroll wrappers become the containing block, so visually-hidden labels inside wide tables can't stretch the page */
.tbl-wrap { position: relative; }
@media (max-width: 480px) {
  .tree-row { grid-template-columns: minmax(0, 1fr) max-content 34px; padding: 0 12px; gap: 8px; }
  .tree-row .bal { flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12.5px; }
}
