/*
 * Misr Stores merchant site: one stylesheet for the public pages (fragments/site.html) and the signed-in
 * area (fragments/app.html).
 *
 *   1. Tokens: colours (light, then dark under [data-theme="dark"]), radii, shadows
 *   2. Base: reset, type, focus, helpers
 *   3. Components: icons, buttons, forms, alerts, badges, cards, lists, modals
 *   4. App shell: sidebar, top bar, page header
 *   5. Signed-in pages: stores, store details, create store, invoices, conversations, profile, services
 *   6. Public site: header, hero, sections, pricing, FAQ, footer, info and error pages
 *
 * Use the tokens (var(--surface), var(--text-muted), …) rather than raw colours, and logical properties
 * (margin-inline-start, inset-inline-end, text-align: start) rather than left/right, so both themes and
 * both directions keep working.
 */

/* ═══════════════════════════ 1. TOKENS ═══════════════════════════ */
:root {
    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-2: #F2F4F7;
    --surface-3: #E7EBF0;
    --border: #E2E6EC;
    --border-strong: #CBD2DB;
    --text: #0F172A;
    --text-muted: #475569;
    --text-subtle: #5F6B7E;

    --brand: #00843A;
    --brand-hover: #006F31;
    --brand-text: #007A33;
    --brand-soft: #E8F6EE;
    --brand-soft-strong: #CDEDD9;
    --on-brand: #FFFFFF;

    --danger: #C81E1E;
    --danger-hover: #A91818;
    --danger-soft: #FDECEC;
    --warning: #A15C00;
    --warning-soft: #FFF6E5;
    --info: #1D5FD1;
    --info-soft: #E8F0FE;
    --purple: #7C3AED;
    --purple-soft: #F3EEFF;

    --overlay: rgba(15, 23, 42, 0.5);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.2);
    --ring: 0 0 0 3px rgba(0, 132, 58, 0.25);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;

    --sidebar-w: 264px;
    --topbar-h: 60px;
    --site-header-h: 68px;

    --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0B1120;
    --surface: #111A2C;
    --surface-2: #172238;
    --surface-3: #1F2C46;
    --border: #22304B;
    --border-strong: #33446A;
    --text: #E7ECF5;
    --text-muted: #A6B1C5;
    --text-subtle: #8A96AD;

    --brand: #1FCB6B;
    --brand-hover: #3DDB82;
    --brand-text: #4ADE80;
    --brand-soft: rgba(31, 203, 107, 0.12);
    --brand-soft-strong: rgba(31, 203, 107, 0.24);
    --on-brand: #052E16;

    --danger: #F87171;
    --danger-hover: #FCA5A5;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --warning: #FBBF24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.12);
    --purple: #C4B5FD;
    --purple-soft: rgba(167, 139, 250, 0.14);

    --overlay: rgba(2, 6, 18, 0.7);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --ring: 0 0 0 3px rgba(31, 203, 107, 0.3);
    color-scheme: dark;
}

/* ═══════════════════════════ 2. BASE ═══════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchor links land below the sticky header */
    scroll-padding-top: calc(var(--site-header-h) + 1rem);
}

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

html[dir="rtl"] body {
    font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    line-height: 1.75;
}

/* Letter-spacing breaks the joins between Arabic letters */
html[dir="rtl"] body * {
    letter-spacing: normal !important;
}

img,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

a {
    color: var(--brand-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    font-weight: 700;
    color: var(--text);
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

ul, ol {
    padding: 0;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: var(--brand-soft-strong);
}

/* Shown at the top of the page once focused with the keyboard */
.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -100px;
    z-index: 200;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* URLs, emails, phone numbers and codes read left to right inside Arabic text */
.ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

.muted {
    color: var(--text-muted);
}

.nowrap {
    white-space: nowrap;
}

.mono {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.875em;
}

/* Only one of the pair shows, by theme: <span class="theme-dark-only">…</span> */
[data-theme="dark"] .theme-light-only,
:root:not([data-theme="dark"]) .theme-dark-only {
    display: none !important;
}

/* ═══════════════════════════ 3. COMPONENTS ═══════════════════════════ */

/* ─── Icons (fragments/icons.html) ─── */
.icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
}

/* Arrows and chevrons point the reading way */
[dir="rtl"] .icon-flip {
    transform: scaleX(-1);
}

/* A tinted square holding an icon, e.g. at the start of a list row */
.icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius);
    background: var(--brand-soft);
    color: var(--brand-text);
    flex-shrink: 0;
}

.icon-tile .icon {
    width: 1.375rem;
    height: 1.375rem;
}

.icon-tile-sm {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
}

.icon-tile-sm .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.icon-tile-lg {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-lg);
}

.icon-tile-lg .icon {
    width: 1.75rem;
    height: 1.75rem;
}

.icon-tile.tone-info { background: var(--info-soft); color: var(--info); }
.icon-tile.tone-warning { background: var(--warning-soft); color: var(--warning); }
.icon-tile.tone-danger { background: var(--danger-soft); color: var(--danger); }
.icon-tile.tone-purple { background: var(--purple-soft); color: var(--purple); }
.icon-tile.tone-neutral { background: var(--surface-2); color: var(--text-muted); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.55rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.btn-primary {
    background: var(--brand);
    color: var(--on-brand);
}

.btn-primary:hover {
    background: var(--brand-hover);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-2);
}

.btn-ghost {
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #FFFFFF;
}

[data-theme="dark"] .btn-danger {
    color: #1F0707;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-danger-outline {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger-soft);
}

.btn-sm {
    min-height: 2.25rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
}

