/*
 * ODZ Properties brand theme
 * ------------------------------------------------------------------
 * Palette sampled from the ODZ Properties logo:
 *   ink       #0a0a0a   logo background — the sidebar
 *   teal      #015557   the monogram block — primary brand colour.
 *                       8.6:1 on white, so it serves fills and link
 *                       text alike
 *   teal-lt   #3a9c9e   dark-mode primary, sidebar active accent
 *                       (6.1:1 on ink)
 *   cream     #f4f1ea   the ODZ wordmark — warm page background
 *   stone     #cccbc7   "PROPERTIES"
 * Type: Montserrat (Latin) + Noto Kufi Arabic; page titles in
 * Playfair Display, the nearest open face to the logo's serif.
 *
 * Everything below rides on Tabler's CSS custom properties, so it
 * layers cleanly over tabler.min.css without patching the vendor file.
 */

/* Local, not Google. The app's Content-Security-Policy has never allowed
   fonts.googleapis.com, so this import was being blocked and every weight
   below fell back to a system face. See vendor/fonts/fonts.css. */
@import url('../vendor/fonts/fonts.css?v=odz2');

:root {
    --brand-primary: #015557;
    --brand-primary-light: #3a9c9e;
    --brand-primary-dark: #01474a;
    --brand-primary-deep: #013a3c;
    --brand-ink: #0a0a0a;
    --brand-ink-soft: #1a1a1a;
    --brand-cream: #f4f1ea;
    --brand-stone: #cccbc7;
}

/* ── Typography ─────────────────────────────────────────────── */

/* Declared on the theme attributes as well as :root, and this matters.
   Tabler sets its own `--tblr-font-sans-serif` on `:root, [data-bs-theme=light]`,
   and this app puts `data-bs-theme` on <body> — so Tabler's value was being
   redefined one level *below* :root and shadowed ours everywhere it counted.
   The variable read correctly on <html> and wrongly on <body>, which is why
   the brand face never actually reached the page.

   `--tblr-body-font-family` is the second half of it: Tabler beta20 drives
   `body` from that variable, not from --tblr-font-sans-serif. Setting only
   the latter left the body text on the system stack. */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --tblr-font-sans-serif: 'Montserrat', 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --tblr-body-font-family: var(--tblr-font-sans-serif);
}

body,
.navbar,
.btn,
.form-control,
.form-select {
    font-family: var(--tblr-font-sans-serif);
}

.navbar-brand,
h1, h2, h3, .page-title, .card-title {
    letter-spacing: -0.01em;
}

/* Page titles take the wordmark's serif. Latin only: Arabic falls through
   to Noto Kufi, which has no Playfair glyphs to clash with. */
.page-title,
.page-header h2 {
    font-family: 'Playfair Display', 'Noto Kufi Arabic', Georgia, serif;
    font-weight: 600;
    letter-spacing: 0;
}

/* Warm cream page, from the wordmark, instead of Tabler's cool grey. */
[data-bs-theme='light'] body,
body[data-bs-theme='light'] {
    --tblr-body-bg: #f7f5f0;
}

/* ── Primary colour (light) ─────────────────────────────────── */
:root,
[data-bs-theme='light'] {
    --tblr-primary: #015557;
    --tblr-primary-rgb: 1, 85, 87;
    --tblr-primary-fg: #ffffff;
    --tblr-primary-darken: #01474a;
    --tblr-primary-lt: #e5efef;
    --tblr-primary-lt-rgb: 229, 239, 239;
    --tblr-primary-bg-subtle: #d6e7e7;
    --tblr-primary-border-subtle: #9cc4c5;
    --tblr-primary-text-emphasis: #013a3c;

    /* Link text needs more contrast than the fill colour provides */
    --tblr-link-color: #01474a;
    --tblr-link-color-rgb: 1, 71, 74;
    --tblr-link-hover-color: #013a3c;
    --tblr-link-hover-color-rgb: 1, 58, 60;
}

