/* hesab app: Persian RTL, phone-first. Self-hosted Vazirmatn. */
@font-face { font-family: "Vazirmatn"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/static/fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("/static/fonts/vazirmatn-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f4f0; --surface: #ffffff; --surface-2: #f0efea; --line: #e4e2db; --line-strong: #d3d0c6;
  --fg: #1c1c1a; --fg-2: #4a4a45; --muted: #75746d; --accent: #12795a; --accent-fg: #ffffff; --accent-soft: #e3f2ec;
  --in: #12795a; --out: #b4301f; --warn: #9a5b00; --warn-soft: #fbf1df; --danger-soft: #fbeae7;
  --shadow: 0 1px 2px rgba(30, 28, 20, .06), 0 4px 16px rgba(30, 28, 20, .06);
  --shadow-lg: 0 10px 40px rgba(20, 18, 10, .18);
  --radius: 14px; --radius-sm: 10px;
  --c-groceries: #2f8f4e; --c-eating_out: #d1631f; --c-bills: #2f6fb8; --c-health: #c2477a; --c-loans: #7b4fc2;
  --c-shopping: #138a8a; --c-transport: #b07d0b; --c-travel: #1f8fbf; --c-streaming: #c4314b; --c-subscriptions: #5156c9; --c-fun_money: #c09012;
  --c-cash: #5f6b78; --c-work: #8a5a3b; --c-income: #12795a; --c-other: #8b8a84; --c-internal: #9ba3ab;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1c1c1a; --surface-2: #252522; --line: #2f2f2b; --line-strong: #3d3d38;
    --fg: #ecebe6; --fg-2: #c8c7c0; --muted: #9a9991; --accent: #4cc699; --accent-fg: #0d1f18; --accent-soft: #18332a;
    --in: #4cc699; --out: #f07a68; --warn: #e5a94b; --warn-soft: #33280f; --danger-soft: #3a1e1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
    --c-groceries: #5cc27c; --c-eating_out: #f08a4b; --c-bills: #5b9de6; --c-health: #e472a1; --c-loans: #a888e8;
    --c-shopping: #3fbdbd; --c-transport: #dcae3e; --c-travel: #4fb8e6; --c-streaming: #f2667e; --c-subscriptions: #8a8ef0; --c-fun_money: #e6bf45;
    --c-cash: #94a2b1; --c-work: #c08b67; --c-income: #4cc699; --c-other: #a3a29b; --c-internal: #7e868d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  font-size: 15px; line-height: 1.65; font-feature-settings: "ss01"; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .amount { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Stroke settings live here: <use> of an external sprite does not inherit
   them from the sprite file (icons rendered as filled blobs otherwise). */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
/* minmax(0, 1fr): otherwise the column grows to the filter row's content
   width (606px on a 390px phone) and the page scrolls sideways. */
.shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--fg-2);
  display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.sync-note { font-size: 12px; color: var(--muted); }

main { width: 100%; min-width: 0; max-width: 760px; margin: 0 auto; padding: 16px 16px 104px; }

.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.tab { border: 0; background: none; padding: 8px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 12px; font-weight: 600; }
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab .badge { position: absolute; }
.tab-wrap { position: relative; display: inline-flex; }
.tab { position: relative; }
.dot-badge { position: absolute; top: -4px; inset-inline-end: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--warn); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .tabbar { position: sticky; top: 59px; align-self: start; grid-row: 2; grid-column: 1; border: 0; background: transparent; padding: 20px 12px; }
  .tabbar-inner { display: flex; flex-direction: column; gap: 4px; }
  .tab { flex-direction: row; gap: 10px; font-size: 15px; padding: 10px 14px; border-radius: 10px; justify-content: flex-start; }
  .tab[aria-current="page"] { background: var(--accent-soft); }
  .tab-wrap { position: static; }
  .dot-badge { top: 50%; transform: translateY(-50%); inset-inline-end: 12px; }
  .tab:hover:not([aria-current="page"]) { background: var(--surface-2); color: var(--fg-2); }
  main { grid-column: 2; padding: 24px 24px 48px; }
}

