/* ==========================================================================
   Stayline - Accommodation Broker Tracker
   Custom design system (no Bootstrap). Mobile-first, responsive throughout.
   ========================================================================== */

/* ---------------------------------------------------------------- theme
   Light is the default (:root). [data-theme="dark"] on <html> overrides
   it. The accent gradient stays identical in both themes for brand
   consistency - only surfaces/text/borders/shadows swap. */

:root {
    --bg: #f6f7fb;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f2f8;
    --border: #dfe3ec;
    --border-soft: #e8eaf1;

    --text: #171a21;
    --text-muted: #5b6373;
    --text-faint: #8890a0;

    --accent: #6d4fe0;
    --accent-2: #0ea885;
    --accent-3: #e8703a;
    --accent-grad: linear-gradient(135deg, #6d4fe0 0%, #0ea885 130%);

    --success: #0ea885;
    --success-bg: rgba(14, 168, 133, 0.12);
    --warning: #b4790c;
    --warning-bg: rgba(180, 121, 12, 0.12);
    --danger: #dc2f4c;
    --danger-bg: rgba(220, 47, 76, 0.1);
    --info: #2f7fe0;
    --info-bg: rgba(47, 127, 224, 0.1);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow: 0 10px 30px rgba(20, 24, 31, 0.08);
    --shadow-sm: 0 4px 14px rgba(20, 24, 31, 0.06);

    --sidebar-w: 248px;
}

html[data-theme="dark"] {
    --bg: #0d1117;
    --bg-elevated: #131a24;
    --surface: #171f2b;
    --surface-2: #1e2734;
    --border: #29323f;
    --border-soft: #232b37;

    --text: #eef1f6;
    --text-muted: #93a1b5;
    --text-faint: #64748b;

    --accent: #7c5cff;
    --accent-2: #22d3a0;
    --accent-3: #ff8a5b;
    --accent-grad: linear-gradient(135deg, #7c5cff 0%, #22d3a0 130%);

    --success: #22d3a0;
    --success-bg: rgba(34, 211, 160, 0.14);
    --warning: #f5b942;
    --warning-bg: rgba(245, 185, 66, 0.14);
    --danger: #ff5d6c;
    --danger-bg: rgba(255, 93, 108, 0.14);
    --info: #5ba9ff;
    --info-bg: rgba(91, 169, 255, 0.14);

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
}

body, .sidebar, .card, .stat-card, .form-control, .auth-card, .detail-item, .data-table td, .payment-row {
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: "Sora", "Plus Jakarta Sans", sans-serif;
    color: var(--text);
    margin: 0 0 0.4em;
    letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
p { color: var(--text-muted); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- shell */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
    transition: transform 0.25s ease;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 26px;
}

.sidebar__brand-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    color: #0d1117;
}

.sidebar__brand-text {
    font-family: "Sora", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar__nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar__nav-link svg { width: 18px; height: 18px; opacity: 0.85; }

.sidebar__nav-link:hover { background: var(--surface); color: var(--text); }
.sidebar__nav-link--muted { font-size: 0.85rem; }

.sidebar__footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #0d1117;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar__user-name { font-weight: 700; font-size: 0.88rem; }
.sidebar__user-role { font-size: 0.76rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 60;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.mobile-nav-toggle span {
    width: 18px; height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 30;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
}

.page {
    padding: 28px 32px 60px;
    max-width: 1280px;
}

/* ---------------------------------------------------------------- page header */

.page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page__title { font-size: 1.5rem; font-weight: 800; }
.page__subtitle { color: var(--text-muted); font-size: 0.92rem; margin-top: 2px; }
.page__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- stat cards */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent-grad);
    opacity: 0.05;
}

.stat-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.stat-card__value {
    font-family: "Sora", sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    margin-top: 6px;
}

.stat-card__hint { font-size: 0.8rem; color: var(--text-faint); margin-top: 4px; }

.stat-card--warning .stat-card__value { color: var(--warning); }
.stat-card--danger .stat-card__value { color: var(--danger); }
.stat-card--success .stat-card__value { color: var(--success); }

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    margin-bottom: 22px;
}

.card__header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card__title { font-size: 1.02rem; font-weight: 700; }
.card__body { padding: 22px; }
.card__body--flush { padding: 0; }

.partner-booking-list { display: flex; flex-direction: column; }
.partner-booking-item { padding: 20px 22px; border-bottom: 1px solid var(--border-soft); }
.partner-booking-item:last-child { border-bottom: none; }
.partner-booking-item__head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.partner-booking-item__info { min-width: 0; }
.card__footer { padding: 16px 22px; border-top: 1px solid var(--border-soft); }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.data-table th {
    text-align: left;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft);
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.9rem;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }

