/* Raya UI kit. Persian RTL, light only. Component contract: docs/UI_KIT.md.
   Sections: 1 fonts+tokens · 2 base/typography · 3 accessibility · 4 layout+header/nav ·
   5 buttons · 6 forms · 7 feedback · 8 badges · 9 page components · 10 tables ·
   11 stepper · 12 pagination/filters/export · 13 login · 14 legacy aliases · 15 mobile · 16 print */

/* ------------------------------------------------------------------ 1. fonts + tokens */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.cdc140628f11.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.7958481fe611.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* brand */
  --raya-primary: #0b3d91;          /* 10:1 on white */
  --raya-primary-hover: #082f70;
  --raya-primary-active: #062660;
  --raya-primary-50: #eaf0fb;       /* light tint; text --raya-primary on it is 8.8:1 */
  --raya-primary-100: #dbe6f8;
  --raya-primary-200: #b9cdf0;
  /* neutrals */
  --raya-ink: #111827;              /* main text */
  --raya-ink-2: #374151;            /* strong secondary text, 10:1 */
  --raya-muted: #4b5563;            /* captions, 7.5:1 on white */
  --raya-bg: #f5f7fb;
  --raya-surface: #ffffff;
  --raya-surface-2: #eef1f7;
  --raya-border: #d3d9e4;
  --raya-border-strong: #6b7280;    /* form controls, 4.8:1 */
  /* semantic tones: text-on-tint pair + border, all >= 7:1 for text */
  --raya-success: #0a5c2a;  --raya-success-bg: #e6f4ea;  --raya-success-border: #8ec7a0;
  --raya-warning: #6f4300;  --raya-warning-bg: #fff3d6;  --raya-warning-border: #e0b45c;
  --raya-danger:  #a3001b;  --raya-danger-bg:  #fdebee;  --raya-danger-border:  #e59aa8;
  --raya-info:    #0a4778;  --raya-info-bg:    #e4f0fa;  --raya-info-border:    #8dbbe0;
  --raya-neutral: #374151;  --raya-neutral-bg: #eceff4;  --raya-neutral-border: #b6bdca;
  --raya-focus: #0b3d91;
  /* shape + spacing + elevation (one shadow only) */
  --raya-radius-sm: .5rem;
  --raya-radius: .75rem;
  --raya-radius-lg: 1rem;
  --raya-space-1: .25rem; --raya-space-2: .5rem; --raya-space-3: .75rem; --raya-space-4: 1rem;
  --raya-space-5: 1.5rem; --raya-space-6: 2rem;  --raya-space-7: 3rem;
  --raya-shadow-sm: 0 1px 2px rgba(17, 24, 39, .08);
  --raya-touch: 44px;
  /* legacy names still used by older templates */
  --raya-blue: var(--raya-primary);
  --raya-text: var(--raya-ink);
  --raya-ok: var(--raya-success);

  /* Bootstrap bridge so stock utilities (.text-primary, .border-primary, links...) match */
  --bs-primary: #0b3d91; --bs-primary-rgb: 11, 61, 145;
  --bs-link-color: #0b3d91; --bs-link-color-rgb: 11, 61, 145;
  --bs-link-hover-color: #082f70; --bs-link-hover-color-rgb: 8, 47, 112;
  --bs-body-font-family: "Vazirmatn", Tahoma, sans-serif;
  --bs-body-color: #111827; --bs-body-color-rgb: 17, 24, 39;
  --bs-body-bg: #f5f7fb; --bs-body-bg-rgb: 245, 247, 251;
  --bs-border-color: #d3d9e4;
  --bs-danger: #a3001b; --bs-danger-rgb: 163, 0, 27;
  --bs-success: #0a5c2a; --bs-success-rgb: 10, 92, 42;
  --bs-secondary-color: #4b5563;
  --bs-border-radius: .6rem;
  --bs-form-invalid-border-color: #a3001b;
  --bs-form-invalid-color: #a3001b;
}