/* ── Primary colour (dark) ──────────────────────────────────── */
[data-bs-theme='dark'] {
    --tblr-primary: #3a9c9e;
    --tblr-primary-rgb: 58, 156, 158;
    --tblr-primary-fg: #0a0a0a;
    --tblr-primary-lt: #0c2222;
    --tblr-primary-lt-rgb: 12, 34, 34;
    --tblr-primary-bg-subtle: #0b1c1c;
    --tblr-primary-border-subtle: #1e4a4b;
    --tblr-primary-text-emphasis: #8fd0d1;

    --tblr-link-color: #6cc0c1;
    --tblr-link-color-rgb: 108, 192, 193;
    --tblr-link-hover-color: #94d3d4;
    --tblr-link-hover-color-rgb: 148, 211, 212;
}

/* ── Sidebar: ODZ ink, teal active state ──────────────────── */
.navbar-vertical[data-bs-theme='dark'],
.navbar-vertical.navbar-dark {
    --tblr-bg-surface: #0a0a0a;
    --tblr-navbar-bg: #0a0a0a;
    --tblr-body-bg: #0a0a0a;
    --tblr-border-color: rgba(255, 255, 255, 0.08);
    --tblr-navbar-color: rgba(255, 255, 255, 0.72);
    --tblr-navbar-hover-color: #ffffff;
    --tblr-navbar-active-color: #ffffff;
    --tblr-navbar-active-bg: rgba(58, 156, 158, 0.14);
    --tblr-navbar-active-border-color: var(--brand-primary-light);
    background-color: #0a0a0a;
}

.navbar-vertical .nav-link {
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-vertical .nav-item.active > .nav-link,
.navbar-vertical .nav-link.active {
    background-color: rgba(58, 156, 158, 0.16);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--brand-primary-light);
}

.navbar-vertical .nav-item.active > .nav-link .nav-link-icon,
.navbar-vertical .nav-link.active .nav-link-icon {
    color: var(--brand-primary-light);
}

.navbar-vertical .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.navbar-vertical .navbar-brand {
    padding-block: 0.35rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    --tblr-btn-bg: var(--brand-primary);
    --tblr-btn-color: #ffffff;
    --tblr-btn-hover-bg: var(--brand-primary-dark);
    --tblr-btn-hover-color: #ffffff;
    --tblr-btn-active-bg: var(--brand-primary-deep);
    --tblr-btn-active-color: #ffffff;
    --tblr-btn-disabled-bg: var(--brand-primary);
    --tblr-btn-disabled-color: #ffffff;
    font-weight: 600;
}

.btn-outline-primary {
    --tblr-btn-color: var(--brand-primary-dark);
    --tblr-btn-border-color: var(--brand-primary);
    --tblr-btn-hover-bg: var(--brand-primary);
    --tblr-btn-hover-border-color: var(--brand-primary);
    --tblr-btn-hover-color: #ffffff;
    --tblr-btn-active-bg: var(--brand-primary-dark);
    --tblr-btn-active-border-color: var(--brand-primary-dark);
    font-weight: 600;
}

[data-bs-theme='dark'] .btn-primary {
    --tblr-btn-bg: var(--brand-primary-light);
    --tblr-btn-color: #0a0a0a;
    --tblr-btn-hover-bg: #6cc0c1;
    --tblr-btn-hover-color: #0a0a0a;
    --tblr-btn-active-bg: #6cc0c1;
    --tblr-btn-active-color: #0a0a0a;
}

[data-bs-theme='dark'] .btn-outline-primary {
    --tblr-btn-color: var(--brand-primary-light);
    --tblr-btn-border-color: var(--brand-primary-light);
    --tblr-btn-hover-color: #0a0a0a;
}

/* ── Focus rings ────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(1, 85, 87, 0.2);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn:focus-visible,
.btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(1, 85, 87, 0.3);
}

/* ── Accents ────────────────────────────────────────────────── */
.badge.bg-primary,
.bg-primary {
    background-color: var(--brand-primary) !important;
}

.text-primary {
    color: var(--brand-primary-dark) !important;
}