/* ---------- Common blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 16px; }
.section-title { font-size: 15px; font-weight: 800; margin: 24px 4px 10px; display: flex; align-items: baseline; gap: 8px; }
.section-title small { font-weight: 500; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

.seg { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 16px; border-radius: 8px; font-weight: 600; color: var(--fg-2); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

.period { display: flex; align-items: center; gap: 8px; margin: 12px 0 16px; }
.period-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.period-title .live { display: inline-block; margin-inline-start: 6px; font-size: 11px; font-weight: 700; color: var(--warn);
  background: var(--warn-soft); padding: 1px 8px; border-radius: 99px; vertical-align: 2px; }
.nav-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); display: grid; place-items: center; }
.nav-btn:disabled { opacity: .35; cursor: default; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Report ---------- */
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.total.net { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.total.net .value { font-size: 17px; margin: 0; }
@media (min-width: 600px) { .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } .total.net { grid-column: auto; display: block; padding: 14px; } .total.net .value { font-size: 22px; margin-top: 2px; } }
.total { padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.total .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.total .value { font-size: clamp(17px, 5vw, 22px); font-weight: 800; margin-top: 2px; }
.total.in .value { color: var(--in); } .total.out .value { color: var(--out); }

.cat-list { list-style: none; margin: 0; padding: 4px 0; }
.cat-row { border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-btn { width: 100%; border: 0; background: none; text-align: start; padding: 12px 16px; display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "ic name amt" "ic bar bar"; column-gap: 12px; row-gap: 6px; align-items: center; }
.cat-btn:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cat-ic { grid-area: ic; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, transparent); }
.cat-name { grid-area: name; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cat-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-name .chev { color: var(--muted); transition: transform .2s; }
.cat-row[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.cat-amt { grid-area: amt; font-weight: 800; }
.cat-bar { grid-area: bar; position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: visible; }
.cat-bar .fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 3px; background: var(--cat); }
.cat-bar .avg { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--fg-2); border-radius: 1px; opacity: .55; }
.cat-meta { grid-column: 2 / -1; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: -2px; }
.delta { direction: ltr; unicode-bidi: isolate; font-weight: 700; font-size: 11.5px; padding: 0 7px; border-radius: 99px; }
.delta.up { color: var(--out); background: var(--danger-soft); } .delta.down { color: var(--in); background: var(--accent-soft); }
.cat-detail { padding: 0 16px 12px 16px; padding-inline-start: 64px; }
.payee { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.payee:first-child { border-top: 0; }
.payee .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payee .count { color: var(--muted); font-size: 12px; }

.acc-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border-bottom: 0; }
.acc-row .name { flex: 1; font-weight: 600; min-width: 0; }
.acc-row .flow { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; }
.acc-row .flow .amount.in { color: var(--in); } .acc-row .flow .amount.out { color: var(--out); }
.acc-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--fg-2); }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--fg); font-size: 14px; }
.alert + .alert { margin-top: 8px; }
.alert .icon { color: var(--warn); margin-top: 3px; }
.footnote { font-size: 12px; color: var(--muted); margin: 20px 4px 0; }

/* ---------- Transactions ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 8px; padding-inline: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--surface); padding: 5px 14px; border-radius: 99px; font-size: 13.5px; font-weight: 600;
  color: var(--fg-2); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .count { font-size: 11.5px; opacity: .8; }
.select { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: var(--fg-2); width: 100%; min-width: 0; }
.selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.search { position: relative; display: block; margin-top: 4px; }
.search input { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 9px 12px; padding-inline-start: 38px; font-size: 14.5px; }
.search .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.summary-line { font-size: 13px; color: var(--muted); margin: 6px 4px 12px; }

.day { margin-top: 14px; }
.day-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 6px 6px; }
.tx { width: 100%; border: 0; background: none; text-align: start; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px;
  align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); position: relative; }
.tx:last-child { border-bottom: 0; }
.tx:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.tx.unclear::before { content: ""; position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--warn); }
.tx-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--cat); background: color-mix(in srgb, var(--cat) 14%, transparent); }
.tx-main { min-width: 0; }
.tx-payee { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tx-sub .pill { color: var(--cat); font-weight: 700; }
.tx-sub .tag { background: var(--surface-2); color: var(--fg-2); border-radius: 6px; padding: 0 6px; font-weight: 600; }
.tx-amt { font-weight: 800; }
.tx-amt.in { color: var(--in); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }

/* ---------- Sheet (editor) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 8, .45); z-index: 50; opacity: 0; transition: opacity .18s; }
.scrim.open { opacity: 1; }
.sheet { position: fixed; z-index: 60; inset-inline: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.sheet.open { transform: none; }
.sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 10px; }
@media (min-width: 700px) {
  .sheet { inset: auto; left: 50%; top: 50%; bottom: auto; width: 560px; border-radius: 20px; transform: translate(-50%, -46%) scale(.98); opacity: 0;
    transition: transform .18s, opacity .18s; padding: 20px 22px 22px; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grabber { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { transition: none; } }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; }
.sheet-head .title { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.sheet-head .raw { font-size: 12.5px; color: var(--muted); direction: ltr; text-align: end; overflow-wrap: anywhere; }
.sheet-amount { font-size: 22px; font-weight: 800; }
.sheet-amount.in { color: var(--in); }
.facts { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-2); margin: 10px 0 14px; }
.facts span { background: var(--surface-2); padding: 2px 10px; border-radius: 99px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--fg-2); margin: 14px 0 8px; display: flex; justify-content: space-between; }
.field-label .hint { font-weight: 500; color: var(--muted); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cat-opt { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; text-align: start; color: var(--fg); }
.cat-opt .sw { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--cat); background: color-mix(in srgb, var(--cat) 14%, transparent); flex: none; }
.cat-opt[aria-checked="true"] { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 9%, var(--surface)); }
.cat-opt .auto { margin-inline-start: auto; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.text-in { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
textarea.text-in { min-height: 70px; resize: vertical; }
.sugs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sugs button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 2px 12px; font-size: 13px; color: var(--fg-2); }
.switch-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.switch-row .text { flex: 1; font-size: 13.5px; }
.switch-row .text b { display: block; font-size: 14px; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; }
/* Explicit "right": ::after on an <input> ignores the page's RTL direction. */
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: right .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch:checked { background: var(--accent); }
.switch:checked::after { right: 21px; }
/* Kept in view at the bottom of the sheet: on a laptop screen the save
   button was below the fold. */