/* ------------------------------------------------------------------ 2. base + typography */
html { font-size: 112.5%; } /* 18px by default, but follows the user's own text-size setting */
body {
  font-family: "Vazirmatn", Tahoma, sans-serif; background: var(--raya-bg); color: var(--raya-ink);
  line-height: 1.8; min-height: 100vh; display: flex; flex-direction: column;
  text-rendering: optimizeLegibility;
}
a { color: var(--raya-primary); text-underline-offset: .2em; }
a:hover { color: var(--raya-primary-hover); }
h1, h2, h3, h4, h5, h6 { line-height: 1.4; color: var(--raya-ink); font-weight: 700; }
/* type ladder: page title > section title > body > caption */
.page-title { font-weight: 700; font-size: 1.65rem; line-height: 1.4; margin: 1rem 0; }
.section-title { font-weight: 700; font-size: 1.2rem; line-height: 1.5; margin: 0 0 var(--raya-space-3); }
.caption { font-size: .9rem; color: var(--raya-muted); }
.lead { font-size: 1.1rem; font-weight: 400; color: var(--raya-ink-2); }
.h4, h2.h4 { font-size: 1.2rem; font-weight: 700; }
.text-muted, .text-secondary { color: var(--raya-muted) !important; }
.text-muted-strong { color: var(--raya-ink-2) !important; }
.prose { max-width: 68ch; }
.raya-main > p, .section-card > p, .page-header__lead { max-width: 68ch; }
.money { direction: rtl; white-space: nowrap; font-weight: 700; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: embed; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.container { max-width: 1200px; }

/* ------------------------------------------------------------------ 3. accessibility */
:focus-visible { outline: 3px solid var(--raya-focus); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus, .navbar-toggler:focus,
.nav-link:focus-visible, .dropdown-item:focus-visible, .btn-check:focus-visible + .btn {
  outline: 3px solid var(--raya-focus); outline-offset: 2px; box-shadow: none;
}
.skip-link { position: absolute; inset-inline-start: .5rem; top: -6rem; z-index: 3000; background: #fff; color: var(--raya-primary); font-weight: 700; padding: .75rem 1rem; border: 2px solid var(--raya-primary); border-radius: var(--raya-radius-sm); text-decoration: none; }
.skip-link:focus { top: .5rem; }
#main:focus { outline: none; }
[data-error-summary]:focus { outline: 3px solid var(--raya-focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ 4. layout, header, navigation */
.raya-main { flex: 1 0 auto; padding-top: var(--raya-space-4); padding-bottom: var(--raya-space-6); }
.raya-footer { margin-top: auto; padding: var(--raya-space-4) 0; border-top: 1px solid var(--raya-border); color: var(--raya-muted); font-size: .95rem; background: var(--raya-surface); }
.raya-footer__note { margin: 0; }

.raya-logo { display: inline-flex; align-items: center; gap: .55rem; color: var(--raya-primary); font-weight: 700; line-height: 1; }
.raya-logo__mark { width: 2rem; height: 2rem; flex: none; }
.raya-logo__mark rect:first-child { fill: var(--raya-primary); }
.raya-logo__word { font-size: 1.5rem; }
.raya-logo--lg .raya-logo__mark { width: 3.25rem; height: 3.25rem; }
.raya-logo--lg .raya-logo__word { font-size: 2.25rem; }

.raya-header { background: var(--raya-surface); border-bottom: 1px solid var(--raya-border); box-shadow: var(--raya-shadow-sm); }
.raya-navbar { padding: .4rem 0; }
.raya-navbar .navbar-brand { display: inline-flex; align-items: center; min-height: var(--raya-touch); margin-inline-end: 1.5rem; padding: 0; text-decoration: none; }
.raya-menu-btn { display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; padding: .4rem 1rem; border: 2px solid var(--raya-primary); border-radius: .6rem; background: #fff; color: var(--raya-primary); font-weight: 700; font-size: 1rem; }
.raya-menu-btn[aria-expanded="true"] { background: var(--raya-primary-50); }
.raya-menu-btn__icon {
  width: 1.25rem; height: 1rem; display: inline-block;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 3px no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 3px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 100% 3px no-repeat;
}
.raya-navbar .nav-link { white-space: nowrap; color: var(--raya-ink-2); font-weight: 700; font-size: 1rem; min-height: var(--raya-touch); display: inline-flex; align-items: center; padding: .5rem .9rem; border-radius: var(--raya-radius-sm); }
.raya-navbar .nav-link:hover { background: var(--raya-primary-50); color: var(--raya-primary); }
.raya-navbar .nav-link.active, .raya-navbar .nav-link[aria-current] { color: var(--raya-primary); background: var(--raya-primary-50); box-shadow: inset 0 -3px 0 var(--raya-primary); }
.raya-navbar .dropdown-toggle::after { margin-inline-start: .5rem; margin-inline-end: 0; }
.raya-nav-desktop { gap: .15rem; flex-wrap: wrap; } /* wraps instead of overflowing when the user's text size is very large */
.raya-navbar .navbar-collapse { flex-wrap: wrap; row-gap: var(--raya-space-2); }
.raya-navbar .dropdown-menu {
  --bs-dropdown-link-active-bg: var(--raya-primary-50); --bs-dropdown-link-active-color: var(--raya-primary);
  --bs-dropdown-link-hover-bg: var(--raya-primary-50); --bs-dropdown-link-hover-color: var(--raya-primary);
  --bs-dropdown-border-color: var(--raya-border); --bs-dropdown-border-radius: var(--raya-radius);
  min-width: 13rem; padding: .35rem; border: 1px solid var(--raya-border); box-shadow: var(--raya-shadow-sm); text-align: start;
}
.dropdown-item { min-height: var(--raya-touch); display: flex; align-items: center; border-radius: .4rem; font-weight: 700; color: var(--raya-ink); white-space: normal; }
.dropdown-item.active, .dropdown-item[aria-current] { color: var(--raya-primary); background: var(--raya-primary-50); }
.raya-user { display: flex; align-items: center; gap: .5rem; }
.raya-user__name { font-weight: 700; color: var(--raya-ink); margin-inline-end: .25rem; }
.raya-user form { margin: 0; }

.raya-nav-mobile { padding: var(--raya-space-2) 0 0; }
.raya-nav-section { margin: 0 0 var(--raya-space-2); padding: 0; }
.raya-nav-section__title { font-size: 1rem; line-height: 1.5; font-weight: 700; color: var(--raya-muted); margin: var(--raya-space-3) 0 var(--raya-space-1); padding-inline: .25rem; border-bottom: 1px solid var(--raya-border); }
.raya-nav-list { list-style: none; margin: 0; padding: 0; }
.raya-nav-link { display: flex; align-items: center; min-height: 48px; padding: .5rem .9rem; border-radius: .6rem; border-inline-start: 4px solid transparent; color: var(--raya-ink); font-weight: 700; text-decoration: none; }
.raya-nav-link:hover { background: var(--raya-primary-50); color: var(--raya-primary); }
.raya-nav-link.active, .raya-nav-link[aria-current] { background: var(--raya-primary-50); color: var(--raya-primary); border-inline-start-color: var(--raya-primary); }
@media (max-width: 1199.98px) {
  .raya-navbar > .container { flex-wrap: wrap; }
  .raya-user { flex-wrap: wrap; margin-top: var(--raya-space-3); padding: var(--raya-space-3) 0 var(--raya-space-2); border-top: 1px solid var(--raya-border); }
  .raya-user__name { flex: 1 0 100%; }
  .raya-user .btn { flex: 1 1 auto; }
  .raya-user form { flex: 1 1 auto; display: flex; }
  .raya-user form .btn { width: 100%; }
}

/* ------------------------------------------------------------------ 5. buttons */
.btn {
  --bs-btn-border-width: 2px; --bs-btn-border-radius: .6rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .55rem 1.3rem; font-weight: 700; font-size: 1rem; line-height: 1.4;
}
.btn-lg { min-height: 56px; font-size: 1.15rem; padding: .7rem 1.8rem; }
.btn-sm { min-height: var(--raya-touch); padding: .35rem 1rem; font-size: .95rem; }
/* one dominant primary per screen */
.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: var(--raya-primary); --bs-btn-border-color: var(--raya-primary); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--raya-primary-hover); --bs-btn-hover-border-color: var(--raya-primary-hover); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--raya-primary-active); --bs-btn-active-border-color: var(--raya-primary-active); --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--raya-primary); --bs-btn-disabled-border-color: var(--raya-primary); --bs-btn-focus-shadow-rgb: 11, 61, 145; }
/* secondary = outlined; outline-primary kept as an alias */
.btn-secondary, .btn-outline-primary { --bs-btn-color: var(--raya-primary); --bs-btn-bg: #fff; --bs-btn-border-color: var(--raya-primary); --bs-btn-hover-color: var(--raya-primary-hover); --bs-btn-hover-bg: var(--raya-primary-50); --bs-btn-hover-border-color: var(--raya-primary-hover); --bs-btn-active-color: var(--raya-primary-active); --bs-btn-active-bg: var(--raya-primary-100); --bs-btn-active-border-color: var(--raya-primary-active); --bs-btn-disabled-color: var(--raya-primary); --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: var(--raya-primary); }
.btn-outline-secondary, .btn-light { --bs-btn-color: var(--raya-ink-2); --bs-btn-bg: #fff; --bs-btn-border-color: var(--raya-border-strong); --bs-btn-hover-color: var(--raya-ink); --bs-btn-hover-bg: var(--raya-surface-2); --bs-btn-hover-border-color: var(--raya-ink-2); --bs-btn-active-color: var(--raya-ink); --bs-btn-active-bg: var(--raya-neutral-bg); --bs-btn-active-border-color: var(--raya-ink-2); }
.btn-ghost { --bs-btn-color: var(--raya-primary); --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-hover-color: var(--raya-primary-hover); --bs-btn-hover-bg: var(--raya-primary-50); --bs-btn-hover-border-color: transparent; --bs-btn-active-color: var(--raya-primary-active); --bs-btn-active-bg: var(--raya-primary-100); --bs-btn-active-border-color: transparent; --bs-btn-disabled-color: var(--raya-muted); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: transparent; }
.btn-danger { --bs-btn-color: #fff; --bs-btn-bg: var(--raya-danger); --bs-btn-border-color: var(--raya-danger); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #82001a; --bs-btn-hover-border-color: #82001a; --bs-btn-active-color: #fff; --bs-btn-active-bg: #6b0015; --bs-btn-active-border-color: #6b0015; }
.btn-danger-outline { --bs-btn-color: var(--raya-danger); --bs-btn-bg: #fff; --bs-btn-border-color: var(--raya-danger); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--raya-danger); --bs-btn-hover-border-color: var(--raya-danger); --bs-btn-active-color: #fff; --bs-btn-active-bg: #82001a; --bs-btn-active-border-color: #82001a; border: 2px solid var(--raya-danger); color: var(--raya-danger); background: #fff; }
.btn-danger-outline:hover { background: var(--raya-danger); color: #fff; }
.btn[aria-busy="true"] { cursor: progress; }
.btn.disabled, .btn:disabled { opacity: .6; }
.password-toggle { display: inline-flex; align-items: center; min-height: var(--raya-touch); padding: .25rem .25rem; margin-top: .1rem; background: none; border: 0; color: var(--raya-primary); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }

/* ------------------------------------------------------------------ 6. forms */
.form-label { font-weight: 700; margin-bottom: .25rem; color: var(--raya-ink); }
.form-control, .form-select { min-height: 50px; font-size: 1.05rem; border: 2px solid var(--raya-border-strong); border-radius: .6rem; color: var(--raya-ink); background-color: #fff; }
.form-control::placeholder { color: #6b7280; opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--raya-primary); }
.form-control:disabled, .form-select:disabled { background: var(--raya-surface-2); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--raya-danger); }
.form-control.is-invalid { background-image: none; padding-left: .75rem; }
.form-select.is-invalid:not([multiple]):not([size]) { --bs-form-select-bg-icon: none; padding-left: 2.25rem; background-position: left .75rem center; background-size: 16px 12px; }
.form-text { color: var(--raya-muted); font-size: .92rem; margin-top: .25rem; }
.form-check { display: flex; align-items: center; gap: .6rem; min-height: var(--raya-touch); padding: 0; margin-bottom: .25rem; }
.form-check .form-check-input { float: none; margin: 0; flex: none; }
.form-check-input { width: 1.5rem; height: 1.5rem; border: 2px solid var(--raya-border-strong); }
.form-check-input:checked { background-color: var(--raya-primary); border-color: var(--raya-primary); }
/* the whole row (>= 44px tall) is the tap target, not just the small box */
.form-check-label { flex: 1 1 auto; min-height: var(--raya-touch); padding-block: .35rem; cursor: pointer; }
.field { margin-bottom: 1.1rem; }
.field__required { color: var(--raya-danger); font-weight: 700; margin-inline-start: .2rem; }
.field-error { color: var(--raya-danger); font-weight: 700; margin-top: .3rem; display: flex; gap: .4rem; align-items: baseline; }
.field-error::before { content: "✕"; flex: none; font-size: .85em; }
.field--fieldset { border: 0; padding: 0; min-width: 0; }
.field--fieldset > legend { float: none; width: auto; font-size: 1rem; font-weight: 700; margin-bottom: .35rem; padding: 0; }
.field--fieldset .form-check-input + label, .field--fieldset label { font-weight: 400; }
.ymd-date { display: flex; flex-direction: row; gap: .5rem; max-width: 22rem; }
.ymd-date__part { flex: 1 1 0; min-width: 0; }
.ymd-date__part:first-child { flex: 1.5 1 0; }
.ymd-date__label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .2rem; }
.ymd-date__input { text-align: center; direction: ltr; font-variant-numeric: tabular-nums; }
.field--invalid .ymd-date__input { border-color: var(--raya-danger, #b42318); }
.form-narrow { max-width: 40rem; }
.choice-card { display: block; border: 2px solid var(--raya-border-strong); border-radius: var(--raya-radius); padding: 1rem; cursor: pointer; background: #fff; }
.choice-card:hover, .choice-card:focus-within { border-color: var(--raya-primary); }
.choice-card:has(input:checked) { border-color: var(--raya-primary); background: var(--raya-primary-50); }
.list-group-item-action { min-height: var(--raya-touch); }
.list-group-item-action:hover, .list-group-item-action:focus { background: var(--raya-primary-50); color: var(--raya-primary); }

/* ------------------------------------------------------------------ 7. feedback (messages, form errors) */
.notice { --tone: var(--raya-info); display: flex; align-items: flex-start; gap: .75rem; padding: .85rem 1rem; margin: 0 0 var(--raya-space-4); border: 2px solid var(--raya-info-border); border-radius: var(--raya-radius); background: var(--raya-info-bg); color: var(--raya-ink); font-weight: 700; }
.notice__icon { flex: none; display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--tone); color: #fff; font-size: .95rem; line-height: 1; margin-top: .1rem; }
.notice__body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.notice__body > :last-child { margin-bottom: 0; }
.notice__list { margin: .35rem 0 0; padding-inline-start: 1.25rem; font-weight: 400; }
.notice-success { --tone: var(--raya-success); background: var(--raya-success-bg); border-color: var(--raya-success-border); }
.notice-warning { --tone: var(--raya-warning); background: var(--raya-warning-bg); border-color: var(--raya-warning-border); }
.notice-danger  { --tone: var(--raya-danger);  background: var(--raya-danger-bg);  border-color: var(--raya-danger-border); }
.notice-info    { --tone: var(--raya-info);    background: var(--raya-info-bg);    border-color: var(--raya-info-border); }
.raya-messages { margin-top: var(--raya-space-2); }
/* Bootstrap .alert kept for older pages, retinted and given an icon char */
.alert { font-size: 1.02rem; font-weight: 700; border-width: 2px; border-radius: var(--raya-radius); color: var(--raya-ink); }
.alert::before { font-weight: 700; margin-inline-end: .4rem; }
.alert-success { background: var(--raya-success-bg); border-color: var(--raya-success-border); } .alert-success::before { content: "✓"; color: var(--raya-success); }
.alert-warning { background: var(--raya-warning-bg); border-color: var(--raya-warning-border); } .alert-warning::before { content: "!"; color: var(--raya-warning); }
.alert-danger  { background: var(--raya-danger-bg);  border-color: var(--raya-danger-border); }  .alert-danger::before  { content: "✕"; color: var(--raya-danger); }
.alert-info    { background: var(--raya-info-bg);    border-color: var(--raya-info-border); }    .alert-info::before    { content: "i"; color: var(--raya-info); }

/* ------------------------------------------------------------------ 8. badges */
.status-badge, .badge-status {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; font-size: .92rem; font-weight: 700; line-height: 1.5;
  padding: .2rem .75rem; border-radius: 999px; border: 1.5px solid var(--raya-neutral-border); background: var(--raya-neutral-bg); color: var(--raya-neutral);
}
.status-badge__icon { font-size: .85em; line-height: 1; }
.status-badge--success, .badge-status.ok { background: var(--raya-success-bg); color: var(--raya-success); border-color: var(--raya-success-border); }
.status-badge--warning { background: var(--raya-warning-bg); color: var(--raya-warning); border-color: var(--raya-warning-border); }
.status-badge--danger, .badge-status.bad { background: var(--raya-danger-bg); color: var(--raya-danger); border-color: var(--raya-danger-border); }
.status-badge--info { background: var(--raya-info-bg); color: var(--raya-info); border-color: var(--raya-info-border); }
.status-badge--neutral { background: var(--raya-neutral-bg); color: var(--raya-neutral); border-color: var(--raya-neutral-border); }

/* ------------------------------------------------------------------ 9. page components */
.card { border: 1px solid var(--raya-border); border-radius: var(--raya-radius-lg); box-shadow: var(--raya-shadow-sm); }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--raya-space-3) var(--raya-space-4); margin: var(--raya-space-4) 0 var(--raya-space-5); }
.page-header__text { flex: 1 1 18rem; min-width: 0; }
.page-header__back { display: inline-flex; align-items: center; min-height: var(--raya-touch); font-weight: 700; text-decoration: none; }
.page-header .page-title, .page-header__title { margin: 0; font-size: 1.65rem; font-weight: 700; line-height: 1.4; }
.page-header__lead { margin: .25rem 0 0; color: var(--raya-ink-2); font-size: 1.05rem; }
.page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }

/* amount ladder: xl > lg > md > sm. Unit is small; digits are tabular. */
.amount-xl, .amount-lg, .amount-md, .amount-sm { direction: rtl; unicode-bidi: isolate; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--raya-ink); overflow-wrap: anywhere; }
.amount-xl { font-size: clamp(2rem, 9vw, 2.9rem); line-height: 1.25; }
.amount-lg { font-size: clamp(1.6rem, 7vw, 2.1rem); line-height: 1.3; }
.amount-md { font-size: 1.4rem; line-height: 1.4; }
.amount-sm { font-size: 1.05rem; line-height: 1.5; }
.amount-unit { font-size: .5em; font-weight: 400; color: var(--raya-ink-2); margin-inline-start: .3em; white-space: nowrap; }
.amount-sm .amount-unit, .amount-md .amount-unit { font-size: .75em; }

/* dominant card: one per screen */
.card-primary, .amount-hero { background: var(--raya-surface); border: 2px solid var(--raya-primary); border-radius: var(--raya-radius-lg); padding: var(--raya-space-5); box-shadow: var(--raya-shadow-sm); margin-bottom: var(--raya-space-5); }
.amount-hero__label { font-size: 1.1rem; font-weight: 700; color: var(--raya-ink-2); margin: 0; }
.amount-hero__value { margin: .15rem 0 .5rem; }
.amount-hero__note { color: var(--raya-ink-2); margin: 0; font-size: .95rem; }
.amount-hero__cta { margin-top: var(--raya-space-4); display: flex; flex-wrap: wrap; gap: .6rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: .9rem; margin-bottom: var(--raya-space-5); }
.kpi { display: block; background: var(--raya-surface); border: 1px solid var(--raya-border); border-radius: var(--raya-radius); padding: var(--raya-space-4); color: var(--raya-ink); text-decoration: none; box-shadow: var(--raya-shadow-sm); }
a.kpi:hover { border-color: var(--raya-primary); background: var(--raya-primary-50); color: var(--raya-ink); }
.kpi__label { display: block; font-size: .95rem; font-weight: 700; color: var(--raya-ink-2); line-height: 1.6; }
.kpi__value { display: block; margin-top: .2rem; font-size: 1.4rem; font-weight: 700; line-height: 1.4; direction: rtl; unicode-bidi: isolate; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__hint { display: block; font-size: .85rem; color: var(--raya-muted); }
.kpi .amount-unit { font-size: .7em; }

.action-list { list-style: none; margin: 0 0 var(--raya-space-5); padding: 0; display: grid; gap: .6rem; }
.action-list > li { min-width: 0; }
.action-list a { display: flex; align-items: center; gap: .9rem; min-height: 60px; padding: .7rem 1rem; background: var(--raya-surface); border: 1px solid var(--raya-border); border-radius: var(--raya-radius); color: var(--raya-ink); text-decoration: none; font-weight: 700; box-shadow: var(--raya-shadow-sm); }
.action-list a:hover { border-color: var(--raya-primary); background: var(--raya-primary-50); }
.action-list a::after { content: ""; flex: none; width: .6rem; height: .6rem; margin-inline-start: .25rem; border-left: 2.5px solid var(--raya-primary); border-bottom: 2.5px solid var(--raya-primary); transform: rotate(45deg); }
.action-list__text { flex: 1 1 auto; min-width: 0; }
.action-list__count { flex: none; min-width: 2.4rem; height: 2.4rem; padding: 0 .65rem; display: inline-grid; place-items: center; border-radius: 999px; background: var(--raya-primary); color: #fff; font-weight: 700; }
.action-list__count--zero { background: var(--raya-surface-2); color: var(--raya-ink-2); }

.section-card { background: var(--raya-surface); border: 1px solid var(--raya-border); border-radius: var(--raya-radius-lg); padding: var(--raya-space-5); margin-bottom: var(--raya-space-5); box-shadow: var(--raya-shadow-sm); }
.section-card__title { font-size: 1.2rem; font-weight: 700; margin: 0 0 var(--raya-space-4); }
.section-card__lead { color: var(--raya-ink-2); margin: -.5rem 0 var(--raya-space-4); }
.fieldset-section { border: 0; padding: 0; margin: 0 0 var(--raya-space-5); min-width: 0; }
.fieldset-section > legend { float: none; width: 100%; font-size: 1.15rem; font-weight: 700; padding: 0 0 .5rem; margin-bottom: var(--raya-space-4); border-bottom: 2px solid var(--raya-primary-100); }
.result-count { color: var(--raya-ink-2); font-size: .95rem; margin: .5rem 0; }
.result-count strong { color: var(--raya-ink); }
.empty-state { text-align: center; padding: var(--raya-space-6) var(--raya-space-4); background: var(--raya-surface); border: 2px dashed var(--raya-border-strong); border-radius: var(--raya-radius-lg); color: var(--raya-ink-2); margin-bottom: var(--raya-space-4); }
.empty-state__title { font-size: 1.15rem; font-weight: 700; color: var(--raya-ink); margin: 0 0 .25rem; }
.empty-state__message { margin: 0 auto; max-width: 40ch; }
.empty-state__action { margin-top: var(--raya-space-4); }
.kv-list { margin: 0 0 var(--raya-space-4); }
.kv-list__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .1rem 1rem; padding: .65rem 0; border-bottom: 1px solid var(--raya-border); }
.kv-list__row:last-child { border-bottom: 0; }
.kv-list dt { font-weight: 400; color: var(--raya-ink-2); margin: 0; }
.kv-list dd { margin: 0; font-weight: 700; text-align: end; overflow-wrap: anywhere; }
/* Customer payment breakdown (templates/partials/payment_breakdown.html): compare, reverse and
   wizard pages. The official first installment and the with-insurance total stand out. */
.payment-breakdown { padding: .5rem .75rem; border: 1px solid var(--raya-border); border-radius: var(--raya-radius, .5rem); background: var(--raya-surface); }
.payment-breakdown__title { color: var(--raya-ink); }
.payment-breakdown .kv-list__row { padding: .4rem 0; }
.payment-breakdown__total { border-top: 1px solid var(--raya-border-strong); }
.payment-breakdown__total dt { font-weight: 700; color: var(--raya-ink); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--raya-primary); }
.stat-card .stat-label { font-size: 1rem; color: var(--raya-ink-2); }

/* ------------------------------------------------------------------ 10. tables */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--raya-border); --bs-table-color: var(--raya-ink); }
.table th { background: var(--raya-surface-2); white-space: nowrap; font-weight: 700; }
.table-bordered { border-color: var(--raya-border); }
.table-raya { width: 100%; margin-bottom: 0; background: var(--raya-surface); border: 1px solid var(--raya-border); border-collapse: separate; border-spacing: 0; --bs-table-striped-bg: #f6f8fc; }
.table-raya { font-size: .9rem; }
.table-raya th, .table-raya td { position: relative; }
.table-raya .ltr { white-space: nowrap; }
span.ltr { white-space: nowrap; }
.table-raya > :not(caption) > * > * { padding: .65rem .5rem; border-bottom: 1px solid var(--raya-border); border-inline: 0; vertical-align: middle; }
.table-raya > thead > tr > th { background: var(--raya-surface-2); color: var(--raya-ink); font-size: .9rem; font-weight: 700; line-height: 1.5; text-align: start; white-space: normal; vertical-align: bottom; border-bottom: 2px solid var(--raya-border-strong); }
.table-raya > tbody > tr:last-child > * { border-bottom: 0; }
.table-raya > tbody > tr:hover > * { box-shadow: inset 0 0 0 9999px var(--raya-primary-50); }
.table-raya td.num, .table-raya th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-raya th.num { white-space: normal; }
.table-raya .status-badge { white-space: normal; border-radius: 1rem; }
.table-raya td.actions, .table-raya th.actions { text-align: end; white-space: nowrap; }
.table-scroll { position: relative; overflow-x: auto; max-width: 100%; }
.table-sticky > thead > tr > th { position: sticky; top: 0; z-index: 2; }
.table-sticky-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--raya-border); border-radius: var(--raya-radius); }
.table-sticky-wrap > .table-raya { border: 0; }
table.kv th { width: 55%; }

/* ------------------------------------------------------------------ 11. stepper */
.stepper { margin: 0 0 var(--raya-space-5); }
.stepper__summary { margin: 0 0 .5rem; font-weight: 700; color: var(--raya-ink-2); }
.stepper__summary strong { color: var(--raya-primary); }
.stepper__progress { display: block; width: 100%; height: .65rem; border: 0; border-radius: 999px; background: var(--raya-surface-2); overflow: hidden; appearance: none; -webkit-appearance: none; }
.stepper__progress::-webkit-progress-bar { background: var(--raya-surface-2); }
.stepper__progress::-webkit-progress-value { background: var(--raya-primary); border-radius: 999px; }
.stepper__progress::-moz-progress-bar { background: var(--raya-primary); border-radius: 999px; }
.stepper__list { display: none; list-style: none; margin: 0; padding: 0; }
.stepper__mark { flex: none; display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 2px solid var(--raya-border-strong); background: #fff; color: var(--raya-ink-2); font-weight: 700; line-height: 1; }
.stepper__step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .5rem; color: var(--raya-ink-2); font-weight: 700; }
.stepper__step:last-child { flex: 0 0 auto; }
.stepper__step:not(:last-child)::after { content: ""; flex: 1 1 1rem; min-width: .75rem; height: 2px; background: var(--raya-border); margin-inline: .25rem; }
.stepper__label { line-height: 1.4; }
.stepper__step--done .stepper__mark { background: var(--raya-success-bg); border-color: var(--raya-success); color: var(--raya-success); }
.stepper__step--done:not(:last-child)::after { background: var(--raya-success); }
.stepper__step--current { color: var(--raya-primary); }
.stepper__step--current .stepper__mark { background: var(--raya-primary); border-color: var(--raya-primary); color: #fff; }
@media (min-width: 768px) {
  .stepper__progress { display: none; }
  .stepper__list { display: flex; align-items: center; }
}

/* Representative per-sale checklist and home worklist cards (v1.29). */
.sale-checklist__summary { margin: 0 0 .5rem; color: var(--raya-ink-2); }
.sale-checklist__summary strong { color: var(--raya-primary); }
.sale-checklist__progress { display: block; width: 100%; height: .65rem; margin-bottom: var(--raya-space-4); border: 0; border-radius: 999px; background: var(--raya-surface-2); overflow: hidden; appearance: none; -webkit-appearance: none; }
.sale-checklist__progress::-webkit-progress-bar { background: var(--raya-surface-2); }
.sale-checklist__progress::-webkit-progress-value { background: var(--raya-success); border-radius: 999px; }
.sale-checklist__progress::-moz-progress-bar { background: var(--raya-success); border-radius: 999px; }
.sale-checklist__list { list-style: none; margin: var(--raya-space-4) 0 0; padding: 0; display: grid; gap: .6rem; }
.sale-checklist__item { border: 1px solid var(--raya-border); border-inline-start-width: 4px; border-radius: var(--raya-radius); padding: .75rem 1rem; background: var(--raya-surface); }
.sale-checklist__item--done { border-inline-start-color: var(--raya-success); }
.sale-checklist__item--missing { border-inline-start-color: var(--raya-warning-border); }
.sale-checklist__item--needs_correction { border-inline-start-color: var(--raya-danger); }
.sale-checklist__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; }
.sale-checklist__title { font-weight: 700; color: var(--raya-ink); }
.sale-checklist__owner, .sale-checklist__why, .sale-checklist__hint { margin: .3rem 0 0; font-size: .9rem; color: var(--raya-muted); line-height: 1.7; }
.sale-checklist__hint { color: var(--raya-ink-2); font-weight: 700; overflow-wrap: anywhere; }
.sale-checklist__item .btn { margin-top: .5rem; }
.kpi--muted { background: var(--raya-surface-2); box-shadow: none; }
.kpi--muted .kpi__value { color: var(--raya-muted); }

/* ------------------------------------------------------------------ 12. pagination, filters, export */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: var(--raya-space-5) 0; }
.pager__info { color: var(--raya-ink-2); margin: 0; }
.pager__nav { display: flex; align-items: center; gap: .6rem; }
.pager__page { color: var(--raya-ink-2); font-weight: 700; padding-inline: .25rem; }
.pager .btn { min-width: 6rem; }
.pager .btn.disabled { opacity: .45; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; padding: var(--raya-space-4); margin-bottom: var(--raya-space-4); background: var(--raya-surface); border: 1px solid var(--raya-border); border-radius: var(--raya-radius-lg); box-shadow: var(--raya-shadow-sm); }
.filter-bar .field, .filter-bar .mb-3 { margin-bottom: 0 !important; flex: 1 1 11rem; min-width: 0; }
.filter-bar__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-inline-start: auto; }
details.more-filters { flex: 1 1 100%; }
details.more-filters > summary { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--raya-touch); cursor: pointer; font-weight: 700; color: var(--raya-primary); list-style: none; }
details.more-filters > summary::-webkit-details-marker { display: none; }
details.more-filters > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border: 2px solid currentColor; border-radius: 50%; line-height: 1; font-size: 1.1rem; }
details.more-filters[open] > summary::before { content: "−"; }
.more-filters__body { display: flex; flex-wrap: wrap; gap: .75rem 1rem; padding-top: var(--raya-space-3); }
.more-filters__body .field { flex: 1 1 11rem; margin-bottom: 0; }
.export-menu { display: inline-block; }
.export-menu .dropdown-menu { min-width: 12rem; padding: .35rem; border: 1px solid var(--raya-border); border-radius: var(--raya-radius); box-shadow: var(--raya-shadow-sm); }

