/* =============================================================================
   Kany Kasa customer services: the whole look
   Same family as the ERP (style.css): grey background, white cards, teal accent,
   one dark highlight card, Phosphor icons. Phone first; wider screens get a top nav.
   Right-to-left (Kurdish, Arabic) works through logical properties (inline-start/end).
   ============================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

@font-face { font-family: 'Phosphor'; src: url('../lib/phosphor/Phosphor.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'Phosphor-Fill'; src: url('../lib/phosphor/Phosphor-Fill.woff2') format('woff2'); font-display: block; }

/* ---- 1. Tokens ------------------------------------------------------------ */
:root {
    --bg: #F1F1F0;
    --surface: #FFFFFF;
    --surface-2: #F7F7F6;
    --ink: #1C1C1E;
    --ink-2: #505157;
    --ink-3: #85868C;
    --line: #E3E3E1;
    --line-strong: #CFCFCC;
    --accent: #0D9488;
    --accent-ink: #0F766E;
    --accent-soft: #E3F3F1;
    --dark: #232427;
    --dark-2: #2F3034;
    --on-dark: #F4F4F3;
    --on-dark-2: #B9BABF;
    --ok: #15803D;   --ok-soft: #E5F4EA;
    --warn: #B45309; --warn-soft: #FCF1E1;
    --bad: #B91C1C;  --bad-soft: #FBE9E8;
    --info: #1D4ED8; --info-soft: #E8EEFC;
    --focus: 0 0 0 3px rgba(13, 148, 136, .28);
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 20px rgba(20, 20, 20, .04);
    --control: 48px;
    --content: 980px;
    --tabbar: 64px;
    --font: 'Inter', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #161618; --surface: #212125; --surface-2: #2A2A2F; --ink: #ECECEF; --ink-2: #B7B8BE; --ink-3: #8B8C93;
    --line: #34353A; --line-strong: #46474D; --accent: #14B8A6; --accent-ink: #2DD4BF; --accent-soft: #11302D;
    --dark: #0E0E10; --dark-2: #1B1B1E; --on-dark: #F4F4F3; --on-dark-2: #A9AAB0;
    --ok: #4ADE80; --ok-soft: #12291B; --warn: #FBBF24; --warn-soft: #2D2310; --bad: #F87171; --bad-soft: #321616;
    --info: #93B4FF; --info-soft: #172240;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #161618; --surface: #212125; --surface-2: #2A2A2F; --ink: #ECECEF; --ink-2: #B7B8BE; --ink-3: #8B8C93;
        --line: #34353A; --line-strong: #46474D; --accent: #14B8A6; --accent-ink: #2DD4BF; --accent-soft: #11302D;
        --dark: #0E0E10; --dark-2: #1B1B1E; --on-dark: #F4F4F3; --on-dark-2: #A9AAB0;
        --ok: #4ADE80; --ok-soft: #12291B; --warn: #FBBF24; --warn-soft: #2D2310; --bad: #F87171; --bad-soft: #321616;
        --info: #93B4FF; --info-soft: #172240;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
        color-scheme: dark;
    }
}
html[dir="rtl"] { --font: 'Vazirmatn', 'Inter', system-ui, sans-serif; }

/* ---- 2. Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
    font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* ---- 3. Icons (Phosphor codes from @phosphor-icons/web 2.1.1, same font as the ERP) --- */
.i { font-family: 'Phosphor'; font-style: normal; font-weight: normal; line-height: 1; display: inline-block;
     speak: never; -webkit-font-smoothing: antialiased; }