[data-bs-theme='dark'] .text-primary {
    color: var(--brand-primary-light) !important;
}

.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--brand-primary);
    color: var(--brand-primary-dark);
}

.progress-bar {
    background-color: var(--brand-primary);
}

.card .card-status-top.bg-primary {
    background-color: var(--brand-primary) !important;
}

.avatar {
    --tblr-avatar-bg: var(--brand-primary-light);
}

/* Auth screens sit on a warm neutral rather than Tabler's cool grey */
.page-center {
    background-color: #f4f1ea;
}

[data-bs-theme='dark'] .page-center {
    background-color: #111111;
}

/* ── KPI stat cards ─────────────────────────────────────────────
 * The stock cards read the metric as a sentence ("44 Active Deal"),
 * which wraps badly and gives the number no weight. These put the
 * label on top, the value on its own line, and replace the four
 * saturated icon fills with one tinted brand chip.
 */
.kpi-card {
    display: block;
    height: 100%;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.kpi-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 6px 18px rgba(29, 29, 29, 0.09);
    transform: translateY(-2px);
    color: inherit;
}

.kpi-card:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.kpi-card .card-body {
    padding: 1rem 1.125rem;
}

.kpi-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tblr-secondary);
    line-height: 1.2;
    /* Reserve two lines so one- and two-line labels still put every
       value on the same baseline across the row. */
    min-height: 2.4em;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--tblr-body-color);
    margin-top: 0.35rem;
}

.kpi-sub {
    font-size: 0.8125rem;
    color: var(--tblr-secondary);
    line-height: 1.3;
    margin-top: 0.2rem;
}

.kpi-sub strong {
    font-weight: 600;
    color: var(--tblr-body-color);
    font-variant-numeric: tabular-nums;
}

/* Tinted chip instead of a saturated fill — keeps four cards on one palette */
.kpi-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(1, 85, 87, 0.13);
    color: var(--brand-primary-dark);
}

.kpi-icon .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* The one place a state colour earns its keep: overdue work */
.kpi-icon--alert {
    background: rgba(214, 57, 57, 0.12);
    color: #b02a2a;
}

.kpi-sub--alert {
    color: #b02a2a;
}

.kpi-sub--alert strong {
    color: #b02a2a;
}

[data-bs-theme='dark'] .kpi-icon {
    background: rgba(58, 156, 158, 0.16);
    color: var(--brand-primary-light);
}

[data-bs-theme='dark'] .kpi-icon--alert {
    background: rgba(214, 57, 57, 0.18);
    color: #f08c8c;
}

[data-bs-theme='dark'] .kpi-sub--alert,
[data-bs-theme='dark'] .kpi-sub--alert strong {
    color: #f08c8c;
}

[data-bs-theme='dark'] .kpi-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* ── Card hover: gold accent across the app ─────────────────────
 * Every card picks up a gold edge on hover. The lift stays reserved
 * for cards that are actually links (KPI tiles), so a static card
 * doesn't read as clickable.
 */
.card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 12px rgba(1, 85, 87, 0.14);
}

[data-bs-theme='dark'] .card:hover {
    border-color: var(--brand-primary-light);
    box-shadow: 0 2px 12px rgba(58, 156, 158, 0.16);
}

/* A card nested inside another shouldn't double up the accent */
.card .card:hover {
    box-shadow: none;
}

/* ── RTL (Arabic) ───────────────────────────────────────────────
 * Tabler's own RTL bundle handles the framework; these cover the
 * few places this app sets direction-specific values by hand.
 */
[dir='rtl'] .navbar-vertical .nav-item.active > .nav-link,
[dir='rtl'] .navbar-vertical .nav-link.active {
    /* the active rail moves to the right edge */
    box-shadow: inset -3px 0 0 var(--brand-primary-light);
}