/* ------------------------------------------------------------------ 13. login / auth */
.auth-wrap { max-width: 26rem; margin: var(--raya-space-5) auto var(--raya-space-6); }
.auth-logo { display: flex; justify-content: center; margin-bottom: var(--raya-space-4); }
.auth-card { background: var(--raya-surface); border: 1px solid var(--raya-border); border-radius: var(--raya-radius-lg); box-shadow: var(--raya-shadow-sm); padding: var(--raya-space-6) var(--raya-space-5); }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin: 0 0 .35rem; }
.auth-card__lead { text-align: center; color: var(--raya-ink-2); margin: 0 auto var(--raya-space-5); }

/* ------------------------------------------------------------------ 14. legacy aliases (untouched pages) */
.navbar-raya { background: var(--raya-primary); }
.step-list { display: flex; gap: .5rem; flex-wrap: wrap; padding: 0; list-style: none; margin: 0 0 1rem; }
.step-list li { padding: .3rem .9rem; border: 2px solid var(--raya-border-strong); border-radius: 2rem; font-weight: 700; }
.step-list li.current { background: var(--raya-primary); border-color: var(--raya-primary); color: #fff; }
.step-list li.done { border-color: var(--raya-success); color: var(--raya-success); }

/* ------------------------------------------------------------------ 15. mobile */
@media (max-width: 767px) {
  html { font-size: 106.25%; } /* 17px by default */
  .page-title, .page-header .page-title, .page-header__title { font-size: 1.4rem; }
  .stat-card .stat-value { font-size: 1.15rem; }
  .stat-card .money { white-space: normal; }
  .ltr { overflow-wrap: anywhere; }
  .page-header__actions { width: 100%; }
  .page-header__actions .btn { flex: 1 1 auto; }
  .card-primary, .amount-hero, .section-card { padding: var(--raya-space-4); }
  .filter-bar__actions { width: 100%; margin-inline-start: 0; }
  .filter-bar__actions .btn { flex: 1 1 auto; }
  .pager { flex-direction: column; align-items: stretch; text-align: center; }
  .pager__nav { justify-content: space-between; }
  .pager .btn { flex: 1 1 0; }
  .auth-card { padding: var(--raya-space-5) var(--raya-space-4); }
  table.kv th { width: auto; }
  .kv-list dd .ltr { white-space: normal; overflow-wrap: anywhere; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { background: #fff; border: 1px solid var(--raya-border); border-radius: .8rem; margin-bottom: .8rem; padding: .4rem .6rem; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border: 0; border-bottom: 1px dashed var(--raya-border); padding: .4rem 0; text-align: left; box-shadow: none !important; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); font-weight: 700; color: var(--raya-ink-2); text-align: right; flex: 0 0 42%; }
  table.stack td:empty { display: none; }
  table.stack td:not([data-label])::before { content: none; }
  table.stack td:not([data-label]) { display: block; padding-top: .6rem; }
  table.stack td:not([data-label]) .btn { width: 100%; }
  table.stack td.num, table.stack td.actions { text-align: left; }
  table.table-raya.stack { border: 0; background: transparent; }
  table.table-raya.stack > tbody > tr > * { border-bottom-width: 1px; }
  table.stack tr:hover > * { box-shadow: none; }
  .btn-block-mobile { width: 100%; }
}

/* ------------------------------------------------------------------ 16. print */
@media print {
  .no-print, .navbar, .raya-header, footer, .skip-link { display: none !important; }
  body { background: #fff; font-size: 12pt; display: block; min-height: 0; }
  .card, .section-card, .card-primary, .amount-hero { border: 0; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
  @page { size: A4; margin: 15mm; }
}
