:root {
  --bg: #f3ede2;
  --surface: #fffbf5;
  --surface-2: #e9dfd0;
  --text: #3f2c26;
  --muted: #7a675c;
  --line: #ddd0be;
  --accent: #b64228;
  --accent-ink: #fff8ec;
  --good: #376447;
  --warning: #885414;
  --danger: #aa292f;
  --radius: 17px;
  --font: Vazirmatn, system-ui, sans-serif;
  --folio: #ee6949;
  --folio-ink: #3f201b;
  --folio-paper: #fff1d7;
  --folio-muted: #3f201b;
  --spine-a: #e4b795;
  --spine-b: #dccbb5;
  --spine-ink: #49352c;
  --crease: #b3452c;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #242321;
  --surface: #302e29;
  --surface-2: #3e3931;
  --text: #f4eadc;
  --muted: #bdac99;
  --line: #504639;
  --accent: #f19b77;
  --accent-ink: #302219;
  --good: #aac9ac;
  --warning: #edc182;
  --danger: #ffaaa4;
  --folio: #e98964;
  --folio-ink: #381f17;
  --folio-paper: #ffe3b8;
  --folio-muted: #482c23;
  --spine-a: #725141;
  --spine-b: #554a3c;
  --spine-ink: #f9e5cc;
  --crease: #ba5e3c;
  color-scheme: dark;
}
body { font-size: 13px; }
.app-shell { max-width: 560px; background: var(--bg); }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + max(env(safe-area-inset-top), var(--host-safe-top, 0px))) 24px 10px; gap: 12px; }
.fold-brand, .fold-header-tools { display: flex; align-items: center; gap: 10px; }
.fold-brand > svg { width: 26px; height: 26px; color: var(--accent); }
.fold-brand strong { font-size: 13px; font-weight: 750; }
.fold-header-tools { gap: 5px; }
.fold-icon, .fold-language { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; background: transparent; color: var(--text); border: 0; border-radius: 50%; }
.fold-language { min-width: 37px; font-size: 11px; font-weight: 700; }
.icon-only > span { display: none; }
.app-main { padding: 0 16px 110px; min-height: calc(100dvh - 66px); }
.fold-heading { padding: 3px 8px 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.fold-eyebrow { color: var(--muted); font-size: 9px; letter-spacing: 1.25px; font-weight: 600; }
[dir="rtl"] .fold-eyebrow { letter-spacing: 0; font-size: 11px; }
.fold-heading h1 { font-size: clamp(25px, 7.5vw, 30px); line-height: 1.45; margin-top: 4px; font-weight: 760; letter-spacing: -1.1px; }
.fold-heading sup { font-size: 12px; color: var(--accent); vertical-align: top; position: relative; top: 4px; margin-inline-start: 6px; letter-spacing: 0; font-weight: 600; }
.fold-search { background: var(--surface); box-shadow: 0 2px 0 var(--line); flex-shrink: 0; margin-bottom: 2px; }
.fold-collection-caption { padding: 0 12px 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; letter-spacing: .7px; }
[dir="rtl"] .fold-collection-caption { letter-spacing: 0; }
.fold-filters { padding: 4px 8px 10px; }
.fold-filters .list-controls { margin-bottom: 14px; gap: 9px; }
.fold-filters .control-row { flex-wrap: wrap; }
.fold-filters .sort-select { padding-inline-start: 0; }
.fold-filters .search-box { border: 0; border-radius: 7px; background: var(--surface); }
.fold-filters .segmented { gap: 2px; }
.fold-filters .segmented button { padding-inline: 9px; }
.fold-filters .segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.folio-stack { padding-top: 15px; }
.app-main article.folio { content-visibility: visible; contain-intrinsic-size: none; }
.folio { background: var(--spine-b); color: var(--spine-ink); position: relative; border-radius: 4px 18px 6px 6px; min-width: 0; overflow: visible; isolation: isolate; padding-bottom: 18px; border-top: 1px solid #ffffff3b; }
[dir="rtl"] .folio { border-radius: 18px 4px 6px 6px; }
.folio:before { content: ''; position: absolute; top: -14px; inset-inline-start: 0; width: 104px; height: 17px; background: inherit; border-radius: 7px 7px 0 0; border-top: 1px solid #ffffff47; z-index: -1; }
.folio:after { content: ''; position: absolute; bottom: 10px; inset-inline: 10px; height: 1px; background: #43231014; box-shadow: 0 3px 0 #4323100b; pointer-events: none; }
.folio + .folio { margin-top: -8px; }
.folio-1 { background: var(--spine-a); }
.folio.is-open { background: var(--folio); color: var(--folio-ink); box-shadow: 0 -4px 22px #6c2c1910; padding-bottom: 18px; }
.folio-spine { width: 100%; border: 0; background: transparent; padding: 12px 18px 11px; display: grid; grid-template-columns: 25px minmax(0,1fr) 30px; gap: 10px; align-items: center; text-align: start; color: inherit; min-height: 69px; }
.folio-spine:focus-visible { outline: 3px solid var(--folio-ink); outline-offset: -5px; border-radius: inherit; }
.folio-index { font-size: 11px; font-weight: 600; align-self: start; padding-top: 3px; }
.folio-index-line { display: block; width: 13px; height: 1px; background: currentColor; margin-top: 8px; opacity: .5; }
.folio-identity { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.folio-identity > strong { font-size: 13px; font-weight: 750; display: block; overflow-wrap: anywhere; text-align: start; }
.folio-spine-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 10px; }
.folio-status { display: inline-flex; gap: 5px; align-items: center; font-weight: 550; }
.folio-status:before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-10 { color: #222b15; }
.status-20, .status-25, .status-50 { color: #551218; }
[data-theme="dark"] .folio:not(.is-open) .status-10 { color: #d8eabe; }
[data-theme="dark"] .folio:not(.is-open) :is(.status-20,.status-25,.status-50) { color: #ffccc1; }
.folio-closed-days { font-size: 9px; opacity: .78; }
.is-open .folio-closed-days { display: none; }
.folio-open-mark { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; opacity: .8; }
.is-open .folio-open-mark { transform: rotate(180deg); border-color: #53281d36; }
.folio-content { position: relative; padding: 0 20px 0; overflow: hidden; }
.folio-category { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0 0; border-top: 1px solid #66302024; color: var(--folio-muted); font-size: 10px; }
.folio-category > span:last-child { text-align: end; }
.folio-original { color: var(--folio-muted); font-size: 10px; margin-top: 3px; overflow-wrap: anywhere; }
.folio-data { padding: 8px 0 7px; }
.folio-data-label { font-size: 11px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.folio-data-label > strong { font-size: 9px; font-weight: 650; padding-inline-start: 8px; border-inline-start: 1px solid currentColor; }
.folio-data-figure { display: flex; align-items: baseline; gap: 12px; margin-top: 0; }
.folio-data-figure > strong { font-size: clamp(57px, 16vw, 69px); font-weight: 480; letter-spacing: -3px; line-height: 1.06; }
.folio-data-figure > span { font-size: 12px; font-weight: 600; }
.folio-meter { height: 14px; background: #7a35201b; position: relative; direction: ltr; overflow: hidden; }
.folio-meter-fill { height: 100%; background: var(--folio-paper); transform-origin: left; }
.meter-critical .folio-meter-fill { background: #551218; }
.meter-warning .folio-meter-fill { background: #73502c; }
.folio-meter-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 2px), var(--folio) calc(5% - 2px) 5%); }
.meter-unknown { background: #6630201a; }
.folio-usage-note { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0 7px; font-size: 10px; color: var(--folio-muted); }
.folio-retry { display: inline-flex; gap: 5px; align-items: center; color: var(--folio-ink); background: none; border: 0; padding: 0; min-height: 32px; margin-block: -7px; font-size: 10px; text-decoration: underline; }
.folio-retry .icon { width: 14px; }
.folio-facts { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; border-block: 1px dashed #63352638; padding: 7px 0; }
.folio-facts > div, .folio-auto { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.folio-facts > div > span, .folio-auto > span { font-size: 9px; letter-spacing: .4px; color: var(--folio-muted); }
.folio-facts strong { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; }
.folio-auto { background: transparent; border: 0; padding: 0; text-align: start; color: var(--folio-ink); }
.folio-auto > strong { justify-content: flex-start; }
.folio-auto i { width: 24px; height: 13px; border-radius: 20px; background: #6b3f3447; position: relative; display: inline-block; }
.folio-auto i:after { content: ''; position: absolute; inset-inline-start: 3px; top: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--folio-paper); }
.folio-auto i.on { background: #42552e; }
.folio-auto i.on:after { inset-inline-start: 14px; }
.folio-actions { margin: 12px -1px 1px; display: flex; gap: 8px; }
.folio-actions button { border: 0; border-radius: 7px; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; font-weight: 600; }
.folio-primary { background: var(--folio-paper); color: var(--folio-ink); padding: 0 15px; flex: 1; box-shadow: 0 2px 0 #53211123; }
.folio-detail { color: var(--folio-ink); background: #77371f16; padding: 0 12px; }
.folio-detail > svg { width: 16px; }
.folio-fold { display: none; }
.fold-stack-hint { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); padding: 19px 2px 0; font-size: 10px; }
.fold-more { padding: 0 8px; }
.fold-more .load-more { border-radius: 7px; margin-top: 20px; border: 1px dashed var(--line); background: transparent; }
.fold-more .empty { margin-top: 10px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface); }
.app-nav { max-width: 528px; inset-inline: 16px; bottom: 12px; border: 0; padding: 7px 8px calc(7px + max(env(safe-area-inset-bottom), var(--host-safe-bottom, 0px))); border-radius: 14px; background: var(--text); color: var(--bg); gap: 3px; box-shadow: 0 8px 22px #2c190c22; }
.app-nav button { min-height: 49px; flex-direction: row; gap: 7px; border-radius: 9px; color: var(--bg); font-size: 10px; flex: 1; opacity: .78; }
.app-nav button[aria-current="page"] { background: var(--bg); color: var(--text); opacity: 1; }
.app-nav .icon { width: 18px; }
.btn, .icon-btn, .field input, .field select, .field textarea { border-radius: 8px; }
.btn { font-size: 12px; }
.fold-secondary { padding: 5px 8px 0; }
.fold-secondary .page-title { margin-bottom: 20px; }
.fold-secondary .page-title h1 { font-weight: 750; font-size: 30px; }
.wallet-card { background: var(--folio); color: var(--folio-ink); border-radius: 4px 16px 4px 4px; position: relative; margin-top: 36px; border-bottom: 5px double #803c242b; padding: 23px; gap: 17px; }
.wallet-card:before { content: ''; width: 105px; height: 16px; position: absolute; inset-inline-start: 0; top: -15px; background: inherit; border-radius: 7px 7px 0 0; }
.wallet-card .balance { font-size: 39px; font-weight: 550; }
.wallet-card .btn { background: var(--folio-paper); color: var(--folio-ink); }
.wallet-tabs .btn { background: var(--surface); }
.transaction { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; }
.tx-icon { width: 30px; height: 34px; border-radius: 4px; }
.tx-title { font-size: 12px; }
.tx-amount { font-size: 11px; }
.tx-meta { font-size: 9px; }
.transaction-list { border-top: 2px solid var(--text); }
.category-list { gap: 25px; margin-top: 36px; }
.category-card { border: 0; border-radius: 4px 14px 4px 4px; position: relative; padding: 21px 15px; grid-template-columns: 38px minmax(0,1fr) 20px; gap: 11px; background: var(--surface); box-shadow: 0 3px 0 var(--line); }
.category-card:before { content: ''; position: absolute; width: 76px; height: 13px; inset-inline-start: 0; top: -12px; background: inherit; border-radius: 6px 6px 0 0; }
.category-symbol { width: 36px; height: 40px; border-radius: 5px; font-size: 19px; }
.category-card h3 { font-size: 13px; }
.plan-card { border-radius: 7px; border-bottom: 3px double var(--line); }
.sheet { background: var(--surface); border-radius: 15px 15px 0 0; border-color: var(--line); }
.sheet::backdrop { background: #29170e77; backdrop-filter: blur(5px); }
.sheet-header, .sheet-body, .sheet-actions { padding-inline: 20px; }
.sheet-header h2 { font-size: 18px; }
.detail-usage, .renew-summary, .technical-value { border-radius: 6px; }
.progress { border-radius: 0; }
.progress > span { border-radius: 0; }
.toast { border-radius: 9px; bottom: calc(97px + env(safe-area-inset-bottom)); }
button { transition: transform 150ms ease, background-color 150ms ease; }
button:active { transform: translateY(1px) scale(.985); }
.folio-spine:active { transform: none; }
@media (min-width: 700px) {
  .app-shell { border-inline: 1px solid var(--line); }
  .app-main { padding-inline: 26px; }
  .app-header { padding-inline: 34px; }
  .sheet { border-radius: 15px; }
}
@media (max-width: 375px) {
  .app-header { padding-inline: 20px; }
  .app-main { padding-inline: 12px; }
  .folio-spine { padding-inline: 15px; gap: 8px; }
  .folio-content { padding-inline: 17px; }
  .folio-data-figure > strong { font-size: 58px; }
  .folio-actions button { font-size: 10px; }
  .folio-detail { padding-inline: 10px; }
  .fold-heading h1 { font-size: 27px; }
  .app-nav { inset-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
