/* Fatoora web: the iOS brand palette (Brand.json) on a calm receipt-paper ground. */
:root {
  color-scheme: light;
  --bg: #F4F8F6; --surface: #FFFFFF; --surface2: #F7FAF9; --ink: #10201C; --muted: #5A6B66; --faint: #8C9A96; --line: #DDE7E3;
  --brand: #0E7C66; --brand-ink: #FFFFFF; --tint: #E6F2EE; --accent: #F2A93B; --ok: #1F8A52; --warn: #B7791F; --bad: #C2412E;
  --shadow: 0 1px 2px rgba(16, 32, 28, .05), 0 16px 36px -24px rgba(16, 32, 28, .35);
  --ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root {
  color-scheme: dark; --bg: #0B1412; --surface: #111D1A; --surface2: #15241F; --ink: #E4EFEB; --muted: #94A8A2; --faint: #66786F; --line: #213430;
  --brand: #35C2A3; --brand-ink: #052019; --tint: #12302A; --accent: #F2B65A; --ok: #55CF8E; --warn: #E8B04B; --bad: #F0806E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .8); } }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15.5px/1.55 var(--ui); padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
p { margin: 0; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { border-radius: 9px; }
.brand b { display: block; font-size: 18px; line-height: 1.1; }
.brand small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-width: 40px; height: 38px; padding: 0 10px; font-weight: 600; cursor: pointer; }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; }
.view { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-h a { font-size: 13.5px; text-decoration: none; }
.card > h2 { margin-bottom: 10px; }

.hero { background: linear-gradient(160deg, #0E7C66, #095A4A); color: #fff; border: 0; display: grid; gap: 4px; }
.hero .eyebrow { opacity: .85; font-size: 13.5px; }
.hero .big { font-size: clamp(34px, 9vw, 44px); font-weight: 500; line-height: 1.1; }
.hero .big small { font-size: 15px; opacity: .8; }
.hero .muted { color: rgba(255, 255, 255, .85); font-size: 13.5px; }
.hero-row { margin-top: 12px; }
.hero .primary { background: #fff; color: #0E7C66; }

.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; padding: 12px 16px; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.primary { background: var(--brand); color: var(--brand-ink); }
.ghost { background: var(--surface2); border-color: var(--line); color: var(--ink); }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.tile b { font-size: 19px; font-weight: 500; } .tile span { font-size: 12.5px; color: var(--muted); }
@media (min-width: 560px) { #i-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.list { display: grid; }
.rrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.rrow:last-child { border-bottom: 0; }
#top .rrow { grid-template-columns: minmax(0, 1fr) auto; }
.cdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.rmain { min-width: 0; display: grid; } .rmain b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rmain small { font-size: 12.5px; color: var(--muted); }
.amt { font-size: 15px; }
.vchip { width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); display: grid; place-items: center; }
.vchip .i { width: 14px; height: 14px; stroke-width: 2.6; }
.del { border: 0; background: transparent; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.empty { color: var(--muted); padding: 12px 0; font-size: 14px; }

.scan-card { display: grid; gap: 12px; text-align: center; }
.file-btn { width: 100%; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.privacy { display: flex; align-items: flex-start; gap: 8px; text-align: start; font-size: 13px; color: var(--muted); background: var(--tint); padding: 10px 12px; border-radius: 12px; }
.preview { max-width: 100%; max-height: 260px; display: block; margin: 0 auto 12px; border-radius: 12px; object-fit: contain; }
.steps { margin: 0 0 8px; padding-inline-start: 20px; display: grid; gap: 4px; color: var(--faint); }
.steps .done { color: var(--ok); } .steps .active { color: var(--ink); font-weight: 600; }

.review { display: grid; gap: 12px; }
.fld { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.fld > span { display: flex; align-items: center; gap: 6px; }
.fld input, .fld select { width: 100%; min-width: 0; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font-size: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.hi { background: var(--ok); } .dot.mid { background: var(--accent); } .dot.lo { background: var(--bad); }
.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); border-color: transparent; }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-color: transparent; }
.ocr summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ocr pre { white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--surface2); padding: 10px; border-radius: 10px; max-height: 200px; overflow: auto; }

.filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 6px; }
.filters input, .filters select, #i-month { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); min-width: 0; max-width: 100%; }

.donut-wrap { display: grid; grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 420px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } }
#donut { width: 100%; max-width: 170px; }
.dn-v { font: 600 13px var(--mono); fill: var(--ink); } .dn-l { font-size: 9px; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 14px; }
.legend small { color: var(--muted); min-width: 34px; text-align: end; }
.bars { width: 100%; height: auto; display: block; }
.bars rect { fill: color-mix(in srgb, var(--brand) 45%, transparent); } .bars rect.cur { fill: var(--brand); }
.bars .grid { stroke: var(--line); stroke-width: 1; } .bars .ax { font-size: 10px; fill: var(--muted); font-family: var(--ui); }

.list-settings { display: grid; padding: 6px; }
.srow { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; text-align: start; }
.srow:hover { background: var(--surface2); } .srow.danger { color: var(--bad); }

.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabs a { display: grid; justify-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11.5px; padding: 4px 0; border-radius: 12px; }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs .scan-tab .i { background: var(--brand); color: var(--brand-ink); border-radius: 12px; width: 38px; height: 30px; padding: 5px 9px; }
.toast { position: fixed; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 12px; font-size: 14px; pointer-events: none; max-width: calc(100% - 32px); z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