.actions { display: flex; gap: 10px; margin: 18px -16px 0; padding: 12px 16px calc(4px + env(safe-area-inset-bottom)); position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); }
@media (min-width: 700px) { .actions { margin: 18px -22px 0; padding: 14px 22px 0; bottom: -22px; padding-bottom: 22px; } .sheet { max-height: 88dvh; } }
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 10px 18px; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); flex: 1; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Upload ---------- */
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 32px 16px; text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop > .icon { width: 40px; height: 40px; color: var(--accent); }
.drop h3 { margin: 8px 0 4px; font-size: 16px; }
.drop p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row .main { flex: 1; min-width: 0; }
.file-row .fname { font-weight: 700; direction: ltr; text-align: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .res { font-size: 13px; color: var(--muted); }
.file-row .res.err { color: var(--out); }
.file-row .state { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.file-row .state.ok { background: var(--accent-soft); color: var(--accent); }
.file-row .state.bad { background: var(--danger-soft); color: var(--out); }
.howto { font-size: 14px; }
.howto summary { cursor: pointer; font-weight: 700; padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 8px; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary .icon { transition: transform .2s; }
.howto[open] summary .icon { transform: rotate(-90deg); }
.howto ol { margin: 0; padding: 0 36px 14px 16px; color: var(--fg-2); }
.howto li { margin: 4px 0; }

/* ---------- Toast, loading, login ---------- */
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .2s; pointer-events: none;
  display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.sk-line { height: 14px; margin: 10px 0; }
.sk-card { height: 84px; border-radius: var(--radius); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; padding: 28px 24px; text-align: center; }
.login .brand { justify-content: center; font-size: 22px; margin-bottom: 8px; }
.login p { color: var(--fg-2); margin: 8px 0 20px; }
.login .btn { width: 100%; }
.login .note { font-size: 13px; color: var(--muted); margin-top: 14px; }
.login .ok { color: var(--in); font-weight: 700; }
.login .bad { color: var(--out); font-weight: 700; }

/* ---------- Language switch and left-to-right (English) ---------- */
.lang-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 3px 12px; font-size: 13px; font-weight: 700; color: var(--fg-2); }
.lang-btn:hover { background: var(--surface-2); }
[dir="ltr"] .icon.flip { transform: scaleX(-1); }
[dir="ltr"] .chev { transform: scaleX(-1); }
[dir="ltr"] .cat-row[aria-expanded="true"] .chev { transform: rotate(-90deg); }
[dir="ltr"] .howto[open] summary .icon { transform: scaleX(-1) rotate(-90deg); }
[dir="ltr"] .switch::after { right: auto; left: 3px; transition: left .15s; }
[dir="ltr"] .switch:checked::after { left: 21px; }
[dir="ltr"] body { font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif; }
.switch-row .text .repeat-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