.btn-lg {
    min-height: 3.25rem;
    padding: 0.75rem 1.6rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 2.25rem;
    min-height: 2.25rem;
}

/* Disabled, or held back until a form is ready (still clickable so it can point at what's missing) */
.btn:disabled,
.btn.is-disabled,
.btn[aria-disabled="true"],
.btn.is-blocked {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled,
.btn.is-disabled {
    pointer-events: none;
}

/* A form's buttons: at the end on wide screens, stacked full width (main action on top) on phones */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 639px) {
    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ─── Forms ─── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.25rem;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 639px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.form-group > label,
.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.form-label-hint {
    font-weight: 400;
    color: var(--text-subtle);
}

.form-control {
    width: 100%;
    min-height: 2.875rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    /* 16px keeps phones from zooming in on focus */
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.form-control.is-centered {
    text-align: center;
}

/* Shown, not edited: a store's link preview, the username a dialog signs in with */
.form-control[readonly] {
    background: var(--surface-2);
    cursor: default;
}

.form-control[readonly]:hover {
    border-color: var(--border-strong);
}

.form-control[readonly]:focus {
    border-color: var(--border-strong);
    box-shadow: none;
}

/* dir="auto" reads an empty field as left to right; until something is typed, the placeholder and the caret
   follow the page. The browser's plaintext bidi on these fields would still put the caret on the left */
.form-control[dir="auto"]:placeholder-shown {
    direction: inherit;
    unicode-bidi: isolate;
}

.form-control::placeholder {
    color: var(--text-subtle);
    opacity: 0.8;
}

.form-control:hover {
    border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-subtle));
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.form-control:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 8rem;
    resize: vertical;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-subtle);
    line-height: 1.5;
}

.text-error {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--danger);
    line-height: 1.5;
}

.form-control.is-invalid,
.choice-grid.is-invalid {
    border-color: var(--danger) !important;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

/* A form that can't be used yet: a disabled fieldset turns off every control inside it */
.form-lock {
    border: 0;
    padding: 0;
    min-width: 0;
}

.form-lock:disabled .form-control,
.form-lock:disabled .choice,
.form-lock:disabled .segmented-option,
.form-lock:disabled .terms-check,
.form-lock:disabled .template-option {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-lock:disabled .template-option {
    pointer-events: none;
}

/* "I agree to the terms of service and privacy policy" */
.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.6;
}

.terms-check input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.2rem;
    accent-color: var(--brand);
    cursor: pointer;
    flex-shrink: 0;
}

.terms-check.is-invalid {
    color: var(--danger);
}

/* Segmented control: a row of radio buttons that read as one control */
.segmented-toggle {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.segmented-toggle.is-full {
    display: grid;
}

.segmented-option {
    position: relative;
}

.segmented-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-option span {
    display: block;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}

.segmented-option input:checked + span {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

[data-theme="dark"] .segmented-option input:checked + span {
    background: var(--surface-3);
}

.segmented-option input:focus-visible + span {
    box-shadow: var(--ring);
}

.segmented-option input:disabled + span {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Choice cards: a radio with a title and a description, e.g. demo or real store */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.choice {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.choice:hover {
    border-color: var(--text-subtle);
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-mark {
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.choice-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.choice-title {
    font-weight: 600;
    color: var(--text);
}

.choice-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.choice:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px var(--brand);
}

.choice:has(input:checked) .choice-mark {
    border-color: var(--brand);
}

.choice:has(input:checked) .choice-mark::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--brand);
}

.choice:has(input:focus-visible) {
    box-shadow: var(--ring);
}

.choice:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.field-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-subtle);
}

.field-status.is-available {
    color: var(--brand-text);
    font-weight: 600;
}

.field-status.is-taken {
    color: var(--danger);
    font-weight: 600;
}

/* Searchable select (searchable-select.js) */
.searchable-select {
    position: relative;
}

.searchable-select .ss-input {
    padding-inline-end: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    cursor: pointer;
}

[dir="rtl"] .searchable-select .ss-input {
    background-position: left 0.85rem center;
}

.ss-select {
    display: none;
}

.ss-dropdown {
    display: none;
    position: absolute;
    z-index: 60;
    top: calc(100% + 4px);
    inset-inline: 0;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.ss-option {
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9375rem;
    cursor: pointer;
}

.ss-option:hover,
.ss-option.ss-active {
    background: var(--surface-2);
}

.ss-option.ss-selected {
    color: var(--brand-text);
    font-weight: 600;
}

.ss-empty {
    color: var(--text-subtle);
    cursor: default;
}

/* Password fields (password-toggle.js) */
.pw-wrap {
    position: relative;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    padding: 0.35rem;
    border-radius: 6px;
    color: var(--text-subtle);
}

.pw-toggle:hover {
    color: var(--text);
    background: var(--surface-2);
}

/* Date selects (date-select.js): day, month and year side by side */
.date-select {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    gap: 0.5rem;
}

/* Narrow boxes: less padding, so a two-digit day and the placeholder still fit on phones */
.date-select .ss-input {
    padding-inline-start: 0.6rem;
    padding-inline-end: 1.75rem;
    background-position: right 0.5rem center;
}

[dir="rtl"] .date-select .ss-input {
    background-position: left 0.5rem center;
}

/* ─── Alerts ─── */
.alert,
.alert-success,
.alert-error,
.alert-warning,
.alert-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    line-height: 1.6;
    text-align: start;
}

.alert > .icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
}

.alert-body {
    flex: 1;
    min-width: 0;
}

.alert-title {
    display: block;
    font-weight: 700;
}

.alert-success {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 25%, transparent);
    color: var(--brand-text);
}

