/* Yomnai Accounting — brand identity (HBranding, Nov 2026).
   Light #E8F4FC (canvas), navy #152641 (rail, bands, ink), deep blue #1E488F (actions),
   lime #C3F84A and green #74C365 as accents only. Shapes: 45° slant panels, pills, rounded sheets.
   Ledger conventions carry the structure: single rule = subtotal, double rule = total,
   negatives in parentheses, tabular Latin figures. */
@font-face { font-family: 'Abd Elrady Pro'; src: url('/fonts/AbdElradyPro-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Abd Elrady Pro'; src: url('/fonts/AbdElradyPro-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Readex Pro'; src: url('/fonts/readex-pro-arabic.woff2') format('woff2'); font-weight: 300 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: 'Readex Pro'; src: url('/fonts/readex-pro-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --navy: #152641; --navy-soft: #22375c; --blue: #1E488F; --blue-hover: #18396f;
  --light: #E8F4FC; --white: #FFFFFF; --lime: #C3F84A; --green: #74C365;
  --ink: #152641; --ink-2: #4d5f7d; --ink-3: #8193ae;
  --rule: #d7e4f0; --rule-soft: #eaf1f8; --row-hover: #f3f8fd;
  --red: #a8323a; --red-tint: #fbeeee; --amber: #7a5410; --amber-tint: #fdf4e1; --green-ink: #33652a; --green-tint: #edf7ea;
  --display: 'Abd Elrady Pro', 'Readex Pro', system-ui, sans-serif;
  --text: 'Readex Pro', 'Abd Elrady Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --r-sheet: 20px; --r-ctl: 12px; --slant: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--text); font-weight: 400; font-size: 14.5px; line-height: 1.6; color: var(--ink); background: var(--light); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.25; margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; border-radius: 6px; }
.num, td.num, th.num { text-align: end; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
bdi { unicode-bidi: isolate; font-variant-numeric: tabular-nums lining-nums; }
.neg { color: var(--red); }
.muted { color: var(--ink-2); }
.mt { margin-top: 14px; }
.right { text-align: end; }

/* ── Frame: navy rail + light canvas ─────────────────────────────── */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #c3d0e6; padding: 22px 14px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; color: var(--white); }
.brand img { height: 36px; width: auto; filter: brightness(0) invert(1); flex: none; }
.brand strong { display: block; font-family: var(--display); font-size: 17px; line-height: 1.2; }
.brand small { display: block; color: var(--lime); font-size: 12.5px; margin-top: 2px; }
.nav { flex: 1; }
/* Groups fold like Zoho's menu (as in Yomnai POS): the one holding the current page opens itself. */
.nav-group, .nav a.top { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 14px; margin: 2px 0; border: 0; border-radius: 999px;
  background: transparent; color: #c3d0e6; font-size: 15px; cursor: pointer; text-align: start; text-decoration: none; transition: background .15s, color .15s; }
.nav-group span:first-of-type { flex: 1; }
.nav-group:hover, .nav a.top:hover { background: var(--navy-soft); color: var(--white); }
.nav-section.holds:not(.open) > .nav-group { background: var(--navy-soft); color: var(--white); }
.nav-group .chev { display: inline-flex; opacity: .7; transition: transform .2s var(--ease); }
.nav-section.open > .nav-group .chev { transform: rotate(180deg); }
.nav-items { display: none; margin: 2px 0 8px; margin-inline-start: 22px; padding-inline-start: 12px; border-inline-start: 1px solid rgba(255,255,255,.1); }
.nav-section.open > .nav-items { display: block; animation: fade .15s ease both; }
.nav-items a { position: relative; display: block; padding: 6px 12px; margin: 1px 0; border-radius: 999px; color: #b3c3dd; font-size: 14px; text-decoration: none; transition: background .15s, color .15s; }
.nav-items a:hover { background: var(--navy-soft); color: var(--white); }
.nav a.active { background: var(--blue); color: var(--white); }
.nav-items a.active::before { content: ''; position: absolute; inset-inline-start: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--lime); }
.nav a.top.active { box-shadow: inset 0 0 0 1px rgba(195,248,74,.35); }
.side-foot { margin-top: 18px; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.side-foot .who { color: var(--white); }
.side-foot .who span { display: block; color: #7f94b6; font-size: 12px; }
.side-foot .foot-actions { display: flex; gap: 6px; margin-top: 10px; }
.side-foot button { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,.16); color: #c3d0e6; border-radius: 999px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.side-foot button:hover { border-color: var(--lime); color: var(--white); }
.main { padding: 0 32px 72px; min-width: 0; }
.topbar { display: none; }

/* ── The slant band: every page opens with it ────────────────────── */
.band { position: relative; margin: 0 -32px 26px; padding: 30px 32px 30px calc(32px + var(--slant)); background: var(--navy); color: var(--white);
  clip-path: polygon(0 0, 100% 0, 100% 100%, var(--slant) 100%); display: grid; gap: 18px; }
[dir=rtl] .band { padding: 30px calc(32px + var(--slant)) 30px 32px; clip-path: polygon(0 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%); }
.band-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.band h1 { font-size: 30px; letter-spacing: -.01em; }
.band p { margin: 4px 0 0; color: #b9c8e2; max-width: 68ch; }
.band .actions .btn.ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,.28); }
.band .actions .btn.ghost:hover { border-color: var(--lime); background: rgba(255,255,255,.06); }
.band .actions .btn:not(.ghost) { background: var(--lime); color: var(--navy); }
.band .actions .btn:not(.ghost):hover { background: #d2fb72; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }
.figure { padding: 0 18px; border-inline-start: 1px solid rgba(255,255,255,.12); }
.figure:first-child { border-inline-start: 0; padding-inline-start: 0; }
.figure .label { color: #9fb2d3; font-size: 13px; }
.figure .value { font-size: 26px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.figure .value .neg { color: #ff9ea4; }
.figure .hint { color: #9fb2d3; font-size: 12px; margin-top: 2px; }
.figure.lead .value { font-size: 34px; color: var(--lime); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Sheets ───────────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--r-sheet); padding: 20px 22px; margin-bottom: 18px; border: 1px solid #dce8f3; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card .sub { color: var(--ink-2); font-size: 13.5px; margin: 0 0 14px; }
.grid { display: grid; gap: 18px; }
.two { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.kpis { display: none; }

/* ── Ledger tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--row-hover); }
tr.group td { font-family: var(--display); font-weight: 700; color: var(--navy); padding-top: 16px; border-bottom: 1px solid var(--rule); }
tr.total td { font-weight: 700; border-top: 1px solid var(--navy); border-bottom: 3px double var(--navy); background: transparent; }
tr.total td.num { font-size: 15.5px; }
tr.muted td { color: var(--ink-3); }
.indent-1 { padding-inline-start: 26px !important; } .indent-2 { padding-inline-start: 42px !important; } .indent-3 { padding-inline-start: 58px !important; } .indent-4 { padding-inline-start: 74px !important; }
.code { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12.5px; letter-spacing: .02em; }
.tree-toggle { cursor: pointer; display: inline-block; width: 20px; color: var(--ink-3); user-select: none; }

/* ── Controls ─────────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); }
input, select, textarea { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-ctl); padding: 9px 12px; min-width: 0; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #b9cde2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,72,143,.15); }
input[disabled], select[disabled] { background: var(--rule-soft); color: var(--ink-2); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 9px 20px; cursor: pointer; background: var(--blue); color: var(--white); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { background: var(--blue-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--white); color: var(--blue); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--blue); background: var(--white); }
.btn.danger { background: var(--white); color: var(--red); border-color: #efc9cc; }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 5px 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; padding: 14px 16px; background: var(--white); border-radius: var(--r-sheet); border: 1px solid #dce8f3; }
.filters label.f { min-width: 150px; }
.filters .btn.small { margin-bottom: 4px; }
/* A report's bar while its app and dimension lists load: the frame only (filterBar in app.js). */
.filters.wait > * { visibility: hidden; }

/* ── Status ───────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 12px; background: var(--light); color: var(--blue); white-space: nowrap; }
.badge.ok { background: var(--green-tint); color: var(--green-ink); }
.badge.warn { background: var(--amber-tint); color: var(--amber); }
.badge.err { background: var(--red-tint); color: var(--red); }
.badge.draft { background: var(--rule-soft); color: var(--ink-2); }
.note { border-radius: var(--r-ctl); padding: 11px 16px; background: var(--white); color: var(--navy); margin-bottom: 16px; font-size: 13.5px; border-inline-start: 4px solid var(--blue); }
.note.warn { border-color: #d9a441; background: var(--amber-tint); color: var(--amber); }
.note.err { border-color: var(--red); background: var(--red-tint); color: var(--red); }
.note.ok { border-color: var(--green); background: var(--green-tint); color: var(--green-ink); }
.empty { text-align: center; color: var(--ink-2); padding: 36px 12px; }
.secret { font-family: ui-monospace, Menlo, monospace; background: var(--navy); color: var(--lime); padding: 11px 14px; border-radius: var(--r-ctl); direction: ltr; word-break: break-all; font-size: 13px; }

/* ── Dashboard chart ──────────────────────────────────────────────── */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 190px; padding-top: 14px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 150px; }
.bar { width: 16px; border-radius: 999px 999px 4px 4px; background: var(--blue); min-height: 3px; transform-origin: bottom; animation: grow .7s var(--ease) both; }
.bar.exp { background: #a9c3e4; }
.bar-col:nth-child(2) .bar { animation-delay: .05s; } .bar-col:nth-child(3) .bar { animation-delay: .1s; } .bar-col:nth-child(4) .bar { animation-delay: .15s; }
.bar-col:nth-child(5) .bar { animation-delay: .2s; } .bar-col:nth-child(6) .bar { animation-delay: .25s; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-col small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-inline-end: 6px; vertical-align: -1px; }

/* ── Dialogs, toasts ──────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(21,38,65,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .15s ease both; }
.modal { background: var(--white); border-radius: 24px; width: min(580px, 100%); max-height: 90vh; overflow: auto; padding: 24px 26px; animation: rise .2s var(--ease) both; }
.modal h2 { margin: 0 0 14px; font-size: 20px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 11px 20px; border-radius: 999px; z-index: 60; border-inline-start: 4px solid var(--lime); animation: rise .2s var(--ease) both; }
[dir=rtl] .toast { transform: translateX(50%); }
.toast.err { border-color: #ff9ea4; }

/* ── Sign-in: one slant panel ─────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr); background: var(--light); }
/* The slant is cut on the panel's inner edge, facing the form. */
.login-panel { background: var(--navy); color: var(--white); clip-path: polygon(0 0, 100% 0, calc(100% - 120px) 100%, 0 100%); padding: 72px 140px 56px 64px; display: flex; flex-direction: column; justify-content: space-between; }
[dir=rtl] .login-panel { clip-path: polygon(0 0, 100% 0, 100% 100%, 120px 100%); padding: 72px 64px 56px 140px; }
.login-panel h1 { font-size: 44px; margin: 0; max-width: 12ch; }
.login-panel p { color: #b9c8e2; max-width: 40ch; }
.login-panel .tag { color: var(--lime); font-family: var(--display); font-size: 18px; }
.login form { align-self: center; justify-self: center; width: min(420px, calc(100% - 48px)); margin: 24px; background: var(--white); border-radius: 24px; padding: 30px; border: 1px solid #dce8f3; }
.login form h2 { font-size: 22px; margin-bottom: 4px; }
.login form .grid { gap: 14px; margin-top: 18px; }

/* ── Entry editor ─────────────────────────────────────────────────── */
.entry-lines input, .entry-lines select { width: 100%; }
.balance-line { display: flex; gap: 22px; justify-content: flex-end; padding: 14px 12px 6px; font-weight: 600; font-variant-numeric: tabular-nums; border-top: 3px double var(--navy); margin-top: 8px; }
.balance-line .ok { color: var(--green-ink); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #b9c8e2; margin-top: 6px; font-size: 13.5px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 40; transform: translateX(100%); transition: transform .2s var(--ease); }
  [dir=ltr] .side { transform: translateX(-100%); }
  .side.open { transform: none !important; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: var(--white); padding: 12px 18px; position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 26px; filter: brightness(0) invert(1); }
  .topbar button { background: none; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: var(--white); padding: 4px 12px; cursor: pointer; }
  .main { padding: 0 16px 56px; }
  .band, [dir=rtl] .band { margin: 0 -16px 20px; padding: 22px 16px 26px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), 0 100%); }
  .band h1 { font-size: 24px; }
  .figure { padding: 10px 0; border-inline-start: 0; border-top: 1px solid rgba(255,255,255,.1); }
  .figure:first-child { border-top: 0; }
  .two { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-panel, [dir=rtl] .login-panel { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 40px), 0 100%); padding: 36px 24px 60px; }
  .login-panel h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .side, .topbar, .actions, .filters, .btn { display: none !important; }
  .shell { display: block; } .main { padding: 0; }
  .band { clip-path: none; background: none; color: var(--ink); margin: 0 0 12px; padding: 0; }
  .band p, .meta { color: var(--ink-2); }
  .card { border: 0; padding: 0; }
  body { background: var(--white); }
}