[dir='rtl'] .notif-unread {
    border-left: 0;
    border-right: 3px solid var(--tblr-primary, #015557);
}

[dir='rtl'] .kpi-label,
[dir='rtl'] .kpi-value,
[dir='rtl'] .kpi-sub {
    text-align: right;
}

/* Numbers, prices and dates stay left-to-right inside Arabic text */
[dir='rtl'] .kpi-value,
[dir='rtl'] .text-nowrap-price,
[dir='rtl'] time {
    direction: ltr;
    unicode-bidi: embed;
}

[dir='rtl'] .kpi-value {
    text-align: right;
}

/* Noto Kufi reads better than Montserrat for Arabic UI text */
[dir='rtl'] body,
[dir='rtl'] .navbar,
[dir='rtl'] .btn,
[dir='rtl'] .form-control,
[dir='rtl'] .form-select {
    font-family: 'Noto Kufi Arabic', 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Property match score ───────────────────────────────────── */
.match-score {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    background: rgba(1, 85, 87, 0.15);
    color: var(--brand-primary-dark);
    border: 2px solid rgba(1, 85, 87, 0.35);
}

[data-bs-theme='dark'] .match-score {
    background: rgba(58, 156, 158, 0.18);
    color: var(--brand-primary-light);
    border-color: rgba(58, 156, 158, 0.4);
}

/* ── Follow-up queue ────────────────────────────────────────── */
.followup-row-overdue {
    border-left: 3px solid #d63939;
}

[dir='rtl'] .followup-row-overdue {
    border-left: 0;
    border-right: 3px solid #d63939;
}

/* ── Google Calendar connect card ───────────────────────────── */
.google-cal-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(1, 85, 87, 0.13);
    color: var(--brand-primary-dark);
}

[data-bs-theme='dark'] .google-cal-mark {
    background: rgba(58, 156, 158, 0.16);
    color: var(--brand-primary-light);
}

/* ── Viewing history date chip ──────────────────────────────── */
.viewing-date {
    flex: 0 0 46px;
    width: 46px;
    text-align: center;
    border-radius: 8px;
    padding: 4px 0 5px;
    background: rgba(1, 85, 87, 0.12);
    color: var(--brand-primary-dark);
    line-height: 1.1;
}

.viewing-date-day {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.viewing-date-month {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-bs-theme='dark'] .viewing-date {
    background: rgba(58, 156, 158, 0.16);
    color: var(--brand-primary-light);
}

/* ── Leads needing attention ────────────────────────────────── */
.lead-row-uncontacted { box-shadow: inset 3px 0 0 #f59f00; }
.lead-row-overdue     { box-shadow: inset 3px 0 0 #d63939; }

[dir='rtl'] .lead-row-uncontacted { box-shadow: inset -3px 0 0 #f59f00; }
[dir='rtl'] .lead-row-overdue     { box-shadow: inset -3px 0 0 #d63939; }

/* ── Lead sources: donut + legend ────────────────────────────────
 * The legend is laid out here rather than by ApexCharts, whose default
 * flows items in ragged columns, wraps long names mid-phrase and shows
 * no values. Each row is a grid, so swatches, names, counts and shares
 * line up in four columns however long a name runs.
 */
.source-donut {
    margin-bottom: 0.25rem;
}

.source-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.source-legend-item {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    align-items: baseline;
    column-gap: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.source-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    align-self: center;
}

/* Text wears text tokens; the swatch beside it carries identity */
.source-name {
    color: var(--tblr-body-color);
    overflow-wrap: anywhere;
}

.source-count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--tblr-body-color);
}

.source-pct {
    font-variant-numeric: tabular-nums;
    color: var(--tblr-secondary);
    min-width: 2.6em;
    text-align: right;
}

/* ── Price comparison: asking vs administrative vs market ────── */
.price-cell {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    background: var(--tblr-bg-surface-secondary, #f8f9fa);
    height: 100%;
}

.price-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tblr-secondary);
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--tblr-body-color);
    /* A price that wraps reads as two numbers */
    white-space: nowrap;
}

.price-sub {
    font-size: 0.73rem;
    color: var(--tblr-secondary);
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

/* The administrative price needs explaining — it is a tax base, not a market price */
.price-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(1, 85, 87, 0.2);
    color: var(--brand-primary-dark);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: help;
    margin-left: 2px;
}

[data-bs-theme='dark'] .price-cell {
    background: rgba(255, 255, 255, 0.04);
}

[data-bs-theme='dark'] .price-hint {
    background: rgba(58, 156, 158, 0.22);
    color: var(--brand-primary-light);
}

/* ── Viewing check-in ────────────────────────────────────────────
 * Sized for a phone held one-handed in a stairwell: a large target,
 * high contrast, and no small tap areas.
 */
.check-in-card {
    border-color: var(--brand-primary);
}

.check-in-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(1, 85, 87, 0.14);
    color: var(--brand-primary-dark);
}

.check-in-mark--done {
    background: rgba(47, 179, 68, 0.14);
    color: #2fb344;
}

.check-in-button {
    min-height: 48px;
    min-width: 140px;
    font-weight: 600;
}

@media (max-width: 575px) {
    /* Full width on a phone — the primary action of the screen */
    .check-in-button,
    #check-in-form {
        width: 100%;
    }
}