.alert-error {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: color-mix(in srgb, var(--warning) 25%, transparent);
    color: var(--warning);
}

.alert-info {
    background: var(--info-soft);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
    color: var(--info);
}

.alert-neutral {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
}

.alert-purple {
    background: var(--purple-soft);
    border-color: color-mix(in srgb, var(--purple) 25%, transparent);
    color: var(--purple);
}

.alert .alert-desc {
    display: block;
    color: var(--text-muted);
}

.alert-action {
    flex-shrink: 0;
    align-self: center;
}

/* A whole alert that leads to the page that resolves it. Hover deepens the alert's own colour (currentColor, so
   any kind of alert) and nudges the chevron forward; translate, not transform, keeps the chevron's RTL flip */
a.alert-link {
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.alert-link:hover,
a.alert-link:focus-visible {
    border-color: color-mix(in srgb, currentColor 45%, transparent);
    box-shadow: inset 0 0 0 100vmax color-mix(in srgb, currentColor 8%, transparent);
}

a.alert-link > .icon:last-child {
    transition: translate 0.15s;
}

a.alert-link:hover > .icon:last-child {
    translate: 3px 0;
}

[dir="rtl"] a.alert-link:hover > .icon:last-child {
    translate: -3px 0;
}

.alert-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.alert-stack:empty {
    display: none;
}

@media (max-width: 639px) {
    .alert.has-action {
        flex-wrap: wrap;
    }

    .alert.has-action .alert-action {
        width: 100%;
    }

    .alert.has-action .alert-action .btn {
        width: 100%;
    }
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

html[dir="rtl"] .badge {
    font-size: 0.8125rem;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

.badge.no-dot::before {
    display: none;
}

.badge-success { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: transparent; }

/* Statuses, by name: invoices (upcoming, due, …) and conversations (open, in-progress, …) */
.status-upcoming, .status-open { background: var(--info-soft); color: var(--info); border-color: transparent; }
.status-due, .status-in-progress { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.status-overdue { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.status-paid, .status-resolved { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.status-lifted, .status-new-reply { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.status-void, .status-closed { background: var(--surface-2); color: var(--text-subtle); }

/* ─── Cards ─── */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 700;
}

.card-sub {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Numbered step in a long form */
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-text);
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

@media (max-width: 639px) {
    .card-body {
        padding: 1.15rem;
    }

    .card-header {
        padding: 1rem 1.15rem;
    }

    .card-footer {
        padding: 1rem 1.15rem;
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stack-lg {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* ─── Stat tiles ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.15rem 1.25rem;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-label .icon {
    color: var(--text-subtle);
    width: 1.1rem;
    height: 1.1rem;
}

.stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-hint {
    font-size: 0.8125rem;
    color: var(--text-subtle);
}

.stat.is-alert {
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.stat.is-alert .stat-hint {
    color: var(--danger);
    font-weight: 600;
}

/* Four tiles: a row of four when there's room, otherwise two by two (never three and one) */
.stat-grid.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1280px), (min-width: 700px) and (max-width: 1023px) {
    .stat-grid.two-up {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .stat-grid.two-up {
        gap: 0.75rem;
    }

    .stat-grid.two-up .stat {
        padding: 1rem;
    }

    .stat-grid.two-up .stat-value {
        font-size: 1.3rem;
    }
}

/* ─── Key/value rows ─── */
.kv {
    display: flex;
    flex-direction: column;
}

.kv-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.kv-row:first-child {
    padding-top: 0;
}

.kv-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.kv-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.kv-value {
    font-weight: 600;
    text-align: end;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Stacked label over value, for longer values */
.kv.is-stacked .kv-row {
    flex-direction: column;
    align-items: stretch;
}

.kv.is-stacked .kv-value {
    text-align: start;
    font-weight: 500;
}

/* ─── Action list: icon, label, description, chevron ─── */
.action-list {
    display: flex;
    flex-direction: column;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-align: start;
    text-decoration: none;
    transition: background-color 0.15s;
}

.action-item:last-child {
    border-bottom: 0;
}

.action-item:hover {
    background: var(--surface-2);
}

/* Round the hover only where the row meets the card's edge, not under a card header */
.action-list:first-child > .action-item:first-child:hover {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.action-list:last-child > .action-item:last-child:hover {
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.action-item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.action-item-title {
    font-weight: 600;
}

.action-item-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.action-item > .icon:last-child {
    color: var(--text-subtle);
}

.action-item:disabled,
.action-item.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: none;
}

.action-item.is-danger .action-item-title {
    color: var(--danger);
}

@media (max-width: 639px) {
    .action-item {
        padding: 0.9rem 1.15rem;
    }
}

/* ─── List of rows linking to details (invoices, conversations) ─── */
.list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s;
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row:hover {
    background: var(--surface-2);
}

.list-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.list-row-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.list-row-meta .sep {
    color: var(--border-strong);
}

.list-row-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.list-row > .icon:last-child {
    color: var(--text-subtle);
}

.list-row.is-unread .list-row-title::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-inline-start: 0.5rem;
    border-radius: 50%;
    background: var(--purple);
    vertical-align: middle;
}

@media (max-width: 639px) {
    .list-row {
        gap: 0.75rem;
        padding: 0.9rem 1rem;
    }

    .list-row > .icon:last-child {
        display: none;
    }

    .list-row .icon-tile {
        width: 2.5rem;
        height: 2.5rem;
    }
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.section-heading .count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-subtle);
}

/* ─── Empty state ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
    text-align: center;
}

.empty-state h2 {
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.empty-state p {
    max-width: 46ch;
    color: var(--text-muted);
}

.empty-state .btn {
    margin-top: 0.75rem;
}

.empty-state.is-compact {
    padding: 2rem 1.25rem;
}

.empty-state.is-compact h2 {
    font-size: 1rem;
}

/* ─── Modals ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--overlay);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-overlay.open {
    display: flex;
    animation: fade-in 0.15s ease-out;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.18s ease-out;
}

/* A page's help (fragments/app :: helpDialog): room for its reading */
.modal-card.is-help {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-title.is-danger {
    color: var(--danger);
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-inline-end: -0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    padding: 1.5rem;
}

.modal-text {
    color: var(--text-muted);
    line-height: 1.7;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* A secondary action kept apart from the main ones, at the footer's other end */
.modal-footer-start {
    margin-inline-end: auto;
}

.check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.check-list li {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    color: var(--text-muted);
    line-height: 1.6;
}

.check-list li > .icon {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.2rem;
    color: var(--brand-text);
}

.check-list.is-warning li > .icon {
    color: var(--warning);
}

.check-list.is-danger li > .icon {
    color: var(--danger);
}

/* Phones: dialogs rise from the bottom and keep their buttons in reach */
@media (max-width: 639px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-card {
        margin: auto 0 0;
        max-width: none;
        max-height: 92vh;
        overflow-y: auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: 0;
        animation: sheet-in 0.22s ease-out;
    }

    .modal-header,
    .modal-body {
        padding-inline: 1.15rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        padding: 1rem 1.15rem calc(1rem + env(safe-area-inset-bottom));
        border-radius: 0;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@keyframes fade-in {
    from { opacity: 0; }
}

@keyframes pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes sheet-in {
    from { transform: translateY(40px); opacity: 0.5; }
}

/* ─── Avatars ─── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-text);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 4.5rem;
    height: 4.5rem;
    font-size: 1.5rem;
}

.avatar.is-support {
    background: var(--brand);
    color: var(--on-brand);
}

/* ─── Logo ─── */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.logo img {
    width: 1.75rem;
    height: 1.75rem;
}

.logo span {
    color: var(--brand-text);
}

/* ═══════════════════════════ 4. APP SHELL ═══════════════════════════ */
.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
}

.app-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: var(--topbar-h);
    padding: 0.75rem 1.25rem;
    flex-shrink: 0;
}

/* The logo with the portal's tagline under it */
.app-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.app-brand-sub {
    font-size: 0.8125rem;
    color: var(--text-subtle);
}

.app-sidebar-head .drawer-close {
    display: none;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.app-nav-label {
    padding: 0.75rem 0.75rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

html[dir="rtl"] .app-nav-label {
    font-size: 0.8125rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-text);
    font-weight: 600;
}

.nav-link .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.app-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Language and theme, side by side */
.pref-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
}

.pref-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.pref-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

.pref-btn.is-square {
    width: 2.5rem;
    padding: 0;
}

.pref-btn .icon {
    width: 1.1rem;
    height: 1.1rem;
}

/* Who is signed in, with Profile and Sign out */
.account {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s;
}

.account:hover,
.account.active {
    background: var(--surface-2);
}

.account-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.35;
    text-align: center;
}

.account-name {
    font-size: 0.9375rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* An English name in the Arabic layout is cut at its end, not its start */
    unicode-bidi: plaintext;
}

.account-email {
    font-size: 0.8125rem;
    color: var(--text-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Top bar: tablets and phones, where the sidebar becomes a drawer */
.app-topbar {
    display: none;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.app-main {
    min-height: 100vh;
    margin-inline-start: var(--sidebar-w);
    padding: 2rem clamp(1.25rem, 3vw, 2.5rem) 4rem;
}

.app-container {
    max-width: 1120px;
    margin-inline: auto;
}

@media (max-width: 1023px) {
    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 40;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        height: var(--topbar-h);
        padding-inline: 1rem;
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: saturate(1.5) blur(10px);
        -webkit-backdrop-filter: saturate(1.5) blur(10px);
        border-bottom: 1px solid var(--border);
    }

    .app-sidebar {
        width: min(300px, 86vw);
        transform: translateX(-100%);
        transition: transform 0.25s ease, visibility 0.25s;
        visibility: hidden;
        box-shadow: var(--shadow-lg);
    }

    [dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }

    .app-sidebar.open {
        transform: none;
        visibility: visible;
    }

    .app-sidebar-head .drawer-close {
        display: inline-flex;
    }

    .app-main {
        margin-inline-start: 0;
        min-height: calc(100vh - var(--topbar-h));
        padding: 1.5rem 1rem 3rem;
    }
}

/* ─── Page header ─── */
.page-head {
    margin-bottom: 1.75rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding-block: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}

.back-link .icon {
    width: 1.1rem;
    height: 1.1rem;
}

.page-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.page-head-main {
    min-width: 0;
    flex: 1 1 320px;
}

.page-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.875rem);
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.page-sub {
    margin-top: 0.35rem;
    max-width: 65ch;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

@media (max-width: 639px) {
    .page-head {
        margin-bottom: 1.25rem;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1 1 0;
    }

    /* The help button keeps its size, and on its own it stays beside the title */
    .page-actions .help-btn {
        flex: none;
    }

    .page-head-row:has(> .page-actions > .help-btn:only-child) {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .page-actions:has(> .help-btn:only-child) {
        width: auto;
    }
}

/* Two columns: main content and a side panel */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.5rem;
    align-items: start;
}

.split-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 1024px) {
    .split-side.is-sticky {
        position: sticky;
        top: 2rem;
    }
}

/* Side panel first: at the start on wide screens, on top on narrow ones */
.split.is-reversed {
    grid-template-columns: 320px minmax(0, 1fr);
}

@media (max-width: 1023px) {
    .split,
    .split.is-reversed {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The side panel holds the summary: show it first */
    .split.side-first .split-side {
        order: -1;
    }
}

/* ═══════════════════════════ 5. SIGNED-IN PAGES ═══════════════════════════ */

/* ─── Stores ─── */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

.store-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.store-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.store-card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

/* A store's brand color with its logo (StoreBrand picks the logo that reads on the color) */
.brand-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(0 0 0 / 0.7);
}

.brand-tile.is-dark {
    color: #fff;
}

.brand-tile img {
    object-fit: contain;
}

.brand-tile .icon {
    stroke-width: 1.5;
    opacity: 0.85;
}

.store-card-media.brand-tile img {
    max-width: 60%;
    max-height: 45%;
}

.store-card-media.brand-tile .icon {
    width: 3rem;
    height: 3rem;
}

.store-card-badges {
    position: absolute;
    z-index: 1;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.store-card-badges .badge {
    box-shadow: var(--shadow-sm);
    border-color: transparent;
}

.store-card-badges .badge:not([class*="badge-"]) {
    background: var(--surface);
}

.store-card-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
}

.store-card-text {
    flex: 1;
    min-width: 0;
}

.store-card-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-card-body > .icon {
    color: var(--text-subtle);
}

/* A disabled store's tile goes grey under its badges */
.store-card.is-disabled .store-card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #808080;
    mix-blend-mode: saturation;
}

.store-card.is-disabled .store-card-media > img,
.store-card.is-disabled .store-card-media > .icon {
    opacity: 0.6;
}

/* Dashed "create" tiles: a store at the end of the grid, a conversation above the list */
.store-card-add,
.list-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 220px;
    padding: 1.5rem;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.store-card-add:hover,
.list-add:hover {
    border-color: var(--brand);
    color: var(--brand-text);
    background: var(--brand-soft);
}

.store-card-add .icon-tile,
.list-add .icon-tile {
    background: var(--surface);
    border: 1px solid var(--border);
}

.list-add {
    flex-direction: row;
    min-height: 0;
    padding: 1rem 1.25rem;
}

.limit-note {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ─── Store details ─── */
.store-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.store-hero-thumb {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
}

.store-hero-thumb.brand-tile img {
    width: 100%;
    height: 100%;
    padding: 0.5rem;
}

.store-hero-thumb.brand-tile .icon {
    width: 1.75rem;
    height: 1.75rem;
}

/* Store details' share card: the QR code (always on white, so it scans in the dark theme too), the address and a download */
.share-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
}

.share-desc {
    align-self: stretch;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.share-qr {
    width: 100%;
    max-width: 240px;
    height: auto;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

/* Sits close under the QR code as its caption */
.share-link {
    align-self: stretch;
    margin-top: -0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}

.copy-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

.copy-btn .icon {
    width: 0.95rem;
    height: 0.95rem;
}

.copy-btn.is-copied {
    color: var(--brand-text);
}

.dns-record {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    font-size: 0.9375rem;
}

.dns-record dt {
    color: var(--text-muted);
}

.dns-record dd {
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* The custom domain page's records: a heading over each, copy buttons beside the values */
.dns-record-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: -0.5rem;
}

.dns-record dd .copy-btn {
    margin-inline-start: 0.35rem;
    vertical-align: middle;
}

.dns-notes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-inline-start: 1.1rem;
    list-style: disc;
}

.custom-domain-live {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.custom-domain-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    font-size: 1.0625rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.custom-domain-link .icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ─── Template picker (create store, change template) ─── */
/* Three per row, two on small tablets, one on phones */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 759px) {
    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 479px) {
    .template-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.template-option {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    text-align: start;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.template-option:hover {
    border-color: var(--text-subtle);
}

.template-option:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.template-option.selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand);
}

.template-media {
    aspect-ratio: 4 / 3;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.template-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

/* Both theme images are stacked, the other theme's on top and hidden. While a card is hovered,
   app.js toggles .show-other-theme every few seconds, fading that top image in and out. */
.template-media {
    position: relative;
    isolation: isolate; /* keeps the stacked images under the selected checkmark */
}

.template-media img {
    position: absolute;
    inset: 0;
}

.template-media .template-img-dark,
[data-theme="dark"] .template-media .template-img-light {
    z-index: 1;
    opacity: 0;
    transition: opacity 0.9s ease-in-out;
}

[data-theme="dark"] .template-media .template-img-dark {
    z-index: auto;
    opacity: 1;
}

.template-option.show-other-theme .template-img-dark,
[data-theme="dark"] .template-option.show-other-theme .template-img-light {
    opacity: 1;
}

.template-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem 1rem 1rem;
}

.template-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* One line: extra keywords scroll sideways and fade out at the end instead of wrapping */
.template-keywords {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
}

.template-keywords::-webkit-scrollbar {
    display: none;
}

[dir="rtl"] .template-keywords {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 1.5rem), transparent);
}

/* Pinned to the bottom so the buttons line up across cards */
.template-preview {
    margin-top: auto;
}

.template-keyword {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.05rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.75rem;
}

html[dir="rtl"] .template-keyword {
    font-size: 0.8125rem;
}

.template-check {
    position: absolute;
    top: 0.65rem;
    inset-inline-end: 0.65rem;
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: var(--shadow);
}

.template-check .icon {
    width: 1rem;
    height: 1rem;
}

.template-option.selected .template-check {
    display: inline-flex;
}

.templates-locked .template-option {
    opacity: 0.5;
    pointer-events: none;
}

.template-empty {
    padding: 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
}

/* Bottom of the create-store form: terms and the button */
.submit-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 639px) {
    .submit-row .btn {
        width: 100%;
    }
}

/* ─── Invoices ─── */
.amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.is-struck {
    text-decoration: line-through;
    opacity: 0.6;
}

.line-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.line-item:last-child {
    border-bottom: 0;
}

.line-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.line-item-title {
    font-weight: 600;
}

.line-item-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-note {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.order-table th {
    padding: 0.65rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-subtle);
    text-align: start;
    white-space: nowrap;
}

.order-table td {
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.order-table tr:last-child td {
    border-bottom: 0;
}

.order-table .num {
    text-align: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.order-id {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: var(--surface-2);
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    direction: ltr;
}

button.order-id {
    color: var(--info);
    border: 1px solid transparent;
}

button.order-id:hover {
    border-color: color-mix(in srgb, var(--info) 40%, transparent);
    background: var(--info-soft);
    text-decoration: underline;
}

button.order-id:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* The order number reads left to right, so its arrow doesn't mirror */
[dir="rtl"] .order-id .icon-flip {
    transform: none;
}

button.order-id .icon {
    width: 0.85rem;
    height: 0.85rem;
}

/* Phones: each order is a small two-line block instead of a table row */
@media (max-width: 639px) {
    .order-table thead {
        display: none;
    }

    .order-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.3rem 1rem;
        padding: 0.85rem 1.15rem;
        border-bottom: 1px solid var(--border);
    }

    .order-table tr:last-child {
        border-bottom: 0;
    }

    .order-table td {
        padding: 0;
        border: 0;
    }

    .order-table td.order-date {
        text-align: end;
        color: var(--text-muted);
        font-size: 0.875rem;
    }

    .order-table td.order-total {
        text-align: start;
        color: var(--text-muted);
        font-size: 0.875rem;
    }

    .line-item,
    .card-note {
        padding-inline: 1.15rem;
    }
}

.order-table td.order-fee {
    font-weight: 700;
    color: var(--text);
}

.totals {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-muted);
}

.totals-row > :last-child {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.totals-row.is-grand {
    margin-top: 0.4rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.totals-row.is-grand > :last-child {
    font-weight: 700;
}

.invoice-amount {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.invoice-amount-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pre-wrap {
    white-space: pre-wrap;
    line-height: 1.75;
    color: var(--text-muted);
}

.subheading {
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

html[dir="rtl"] .subheading {
    font-size: 0.875rem;
}

/* ─── Conversations ─── */
.thread {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 88%;
}

/* The merchant's own messages sit at the start (left in English, right in Arabic) and the team's at the end,
   each with its avatar on the outer side */
.message:not(.is-mine) {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.message.is-mine {
    align-self: flex-start;
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.message:not(.is-mine) .message-body {
    align-items: flex-end;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-subtle);
}

.message-author {
    font-weight: 600;
    color: var(--text);
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    /* The corner by the avatar. Physical sides from the page's direction: the bubble's own (dir="auto")
       follows its text, so an Arabic message in English would put a logical corner on the wrong side */
    border-top-right-radius: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.7;
}

html[dir="rtl"] .message-bubble,
.message.is-mine .message-bubble {
    border-top-right-radius: var(--radius-lg);
    border-top-left-radius: 4px;
}

html[dir="rtl"] .message.is-mine .message-bubble {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: 4px;
}

.message.is-mine .message-bubble {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 20%, transparent);
}

.thread-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-subtle);
}

.thread-divider::before,
.thread-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.composer textarea.form-control {
    min-height: 6.5rem;
}

.composer-actions {
    display: flex;
    justify-content: flex-end;
}

.thread-closed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    color: var(--text-muted);
    font-weight: 600;
}

@media (max-width: 639px) {
    .thread {
        padding: 1.15rem;
    }

    .message {
        max-width: 100%;
    }

    .message .avatar {
        display: none;
    }

    .composer {
        padding: 1rem 1.15rem;
    }

    .composer-actions .btn {
        width: 100%;
    }
}

/* ─── Profile ─── */
.profile-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
}

.profile-identity-name {
    font-size: 1.125rem;
    font-weight: 700;
}

.profile-identity-email {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
}

.profile-identity-email svg {
    width: 1rem;
    height: 1rem;
}

.review-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.review-list dt,
.review-list dd {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.review-list dt {
    color: var(--text-muted);
    background: var(--surface-2);
}

.review-list dd {
    font-weight: 600;
    overflow-wrap: anywhere;
    text-align: center;
}

.review-list dt:last-of-type,
.review-list dd:last-of-type {
    border-bottom: 0;
}

@media (max-width: 539px) {
    .review-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .review-list dt {
        border-bottom: 0;
        padding-bottom: 0.2rem;
    }

    /* Stacked under its label, the value lines up with it */
    .review-list dd {
        padding-top: 0.2rem;
        text-align: start;
    }
}

/* The personal details read centred: the name and address right to left, the phone numbers left to right */
.profile-fieldset .form-control {
    text-align: center;
}

/* Hints explain how to fill a field; a locked profile can't be filled in, so they're left out */
.profile-fieldset:disabled .form-hint {
    display: none;
}

/* ─── Additional services ─── */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.service-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

a.service-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* The icon with the title beside it */
.service-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.service-card h2,
.service-card h3 {
    font-size: 1.0625rem;
}

.service-card p {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.service-card.is-muted {
    border-style: dashed;
    background: transparent;
    box-shadow: none;
}

.steps-list {
    list-style: none;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.steps-list li {
    counter-increment: step;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    color: var(--text-muted);
    line-height: 1.6;
}

.steps-list li::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-top: 0.05rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-text);
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ═══════════════════════════ 6. PUBLIC SITE ═══════════════════════════ */
.container {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.5) blur(12px);
    -webkit-backdrop-filter: saturate(1.5) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--site-header-h);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.site-nav a {
    display: inline-flex;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-btn {
    display: none;
}

.site-drawer {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: min(320px, 88vw);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s;
}

[dir="rtl"] .site-drawer {
    transform: translateX(-100%);
}

.site-drawer.open {
    transform: none;
    visibility: visible;
}

.site-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--site-header-h);
    padding-inline: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.site-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.site-drawer-foot {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
}

@media (max-width: 1023px) {
    .site-nav,
    .site-header-actions .hide-mobile {
        display: none;
    }

    .menu-btn {
        display: inline-flex;
    }
}

@media (min-width: 1024px) {
    .site-drawer,
    .site-drawer + .drawer-overlay {
        display: none;
    }
}

/* ─── Sections ─── */
.section {
    padding-block: clamp(3.5rem, 8vw, 6rem);
}

.section.is-alt {
    background: var(--surface);
    border-block: 1px solid var(--border);
}

.section-head {
    max-width: 680px;
    margin: 0 auto clamp(2rem, 5vw, 3rem);
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--brand-text);
}

.section-title {
    font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
    line-height: 1.25;
}

.section-sub {
    margin-top: 0.85rem;
    font-size: 1.0625rem;
    color: var(--text-muted);
}

/* ─── Hero ─── */
.hero {
    position: relative;
    padding-block: clamp(2.5rem, 7vw, 5.5rem);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: -40% -10% auto;
    height: 120%;
    background:
        radial-gradient(ellipse 50% 45% at 20% 30%, var(--brand-soft-strong), transparent 70%),
        radial-gradient(ellipse 40% 40% at 85% 20%, var(--info-soft), transparent 70%);
    opacity: 0.7;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand-text);
}

.hero-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft-strong);
}

.hero h1 {
    font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

html[dir="rtl"] .hero h1 {
    line-height: 1.4;
}

.hero h1 .highlight {
    color: var(--brand-text);
}

.hero-desc {
    max-width: 54ch;
    margin-top: 1.25rem;
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
    color: var(--text-muted);
}

.hero-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1.5rem;
    list-style: none;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.hero-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.hero-points .icon {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--brand-text);
}

.hero-demos {
    padding: clamp(1.25rem, 3vw, 1.75rem);
    box-shadow: var(--shadow);
}

.hero-demos-title {
    font-size: 1.125rem;
}

.hero-demos-sub {
    margin-top: 0.3rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.demo-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.demo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.demo-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 10;
    color: #FFFFFF;
}

.demo-card-media .icon {
    width: 2.25rem;
    height: 2.25rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.demo-fashion { background: linear-gradient(135deg, #F472B6, #A855F7); }
.demo-electronics { background: linear-gradient(135deg, #38BDF8, #1D4ED8); }
.demo-home { background: linear-gradient(135deg, #FBBF24, #EA580C); }
.demo-beauty { background: linear-gradient(135deg, #34D399, #0F766E); }

.demo-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--surface);
}

.demo-card-body .icon {
    width: 1rem;
    height: 1rem;
    color: var(--text-subtle);
}

@media (max-width: 1023px) {
    .hero-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-copy {
        text-align: center;
    }

    .hero-desc {
        margin-inline: auto;
    }

    .hero-ctas,
    .hero-points {
        justify-content: center;
    }
}

@media (max-width: 479px) {
    .hero-ctas .btn {
        width: 100%;
    }
}

/* ─── Feature cards ─── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.feature-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
}

.feature-card h3 {
    font-size: 1.0625rem;
    margin-top: 0.25rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Nine features: three by three */
.feature-grid.is-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1099px) {
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 759px) {
    .feature-grid.is-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* An odd count leaves the last card alone: let it take the whole row */
    .feature-grid.is-three > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 599px) {
    .feature-grid,
    .feature-grid.is-three {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ─── Pricing ─── */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    max-width: 920px;
    margin-inline: auto;
}

.plan {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: clamp(1.5rem, 3vw, 2rem);
}

.plan.is-featured {
    border: 2px solid var(--brand);
    box-shadow: var(--shadow);
}

.plan-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-head h3 {
    font-size: 1.125rem;
}

.plan-badge {
    margin-inline-start: auto;
}

.plan-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.plan-amount {
    font-size: clamp(2rem, 9vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
}

.plan-period {
    color: var(--text-muted);
    font-weight: 500;
}

.plan-plus {
    margin-top: -0.6rem;
    font-weight: 600;
    color: var(--brand-text);
}

.plan-desc {
    color: var(--text-muted);
}

.plan .check-list {
    flex: 1;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.plan .check-list li {
    color: var(--text);
}

.plan-example {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 920px;
    margin: 1.25rem auto 0;
}

.plan-note {
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 799px) {
    .plan-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ─── Steps ─── */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    list-style: none;
}

.step-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.5rem;
}

.step-card .step-num {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
}

.step-card h3 {
    font-size: 1.0625rem;
    margin-top: 0.25rem;
}

.step-card p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

@media (max-width: 799px) {
    .steps-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ─── FAQ ─── */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 780px;
    margin-inline: auto;
}

.faq-item {
    overflow: hidden;
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary .icon {
    color: var(--text-subtle);
    transition: transform 0.2s;
}

.faq-item[open] summary .icon {
    transform: rotate(180deg);
}

.faq-item summary:hover {
    background: var(--surface-2);
}

.faq-answer {
    padding: 0 1.25rem 1.15rem;
    color: var(--text-muted);
    line-height: 1.75;
}

/* ─── Call to action band ─── */
.cta-band {
    position: relative;
    padding: clamp(2rem, 6vw, 3.5rem);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(ellipse 60% 80% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(135deg, #00843A, #005C29);
    color: #FFFFFF;
    text-align: center;
    overflow: hidden;
}

.cta-band h2 {
    color: #FFFFFF;
    font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem);
}

.cta-band p {
    max-width: 56ch;
    margin: 0.85rem auto 0;
    color: rgba(255, 255, 255, 0.88);
}

.cta-band .btn {
    margin-top: 1.75rem;
    background: #FFFFFF;
    color: #00612B;
}

.cta-band .btn:hover {
    background: #EAF7EF;
}

/* ─── Footer ─── */
.site-footer {
    padding-block: 2.25rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9375rem;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--text);
    text-decoration: underline;
}

.footer-socials {
    display: flex;
    gap: 0.5rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s;
}

.social-btn:hover {
    color: var(--brand-text);
    border-color: var(--brand);
}

.social-btn svg {
    width: 1.1rem;
    height: 1.1rem;
}

.footer-copy {
    width: 100%;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-subtle);
}

@media (max-width: 639px) {
    .site-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

/* ─── Info pages (about, terms, privacy, contact) ─── */
.page-hero {
    padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.page-hero h1 {
    font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem);
}

.page-hero p {
    max-width: 56ch;
    margin: 0.75rem auto 0;
    color: var(--text-muted);
    font-size: 1.0625rem;
}

.prose-card {
    max-width: 780px;
    margin: 0 auto clamp(3rem, 8vw, 5rem);
    padding: clamp(1.5rem, 4vw, 2.75rem);
}

.prose h2 {
    margin: 2rem 0 0.6rem;
    font-size: 1.25rem;
}

.prose h2:first-child {
    margin-top: 0;
}

.prose p {
    color: var(--text-muted);
    font-size: 1.0625rem;
    line-height: 1.85;
}

.prose p + p {
    margin-top: 1rem;
}

/* Legal pages: contents beside the text on wide screens, above it on narrow ones */
.legal {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    max-width: 1060px;
    margin: 0 auto clamp(3rem, 8vw, 5rem);
}

.legal .prose-card {
    max-width: none;
    margin: 0;
}

.legal-toc {
    position: sticky;
    top: calc(var(--site-header-h) + 1rem);
    padding: 1.15rem 1.25rem;
}

.legal-toc ol {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-inline-start: 1.1rem;
    font-size: 0.9375rem;
}

.legal-toc li::marker {
    color: var(--text-subtle);
}

.legal-toc a {
    display: block;
    padding: 0.2rem 0;
    color: var(--text-muted);
    text-decoration: none;
}

.legal-toc a:hover {
    color: var(--brand-text);
}

.legal-summary {
    margin-bottom: 2rem;
}

.legal h2 {
    scroll-margin-top: calc(var(--site-header-h) + 1rem);
}

.prose ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-inline-start: 1.25rem;
    color: var(--text-muted);
    font-size: 1.0625rem;
    line-height: 1.8;
}

.prose ul + p,
.prose p + ul + p {
    margin-top: 1rem;
}

.prose li::marker {
    color: var(--brand-text);
}

.prose strong {
    color: var(--text);
}

.legal-lang-note {
    margin-top: 2rem !important;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.9375rem !important;
}

@media (max-width: 899px) {
    .legal {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-toc {
        position: static;
    }

    /* Two columns keep the contents short above the text */
    .legal-toc ol {
        display: block;
        columns: 2;
        column-gap: 1.75rem;
        font-size: 0.875rem;
    }

    .legal-toc li {
        break-inside: avoid;
    }
}

/* Same width as the about page's card */
.contact-grid {
    display: grid;
    gap: 1rem;
    max-width: 780px;
    margin: 0 auto clamp(3rem, 8vw, 5rem);
}

@media (min-width: 640px) {
    .contact-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Both cards' buttons span the card and line up at the bottom */
.contact-card {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.35rem 1.5rem;
}

.contact-card-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
}

.contact-card h2 {
    font-size: 1.0625rem;
}

.contact-card p {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Reporting a store: the page's largest card, spanning both columns */
.contact-abuse {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: clamp(1.5rem, 4vw, 2.75rem);
}

.contact-abuse-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.contact-abuse-head h2 {
    font-size: 1.375rem;
}

.contact-abuse-head p {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.75;
}

.contact-abuse-when {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.contact-abuse h3 {
    margin-bottom: -0.6rem;
    font-size: 1rem;
}

.contact-abuse ul {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-inline-start: 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.contact-abuse li::marker {
    color: var(--brand-text);
}

@media (max-width: 479px) {
    .contact-abuse-head {
        flex-direction: column;
    }
}

/* ─── Error pages ─── */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.error-card {
    width: 100%;
    max-width: 460px;
    padding: clamp(2rem, 6vw, 3rem) 2rem;
    text-align: center;
}

.error-code {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brand-text);
}

.error-code.is-danger {
    color: var(--danger);
}

.error-card h1 {
    margin-top: 0.75rem;
    font-size: 1.5rem;
}

.error-card p {
    margin: 0.6rem 0 1.75rem;
    color: var(--text-muted);
}

/* ─── Touch, motion, print ─── */
@media (pointer: coarse) {
    .copy-btn {
        min-height: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .page-actions,
    .back-link,
    .drawer-overlay {
        display: none !important;
    }

    .app-main {
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}

/* Shown under the public header while sign-in and the dashboard are closed */
.platform-notice {
    padding-block: 0.75rem;
}