.i.fill { font-family: 'Phosphor-Fill'; }
.i-house::before { content: "\e2c2"; }        .i-receipt::before { content: "\e3ec"; }
.i-credit-card::before { content: "\e1d2"; }  .i-wrench::before { content: "\e5d4"; }
.i-user::before { content: "\e4c2"; }         .i-lightning::before { content: "\e2de"; }
.i-buildings::before { content: "\e102"; }    .i-building-apartment::before { content: "\e0fe"; }
.i-key::before { content: "\e2d6"; }          .i-calendar::before { content: "\e10a"; }
.i-clock::before { content: "\e19a"; }        .i-check-circle::before { content: "\e184"; }
.i-x-circle::before { content: "\e4f8"; }     .i-warning-circle::before { content: "\e4e2"; }
.i-qr-code::before { content: "\e3e6"; }      .i-copy::before { content: "\e1ca"; }
.i-arrow-left::before { content: "\e058"; }   .i-arrow-right::before { content: "\e06c"; }
.i-caret-right::before { content: "\e13a"; }  .i-caret-left::before { content: "\e138"; }
.i-sign-out::before { content: "\e42a"; }     .i-devices::before { content: "\eba4"; }
.i-device-mobile::before { content: "\e1e0"; } .i-translate::before { content: "\e4a2"; }
.i-moon::before { content: "\e330"; }         .i-sun::before { content: "\e472"; }
.i-eye::before { content: "\e220"; }          .i-eye-slash::before { content: "\e224"; }
.i-lock::before { content: "\e2fa"; }         .i-phone::before { content: "\e3b8"; }
.i-printer::before { content: "\e3dc"; }      .i-bank::before { content: "\e0b4"; }
.i-hourglass::before { content: "\e2b8"; }    .i-drop::before { content: "\e210"; }
.i-fan::before { content: "\e9f2"; }          .i-door::before { content: "\e61c"; }
.i-paint-roller::before { content: "\e6f4"; } .i-plug::before { content: "\e946"; }
.i-toolbox::before { content: "\eca0"; }      .i-plus::before { content: "\e3d4"; }
.i-history::before { content: "\e1a0"; }      .i-info::before { content: "\e2ce"; }
.i-spinner::before { content: "\eb44"; }      .i-check::before { content: "\e182"; }
.i-file-text::before { content: "\e23a"; }    .i-calendar-check::before { content: "\e712"; }
.i-shield-check::before { content: "\e40c"; } .i-globe::before { content: "\e28e"; }
.i-x::before { content: "\e4f6"; }            .i-wallet::before { content: "\e68a"; }
.i-circle-half::before { content: "\e18c"; }  .i-monitor::before { content: "\e32e"; }
.i-user-circle::before { content: "\e4c4"; }  .i-hand-coins::before { content: "\ea8c"; }
/* Arrows that point "forward" flip in right-to-left languages */
html[dir="rtl"] .i-arrow-right, html[dir="rtl"] .i-arrow-left,
html[dir="rtl"] .i-caret-right, html[dir="rtl"] .i-caret-left { transform: scaleX(-1); }
@keyframes kk-spin { to { transform: rotate(360deg); } }
.spin { animation: kk-spin 0.9s linear infinite; }

/* ---- 4. Page frame: demo ribbon, header, desktop nav, bottom tab bar ------- */
.demo-ribbon {
    background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; text-align: center;
    padding: 6px 16px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
.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-in {
    max-width: calc(var(--content) + 32px); margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 12px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: #fff; border: 1px solid var(--line);
              display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-logo img { width: 30px; height: 30px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; gap: 4px; margin-inline-start: 12px; }
.topnav a {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
    color: var(--ink-2); font-weight: 550; font-size: 14px; text-decoration: none;
}
.topnav a:hover { background: var(--surface); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.topnav a .i { font-size: 18px; }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
    display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); font-size: 20px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.lang-btn { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 600; }
.lang-btn .i { font-size: 18px; }

.menu { position: relative; }
.menu-list {
    position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 170px; z-index: 30;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.menu-list button {
    display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: start; font-size: 15px;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list button[aria-checked="true"] { color: var(--accent-ink); font-weight: 650; }

.tabbar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 560px; margin: 0 auto; height: var(--tabbar); }
.tabbar a {
    min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--ink-3); font-size: 11px; font-weight: 550; text-decoration: none;
}
.tabbar a span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar a .i { font-size: 23px; }
.tabbar a[aria-current="page"] { color: var(--accent-ink); }
.tabbar a[aria-current="page"] .i { font-family: 'Phosphor-Fill'; }

main.page {
    min-width: 0;
    max-width: calc(var(--content) + 32px); margin: 0 auto;
    padding: 20px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom));
}
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { flex: 1; min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 550; margin-bottom: 10px; }

@media (min-width: 900px) {
    .topnav { display: flex; }
    .tabbar { display: none; }
    main.page { padding-bottom: 48px; padding-top: 28px; }
    h1 { font-size: 28px; }
}