[data-bs-theme='dark'] .check-in-mark {
    background: rgba(58, 156, 158, 0.18);
    color: var(--brand-primary-light);
}

/* ── My Day: the agent's landing screen ──────────────────────────
 * Built for a phone held one-handed: big numbers, one row per job,
 * and the action always on the right at a full-size target.
 */
.myday-counts a { text-decoration: none; }

.myday-count {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: var(--tblr-bg-surface, #fff);
    border: 1px solid var(--tblr-border-color);
    height: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.myday-count:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 12px rgba(1, 85, 87, 0.14);
}

.myday-count-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--tblr-body-color);
}

.myday-count-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--tblr-secondary);
}

.myday-count--alert .myday-count-value { color: #d63939; }

/* One job per row */
.myday-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
}

.myday-time {
    flex: 0 0 54px;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--brand-primary-dark);
    text-align: center;
}

.myday-time--small {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}

.myday-action {
    flex: 0 0 auto;
    min-width: 96px;
}

.myday-action .btn {
    min-height: 40px;
}

[data-bs-theme='dark'] .myday-time { color: var(--brand-primary-light); }

/* On a phone the action drops to its own full-width line */
@media (max-width: 480px) {
    .myday-row {
        flex-wrap: wrap;
        row-gap: 0.6rem;
    }
    .myday-action {
        flex: 1 1 100%;
        min-width: 0;
    }
    .myday-count-value { font-size: 1.4rem; }
}

/* ── My Day: the week's chart ────────────────────────────────────
 * The totals above the chart double as each series' direct label, so
 * identity never rests on colour alone.
 */
.week-key {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--tblr-secondary);
}

.week-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Chart-safe steps of the series hues — the brand gold is too
   desaturated to carry a series and reads grey beside the blue. */
