/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r-md);
  font-weight: 700; font-size: var(--fs-md); line-height: 1.1; white-space: nowrap;
  border: 1px solid transparent; transition: background var(--dur) var(--ease), transform 80ms var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur), border-color var(--dur);
  text-decoration: none; user-select: none; -webkit-user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: var(--fs-sm); border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 54px; padding: 0 22px; font-size: var(--fs-lg); border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 46px; }
.btn-sm.btn-icon { width: 38px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost-danger { background: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand) 20%); }
.btn-accent { background: var(--accent); color: #2B1600; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-debt { background: var(--debt-solid); color: #fff; box-shadow: var(--shadow-sm); }
.btn-debt:hover { background: color-mix(in srgb, var(--debt-solid) 88%, #000); }
.btn-payment { background: var(--payment); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn-payment:hover { background: var(--brand-hover); }
.btn-whatsapp { background: #25D366; color: #06301a; }
.btn-whatsapp:hover { background: #1fc15b; }
.btn .spinner { margin: 0; }
.is-loading .btn-label { opacity: .7; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  color: var(--text-2); transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 700; }
.link-btn:hover { text-decoration: underline; }
.link-row { text-align: start; width: 100%; }

/* ===== Inputs ===== */
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 16px; /* 16px stops iOS from zooming into the field */
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.input:disabled { opacity: .6; }
.input.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input.select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23768784' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: left 12px center; }
[dir='ltr'] .input.select { background-position: right 12px center; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 46px; }
/* The (eye) button sits on the left in Arabic/Kurdish even when the field itself is left-to-right (passwords). */
[dir='rtl'] .input-wrap .input { padding-left: 46px; padding-right: 14px; }
.input-affix { position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.input-affix:hover { color: var(--text); background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field-inline .input { width: auto; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.field-label .opt { font-weight: 500; color: var(--text-3); }
.field-hint { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; }
.field-error { font-size: var(--fs-xs); color: var(--danger); font-weight: 700; }
.field.has-error .input { border-color: var(--danger); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger-ink); font-size: var(--fs-sm); font-weight: 700; }
.code-input { font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .grid-2 { grid-template-columns: 1fr; } }
.phone-input { direction: ltr; text-align: left; letter-spacing: .02em; }
[dir='rtl'] .phone-input::placeholder { text-align: left; }

/* Search with clear button */
.search-wrap { position: relative; }
.search-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input { padding-inline-start: 44px; padding-inline-end: 44px; border-radius: 14px; background: var(--surface); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear { position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.search-clear:hover { background: var(--surface-2); color: var(--text); }

/* OTP code */
.otp-input { direction: ltr; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: .42em; padding-inline-start: .42em; min-height: 64px; font-variant-numeric: tabular-nums; border-radius: 16px; }
.otp-input::placeholder { letter-spacing: .42em; color: var(--border-strong); }

/* Switch */
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; background: var(--border-strong); transition: background var(--dur); flex: 0 0 auto; }
.switch.on { background: var(--brand); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch-knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.switch.on .switch-knob { transform: translateX(20px); }
[dir='rtl'] .switch.on .switch-knob { transform: translateX(-20px); }

/* Segmented */
.segmented { display: flex; padding: 4px; border-radius: 14px; background: var(--surface-3); gap: 4px; }
.seg { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 10px; border-radius: 10px; font-weight: 700; color: var(--text-2); transition: background var(--dur), color var(--dur), box-shadow var(--dur); white-space: nowrap; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
/* V5: the active choice reads in normal ink; only its icon carries the colour (red never means "error" in a form) */
.seg.active.tone-debt, .seg.active.tone-payment { color: var(--text); }
.seg.tone-debt .icon { color: var(--debt); }
.seg.tone-payment .icon { color: var(--payment); }
.segmented.sm .seg { min-height: 36px; font-size: var(--fs-sm); }

/* ===== Chips ===== */
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 700; border: 1px solid transparent; white-space: nowrap; transition: background var(--dur), color var(--dur), border-color var(--dur); }
.chip-sm { min-height: 22px; padding: 0 8px; font-size: 11px; }
.chip-neutral { background: var(--surface); color: var(--text-2); border-color: var(--border); }
@media (hover: hover) { button.chip-neutral:not(.active):hover { background: var(--surface-2); color: var(--text); } }
.chip-brand, .chip-ok, .chip-info { background: var(--brand-soft); color: var(--brand-strong); }
.chip-danger { background: var(--danger-soft); color: var(--danger-ink); }
.chip-warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.active.chip-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-spacer { flex: 1; }
.plan-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; width: max-content; line-height: 1.6; }
.plan-pill.pro { background: var(--accent-soft); color: var(--accent-ink); }
.plan-pill.free { background: var(--surface-3); color: var(--text-3); }
.plan-pill.pro-gold { background: linear-gradient(135deg, #F59E0B, #FBBF24); color: #3b1d05; }

/* ===== Cards & lists ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); }
.card.pad, section.card:not(.list):not(.empty-inline) { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: var(--fs-md); font-weight: 800; color: var(--text); }
.card-brand { background: var(--brand-softer); border-color: color-mix(in srgb, var(--brand) 22%, var(--border)); }
.card-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, var(--border)); }
.list { display: flex; flex-direction: column; }
.list.card { overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; min-height: 64px; text-align: start; color: var(--text); text-decoration: none; border: 0; background: transparent; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row.clickable { cursor: pointer; transition: background var(--dur); }
.list-row.clickable:hover { background: var(--surface-2); text-decoration: none; }
.list-row.clickable:active { background: var(--surface-3); }
.list-row.active { background: var(--brand-softer); }
.list-leading { flex: 0 0 auto; display: flex; }
.list-body { flex: 1 1 auto; min-width: 0; }
.list-title { font-weight: 700; }
.list-subtitle { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.list-trailing { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.list-meta { padding: 0 4px; }
.menu-list { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; width: 100%; min-height: 54px; text-align: start; font-weight: 700; color: var(--text); text-decoration: none; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .icon { color: var(--text-3); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item + .menu-item { border-top: 1px solid var(--border); }
.menu-item .grow { display: flex; flex-direction: column; }

/* Avatar — one calm style (initials on soft teal) */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; flex: 0 0 auto; object-fit: cover; letter-spacing: 0; overflow: hidden; }
.avatar.tone-debt { background: var(--debt-soft); color: var(--danger-ink); }
.avatar.tone-amber { background: var(--accent-soft); color: var(--accent-ink); }
.type-dot { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; }
.type-dot.debt { background: var(--debt-soft); color: var(--debt); }
.type-dot.payment { background: var(--payment-soft); color: var(--payment); }

/* ===== Notices & banners (teal or amber only) ===== */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.55; background: var(--brand-softer); color: var(--text); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }
.notice > .icon { color: var(--brand); margin-top: 1px; }
.notice-warn { background: var(--warn-soft); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice-warn > .icon { color: var(--accent-strong); }
.notice-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.notice-danger > .icon { color: var(--danger); }
.notice-info, .notice-brand { background: var(--brand-softer); color: var(--text); }
.notice .grow { display: flex; flex-direction: column; gap: 2px; }
.notice-title { font-weight: 800; }
.banners { position: relative; z-index: 16; } /* not sticky: it must never sit on top of the page's own top bar */
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: calc(8px + var(--safe-t)); font-size: var(--fs-sm); font-weight: 700; }
.banner + .banner { padding-top: 8px; }
.banner-warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner-info, .banner-brand { background: var(--brand-soft); color: var(--brand-strong); }
.banner span { flex: 1; }
.banner-action { font-weight: 800; text-decoration: underline; color: inherit; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--accent-strong); }

/* Info hint: (i) button that reveals a short explanation */
.info-hint-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: var(--brand); background: var(--brand-softer); flex: 0 0 auto; }
.info-hint-btn:hover { background: var(--brand-soft); }
.info-hint { margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--brand-softer); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; border: 1px dashed color-mix(in srgb, var(--brand) 30%, transparent); }

/* ===== Accordion (settings sections) ===== */
.accordion { display: flex; flex-direction: column; gap: 10px; }
.acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; min-height: 68px; text-align: start; }
.acc-head:hover { background: var(--surface-2); }
.acc-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-softer); color: var(--brand); flex: 0 0 auto; }
.acc-icon.tone-accent { background: var(--accent-soft); color: var(--accent-strong); }
.acc-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acc-title { font-weight: 800; font-size: var(--fs-md); }
.acc-desc { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.acc-summary { font-size: var(--fs-xs); color: var(--text-2); font-weight: 700; max-width: 40%; text-align: end; }
.acc-chevron { color: var(--text-3); transition: transform var(--dur) var(--ease); flex: 0 0 auto; }
.acc.open .acc-chevron { transform: rotate(180deg); }
.acc-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.acc.open .acc-head { background: transparent; }

/* ===== Radio list (plan / price pickers) ===== */
.radio-list { display: flex; flex-direction: column; gap: 10px; }
.radio-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--border-strong); background: var(--surface); text-align: start; transition: border-color var(--dur), box-shadow var(--dur), background var(--dur); }
.radio-item:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border-strong)); }
.radio-item.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); background: color-mix(in srgb, var(--brand-softer) 55%, var(--surface)); }
.radio-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex: 0 0 auto; position: relative; transition: border-color var(--dur); }
.radio-item.selected .radio-dot { border-color: var(--brand); }
.radio-item.selected .radio-dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand); }
.radio-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.radio-title { font-weight: 800; }
.radio-sub { font-size: var(--fs-xs); color: var(--text-3); }
.radio-end { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; }
.radio-badge { position: absolute; top: -10px; inset-inline-end: 14px; padding: 1px 10px; border-radius: 999px; background: var(--accent); color: #2B1600; font-size: 11px; font-weight: 800; }

/* Copy box (account numbers) */
.copy-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.copy-box .grow { display: flex; flex-direction: column; gap: 2px; }
.copy-value { font-size: var(--fs-lg); font-weight: 800; letter-spacing: .02em; }

/* ===== Empty ===== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; }
.empty-icon { width: 72px; height: 72px; border-radius: 24px; display: flex; align-items: center; justify-content: center; background: var(--brand-softer); color: var(--brand); margin-bottom: 6px; }
.empty-title { font-size: var(--fs-lg); }
.empty-body { max-width: 360px; }
.empty-action { margin-top: 8px; }
.empty-inline { padding: 20px; text-align: center; }

/* ===== Topbar ===== */
.topbar { display: flex; align-items: center; gap: 6px; min-height: var(--topbar-h); padding: 6px 10px 6px 12px; padding-top: calc(6px + var(--safe-t)); position: sticky; top: 0; z-index: 15; background: var(--bg); }
.topbar.scrolled { box-shadow: 0 1px 0 var(--border); }
.topbar-titles { flex: 1; min-width: 0; padding: 0 4px; }
.topbar-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.topbar-subtitle { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.35; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.section-title h2 { font-size: var(--fs-lg); font-weight: 800; color: var(--text); }

/* ===== Sheet / dialog ===== */
.sheet-overlay { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; animation: fade var(--dur) var(--ease); }
.sheet { width: 100%; max-height: min(92vh, calc(100% - 24px)); max-height: min(92dvh, calc(100% - 24px)); background: var(--bg-elevated); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide-up 220ms var(--ease); padding-bottom: var(--safe-b); overscroll-behavior: contain; }
.sheet-overlay.kb-open .sheet { padding-bottom: 0; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 10px auto 0; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px 16px; flex: 0 0 auto; }
.sheet-title { flex: 1; font-size: var(--fs-lg); font-weight: 800; min-width: 0; }
.sheet-subtitle { font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
.sheet-body { padding: 6px 16px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.sheet-body.no-pad { padding: 0 0 8px; }
.sheet-foot { padding: 12px 16px; border-top: 1px solid var(--border); flex: 0 0 auto; background: var(--bg-elevated); }
@media (min-width: 721px) {
  .sheet-overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; max-width: 520px; max-height: 88vh; animation: pop 200ms var(--ease); padding-bottom: 0; }
  .sheet-sm { max-width: 440px; }
  .sheet-lg { max-width: 720px; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
}
/* Swapping the content of a sheet (quick add steps) must not replay the opening animation. */
.sheet-overlay.sheet-swap, .sheet-overlay.sheet-swap .sheet { animation: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(48px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toasts ===== */
.toasts { position: fixed; inset-inline: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
/* While a sheet is open, toasts move to the TOP of the screen (over the dimmed page), so they never cover the
   sheet's fields or its Save button. */
body.sheet-open .toasts { top: calc(var(--safe-t) + 12px); bottom: auto; }
body.sheet-open .toast { animation-name: slide-down-in; }
@keyframes slide-down-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; width: 100%; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 700; font-size: var(--fs-sm); animation: slide-up 200ms var(--ease); }
.toast-success { background: var(--brand-strong); color: #fff; }
:root[data-theme='dark'] .toast-success { background: #0F766E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .toast-success { background: #0F766E; } }
.toast-error { background: var(--danger); color: #fff; }
.toast-msg { flex: 1; }
.toast-action { font-weight: 800; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .18); color: inherit; }
@media (min-width: 721px) { .toasts { bottom: 24px; } }

/* ===== Spinner ===== */
.spinner { display: inline-block; width: 22px; height: 22px; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* ===== Tables ===== */
.items-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.items-table th, .items-table td { padding: 8px 6px; text-align: start; border-bottom: 1px solid var(--border); }
.items-table th { color: var(--text-3); font-weight: 700; font-size: var(--fs-xs); }
.items-table .num, .items-table .money, .items-table th.num { text-align: end; }
.pre { white-space: pre-wrap; font: inherit; background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-md); margin-top: 8px; font-size: var(--fs-sm); }
.steps { padding-inline-start: 20px; list-style: decimal; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.rotate-180 { transform: rotate(180deg); }
[dir='rtl'] .rotate-180 { transform: rotate(180deg) scaleX(-1); }
.photo-thumb img, .photo-preview { max-height: 160px; border-radius: 12px; border: 1px solid var(--border); }
.photo-preview { width: 96px; height: 96px; object-fit: cover; }
.qr { color: #0E1E1B; background: #fff; border-radius: 12px; padding: 8px; }
.qr svg { width: 100%; height: auto; }

/* DateInput: our own Latin-digit label with the phone's date picker invisibly on top (see ui.js) */
.date-pick { position: relative; cursor: pointer; }
.date-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.input.date-input { display: flex; align-items: center; gap: 10px; }
.date-input .date-pick-icon { color: var(--brand); flex: 0 0 auto; }
.date-pick-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.date-pick .date-pick-text { flex: 0 1 auto; }
.date-native {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer; font-size: 16px; background: transparent; color: transparent; min-height: 0;
}
.date-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }

/* ===== Amount input + calculator (V5, customer agent) =====
   Always neutral: ink number, neutral border, teal focus. `tone-*` classes from callers never colour the field.
   The number is right-aligned (Latin digits, LTR) in every language; the 🧮 button sits at the left edge, the currency
   at the right in English and next to the 🧮 in Arabic/Kurdish (where amounts read «د.ع 25,000»). */
.amount-input { position: relative; display: flex; flex-direction: column; gap: 6px; }
.amount-box { position: relative; }
.amount-field {
  font-size: 22px; font-weight: 800; min-height: 52px; direction: ltr; text-align: right;
  padding-right: 60px; padding-left: 16px; color: var(--text); caret-color: var(--brand);
  font-variant-numeric: tabular-nums; letter-spacing: -0.005em;
}
.amount-input.tone-debt .amount-field, .amount-input.tone-payment .amount-field, .amount-input .amount-field:focus { color: var(--text); }
.amount-field::placeholder { color: var(--border-strong); font-weight: 700; }
.amount-input .amount-field:focus, .amount-input.pad-open .amount-field { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-glow); }
.amount-input.large .amount-field { font-size: clamp(30px, 8.6vw, 40px); min-height: 72px; border-radius: 18px; letter-spacing: -0.015em; }
.amount-input.has-calc .amount-field { padding-left: 54px; }
.amount-input.large.has-calc .amount-field { padding-left: 62px; }
.amount-symbol { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--text-3); font-size: var(--fs-md); pointer-events: none; }
[dir='rtl'] .amount-input .amount-field { padding-right: 16px; padding-left: 64px; }
[dir='rtl'] .amount-input.has-calc .amount-field { padding-left: 94px; }
[dir='rtl'] .amount-input.large.has-calc .amount-field { padding-left: 106px; padding-right: 18px; }
[dir='rtl'] .amount-symbol { right: auto; left: 18px; }
[dir='rtl'] .amount-input.has-calc .amount-symbol { left: 52px; }
[dir='rtl'] .amount-input.large.has-calc .amount-symbol { left: 62px; }
.amount-calc {
  position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px;
  color: var(--text-2); background: var(--surface-2); transition: background var(--dur), color var(--dur), transform 80ms var(--ease);
}
.amount-input.large .amount-calc { left: 9px; width: 46px; height: 46px; border-radius: 13px; }
.amount-calc:hover { background: var(--surface-3); color: var(--text); }
.amount-calc:active { transform: translateY(-50%) scale(.94); }
.amount-calc.on { background: var(--brand-soft); color: var(--brand-strong); }
.amount-calc:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.amount-preview { direction: ltr; text-align: right; padding: 0 8px; font-size: var(--fs-md); font-weight: 800; color: var(--brand-strong); font-variant-numeric: tabular-nums; }
.calc-pad {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px;
  border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border);
  animation: calc-in 180ms var(--ease);
}
.ck {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform 80ms var(--ease), background var(--dur);
}
.ck:hover { background: var(--bg-elevated); }
.ck:active { transform: scale(.95); background: var(--surface-3); }
.ck-op { background: var(--brand-softer); color: var(--brand-strong); border-color: transparent; font-size: 25px; }
.ck-fn { background: transparent; color: var(--text-2); }
.ck-eq { grid-row: span 2; background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; font-size: 28px; }
.ck:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@keyframes calc-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .calc-pad { animation: none; } .ck:active { transform: none; } .amount-calc:active { transform: translateY(-50%); } }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-amounts .chip { flex: 0 0 auto; }
.amount-preview.is-memo { color: var(--text-3); font-weight: 700; }