.cell-primary { font-weight: 700; }
.cell-muted { color: var(--text-muted); font-size: 0.82rem; }
.cell-amount { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Stack two lines inside one table cell (e.g. name + phone) instead of <br> -
   keeps the responsive mobile "card" row layout from breaking. */
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stack > * { min-width: 0; overflow-wrap: break-word; }

.row-link { cursor: pointer; }

/* ---------------------------------------------------------------------
   Mobile card list - a genuinely separate markup block (not a CSS trick
   on top of <table>) shown only on narrow screens, with the real <table>
   hidden in its place. This is deliberately two independent renderings
   of the same data rather than fighting table/thead/td display overrides,
   which is far more reliable across browsers.
   ------------------------------------------------------------------- */

.desktop-only { display: block; }
.mobile-cards { display: none; }

.m-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.m-card + .m-card { margin-top: 12px; }

.m-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.m-card__badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

.m-card__title { font-weight: 700; font-size: 1rem; color: var(--text); word-break: break-word; }
.m-card__subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; word-break: break-word; }

.m-card__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}

.m-card__grid--single { grid-template-columns: 1fr; }

.m-card__field { min-width: 0; }
.m-card__field-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    font-weight: 700;
}
.m-card__field-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 3px;
    word-break: break-word;
}
.m-card__field-value--danger { color: var(--danger); }
.m-card__field-value--success { color: var(--success); }

.m-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}
.m-card__actions .btn { flex: 1; min-width: 90px; }
.m-card__actions form { flex: 1; min-width: 90px; }
.m-card__actions form .btn { width: 100%; }

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge--upcoming { background: var(--info-bg); color: var(--info); }
.badge--checkedin { background: var(--success-bg); color: var(--success); }
.badge--checkedout { background: var(--surface-2); color: var(--text-muted); }
.badge--cancelled { background: var(--danger-bg); color: var(--danger); }
.badge--paid { background: var(--success-bg); color: var(--success); }
.badge--partial { background: var(--warning-bg); color: var(--warning); }
.badge--pending { background: var(--danger-bg); color: var(--danger); }
.badge--neutral { background: var(--surface-2); color: var(--text-muted); }

/* ---------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.86rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
    background: var(--surface-2);
    color: var(--text);
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn--primary { background: var(--accent-grad); color: #0d1117; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--sm { padding: 7px 14px; font-size: 0.78rem; }
.btn--block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------- forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-grid--single { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--span2 { grid-column: 1 / -1; }

.form-label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }

.form-control {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

select.form-control { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 13px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 0.76rem; color: var(--text-faint); }
.field-validation-error, .form-error { color: var(--danger); font-size: 0.78rem; font-weight: 600; }
.input-validation-error { border-color: var(--danger) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; color: var(--danger); font-size: 0.85rem; }
.validation-summary-errors { background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 42px; height: 24px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    position: relative;
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.15s ease, background 0.15s ease;
}
.switch input:checked + .switch__track { background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--accent); }
.switch__label { font-size: 0.88rem; font-weight: 600; color: var(--text); }

/* sun/moon theme toggle button */
.theme-toggle-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle-btn svg { width: 19px; height: 19px; }
.theme-toggle-btn .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }

.theme-toggle-floating {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
    box-shadow: var(--shadow-sm);
    border-radius: 50px;
}

.sidebar__theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 4px;
}
.sidebar__theme-row span { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }

fieldset.conditional-fields {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ---------------------------------------------------------------- alerts */

.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.88rem;
    font-weight: 600;
}

.alert--success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.alert--error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

/* ---------------------------------------------------------------- empty state */

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-faint);
}

.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.6; }

/* ---------------------------------------------------------------- auth pages */

