:root, :root[data-theme="dark"] {
  --bg: #101110;
  --surface: #1a1b19;
  --surface-2: #242521;
  --text: #f5f3ed;
  --muted: #a9aaa2;
  --line: #383a33;
  --accent: #ffb78c;
  --accent-text: #ffb78c;
  --accent-ink: #24180f;
  --good: #9ddbb6;
  --warning: #e8c17b;
  --danger: #ff9393;
  --radius: 18px;
  --font: 'Vazirmatn', system-ui, sans-serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --pass-status: var(--good);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f3ef;
  --surface: #ffffff;
  --surface-2: #eaece5;
  --text: #20221e;
  --muted: #63675c;
  --line: #d8dbd0;
  --accent: #f7ad7e;
  --accent-text: #925020;
  --accent-ink: #271c14;
  --good: #287647;
  --warning: #886115;
  --danger: #af3035;
  color-scheme: light;
}

body { background: var(--bg); font-family: var(--font); font-size: 15px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: #ffb78c1f; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.app-shell { width: 100%; max-width: 580px; min-height: 100dvh; margin-inline: auto; background: var(--bg); }
.app-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 86px; padding: calc(17px + max(env(safe-area-inset-top), var(--host-safe-top, 0px))) 22px 17px; border-bottom: 1px solid var(--line); background: var(--bg); }
.atelier-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.atelier-symbol { display: grid; place-items: center; width: 34px; height: 38px; color: var(--accent-text); flex: 0 0 auto; }
.atelier-symbol svg { width: 32px; height: 32px; }
.atelier-brand strong { display: block; font-size: 15px; line-height: 1.5; font-weight: 700; }
.atelier-brand div > span { display: block; font-size: 11px; margin-top: 1px; color: var(--muted); }
.atelier-header-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.atelier-language { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: transparent; font-size: 11px; font-weight: 600; }
.atelier-settings.icon-btn { width: 44px; height: 44px; background: transparent; border: 0; color: var(--muted); }
.app-main { padding: 22px 20px calc(108px + max(env(safe-area-inset-bottom), var(--host-safe-bottom, 0px))); }
.atelier-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 2px 18px; }
.atelier-eyebrow { color: var(--muted); font-size: 10px; letter-spacing: 1.7px; line-height: 1.8; font-weight: 600; margin-bottom: 5px; }
[dir="rtl"] .atelier-eyebrow { letter-spacing: 0; font-size: 12px; }
.atelier-heading h1 { display: flex; align-items: center; gap: 12px; font-size: 30px; line-height: 1.35; letter-spacing: -1px; margin: 3px 0 7px; font-weight: 700; }
[dir="rtl"] .atelier-heading h1 { letter-spacing: -.8px; font-weight: 750; }
.atelier-total { display: inline-flex; align-items: center; justify-content: center; min-width: 27px; height: 25px; border: 1px solid var(--line); padding-inline: 6px; color: var(--muted); font-size: 12px; letter-spacing: 0; border-radius: 6px; font-weight: 500; }
.atelier-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.atelier-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; }
.atelier-attention { display: inline-flex; align-items: center; gap: 8px; }
.atelier-attention::before { content: ''; width: 3px; height: 3px; background: var(--muted); border-radius: 50%; }
.atelier-attention.has-attention { color: var(--warning); }
.atelier-add.icon-btn { width: 48px; height: 48px; background: var(--accent); border: 0; color: var(--accent-ink); border-radius: 50%; flex: 0 0 auto; }
.atelier-controls { margin-bottom: 18px; }
.atelier-controls .search-box { min-height: 48px; background: transparent; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; box-shadow: none; }
.atelier-controls .search-box input { font-size: 13px; min-height: 46px; background: transparent; }
.atelier-controls .search-box:focus-within { border-color: var(--accent); }
.atelier-controls .segmented { padding: 0; background: transparent; border: 0; gap: 7px; margin: 0; }
.atelier-controls .segmented button { min-height: 40px; border-radius: 8px; padding: 7px 12px; border: 1px solid transparent; color: var(--muted); background: transparent; font-size: 12px; }
.atelier-controls .segmented button.active, .atelier-controls .segmented button[aria-pressed="true"], .atelier-controls .segmented button[aria-selected="true"] { border-color: var(--line); background: var(--surface-2); color: var(--text); box-shadow: none; }
.atelier-controls select { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; min-height: 40px; padding-inline: 8px; }
.atelier-controls .row { gap: 6px; }
.atelier-sync { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin: -2px 3px 12px; }
.sync-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: quiet-pulse 1.2s ease-in-out infinite; }
.atelier-passes { display: flex; flex-direction: column; gap: 16px; }
.membership-pass { position: relative; background: var(--surface); border: 1px solid var(--line); padding: 18px; border-radius: 8px; overflow: hidden; --pass-status: var(--good); }
.membership-pass.pass-expired::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--danger); pointer-events: none; }
.membership-pass.warning { --pass-status: var(--warning); }
.membership-pass.critical { --pass-status: var(--danger); }
.membership-pass.muted { --pass-status: var(--muted); }
.pass-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 10px; }
.pass-category { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.pass-serial { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.pass-heading { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pass-identity { min-width: 0; }
.pass-heading h2 { margin: 0; line-height: 1.55; font-size: 18px; font-weight: 650; letter-spacing: -.25px; overflow-wrap: anywhere; }
.pass-technical { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 4px 0 0; overflow-wrap: anywhere; }
.pass-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--pass-status) 27%, transparent); background: color-mix(in srgb, var(--pass-status) 8%, transparent); border-radius: 6px; color: var(--pass-status); flex: 0 1 auto; max-width: 43%; text-align: center; line-height: 1.5; }
.pass-status i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.pass-plan { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.pass-stats { display: grid; grid-template-columns: 1.25fr 1fr; margin: 23px 0 19px; gap: 10px; }
.pass-label { display: block; font-size: 11px; color: var(--muted); line-height: 1.5; }
.pass-figure { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; row-gap: 0; min-height: 42px; padding-top: 3px; }
.pass-number { font-variant-numeric: tabular-nums; font-size: 32px; font-weight: 600; line-height: 1.2; letter-spacing: -1.1px; }
.pass-unit { color: var(--muted); font-size: 10px; font-weight: 500; }
.pass-time { border-inline-start: 1px solid var(--line); padding-inline-start: 15px; }
.pass-time > strong { display: block; margin-top: 8px; font-size: 18px; line-height: 1.5; font-weight: 500; }
.pass-date { display: block; margin-top: 3px; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: normal; }
.pass-meter { height: 4px; width: 100%; overflow: hidden; background: var(--line); border-radius: 3px; }
.pass-meter > span { display: block; height: 100%; background: var(--pass-status); border-radius: inherit; transition: width .45s ease; }
.pass-usage-labels { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 10px; color: var(--muted); }
.pass-usage-labels b { color: var(--text); font-weight: 500; margin-inline-start: 2px; }
.pass-actions { display: flex; align-items: stretch; gap: 8px; border-top: 1px solid var(--line); padding-top: 15px; margin-top: 17px; }
.pass-actions .btn { min-height: 43px; border-radius: 9px; padding: 10px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.5; font-size: 12px; box-shadow: none; white-space: nowrap; font-weight: 600; }
.pass-primary.btn { flex: 1 1 auto; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.pass-qr.btn, .pass-copy.btn { width: 46px; flex: 0 0 46px; color: var(--text); background: transparent; border: 1px solid var(--line); }
.pass-qr.btn span, .pass-copy.btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pass-detail.btn { flex: 0 0 auto; color: var(--text); background: transparent; border: 1px solid var(--line); }
.pass-auto { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 9px; color: var(--muted); margin-top: 13px; }
.pass-message { margin: 12px 0 0; color: var(--pass-status); font-size: 11px; line-height: 1.65; }
.pass-expired .pass-number { color: var(--muted); }
.pass-expired .pass-primary.btn, .pass-unavailable-state .pass-primary.btn { background: transparent; color: var(--accent-text); border-color: color-mix(in srgb, var(--accent-text) 40%, var(--line)); }
.pass-pending { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 10px; color: var(--muted); }
.loading-stroke { display: block; width: 85px; height: 23px; margin-top: 3px; background: var(--surface-2); border-radius: 4px; animation: quiet-pulse 1.2s ease-in-out infinite; }
.pass-unavailable { font-size: 15px; line-height: 1.6; margin-top: 6px; font-weight: 500; color: var(--muted); }
.atelier-footnote { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); margin: 26px 0 0; font-size: 10px; }
.app-nav { position: fixed; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; max-width: 580px; margin-inline: auto; padding: 11px 18px calc(11px + max(env(safe-area-inset-bottom), var(--host-safe-bottom, 0px))); border-top: 1px solid var(--line); background: var(--bg); border-radius: 0; z-index: 20; }
.app-nav .atelier-nav-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 53px; justify-content: center; color: var(--muted); background: transparent; border: 0; border-radius: 10px; font-size: 10px; padding: 4px 6px; }
.atelier-nav-icon { display: inline-flex; justify-content: center; align-items: center; }
.app-nav .atelier-nav-item.is-current { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.atelier-nav-item.is-current::before { content: ''; position: absolute; height: 2px; width: 20px; border-radius: 2px; top: -12px; background: var(--accent-text); }
.atelier-wallet > .atelier-eyebrow, .atelier-shop > .atelier-eyebrow { margin: -4px 0 8px; }
.page-title { font-size: 29px; line-height: 1.4; font-weight: 700; letter-spacing: -.6px; margin-block: 0 22px; }
.page-title p { font-weight: 400; letter-spacing: 0; }
.section-title { font-size: 15px; font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: none; border-radius: 16px; }
.btn { min-height: 44px; border-radius: 10px; font-weight: 600; box-shadow: none; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
.icon-btn { border-radius: 10px; }
.wallet-card { position: relative; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 20px; padding: 26px 22px; overflow: hidden; }
.wallet-card::after { content: ''; position: absolute; width: 90px; height: 90px; border: 1px solid var(--line); border-radius: 50%; inset-inline-end: -37px; top: -36px; box-shadow: 0 0 0 15px color-mix(in srgb, var(--line) 26%, transparent), 0 0 0 30px color-mix(in srgb, var(--line) 15%, transparent); pointer-events: none; }
.wallet-card .balance, .wallet-card .wallet-balance { font-weight: 500; font-size: 38px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.wallet-card .muted { color: var(--muted); }
.wallet-tabs { padding: 4px; gap: 5px; border: 1px solid var(--line); background: transparent; border-radius: 10px; }
.wallet-tabs button { min-height: 43px; color: var(--muted); background: transparent; border-radius: 7px; }
.wallet-tabs button.active, .wallet-tabs button[aria-selected="true"] { color: var(--text); background: var(--surface-2); }
.transaction-list { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.transaction { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 15px; box-shadow: none; }
.transaction:last-child { border-bottom: 0; }
.tx-icon { width: 38px; height: 38px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 50%; }
.tx-amount { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.atelier-wallet .transaction-list { display: grid; background: transparent; border: 0; border-radius: 0; gap: 12px; }
.atelier-wallet .transaction-list > .transaction { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.atelier-linked-transactions { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.atelier-linked-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.atelier-linked-heading h3 { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; margin: 0; }
.atelier-linked-count { font-size: 10px; color: var(--muted); text-align: end; }
.atelier-linked-entries { position: relative; }
.atelier-linked-entries::before { content: ''; position: absolute; inset-inline-start: 19px; top: 28px; bottom: 28px; width: 1px; background: var(--line); }
.atelier-linked-entry.transaction { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; width: 100%; padding: 18px 15px; padding-inline-start: 36px; text-align: start; }
.atelier-linked-entry::before { content: ''; position: absolute; inset-inline-start: 15px; top: 25px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--muted); background: var(--surface); }
.atelier-linked-entry.is-cashback::before { border-color: var(--good); }
.atelier-entry-heading { display: flex; flex-direction: column; gap: 4px; }
.atelier-entry-heading .tx-title { font-size: 14px; line-height: 1.5; }
.atelier-entry-status { font-size: 11px; color: var(--muted); }
.atelier-linked-entry .tx-amount { align-self: start; font-size: 17px; text-align: end; }
.atelier-linked-entry .tx-amount small { display: block; font-size: 10px; font-weight: 400; margin-top: 3px; color: var(--muted); }
.atelier-entry-meta { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.atelier-entry-meta bdi { color: var(--text); }
.atelier-entry-method { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.atelier-linked-entry:focus-visible { outline-offset: -4px; }
.category-list, .plan-list { gap: 13px; }
.category-card { padding: 21px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
.category-card h2, .category-card h3 { font-size: 18px; font-weight: 600; }
.category-card .icon { color: var(--accent-text); }
.atelier-shop .category-card { grid-template-columns: minmax(0, 1fr) auto; }
.plan-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: none; }
.plan-card .price { color: var(--text); font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-card .primary { border: 1px solid color-mix(in srgb, var(--accent-text) 45%, transparent); background: transparent; color: var(--accent-text); }
.field input, .field select, .field textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 9px; min-height: 46px; }
.field label, .field > span { font-size: 12px; color: var(--muted); }
.notice { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; font-size: 12px; line-height: 1.8; }
.badge { border-radius: 6px; font-size: 10px; }
.empty { background: transparent; border: 1px dashed var(--line); border-radius: 16px; padding: 40px 22px; }
.sheet-backdrop, dialog.sheet::backdrop { background: #0009; backdrop-filter: blur(6px); }
dialog.sheet { max-width: 580px; border: 1px solid var(--line); border-radius: 23px 23px 0 0; background: var(--surface); color: var(--text); overscroll-behavior: contain; }
.sheet-header { border-bottom: 1px solid var(--line); padding: 21px 22px 17px; }
.sheet-header h2 { font-size: 20px; font-weight: 650; }
.sheet-body { padding: 21px 22px; }
.sheet-actions { padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.fact-list { border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.fact-list > div { border-color: var(--line); padding: 10px 12px; }
.toast { background: var(--text); color: var(--bg); border-radius: 10px; font-size: 13px; box-shadow: 0 8px 32px #0003; }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.good { color: var(--good); }
.warning { color: var(--warning); }
.critical { color: var(--danger); }
.membership-pass { color: var(--text); }
@keyframes quiet-pulse { 50% { opacity: .4; } }
@media (hover: hover) { .pass-primary:hover, .atelier-add:hover { filter: brightness(1.07); } .pass-detail:hover, .pass-qr:hover, .pass-copy:hover, .atelier-language:hover, .atelier-linked-entry:hover { background: var(--surface-2); } }
@media (max-width: 374px) { .app-header { padding-inline: 17px; }.app-main { padding-inline: 14px; }.membership-pass { padding: 16px; }.atelier-heading h1 { font-size: 28px; }.pass-number { font-size: 29px; }.pass-time { padding-inline-start: 12px; }.pass-actions { gap: 6px; }.pass-actions .btn { padding-inline: 9px; }.atelier-controls .segmented button { padding-inline: 9px; } }
@media (min-width: 650px) { .app-shell { border-inline: 1px solid var(--line); }.app-main { padding-inline: 30px; }.app-header { padding-inline: 30px; }.app-nav { border-inline: 1px solid var(--line); }.membership-pass { padding: 23px; }.pass-stats { grid-template-columns: 1.3fr 1fr; }.pass-number { font-size: 36px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
