:root {
  --bg: #f4f1e8;
  --bg-2: #ebe6d7;
  --card: #fffdf8;
  --ink: #17302a;
  --ink-2: #4b5d56;
  --ink-3: #87958f;
  --line: #e4ddcc;
  --line-2: #d3cbb5;
  --dr: #1f7a63;          /* debit */
  --dr-soft: #dcefe7;
  --cr: #b8612a;          /* credit */
  --cr-soft: #f8e7da;
  --ok: #2f8f4e;
  --ok-soft: #e1f2e5;
  --warn: #c2452d;        /* fix */
  --warn-soft: #f9e1da;
  --look: #b9800f;        /* worth a look */
  --look-soft: #fbefd2;
  --info: #3c6fb0;
  --info-soft: #e3ecf7;
  --focus: #1f6fd1;
  --shadow: 0 1px 2px rgba(23, 48, 42, .05), 0 6px 24px rgba(23, 48, 42, .07);
  --radius: 14px;
  --sans: "Hanken Grotesk Variable", "Mutabaqa Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque Variable", "Hanken Grotesk Variable", "Mutabaqa Arabic", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono Variable", "Mutabaqa Arabic", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1714; --bg-2: #13201c; --card: #172722; --ink: #e8efe9; --ink-2: #a9bab2; --ink-3: #78897f;
    --line: #22362f; --line-2: #2e463d;
    --dr: #4cc59f; --dr-soft: #133229; --cr: #ee9a5c; --cr-soft: #3a2415;
    --ok: #5cc27a; --ok-soft: #15301f; --warn: #f07a5e; --warn-soft: #3a1c15;
    --look: #e7b545; --look-soft: #352a10; --info: #7aa7e6; --info-soft: #172a42;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, .brand-name, .tile .n, .verdict b { font-family: var(--display); }
:root:lang(ar) body { line-height: 1.6; }
:root:lang(ar) * { letter-spacing: 0 !important; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.hidden { display: none !important; }
.neg { color: var(--cr); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 40px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-name em { font-style: normal; font-weight: 500; color: var(--ink-3); margin-inline-start: 4px; }
.logo { position: relative; width: 32px; height: 24px; display: inline-block; }
.logo i, .logo b { position: absolute; top: 2px; width: 14px; height: 20px; }
.logo i { left: 1px; background: var(--dr); border-radius: 5px 2px 2px 5px; transform: skewY(6deg); }
.logo b { right: 1px; background: var(--cr); border-radius: 2px 5px 5px 2px; transform: skewY(-6deg); }
.logo::after { content: ""; position: absolute; left: 15px; top: 0; width: 2px; height: 24px; border-radius: 1px; background: var(--ink); }
.logo::before { content: ""; position: absolute; left: 4px; right: 4px; top: 11px; height: 2px; background: var(--card); opacity: .85; z-index: 1; }
.lang { border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; min-width: 40px; height: 36px; padding: 0 12px; font-weight: 600; }
.lang:hover { border-color: var(--ink-3); }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 48px; }
.foot { text-align: center; color: var(--ink-3); font-size: 13px; padding: 18px 16px 28px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.by { color: var(--ink-3); font-size: 12px; letter-spacing: .26em; text-decoration: none; white-space: nowrap; }
[dir=rtl] .by { letter-spacing: 0; font-size: 13px; }
.by:hover { color: var(--ink); }
.beta { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cr); background: var(--cr-soft); border-radius: 999px; padding: 2px 8px; }
.foot p { margin: 0 0 8px; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.foot a { color: var(--ink-3); }
.foot a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--card); padding: 10px 16px; font-weight: 600; text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(23, 48, 42, .22); }
.btn.big { padding: 14px 28px; font-size: 17px; border-radius: 14px; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link:hover { text-decoration-color: var(--ink); }

/* ---------- home ---------- */
.hero { text-align: center; padding: clamp(24px, 6vh, 60px) 0 24px; }
.hero h1 { font-size: clamp(30px, 5vw, 50px); line-height: 1.12; letter-spacing: -.025em; margin: 0 auto 14px; max-width: 18ch; font-weight: 600; }
.hero h1 .dr { color: var(--dr); }
.hero h1 .cr { color: var(--cr); }
.hero p { margin: 0 auto; max-width: 60ch; color: var(--ink-2); font-size: 17px; }
.drop {
  display: block; cursor: pointer; position: relative; margin: 26px auto 0; max-width: 760px; border: 2px dashed var(--line-2); border-radius: 22px;
  background: var(--card); padding: 34px 24px 28px; text-align: center; box-shadow: var(--shadow);
  transition: border-color .15s, background .15s, transform .15s;
}
.drop.over { border-color: var(--dr); background: var(--dr-soft); transform: scale(1.01); }
.drop h2 { margin: 14px 0 4px; font-size: 21px; }
.drop p { margin: 0; color: var(--ink-2); }
.drop .actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.files { list-style: none; padding: 0; margin: 16px auto 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.files li { background: var(--bg-2); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.privacy { text-align: center; color: var(--ink-3); font-size: 13.5px; margin-top: 16px; }
.privacy a { color: var(--ink-3); }
.privacy .limits { color: var(--ink-2); font-weight: 500; }
.error { margin: 16px auto 0; max-width: 760px; background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px 16px; border-inline-start: 4px solid var(--warn); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the little ledger on the drop box: two pages, lines being written, a beam that levels */
.book-art { display: inline-flex; align-items: flex-end; gap: 0; position: relative; height: 70px; }
.book-art .pg { width: 56px; height: 66px; border-radius: 10px 4px 4px 10px; position: relative; overflow: hidden; }
.book-art .pg.l { background: var(--dr-soft); color: var(--dr); transform-origin: right center; animation: pageL 4s ease-in-out infinite; }
.book-art .pg.r { background: var(--cr-soft); color: var(--cr); border-radius: 4px 10px 10px 4px; transform-origin: left center; animation: pageR 4s ease-in-out infinite; }
.book-art .pg::before { content: ""; position: absolute; inset: 12px 10px; background: repeating-linear-gradient(to bottom, currentColor 0 3px, transparent 3px 10px);
  opacity: .55; clip-path: inset(0 100% 0 0); animation: write 4s steps(12) infinite; }
.book-art .pg.r::before { animation-delay: .5s; }
.book-art .spine { width: 3px; height: 70px; background: var(--ink); border-radius: 2px; }
@keyframes pageL { 50% { transform: perspective(200px) rotateY(8deg); } }
@keyframes pageR { 50% { transform: perspective(200px) rotateY(-8deg); } }
@keyframes write { 0% { clip-path: inset(0 100% 0 0); } 70%, 100% { clip-path: inset(0 0 0 0); } }

.answers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 40px auto 0; max-width: 1040px; }
.answers div { padding: 18px; border-radius: var(--radius); background: var(--bg-2); position: relative; overflow: hidden; }
.answers b { display: block; margin: 8px 0 4px; }
.answers span { color: var(--ink-2); font-size: 14.5px; }
.answers .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card); font-size: 17px; }
.answers div:nth-child(1) .ico { color: var(--ok); }
.answers div:nth-child(2) .ico { color: var(--dr); }
.answers div:nth-child(3) .ico { color: var(--look); }
.answers div:nth-child(4) .ico { color: var(--cr); }

/* ---------- setup ---------- */
.setup-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 18px 0 18px; flex-wrap: wrap; }
.setup-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.setup-head p { margin: 4px 0 0; color: var(--ink-2); }
.sheet-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border-top: 5px solid var(--dr); min-width: 0; }
.sheet-card h2 { margin: 0 0 2px; font-size: 21px; overflow-wrap: anywhere; }
.sheet-card .meta { color: var(--ink-2); font-size: 14px; }
.sheet-card select.table-pick { margin-top: 10px; }
.verdict-line { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--ok-soft); font-size: 14.5px; }
.verdict-line.probably { background: var(--look-soft); }
.verdict-line.unsure, .verdict-line.missing { background: var(--warn-soft); }
.verdict-line .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.verdict-line.probably .dot { background: var(--look); }
.verdict-line.unsure .dot, .verdict-line.missing .dot { background: var(--warn); }
.roles-summary { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; background: var(--bg-2); padding: 3px 10px; font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-weight: 600; }
.chip.missing { background: var(--warn-soft); }
.chip.dr { background: var(--dr-soft); } .chip.cr { background: var(--cr-soft); }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 18px; margin-top: 14px; font-size: 14px; }
.roles-grid label { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; }
.roles-grid label span small { display: block; color: var(--ink-3); font-size: 11.5px; }
select { border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 10px; background: var(--card); max-width: 100%; min-width: 0; }
.preview { margin-top: 14px; overflow: auto; max-height: 260px; border: 1px solid var(--line); border-radius: 10px; }
.preview table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.preview th, .preview td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.preview th { position: sticky; top: 0; background: var(--bg-2); font-weight: 600; }
.preview th small { display: block; color: var(--dr); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.preview td.on, .preview th.on { background: color-mix(in srgb, var(--dr-soft) 60%, transparent); }
.go { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 28px 0 8px; }
.go small { color: var(--ink-3); }

/* ---------- working (animation) ---------- */
.work { position: relative; margin: 6px 0 0; height: min(70vh, 640px); min-height: 480px; border-radius: 24px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%, var(--card) 0%, var(--bg-2) 75%); box-shadow: var(--shadow); }
.work::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(to bottom, transparent 0 31px, color-mix(in srgb, var(--line) 70%, transparent) 31px 32px); }
.work canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.work .caption { position: absolute; left: 0; right: 0; top: 20px; text-align: center; padding: 0 16px; pointer-events: none; }
.work .caption h2 { margin: 0; font-size: clamp(19px, 2.6vw, 26px); letter-spacing: -.01em; }
.work .caption p { margin: 6px 0 0; color: var(--ink-2); min-height: 1.5em; transition: opacity .3s; }
.stages { list-style: none; margin: 18px auto 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px; max-width: 900px; }
.stages li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--bg-2); color: var(--ink-3); transition: background .3s, color .3s; }
.stages li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
.stages li.active { background: var(--ink); color: var(--bg); }
.stages li.active::before { opacity: 1; animation: blink .8s ease-in-out infinite; }
.stages li.done { background: var(--ok-soft); color: var(--ok); }
.stages li.done::before { opacity: 1; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- report ---------- */
.rep-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 10px 0 18px; }
.rep-head h1 { margin: 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.02em; overflow-wrap: anywhere; }
.rep-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.rep-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 14px; text-align: start; border: 2px solid transparent;
  transition: border-color .15s, transform .15s; position: relative; overflow: hidden; min-width: 0; }