.week-swatch--contacts { background: #a87c1f; }
.week-swatch--viewings { background: #2a78d6; }

[data-bs-theme='dark'] .week-swatch--contacts { background: #ad8a24; }
[data-bs-theme='dark'] .week-swatch--viewings { background: #3987e5; }

.week-total {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    color: var(--tblr-body-color);
    margin-top: 0.1rem;
}

.week-delta {
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

.week-delta.up   { color: #2fb344; }
.week-delta.down { color: #d63939; }

.week-prev {
    font-size: 0.72rem;
    color: var(--tblr-secondary);
    font-variant-numeric: tabular-nums;
}

/* ── Sidebar count badges ────────────────────────────────────────
 * Tabler positions a badge inside a nav-link absolutely at top/right 0
 * with translate(50%, -50%) — that is for a small round dot sitting on
 * an icon. On a full-width row a wide count like "129" is thrown half
 * outside the sidebar and clipped by its scroll overflow.
 *
 * These badges belong in the flow, pushed to the right by ms-auto.
 */
/* Tabler's rule is `.navbar .navbar-nav .nav-link .badge`, so this has to
   match its specificity to win — and stays scoped to the sidebar, leaving
   the top bar's notification dot alone. */
.navbar-vertical .navbar-nav .nav-link .badge {
    position: static;
    transform: none;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1.2;
}

[dir='rtl'] .navbar-vertical .navbar-nav .nav-link .badge {
    margin-left: 0;
    margin-right: auto;
}

/* Let a long label give way to the badge rather than pushing it out */
.navbar-vertical .nav-link-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Arabic reading type ─────────────────────────────────────────
 *
 * Noto Kufi is a display face. It is the right choice for the sidebar, buttons
 * and headings — short, bold, wide — and the wrong one for anything read at
 * length: a paragraph set in Kufi is tiring by the second line, which is why
 * an Arabic report in it looks like a bank poster rather than a document.
 *
 * So Kufi keeps the chrome, and Noto Naskh — same family, no brand conflict —
 * takes the running text. Naskh is what Arabic prose is actually read in.
 */
[dir='rtl'] p,
[dir='rtl'] .card-body,
[dir='rtl'] .datagrid-content,
[dir='rtl'] .timeline-content,
[dir='rtl'] .activity-body,
[dir='rtl'] textarea,
[dir='rtl'] .text-body,
[dir='rtl'] .lead {
    font-family: 'Noto Naskh Arabic', 'Noto Kufi Arabic', serif;
    line-height: 1.85;
}

/* Negative tracking visibly damages Arabic letter joining — the glyphs are
 * connected, so pulling them together breaks the join rather than tightening
 * the word. The Latin rule above must not reach RTL. */
[dir='rtl'] .navbar-brand,
[dir='rtl'] h1,
[dir='rtl'] h2,
[dir='rtl'] h3,
[dir='rtl'] .page-title,
[dir='rtl'] .card-title,
[dir='rtl'] .nav-link-title {
    letter-spacing: 0;
}

/* Arabic at 700 in Kufi reads as a warning sign rather than a heading. */
[dir='rtl'] h1,
[dir='rtl'] h2,
[dir='rtl'] h3,
[dir='rtl'] .page-title,
[dir='rtl'] .card-title {
    font-weight: 600;
}

/* Every Latin run, price and time inside Arabic prose is isolated so the
 * bidirectional algorithm cannot reorder it mid-line. Without this a sentence
 * renders correctly most of the time, which in front of a client is the same
 * as not at all. */
bdi {
    unicode-bidi: isolate;
}

/* A listing with no photograph: a quiet dashed tile that opens the Listing
 * Studio. Quiet on purpose — the book should read as a list of properties,
 * not as a wall of warnings. */
.listing-nophoto {
    width: 64px;
    height: 48px;
    border: 1.5px dashed var(--tblr-border-color, #d9dbde);
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--tblr-secondary, #8a8f98);
}
.listing-nophoto:hover { border-color: var(--brand-primary, #015557); color: var(--brand-primary, #015557); }

/* ── Sale rail ───────────────────────────────────────────────
 *
 * Where a listing has reached, read left to right. It is a list, not a
 * decoration: an <ol> of steps with the connecting line drawn between the
 * dots, so a screen reader hears the sequence and a sighted reader sees it.
 *
 * One unbroken row, always. Wrapping was the first attempt and it reads badly
 * — the second row starts with a connector reaching back to a dot that is
 * above it, and the rows divide the stages at whatever point the column width
 * happens to fall. A pipeline is one line or it is not a pipeline, so on a
 * narrow screen it scrolls inside its own box rather than breaking apart.
 */
.sale-rail {
    display: flex;
    flex-wrap: nowrap;
    list-style: none;
    margin: 0;
    padding: 0 0 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.sale-rail-step {
    position: relative;
    /* Share the width rather than claim a basis: nine sale stages in a column
     * this narrow have to fit, and a fixed basis pushed the last two off the
     * edge where nothing said they were there. The floor is where legibility
     * gives out, and only below it does the rail scroll. */
    flex: 1 1 0;
    min-width: 66px;
    padding: 0 3px;
    text-align: center;
    color: var(--tblr-secondary);
}

/* Reaching back to the previous dot rather than forward to the next means the
 * first step needs no special case and the last never trails into space. */
.sale-rail-step::before {
    content: '';
    position: absolute;
    top: 7px;
    right: 50%;
    left: -50%;
    height: 2px;
    background: var(--tblr-border-color);
}

.sale-rail-step:first-child::before {
    display: none;
}

.sale-rail-dot {
    position: relative;
    z-index: 1;
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto 6px;
    border: 2px solid var(--tblr-border-color);
    border-radius: 50%;
    background: var(--tblr-bg-surface);
}

.sale-rail-label {
    display: block;
    font-size: 0.75rem;
    line-height: 1.25;
}

/* Reached. Gold rather than green: green is the app's "completed" colour and
 * a passed stage is not a completed sale. */
.sale-rail-step--done .sale-rail-dot {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
}

.sale-rail-step--done::before {
    background: var(--brand-primary);
}

.sale-rail-step--done .sale-rail-label {
    color: var(--tblr-body-color);
}

/* Where it is now. The ring makes the current step findable without reading
 * every label, which is the whole question the rail answers. */
.sale-rail-step--current .sale-rail-dot {
    border-color: var(--brand-primary);
    background: var(--tblr-bg-surface);
    box-shadow: 0 0 0 4px rgba(1, 85, 87, 0.2);
}

.sale-rail-step--current::before {
    background: var(--brand-primary);
}

.sale-rail-step--current .sale-rail-label {
    font-weight: 600;
    color: var(--tblr-body-color);
}

.sale-rail-step--lost .sale-rail-dot {
    border-color: var(--tblr-danger);
    background: var(--tblr-danger);
}

.sale-rail-step--lost::before {
    background: var(--brand-primary);
}

.sale-rail-step--lost .sale-rail-label {
    font-weight: 600;
    color: var(--tblr-danger);
}

/* A stage with an explanation behind it is worth pointing at. */
.sale-rail-label[data-bs-toggle='tooltip'] {
    cursor: help;
    text-decoration: underline dotted var(--tblr-border-color);
    text-underline-offset: 3px;
}

/* The date the current stage was reached, under the rail rather than under its
 * dot — hung on the step it made that one column twice the height of the rest
 * and pulled the whole row off balance. */
.sale-rail-caption {
    margin-top: 10px;
    font-size: 0.8125rem;
    color: var(--tblr-secondary);
}

/* Arabic reads right to left, and so does the rail — the connector has to
 * turn round with it or every line points back at the step before. */
[dir='rtl'] .sale-rail-step::before {
    right: -50%;
    left: 50%;
}

/* ── A listing's rail on My Day ──────────────────────────────
 *
 * The same rail, one per listing, so it has to be quieter: smaller dots and
 * labels, and no room for the stage a listing is heading towards to shout
 * over the one it is at.
 */
.myday-listing {
    padding: 0.85rem 1rem 0.75rem;
}

/* A listing going stale is the reason this card exists, so it is marked on the
 * row rather than left to the reader to work out from the day count. */
.myday-listing--stale {
    box-shadow: inset 3px 0 0 #d63939;
}

.sale-rail--compact .sale-rail-step {
    min-width: 52px;
}

.sale-rail--compact .sale-rail-dot {
    width: 11px;
    height: 11px;
    margin-bottom: 4px;
}

.sale-rail--compact .sale-rail-step::before {
    top: 4.5px;
}

.sale-rail--compact .sale-rail-label {
    font-size: 0.68rem;
}

.sale-rail--compact .sale-rail-step--current .sale-rail-dot {
    box-shadow: 0 0 0 3px rgba(1, 85, 87, 0.2);
}

.sale-rail--compact + .sale-rail-caption {
    margin-top: 6px;
    font-size: 0.75rem;
}

[dir='rtl'] .myday-listing--stale {
    box-shadow: inset -3px 0 0 #d63939;
}
