/* Zarghoon Mining Company — styles. Developed by Mr. Muhammad Huzaifa Zaman */
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(../fonts/inter-latin-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nastaliq'; src: url(../fonts/noto-nastaliq-urdu-arabic-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nastaliq'; src: url(../fonts/noto-nastaliq-urdu-arabic-700-normal.woff2) format('woff2'); font-weight: 600 800; font-display: swap; }

:root {
  --primary: #E07A1A; --secondary: #2B2B2B; --accent: #F2A81D; --bg: #F6F4F1; --card: #FFFFFF; --text: #1C1C1C;
  --success: #1F9D55; --warning: #E0A100; --danger: #D64545;
  --muted: color-mix(in srgb, var(--text) 58%, transparent);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --soft: color-mix(in srgb, var(--primary) 10%, var(--card));
  --radius: 18px; --shadow: 0 6px 22px -8px rgba(30, 20, 10, .22), 0 2px 6px -2px rgba(30, 20, 10, .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ur: 'Nastaliq', 'Jameel Noori Nastaleeq', 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif;
  --nav-h: 66px; --head-h: 58px;
  color-scheme: light;
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html.fs-small { font-size: 14px; } html.fs-large { font-size: 18px; } html.fs-xl { font-size: 20.5px; }
html.dark { --bg: #121212; --card: #1E1E1E; --text: #F1EEEA; color-scheme: dark; --shadow: 0 6px 22px -8px rgba(0,0,0,.6); }
html.hc { --text: #000; --muted: #222; --line: #000; --bg: #fff; --card: #fff; }
html.dark.hc { --text: #fff; --muted: #eee; --line: #fff; --bg: #000; --card: #000; }
html.hc .card, html.hc .btn { border: 2px solid var(--text) !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.45; min-height: 100vh; overscroll-behavior-y: none; }
html[dir=rtl] body { font-family: var(--font-ur); line-height: 2.05; }
html[dir=rtl] input, html[dir=rtl] select, html[dir=rtl] textarea, html[dir=rtl] button { font-family: var(--font-ur); }
.num, input[type=number], .money { font-family: var(--font); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
html[dir=rtl] .money { display: inline-block; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.3; }
html[dir=rtl] h1, html[dir=rtl] h2, html[dir=rtl] h3 { line-height: 1.9; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--primary); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; } .bold { font-weight: 700; }
.ok { color: var(--success); } .warn { color: var(--warning); } .bad { color: var(--danger); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-rows: var(--head-h) 1fr; min-height: 100vh; }
header.top { position: sticky; top: 0; z-index: 40; height: var(--head-h); display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
header.top .brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; text-decoration: none; color: var(--text); }
header.top .brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; }
header.top .brand b { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.langtog { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.langtog button { border: 0; background: transparent; padding: 6px 11px; font-weight: 700; font-size: .82rem; cursor: pointer; color: var(--text); min-height: 36px; }
.langtog button[aria-pressed=true] { background: var(--primary); color: #fff; }
.langtog button.ur { font-family: var(--font-ur); font-size: .9rem; padding-top: 2px; }
.iconbtn { border: 0; background: transparent; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--text); position: relative; flex: none; }
.iconbtn:hover { background: var(--soft); }
.iconbtn .dot { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; font-family: var(--font); line-height: 1; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
html[dir=rtl] svg.flip { transform: scaleX(-1); }

.syncpill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; color: var(--text); min-height: 32px; }
.syncpill i { width: 10px; height: 10px; border-radius: 50%; background: var(--success); flex: none; }
.syncpill.busy i { background: var(--warning); animation: pulse 1s infinite; } .syncpill.off i, .syncpill.err i { background: var(--danger); }
.syncpill.local i { background: #888; }
@keyframes pulse { 50% { opacity: .35; } }

main.page { padding: 14px 14px calc(var(--nav-h) + 90px); max-width: 1180px; width: 100%; margin: 0 auto; }
.page-enter { animation: pageIn .32s cubic-bezier(.2, .8, .2, 1); transform-origin: 50% 0; }
@keyframes pageIn { from { opacity: 0; transform: perspective(900px) rotateX(6deg) translateY(14px); } to { opacity: 1; transform: none; } }
html.lite .page-enter { animation: none; }

nav.bottom { position: fixed; bottom: 0; inset-inline: 0; z-index: 45; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; position: relative; }
html[dir=rtl] nav.bottom a { font-size: .74rem; line-height: 1.5; }
nav.bottom a.on { color: var(--primary); }
nav.bottom a.on::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
nav.bottom a .dot { position: absolute; top: 6px; margin-inline-start: 24px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center; font-family: var(--font); }
.fab { position: fixed; z-index: 46; inset-inline-end: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 20px; border: 0;
  background: linear-gradient(145deg, var(--accent), var(--primary)); color: #fff; box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary) 70%, transparent); display: grid; place-items: center; cursor: pointer; transition: transform .15s; }
.fab:active { transform: scale(.93); } .fab svg { width: 30px; height: 30px; stroke-width: 2.6; }

aside.side { display: none; }
@media (min-width: 980px) {
  .shell { grid-template-columns: 250px 1fr; grid-template-rows: var(--head-h) 1fr; }
  header.top { grid-column: 1 / -1; }
  aside.side { display: block; position: sticky; top: var(--head-h); height: calc(100vh - var(--head-h)); overflow: auto; padding: 14px 10px; border-inline-end: 1px solid var(--line); background: var(--card); }
  aside.side a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; margin-bottom: 2px; }
  aside.side a:hover { background: var(--soft); } aside.side a.on { background: var(--primary); color: #fff; }
  aside.side .credit { font-size: .72rem; color: var(--muted); padding: 14px; }
  nav.bottom { display: none; } main.page { padding-bottom: 100px; }
  .fab { bottom: 28px; inset-inline-end: 32px; }
}

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 560px) { .g3 { grid-template-columns: 1fr; } .gauto { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.tilt { transform-style: preserve-3d; transition: transform .25s ease, box-shadow .25s; will-change: transform; }
html.lite .tilt { transform: none !important; transition: none; }

.hero { position: relative; overflow: hidden; color: #fff; border: 0;
  background: radial-gradient(120% 140% at 100% 0%, var(--accent) 0%, var(--primary) 45%, color-mix(in srgb, var(--primary) 50%, var(--secondary)) 100%); }
.hero::after { content: ''; position: absolute; inset: auto -40px -60px auto; width: 200px; height: 200px; border-radius: 40px; transform: rotate(35deg); background: rgba(255,255,255,.09); }
html[dir=rtl] .hero::after { inset: auto auto -60px -40px; }
.hero .label { opacity: .9; font-weight: 600; } .hero .big { font-size: 2.3rem; font-weight: 800; letter-spacing: -.5px; margin: 2px 0; font-family: var(--font); }
.hero .sub { display: flex; gap: 16px; flex-wrap: wrap; opacity: .95; font-size: .9rem; }
.hero.low { background: radial-gradient(120% 140% at 100% 0%, #f7b24a 0%, #d9822b 40%, #a33 100%); }

.stat { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 600; } .stat .v { font-size: 1.25rem; font-weight: 800; font-family: var(--font); }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; } .bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .6s; }
.bar.low > i { background: linear-gradient(90deg, var(--warning), var(--danger)); }
.sitecard { cursor: pointer; text-decoration: none; color: inherit; display: block; }
.sitecard .top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--soft); color: var(--text); white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: var(--success); }
.chip.warn { background: color-mix(in srgb, var(--warning) 18%, var(--card)); color: color-mix(in srgb, var(--warning) 70%, #000); }
.chip.bad { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: var(--danger); }
.chip.info { background: color-mix(in srgb, var(--secondary) 12%, var(--card)); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; cursor: pointer; font-weight: 700; font-size: 1rem;
  background: var(--primary); color: #fff; text-decoration: none; transition: transform .1s, filter .15s; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 60%, transparent); }
.btn:active { transform: scale(.97); } .btn:hover { filter: brightness(1.05); } .btn[disabled] { opacity: .5; pointer-events: none; }
.btn.sec { background: var(--card); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: none; } .btn.ok { background: var(--success); box-shadow: none; }
.btn.dark { background: var(--secondary); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .88rem; border-radius: 11px; } .btn.block { width: 100%; }
html[dir=rtl] .btn { padding-top: 4px; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick button { min-height: 92px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: .95rem; color: var(--text); cursor: pointer; padding: 10px; }
.quick button svg { width: 30px; height: 30px; color: var(--primary); }
.quick button:active { transform: scale(.96); }

label.f { display: block; margin-bottom: 12px; } label.f > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
label.f > span .req { color: var(--danger); margin-inline-start: 3px; }
label.f small { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
input, select, textarea { width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-size: 1rem; font-family: inherit; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input.amount { font-size: 1.6rem; font-weight: 800; text-align: center; min-height: 64px; }
input[type=color] { padding: 4px; min-height: 46px; width: 64px; }
.err-text { color: var(--danger); font-size: .85rem; margin-top: 4px; font-weight: 600; }
.invalid { border-color: var(--danger) !important; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; } .seg button { flex: 1; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; color: var(--text); cursor: pointer; padding: 0 10px; min-width: 70px; }
.seg button[aria-pressed=true] { background: var(--primary); color: #fff; border-color: var(--primary); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch input { width: 52px; min-height: 30px; height: 30px; appearance: none; -webkit-appearance: none; border-radius: 15px; background: var(--line); position: relative; cursor: pointer; border: 0; flex: none; padding: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--success); } .switch input:checked::after { inset-inline-start: 25px; }
.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .pills::-webkit-scrollbar { display: none; }
.pills button { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 600; color: var(--text); cursor: pointer; min-height: 38px; }
.pills button.on { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.photo-prev { width: 100%; max-height: 240px; object-fit: contain; border-radius: 12px; background: var(--line); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 -14px 14px; padding: 0 14px; position: sticky; top: var(--head-h); background: var(--bg); z-index: 20; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; white-space: nowrap; font-size: .92rem; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }

/* ---------- lists / ledger ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.item:last-child { border-bottom: 0; } .item:hover { background: color-mix(in srgb, var(--soft) 50%, transparent); }
.item .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--soft); color: var(--primary); flex: none; }
.item .ic.in { background: color-mix(in srgb, var(--success) 14%, var(--card)); color: var(--success); }
.item .ic.out { background: color-mix(in srgb, var(--danger) 11%, var(--card)); color: var(--danger); }
.item .t { font-weight: 700; } .item .s { font-size: .8rem; color: var(--muted); }
html[dir=rtl] .item .s { line-height: 1.7; }
.item .amt { font-weight: 800; font-family: var(--font); text-align: end; white-space: nowrap; }
.item.deleted .t, .item.deleted .amt { text-decoration: line-through; opacity: .6; }
.tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 760px; background: var(--card); }
table.tbl th { background: var(--secondary); color: #fff; text-align: start; padding: 9px 10px; font-weight: 700; position: sticky; top: 0; white-space: nowrap; }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:nth-child(even) td { background: color-mix(in srgb, var(--soft) 40%, var(--card)); }
table.tbl td.n { text-align: end; font-family: var(--font); white-space: nowrap; }
table.tbl tr.rev td { color: var(--muted); font-style: italic; }
.ledger-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 700px) { .ledger-sum { grid-template-columns: repeat(2, 1fr); } }
.ledger-cards .lc { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ledger-cards .lc .bal { font-size: .78rem; color: var(--muted); text-align: end; font-family: var(--font); }
@media (min-width: 900px) { .ledger-cards { display: none; } } @media (max-width: 899px) { .ledger-table { display: none; } }

.empty { text-align: center; padding: 34px 14px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; color: var(--primary); opacity: .55; margin-bottom: 6px; }

/* ---------- modal / sheet / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 10, 5, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--card); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2, .8, .2, 1); }
.sheet .grab { width: 44px; height: 5px; background: var(--line); border-radius: 3px; margin: 4px auto 10px; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: -8px; background: var(--card); padding: 6px 0; z-index: 2; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: -18px; background: var(--card); padding: 10px 0 4px; }
.sheet .actions .btn { flex: 1; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 24px; max-height: 88vh; } .sheet.wide { max-width: 980px; } }
.summary { background: var(--soft); border-radius: 14px; padding: 12px 14px; } .summary div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.summary .big { font-size: 1.4rem; font-weight: 800; }
#toasts { position: fixed; z-index: 95; inset-inline: 0; bottom: calc(var(--nav-h) + 92px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
@media (min-width: 980px) { #toasts { bottom: 30px; } }
.toast { pointer-events: auto; background: var(--secondary); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; max-width: 560px; font-weight: 600; animation: up .25s; }
.toast.bad { background: var(--danger); } .toast.ok { background: var(--success); }
.toast button { background: rgba(255,255,255,.2); color: #fff; border: 0; border-radius: 9px; padding: 6px 12px; font-weight: 800; cursor: pointer; }

/* ---------- login / splash ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 18px; position: relative; overflow: hidden;
  background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--accent) 30%, var(--bg)), var(--bg)); }
#hero3d { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.auth .box { position: relative; z-index: 1; width: 100%; max-width: 420px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px); border-radius: 26px; padding: 22px; box-shadow: 0 30px 60px -20px rgba(60, 30, 0, .35); }
.auth .logo { width: 110px; height: 110px; object-fit: contain; display: block; margin: 0 auto 6px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.18)); }
html:not(.lite) .auth .logo { animation: float 4.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotateY(12deg); } }
.auth .topbar { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; display: flex; gap: 8px; align-items: center; }
.credit-line { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 14px; }
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); transition: opacity .4s; }
.splash.out { opacity: 0; pointer-events: none; }
.splash img { width: 120px; } .splash .credit-line { margin-top: 10px; }
.splash .ring { width: 54px; height: 54px; border: 4px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 16px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- comments ---------- */
.thread .msg { max-width: 85%; padding: 9px 13px; border-radius: 16px; margin-bottom: 8px; background: var(--soft); }
.thread .msg.mine { margin-inline-start: auto; background: color-mix(in srgb, var(--primary) 18%, var(--card)); }
.thread .msg .meta { font-size: .72rem; color: var(--muted); }

/* ---------- onboarding ---------- */
.ob { text-align: center; padding: 10px 6px; } .ob .art { width: 120px; height: 120px; margin: 6px auto 12px; border-radius: 30px; display: grid; place-items: center; background: linear-gradient(145deg, var(--accent), var(--primary)); color: #fff; box-shadow: var(--shadow); }
html:not(.lite) .ob .art { animation: float 4s ease-in-out infinite; } .ob .art svg { width: 60px; height: 60px; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; } .dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); } .dots i.on { width: 22px; background: var(--primary); }

/* ---------- charts ---------- */
.chartbox { position: relative; height: 260px; } .chartbox.tall { height: 320px; }
.bars3d { display: flex; align-items: flex-end; gap: 16px; height: 210px; padding: 10px 6px 0; overflow-x: auto; perspective: 700px; }
.bars3d .b { flex: 1; min-width: 56px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: .74rem; text-align: center; }
.bars3d .col { position: relative; width: 34px; transform-style: preserve-3d; transform: rotateX(-12deg) rotateY(-22deg); transition: height .8s cubic-bezier(.2,.8,.2,1); }
html.lite .bars3d .col { transform: none; }
.bars3d .col .f { position: absolute; inset: 0; background: linear-gradient(180deg, var(--c1), var(--c2)); border-radius: 4px 4px 0 0; }
.bars3d .col .s { position: absolute; top: 0; bottom: 0; inset-inline-start: 100%; width: 12px; background: var(--c2); filter: brightness(.7); transform: skewY(-35deg); transform-origin: left; }
.bars3d .col .tp { position: absolute; left: 0; right: -12px; height: 9px; top: -9px; background: var(--c1); filter: brightness(1.15); transform: skewX(-50deg); transform-origin: bottom; }
.bars3d .pair { display: flex; gap: 6px; align-items: flex-end; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; margin-top: 8px; } .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-inline-end: 4px; }

/* ---------- receipt ---------- */
.receipt-wrap { background: #e9e6e1; padding: 14px; border-radius: 16px; overflow: auto; }
.rcpt { background: #fff; color: #111; margin: 0 auto; font-family: 'Inter', sans-serif; line-height: 1.4; }
.rcpt.a4 { width: 794px; min-height: 1060px; padding: 44px 50px; font-size: 13.5px; }
.rcpt.thermal { width: 302px; padding: 12px 10px; font-size: 11.5px; }
.rcpt[dir=rtl] { font-family: 'Nastaliq', serif; line-height: 2; }
.rcpt[dir=rtl] .num, .rcpt[dir=rtl] .money { font-family: 'Inter', sans-serif; }
.rcpt .rh { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--r-primary, #E07A1A); padding-bottom: 12px; margin-bottom: 12px; }
.rcpt .rh img { width: 76px; height: 76px; object-fit: contain; }
.rcpt.thermal .rh { flex-direction: column; text-align: center; gap: 2px; border-bottom: 1px dashed #000; } .rcpt.thermal .rh img { width: 54px; height: 54px; }
.rcpt .rh h1 { font-size: 22px; margin: 0; color: #111; } .rcpt.thermal .rh h1 { font-size: 15px; }
.rcpt .kind { display: inline-block; background: var(--r-primary, #E07A1A); color: #fff; padding: 2px 12px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.rcpt .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; margin: 10px 0; } .rcpt.thermal .meta { grid-template-columns: 1fr; }
.rcpt .meta div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted #bbb; }
.rcpt table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.rcpt th { background: #2b2b2b; color: #fff; padding: 6px; text-align: start; font-size: .92em; } .rcpt td { padding: 5px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
.rcpt.thermal th { background: none; color: #000; border-bottom: 1px dashed #000; padding: 3px 2px; } .rcpt.thermal td { padding: 3px 2px; border-bottom: 1px dotted #999; }
.rcpt td.n, .rcpt th.n { text-align: end; white-space: nowrap; }
.rcpt .tot { display: flex; justify-content: space-between; font-size: 1.35em; font-weight: 800; padding: 8px 10px; background: #f6efe6; border-radius: 6px; }
.rcpt.thermal .tot { background: none; border-top: 2px solid #000; border-bottom: 2px solid #000; border-radius: 0; padding: 4px 0; }
.rcpt .words { margin: 8px 0; padding: 6px 10px; border: 1px dashed #aaa; border-radius: 6px; } .rcpt .words b { display: block; }
.rcpt .bal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; text-align: center; } .rcpt .bal div { border: 1px solid #ddd; border-radius: 6px; padding: 5px; }
.rcpt.thermal .bal { grid-template-columns: 1fr; gap: 2px; } .rcpt.thermal .bal div { display: flex; justify-content: space-between; border: 0; padding: 0; }
.rcpt .foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 28px; }
.rcpt.thermal .foot { flex-direction: column; align-items: center; margin-top: 10px; }
.rcpt .sig { flex: 1; text-align: center; } .rcpt .sig hr { border: 0; border-top: 1px solid #333; margin: 38px 10px 4px; }
.rcpt.thermal .sig { width: 100%; } .rcpt.thermal .sig hr { margin-top: 22px; }
.rcpt .qr { text-align: center; font-size: 10px; } .rcpt .qr img, .rcpt .qr svg { width: 110px; height: 110px; display: block; margin: 0 auto; }
.rcpt .credit { text-align: center; font-size: 10.5px; color: #555; border-top: 1px solid #ddd; margin-top: 18px; padding-top: 6px; }
.rcpt .stamp { display: inline-block; border: 2px solid; padding: 1px 10px; border-radius: 6px; font-weight: 800; transform: rotate(-4deg); }

@media print {
  body * { visibility: hidden !important; } #print-area, #print-area * { visibility: visible !important; }
  #print-area { position: absolute; inset: 0 auto auto 0; } .rcpt { box-shadow: none; }
  @page { margin: 8mm; }
}
#print-area { position: fixed; left: -10000px; top: 0; }

@media (max-width: 560px) {
  header.top { gap: 4px; padding: 0 8px; }
  header.top .brand b { display: none; }
  .syncpill span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .langtog button { padding: 6px 9px; }
}
@media (max-width: 360px) { .syncpill span { display: none; } }

.shell { grid-template-columns: minmax(0, 1fr); } main.page { min-width: 0; }
@media (min-width: 980px) { .shell { grid-template-columns: 250px minmax(0, 1fr); } }
.sitecard .grid.g3 { grid-template-columns: repeat(3, 1fr); }
.receipt-wrap .rcpt { zoom: var(--z, 1); }
.item .amt, .lc .bold, .amt { direction: ltr; unicode-bidi: isolate; }

html[dir=rtl] .item .t, html[dir=rtl] .item .s, html[dir=rtl] table.tbl td { unicode-bidi: plaintext; text-align: start; }
.rcpt[dir=rtl] bdi { font-family: inherit; }
.rcpt .num, .rcpt .money { font-variant-numeric: normal; }

/* ---------- You gave / You got ---------- */
.khata-bar { position: sticky; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; z-index: 30; margin-top: 12px; padding: 8px; border-radius: 18px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); }
@media (min-width: 980px) { .khata-bar { bottom: 16px; } }
.khata-bar .btn { min-height: 56px; font-size: 1.08rem; letter-spacing: .3px; }
.btn.ok, .seg.khata-dir button.got[aria-pressed=true] { background: var(--success); color: #fff; border-color: var(--success); }
.seg.khata-dir button { min-height: 54px; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg.khata-dir button.gave[aria-pressed=true] { background: var(--danger); color: #fff; border-color: var(--danger); }
.seg.khata-dir { margin-bottom: 12px; }
table.ktbl { width: 100%; border-collapse: collapse; }
table.ktbl th { background: var(--soft); padding: 9px 12px; text-align: start; font-size: .8rem; }
table.ktbl th.n, table.ktbl td.n { text-align: end; width: 28%; white-space: nowrap; font-family: var(--font); }
table.ktbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.ktbl tr { cursor: pointer; } table.ktbl td.gave { color: var(--danger); font-weight: 800; background: color-mix(in srgb, var(--danger) 5%, transparent); }
table.ktbl td.got { color: var(--success); font-weight: 800; background: color-mix(in srgb, var(--success) 5%, transparent); }
.quick button.qgave svg { color: var(--danger); } .quick button.qgot svg { color: var(--success); }

/* ---------- company card with 3D rotating logo ---------- */
.company-card { position: relative; display: flex; align-items: center; gap: 16px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--card)), var(--card) 55%); }
.company-card::after { content: ''; position: absolute; inset: auto -30px -50px auto; width: 160px; height: 160px; border-radius: 36px; transform: rotate(30deg);
  background: color-mix(in srgb, var(--primary) 10%, transparent); pointer-events: none; }
html[dir=rtl] .company-card::after { inset: auto auto -50px -30px; }
.cc-3d { flex: none; width: 92px; height: 104px; perspective: 600px; display: flex; flex-direction: column; align-items: center; }
.coin { position: relative; width: 84px; height: 84px; transform-style: preserve-3d; animation: coinspin 6s linear infinite; }
.coin .face { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--accent) 30%, #fff) 70%); box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--primary) 55%, #fff), 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.coin .face img { width: 70%; height: 70%; object-fit: contain; }
.coin .back { transform: rotateY(180deg); }
.coin-shadow { width: 60px; height: 10px; margin-top: 8px; border-radius: 50%; background: rgba(0,0,0,.18); filter: blur(3px); animation: coinshadow 6s linear infinite; }
@keyframes coinspin { 0% { transform: rotateY(0) rotateX(8deg); } 100% { transform: rotateY(360deg) rotateX(8deg); } }
@keyframes coinshadow { 0%, 50%, 100% { transform: scaleX(1); } 25%, 75% { transform: scaleX(.35); } }
html.lite-pref .coin, html.lite-pref .coin-shadow { animation: none; }
.cc-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.cc-name { margin: 0 0 4px; font-size: 1.35rem; }
html[dir=rtl] .cc-name { font-size: 1.45rem; }
.cc-line { font-size: .98rem; } .cc-line a { color: var(--text); font-weight: 700; text-decoration: none; }
.cc-tag { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .9rem; }
.cc-edit { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; }
@media (max-width: 380px) { .cc-3d { width: 70px; } .coin { width: 64px; height: 64px; } }

/* ---------- site dashboard ---------- */
.site-totals .stat { box-shadow: none; }
.site-totals .stat .v { font-size: 1.35rem; }
.range-bar { margin-top: 12px; gap: 8px; align-items: flex-end; }
.range-bar label { font-size: .78rem; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.range-bar input { min-height: 42px; }
.sec-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .sec-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 360px) { .sec-grid { grid-template-columns: repeat(2, 1fr); } }
.sec-tile { min-height: 100px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); color: var(--text); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 1rem; cursor: pointer; padding: 10px; font-family: inherit; }
.sec-tile svg { width: 32px; height: 32px; color: var(--primary); }
.sec-tile:active { transform: scale(.96); }
.sec-tile[data-sec=income] svg { color: var(--success); } .sec-tile[data-sec=expense] svg { color: var(--danger); }
.sec-tile[data-sec=divide] { background: linear-gradient(145deg, var(--accent), var(--primary)); color: #fff; border: 0; } .sec-tile[data-sec=divide] svg { color: #fff; }
.site-num-wrap { position: relative; }
.site-num { position: absolute; z-index: 2; top: -8px; inset-inline-start: -6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--secondary); color: #fff; font-weight: 800; font-size: .9rem; box-shadow: var(--shadow); font-family: var(--font); }
.income-tbl tfoot td { border-top: 2px solid var(--line); background: color-mix(in srgb, var(--success) 6%, var(--card)); padding: 12px; }
.income-tbl tr.deleted td { text-decoration: line-through; opacity: .55; }
.income-tbl { width: 100%; font-size: .9rem; }
.income-tbl th, .income-tbl td { padding: 10px 8px; }
.income-tbl td.n, .income-tbl th.n { white-space: nowrap; }
.income-tbl td:nth-child(2) { word-break: break-word; }
@media (max-width: 420px) { .income-tbl { font-size: .82rem; } .income-tbl th, .income-tbl td { padding: 9px 6px; } }
.site-totals .amt-big { font-size: clamp(1.1rem, 5.2vw, 1.6rem); white-space: nowrap; }
.tot-exp .v, .tot-inc .v { font-size: clamp(1.05rem, 5vw, 1.55rem); white-space: nowrap; }
.site-totals .grid > .stat { min-width: 0; padding: 12px 10px; }
.tot-exp .v, .tot-inc .v { font-size: clamp(.98rem, 4.6vw, 1.5rem); }
.income-tbl tfoot td { padding: 12px 8px; }
.income-sheet-pad { height: 70px; }
@media (prefers-reduced-motion: reduce) { .coin, .coin-shadow { animation: none; } }