/* ---- 5. Cards, sections, lists ------------------------------------------- */
.stack { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 2px 10px; }
.section-title a { font-size: 14px; font-weight: 600; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
/* Grids hold long text that is cut off with "…": the column must be allowed to shrink to the screen */
.stack, .grid-2, .hero, .pay-screen, .auth-card, .req, .sheet-body, .pay-way, .setting, .demo-box { grid-template-columns: minmax(0, 1fr); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; width: 100%;
    background: none; border: 0; text-align: start; cursor: pointer;
}
a.row:hover, button.row:hover { background: var(--surface-2); text-decoration: none; }
.list > li:first-child > .row { border-radius: var(--radius) var(--radius) 0 0; }
.list > li:last-child > .row { border-radius: 0 0 var(--radius) var(--radius); }
.row-icon {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 21px;
    background: var(--surface-2); color: var(--ink-2);
}
.row-icon.utility { background: #FFF4D6; color: #A16207; }
.row-icon.rent { background: #E6F0FF; color: #1D4ED8; }
.row-icon.installment { background: var(--accent-soft); color: var(--accent-ink); }
:root[data-theme="dark"] .row-icon.utility { background: #2E2610; color: #FACC15; }
:root[data-theme="dark"] .row-icon.rent { background: #172240; color: #93B4FF; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .row-icon.utility { background: #2E2610; color: #FACC15; }
    :root:not([data-theme="light"]) .row-icon.rent { background: #172240; color: #93B4FF; }
}
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; color: var(--ink-3); font-size: 13px; overflow-wrap: anywhere; }
.row-end { text-align: end; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .chev { color: var(--ink-3); font-size: 18px; }

/* ---- 6. Chips (statuses) ------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
}
.chip .i { font-size: 13px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- 7. Buttons and form fields ------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control);
    padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font-weight: 650; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--line-strong); }
.btn .i { font-size: 19px; }
.btn.primary { background: var(--dark-2); border-color: var(--dark-2); color: var(--on-dark); }
.btn.primary:hover { background: var(--dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { filter: brightness(0.95); }
.btn.light { background: var(--on-dark); border-color: var(--on-dark); color: #17171A; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.field { display: grid; gap: 6px; }
.field > label, .field-label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--ink-3); }
.input {
    width: 100%; min-height: var(--control); padding: 0 14px; border-radius: 13px;
    border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px;
}
textarea.input { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 52px; }
.input-wrap .reveal {
    position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 42px; height: 40px;
    border: 0; background: none; color: var(--ink-3); font-size: 20px; cursor: pointer; border-radius: 10px;
}
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.form-error {
    display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: 12px;
    background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 550;
}
.form-error .i { font-size: 18px; margin-top: 1px; }
.form-ok { display: flex; gap: 8px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 550; }

/* Segmented control (To pay | Paid | All) and filter chips */
.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; gap: 2px; }
.seg button {
    border: 0; background: none; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
    color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pill {
    border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.pill[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---- 8. Home: dark highlight card + quick actions ------------------------ */
.hero {
    background: var(--dark-2); color: var(--on-dark); border-radius: 22px; padding: 22px;
    display: grid; gap: 14px; position: relative; overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, .35), transparent 70%); pointer-events: none;
}
.hero-label { color: var(--on-dark-2); font-size: 14px; font-weight: 550; }
.hero-amount { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-amount small { font-size: 18px; font-weight: 600; color: var(--on-dark-2); margin-inline-start: 4px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-meta .chip { background: rgba(255, 255, 255, .1); color: var(--on-dark); }
.hero-meta .chip.bad { background: rgba(248, 113, 113, .18); color: #FCA5A5; }
.hero .btn { justify-self: start; position: relative; z-index: 1; }
.hero-done { display: flex; align-items: center; gap: 12px; }
.hero-done .i { font-size: 34px; color: #5EEAD4; }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a span { overflow-wrap: anywhere; }
.quick a {
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; text-align: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink);
    font-size: 12.5px; font-weight: 600; text-decoration: none; line-height: 1.25;
}
.quick a:hover { border-color: var(--line-strong); text-decoration: none; }
.quick .i { font-size: 24px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
            background: var(--accent-soft); color: var(--accent-ink); }

.notice {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px;
    background: var(--info-soft); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 20%, transparent);
}
.notice .i { font-size: 24px; flex: none; }
.notice .notice-main { flex: 1; min-width: 0; }
.notice strong { display: block; color: var(--ink); }
.notice span { color: var(--ink-2); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 20%, transparent); }

.apt { display: flex; align-items: center; gap: 12px; padding: 16px; }
.apt-id { font-size: 12px; color: var(--ink-3); font-weight: 600; }

/* ---- 9. Bills: selectable cards + sticky pay bar ------------------------- */
.bill-row { display: flex; align-items: stretch; }
.bill-row .select { display: grid; place-items: center; padding-inline-start: 14px; }
.bill-row .select input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.bill-row .row { flex: 1; min-width: 0; }
.bill-note { font-size: 12.5px; color: var(--ink-3); padding: 0 16px 12px; margin-top: -6px; padding-inline-start: 70px; }
.bill-row:has(.select) + .bill-note { padding-inline-start: 106px; }
.paybar {
    position: fixed; inset-inline: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 19;
    padding: 10px 16px; pointer-events: none;
}
.paybar-in {
    pointer-events: auto; max-width: 640px; margin: 0 auto; background: var(--dark-2); color: var(--on-dark);
    border-radius: 18px; padding: 12px 12px 12px 18px; display: flex; align-items: center; gap: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
html[dir="rtl"] .paybar-in { padding: 12px 18px 12px 12px; }
.paybar-text { flex: 1; min-width: 0; }
.paybar-count { font-size: 13px; color: var(--on-dark-2); }
.paybar-total { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.paybar-warn { font-size: 13px; color: #FCD34D; }
@media (min-width: 900px) { .paybar { bottom: 16px; } }
.has-paybar main.page { padding-bottom: calc(var(--tabbar) + 120px); }

/* Bill details sheet (a <dialog>) */
dialog.sheet {
    border: 0; padding: 0; width: min(560px, 100%); max-height: 88vh; border-radius: 22px 22px 0 0;
    background: var(--surface); color: var(--ink); margin: auto auto 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }
@media (min-width: 640px) { dialog.sheet { border-radius: 22px; margin: auto; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 8px; }
.sheet-head h2 { flex: 1; }
.sheet-body { padding: 8px 18px 20px; display: grid; gap: 14px; overflow: auto; max-height: calc(88vh - 70px); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: end; font-weight: 550; }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lines td:last-child { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines tr:last-child td { border-bottom: 0; }
.lines .q { color: var(--ink-3); font-size: 12.5px; display: block; }

/* ---- 10. Checkout and bank choice ---------------------------------------- */
.bank-choice { display: grid; gap: 10px; }
.bank-option {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line);
    border-radius: 16px; background: var(--surface); cursor: pointer;
}
.bank-option:has(input:checked) { border-color: var(--accent); box-shadow: var(--focus); }
.bank-option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.bank-option input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.bank-logo { width: 46px; height: 46px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.total-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px; border-top: 1px solid var(--line); }
.total-line strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.secure-note { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-3); font-size: 13px; }
.secure-note .i { font-size: 18px; color: var(--ok); margin-top: 1px; }

/* ---- 11. Payment screen -------------------------------------------------- */
.pay-screen { max-width: 520px; margin: 0 auto; display: grid; gap: 16px; text-align: center; }
.pay-amount { font-size: 36px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pay-ways { display: flex; flex-direction: column; gap: 16px; }
.pay-way { padding: 18px; display: grid; gap: 12px; justify-items: center; }
.qr { width: 236px; height: 236px; border-radius: 16px; background: #fff; padding: 10px; border: 1px solid var(--line); image-rendering: pixelated; }
.code-box {
    display: flex; align-items: center; justify-content: center; gap: 10px; font: 700 22px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
    letter-spacing: 0.08em; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 14px;
    direction: ltr;
}
.status-line { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 550; justify-content: center; }
.status-line .i { font-size: 20px; color: var(--accent); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 650; }
.result-icon { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 0; font-size: 46px; }
.result-icon.ok { background: var(--ok-soft); color: var(--ok); }
.result-icon.bad { background: var(--bad-soft); color: var(--bad); }
.result-icon.wait { background: var(--accent-soft); color: var(--accent); }
.result-icon.muted { background: var(--surface-2); color: var(--ink-3); }
/* Phones: "Open the app" first; computers: the QR first */
.way-app { order: 1; }
.way-qr { order: 2; }
.way-code { order: 3; }
@media (min-width: 900px) {
    .way-qr { order: 1; }
    .way-app { order: 3; }
}

/* ---- 12. Maintenance ----------------------------------------------------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; text-align: center;
    border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer;
    font-size: 12.5px; font-weight: 600; line-height: 1.25;
}
.cat .i { font-size: 24px; color: var(--ink-2); }
.cat:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cat:has(input:checked) .i { color: var(--accent-ink); }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.req { padding: 16px; display: grid; gap: 10px; }
.req-head { display: flex; align-items: flex-start; gap: 12px; }
.req-text { color: var(--ink-2); font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.req-note { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.req-note b { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }
.req-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--ink-3); font-size: 13px; }
.req-foot .i { font-size: 15px; vertical-align: -2px; }

/* ---- 13. Account --------------------------------------------------------- */
.profile { display: flex; align-items: center; gap: 14px; padding: 18px; }
.avatar { width: 56px; height: 56px; border-radius: 18px; background: var(--dark-2); color: var(--on-dark);
          display: grid; place-items: center; font-weight: 700; font-size: 20px; flex: none; }
.setting { padding: 16px 18px; display: grid; gap: 12px; }
.setting + .setting { border-top: 1px solid var(--line); }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- 14. Sign-in --------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.auth-main { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; padding: 24px 16px 48px; }
@media (min-width: 640px) { .auth-main { align-content: center; } }
.auth-card { width: 100%; max-width: 420px; padding: 26px 22px; display: grid; gap: 18px; }
.auth-logo { width: 72px; height: 72px; border-radius: 20px; background: #fff; border: 1px solid var(--line);
             display: grid; place-items: center; margin: 0 auto; }
.auth-logo img { width: 56px; height: 56px; object-fit: contain; }
.auth-title { text-align: center; display: grid; gap: 6px; }
.auth-title p { color: var(--ink-3); }
.demo-box { width: 100%; max-width: 420px; margin-top: 16px; padding: 16px; border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); border-radius: 16px; display: grid; gap: 10px; }
.demo-box h2 { font-size: 14px; color: var(--warn); display: flex; gap: 8px; align-items: center; }
.demo-acc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border-radius: 11px; border: 1px solid var(--line); }
.demo-acc .row-main { font-size: 13.5px; }
.demo-acc .row-sub { white-space: normal; }

/* ---- 15. Empty, loading, toast ------------------------------------------- */
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 16px; color: var(--ink-3); }
.empty .i { font-size: 38px; color: var(--ink-3); }
.empty strong { color: var(--ink); font-size: 16px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%;
            animation: kk-shimmer 1.2s ease-in-out infinite; border-radius: 12px; }
@keyframes kk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-hero { height: 170px; border-radius: 22px; }
.sk-row { height: 70px; }
.toast {
    position: fixed; inset-inline: 16px; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); z-index: 50;
    max-width: 420px; margin: 0 auto; background: var(--ink); color: var(--bg); padding: 12px 16px;
    border-radius: 14px; font-weight: 550; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); text-align: center;
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
.page-error { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; text-align: center; }
.page-error .i { font-size: 40px; color: var(--bad); }

/* ---- 16. Receipt (screen + print) ---------------------------------------- */
.receipt { max-width: 720px; margin: 0 auto; padding: 26px; display: grid; gap: 20px; }
.receipt-head { display: flex; align-items: center; gap: 14px; }
.receipt-head img { width: 64px; height: 64px; object-fit: contain; }
.receipt-head .grow { flex: 1; }
.stamp { border: 3px solid var(--ok); color: var(--ok); border-radius: 12px; padding: 6px 14px; font-weight: 800; letter-spacing: .12em;
         transform: rotate(-6deg); font-size: 18px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.rtable th, .rtable td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.rtable th { color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.rtable td.amt, .rtable th.amt { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rtable tfoot td { font-weight: 750; font-size: 16px; border-bottom: 0; }
@media print {
    .topbar, .tabbar, .demo-ribbon, .no-print, .toast { display: none !important; }
    body { background: #fff; color: #000; }
    main.page { padding: 0; max-width: none; }
    .card { box-shadow: none; border: 0; }
    .receipt { padding: 0; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