.auth-body { background: radial-gradient(circle at 20% 20%, #eceffb 0%, #f6f7fb 55%); }
html[data-theme="dark"] .auth-body { background: radial-gradient(circle at 20% 20%, #17203a 0%, #0d1117 55%); }

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 34px 30px;
    box-shadow: var(--shadow);
}

.auth-card__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.auth-card h1 { font-size: 1.3rem; margin-bottom: 6px; }
.auth-card p.lead { margin-bottom: 22px; font-size: 0.88rem; }

/* ---------------------------------------------------------------- misc */

.section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    font-weight: 700;
    margin: 26px 0 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-item { background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 14px 16px; }
.detail-item__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); font-weight: 700; }
.detail-item__value { font-size: 1.1rem; font-weight: 700; margin-top: 4px; }
.detail-item--positive .detail-item__value { color: var(--success); }
.detail-item--warning .detail-item__value { color: var(--warning); }
.detail-item--danger .detail-item__value { color: var(--danger); }

.link { color: var(--accent-2); font-weight: 600; }
.link:hover { text-decoration: underline; }

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 160px; }
.filter-bar__search { flex: 1; min-width: 220px; }
.filter-bar__count { font-size: 0.82rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* Card grid used by list views that show cards at every screen size
   (not just mobile) - columns adapt automatically via auto-fill, so no
   separate desktop/mobile markup or media query is needed here. */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.pagination-bar__info { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

.payment-list { display: flex; flex-direction: column; gap: 10px; }
.payment-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); flex-wrap: wrap; }
.payment-row__meta { font-size: 0.78rem; color: var(--text-faint); }

/* ---------------------------------------------------------------- progress bar
   Paid-vs-pending indicator used on Dealers/Partners list + detail pages. */

.progress { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress__fill { height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width 0.25s ease; }
.progress__fill--full { background: var(--success); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row__pct { font-size: 0.74rem; font-weight: 700; color: var(--text-faint); white-space: nowrap; min-width: 34px; text-align: right; }

/* ---------------------------------------------------------------- ranked pending list
   Compact "who owes / is owed the most" widget used on the admin dashboard. */

.rank-list { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border-soft); transition: background 0.15s ease; }
.rank-row:last-child { border-bottom: none; }
a.rank-row:hover { background: var(--surface-2); }
.rank-row__num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.rank-row__body { flex: 1; min-width: 0; }
.rank-row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rank-row__name { font-weight: 700; font-size: 0.92rem; }
.rank-row__amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-row__sub { font-size: 0.76rem; color: var(--text-faint); margin-top: 6px; }

/* ---------------------------------------------------------------- summary/detail cell
   Name + secondary info stacked inside a table cell or mobile card - used on the
   Dealers/Partners tables to show name + booking count together. */

.summary-cell__name { font-weight: 700; }
.summary-cell__meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ==========================================================================
   Responsive breakpoints - nothing should ever overflow or break on mobile
   ========================================================================== */

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow); }
    .mobile-nav-toggle { display: flex; }
    .mobile-nav-toggle.is-hidden { display: none; }
    .mobile-nav-overlay.is-open { display: block; }
    .main { margin-left: 0; }
    .page { padding: 78px 16px 50px; }
    .form-grid, fieldset.conditional-fields { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .page { padding: 78px 14px 40px; }
    .page__header { flex-direction: column; align-items: stretch; }
    .page__title { font-size: 1.25rem; }
    .page__actions { width: 100%; }
    .page__actions .btn { flex: 1; }

    .card { border-radius: var(--radius); margin-bottom: 16px; }
    .card__header { padding: 16px 16px; }
    .card__body { padding: 16px; }

    /* Cards whose table normally sits flush (padding:0) get breathing room back
       once the table collapses into stacked mobile rows. */
    .card__body--flush { padding: 12px 10px 16px; }
    .partner-booking-item { padding: 16px; }
    .rank-row { padding: 12px 16px; gap: 10px; }
    .rank-row__name { font-size: 0.88rem; }
    .rank-row__amount { font-size: 0.9rem; }

    .stat-grid { gap: 12px; margin-bottom: 20px; }
    .stat-card { padding: 14px 16px; }

    .detail-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-control { width: 100%; min-width: 0; }
    .filter-bar .btn { width: 100%; }
    .filter-bar__count { margin-left: 0; }

    .card-grid { grid-template-columns: 1fr; }
    .pagination-bar { gap: 10px; }

    /* Swap the real <table> out for the separate mobile card markup - two
       independent renderings of the same data, toggled by plain display,
       instead of forcing table/thead/td to behave like flex rows (which is
       what silently broke before). !important here is deliberate belt-and-
       braces given how often stale/cached CSS has bitten this project. */
    .desktop-only { display: none !important; }
    .mobile-cards { display: block !important; }
}

@media (max-width: 480px) {
    .auth-card { padding: 26px 20px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card__value { font-size: 1.3rem; }
    .detail-grid { grid-template-columns: 1fr; }
}