.tile:hover { transform: translateY(-2px); }
.tile.sel { border-color: var(--ink); }
.tile .k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tile .k i { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-style: normal; font-size: 12px; background: var(--bg-2); }
.tile .n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.tile.ok .n { color: var(--ok); } .tile.look .n { color: var(--look); } .tile.fix .n { color: var(--warn); }
.tile.t-bal .n { color: var(--dr); } .tile.t-par .n { color: var(--cr); }
.tile .bar-in { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: currentColor; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.tile.ok .bar-in { color: var(--ok); } .tile.look .bar-in { color: var(--look); } .tile.fix .bar-in { color: var(--warn); }
.tile.t-bal .bar-in { color: var(--dr); } .tile.t-par .bar-in { color: var(--cr); }
[dir=rtl] .tile .bar-in { left: auto; right: 0; }

.tabs { display: flex; gap: 4px; margin: 26px 0 0; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button .cnt { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--bg-2); font-size: 12px; margin-inline-start: 6px; text-align: center; }
.pane { animation: paneIn .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes paneIn { from { opacity: 0; transform: translateY(10px); } }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 10px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; background: var(--card); }
.filter { border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.filter .c { color: var(--ink-3); font-size: 12px; }
.filter.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter.on .c { color: inherit; opacity: .7; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.lead { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.empty { text-align: center; padding: 36px; color: var(--ink-3); background: var(--card); border-radius: 12px; }
.more { display: flex; justify-content: center; margin: 14px 0; }

/* health */
.verdict { display: flex; gap: 16px; align-items: center; margin-top: 16px; padding: 18px 20px; border-radius: var(--radius); background: var(--ok-soft); }
.verdict.look { background: var(--look-soft); } .verdict.fix { background: var(--warn-soft); }
.verdict .seal { width: 54px; height: 54px; flex: none; }
.verdict b { display: block; font-size: 20px; }
.verdict span { color: var(--ink-2); font-size: 14px; }
.finds { display: grid; gap: 10px; margin-top: 14px; }
.find { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; border-inline-start: 4px solid var(--info); animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.find.lv-error { border-inline-start-color: var(--warn); } .find.lv-warning { border-inline-start-color: var(--look); }
.find .h { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.find .lv { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 9px; background: var(--info-soft); color: var(--info); white-space: nowrap; }
.find.lv-error .lv { background: var(--warn-soft); color: var(--warn); } .find.lv-warning .lv { background: var(--look-soft); color: var(--look); }
.find p { margin: 6px 0 0; }
.find .ex { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.find .ex button, .find .ex span { font-size: 12.5px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 2px 8px; color: var(--ink-2); }
.find .ex button:hover { border-color: var(--ink-3); color: var(--ink); }
.find .fixit { margin-top: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* balances */
.checkline { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--ok-soft); margin-top: 16px; flex-wrap: wrap; }
.checkline.bad { background: var(--warn-soft); }
.checkline .scale { width: 46px; height: 30px; flex: none; }
.rows { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.rows th, .rows td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: start; }
.rows th { background: var(--bg-2); font-size: 12.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.rows td.e, .rows th.e { text-align: end; white-space: nowrap; }
.rows td.t { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows tr.grp td { background: color-mix(in srgb, var(--bg-2) 60%, var(--card)); font-weight: 700; font-size: 13px; }
.rows tr.sum td { font-weight: 700; background: var(--bg-2); }
.rows tr.click { cursor: pointer; }
.rows tr.click:hover td { background: color-mix(in srgb, var(--dr-soft) 45%, var(--card)); }
.rows tr.odd td:first-child { box-shadow: inset 3px 0 0 var(--look); }
[dir=rtl] .rows tr.odd td:first-child { box-shadow: inset -3px 0 0 var(--look); }
.tbl-wrap { overflow-x: auto; border-radius: 12px; box-shadow: var(--shadow); }
.tbl-wrap .rows { box-shadow: none; }
.flagdot { display: inline-block; font-size: 11px; font-weight: 700; color: var(--look); background: var(--look-soft); border-radius: 999px; padding: 0 7px; margin-inline-start: 6px; }
.type-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.type-bars .tb { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; min-width: 0; }
.type-bars .tb small { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.type-bars .tb div { font-size: 16px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-bars .tb .meter { height: 6px; background: var(--bg-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.type-bars .tb .meter span { display: block; height: 100%; width: 0; border-radius: 3px; transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* review and parties lists */
.items { display: grid; gap: 8px; }
.item { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; border-inline-start: 4px solid transparent; }
.item.hot { border-inline-start-color: var(--look); }
.item.m-checked { border-inline-start-color: var(--info); } .item.m-fine { border-inline-start-color: var(--ok); } .item.m-follow_up { border-inline-start-color: var(--warn); }
.ring { width: 46px; height: 46px; position: relative; }
.ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: var(--bg-2); }
.ring .fg { stroke: var(--look); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring.low .fg { stroke: var(--ink-3); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-family: var(--mono); }
.item .main { min-width: 0; }
.item .t1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.item .t1 .id { font-weight: 700; }
.item .t1 .co { color: var(--ink-3); font-size: 13px; }
.item .t2 { color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .why { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.item .why span { font-size: 12px; background: var(--look-soft); color: color-mix(in srgb, var(--look) 70%, var(--ink)); border-radius: 999px; padding: 1px 9px; }
.item .why span.quiet { background: var(--bg-2); color: var(--ink-2); }
.item .side { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item .amt { font-weight: 600; font-size: 15px; }
.marks { display: inline-flex; gap: 4px; }
.marks button { border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; font-size: 12px; padding: 2px 8px; color: var(--ink-2); }
.marks button.on[data-mark=checked] { background: var(--info); border-color: var(--info); color: #fff; }
.marks button.on[data-mark=fine] { background: var(--ok); border-color: var(--ok); color: #fff; }
.marks button.on[data-mark=follow_up] { background: var(--warn); border-color: var(--warn); color: #fff; }
.item .note { grid-column: 2 / -1; }
.item .note input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: var(--bg); font-size: 13px; }
.item .open { background: none; border: 0; padding: 0; text-align: start; color: inherit; }
.item .open:hover .id { text-decoration: underline; text-underline-offset: 3px; }

.aging { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.age-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; border: 2px solid transparent; text-align: start; }
.age-card.sel { border-color: var(--ink); }
.age-card .big { font-size: 24px; font-weight: 700; margin: 2px 0 10px; }
.age-card.receivable .big { color: var(--dr); } .age-card.payable .big { color: var(--cr); }
.agebar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg-2); }
.agebar span { height: 100%; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.a0 { background: color-mix(in srgb, var(--ok) 75%, transparent); } .a1 { background: color-mix(in srgb, var(--look) 65%, transparent); }
.a2 { background: color-mix(in srgb, var(--cr) 75%, transparent); } .a3 { background: var(--warn); } .a4 { background: var(--ink-3); }
.agelegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.agelegend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.mini-age { display: flex; height: 6px; width: 120px; border-radius: 3px; overflow: hidden; background: var(--bg-2); }
.mini-age span { height: 100%; }
.flags { display: grid; gap: 8px; margin-top: 14px; }
.flag { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; font-size: 14px; border-inline-start: 4px solid var(--info); }
.flag.look { border-inline-start-color: var(--look); } .flag.fix { border-inline-start-color: var(--warn); }

/* drawer with the lines behind a number */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 20, 16, .32); z-index: 40; animation: fadeBg .2s ease both; }
@keyframes fadeBg { from { opacity: 0; } }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(760px, 100%); background: var(--bg); z-index: 41; box-shadow: -10px 0 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column; animation: slideIn .32s cubic-bezier(.2,.8,.2,1) both; }
[dir=rtl] .drawer { animation-name: slideInR; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes slideInR { from { transform: translateX(-40px); opacity: 0; } }
.drawer header { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.drawer header h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.drawer header p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.drawer .body { overflow: auto; padding: 14px 20px 30px; flex: 1; }
.drawer .rows { font-size: 13px; }
.drawer .rows td, .drawer .rows th { padding: 6px 8px; }
.drawer .tot { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13.5px; color: var(--ink-2); }
.drawer .tot b { color: var(--ink); }
.x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card); font-size: 18px; flex: none; }

.feedback { margin-top: 14px; }
.feedback h3 { margin: 0 0 10px; }
.fb-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.fb-choices .btn.on { border-color: var(--ink); background: var(--bg-2); }
.fb-label { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--ink-2); }
.feedback textarea, .feedback input { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; background: var(--card); resize: vertical; }
.feedback input { display: block; max-width: 420px; }
[dir=rtl] .feedback input { text-align: right; }
.fb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.fb-actions small { flex-basis: 100%; }
.feedback .error { margin: 12px 0 0; }
.feedback.done p { margin: 0; color: var(--ok); font-weight: 600; }
.sorites { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; border-inline-start: 4px solid var(--dr); }
.sorites h3 { margin: 0 0 2px; font-size: 16px; }
.sorites p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 70ch; }

.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }
.stagger > * { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }

/* questions under the home screen */
.faq { width: 100%; max-width: 960px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 56px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 32px; }
.faq h2 { grid-column: 1 / -1; font-size: 22px; margin: 0 0 8px; }
.faq h3 { font-family: var(--sans); font-size: 16px; margin: 16px 0 6px; }
.faq p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.faq[hidden] { display: none; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .answers { grid-template-columns: repeat(2, 1fr); }
  .type-bars { grid-template-columns: repeat(3, 1fr); }
  .aging { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .faq { grid-template-columns: 1fr; }
  .answers { grid-template-columns: 1fr; }
  .type-bars { grid-template-columns: repeat(2, 1fr); }
  .item { grid-template-columns: 46px minmax(0, 1fr); }
  .item .side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .item .note { grid-column: 1 / -1; }
  .roles-grid label { grid-template-columns: 110px 1fr; }
  .tile .n { font-size: 22px; }
}
@media (max-width: 560px) {
  .by { display: none; }
  .brand-name em { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
