/* ============================================================================
   PropRent — Design System (Phase I: Polish)
   ----------------------------------------------------------------------------
   Single source of truth. Corporate enterprise direction.
   Tokens → Base → Layout shell → Components → Page patterns → RTL → Responsive.
   Light + dark themes via [data-theme] on <html>.
   Brand colors driven by --brand-* vars (overridable by white-label inline).
   ========================================================================== */

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
}
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-inline-start: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--border-color); margin: var(--space-5) 0; }

::selection { background: var(--brand-100); color: var(--brand-900); }

/* ── Design tokens (LIGHT) ──────────────────────────────────────────────── */
:root {
    /* Brand — corporate blue, overridable by white-label */
    --brand-primary:        #1d4ed8;
    --brand-primary-hover:  #1e40af;
    --brand-primary-active: #1e3a8a;
    --brand-secondary:      #2563eb;
    --brand-accent:         #0ea5e9;

    --brand-50:   #eff6ff;
    --brand-100:  #dbeafe;
    --brand-200:  #bfdbfe;
    --brand-300:  #93c5fd;
    --brand-500:  #3b82f6;
    --brand-600:  #2563eb;
    --brand-700:  #1d4ed8;
    --brand-800:  #1e40af;
    --brand-900:  #1e3a8a;

    /* Neutrals — slate-cool */
    --ink-50:   #f8fafc;
    --ink-100:  #f1f5f9;
    --ink-200:  #e2e8f0;
    --ink-300:  #cbd5e1;
    --ink-400:  #94a3b8;
    --ink-500:  #64748b;
    --ink-600:  #475569;
    --ink-700:  #334155;
    --ink-800:  #1e293b;
    --ink-900:  #0f172a;

    /* Semantic */
    --ok-50:    #ecfdf5; --ok-100:   #d1fae5; --ok-500:   #10b981; --ok-600:  #059669; --ok-700:   #047857;
    --warn-50:  #fffbeb; --warn-100: #fef3c7; --warn-500: #f59e0b; --warn-600:#d97706; --warn-700: #b45309;
    --err-50:   #fef2f2; --err-100:  #fee2e2; --err-500:  #ef4444; --err-600: #dc2626; --err-700:  #b91c1c;
    --info-50:  #eff6ff; --info-100: #dbeafe; --info-500: #3b82f6; --info-600:#2563eb; --info-700: #1d4ed8;

    /* Surfaces */
    --bg-app:        #f6f8fb;
    --bg-surface:    #ffffff;
    --bg-surface-2:  #f1f5f9;
    --bg-surface-3:  #e2e8f0;
    --bg-overlay:    rgba(15, 23, 42, 0.45);

    /* Text */
    --text-primary:   var(--ink-900);
    --text-secondary: var(--ink-600);
    --text-muted:     var(--ink-500);
    --text-soft:      var(--ink-400);
    --text-on-brand:  #ffffff;

    /* Border */
    --border-color:    #e2e8f0;
    --border-strong:   #cbd5e1;
    --border-focus:    var(--brand-primary);
    --border-focus-ring: rgba(29, 78, 216, 0.18);

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Cairo", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --text-xs:   0.75rem;       /* 12 */
    --text-sm:   0.8125rem;     /* 13 */
    --text-base: 0.875rem;      /* 14 */
    --text-md:   0.9375rem;     /* 15 */
    --text-lg:   1.0625rem;     /* 17 */
    --text-xl:   1.25rem;       /* 20 */
    --text-2xl:  1.5rem;        /* 24 */
    --text-3xl:  1.875rem;      /* 30 */

    --leading-tight: 1.25;
    --leading-snug:  1.4;
    --leading-base:  1.5;
    --leading-loose: 1.65;

    /* Spacing — 4px base */
    --space-0:  0;
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-7:  1.75rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius — corporate-tight */
    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 14px;
    --radius-full: 9999px;

    /* Shadow — subtle, structural */
    --shadow-1: 0 1px 1px rgba(15, 23, 42, 0.04);
    --shadow-2: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
    --shadow-3: 0 4px 8px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-4: 0 12px 20px -8px rgba(15, 23, 42, 0.14), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
    --shadow-focus: 0 0 0 3px var(--border-focus-ring);

    /* Transitions */
    --t-fast:   120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-normal: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow:   260ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --sidebar-w:           248px;
    --sidebar-w-collapsed: 64px;
    --header-h:            60px;
    --content-max:         1400px;

    /* Tabular nums helper (apply to numeric cells) */
    --num-tabular: 'tnum' 1, 'lnum' 1;
}

/* ── Design tokens (DARK) ───────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-app:        #0b1220;
    --bg-surface:    #111a2c;
    --bg-surface-2:  #182238;
    --bg-surface-3:  #1f2c45;
    --bg-overlay:    rgba(0, 0, 0, 0.65);

    --text-primary:   #e6ebf3;
    --text-secondary: #aab4c5;
    --text-muted:     #7a8499;
    --text-soft:      #5b6580;

    --border-color:  #1f2c45;
    --border-strong: #2c3a58;
    --border-focus-ring: rgba(59, 130, 246, 0.30);

    --ink-50:  #0e1729;
    --ink-100: #14213a;
    --ink-200: #1f2c45;
    --ink-300: #2c3a58;
    --ink-400: #4a5876;
    --ink-500: #7a8499;
    --ink-600: #aab4c5;
    --ink-700: #c5cdda;
    --ink-800: #e6ebf3;
    --ink-900: #f4f6fb;

    --brand-50:   rgba(37, 99, 235, 0.10);
    --brand-100:  rgba(37, 99, 235, 0.18);
    --brand-200:  rgba(37, 99, 235, 0.30);

    --ok-50:    rgba(16, 185, 129, 0.12);
    --warn-50:  rgba(245, 158, 11, 0.12);
    --err-50:   rgba(239, 68, 68, 0.12);
    --info-50:  rgba(59, 130, 246, 0.12);

    --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.30);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.25);
    --shadow-3: 0 4px 8px -2px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.30);
    --shadow-4: 0 12px 20px -8px rgba(0, 0, 0, 0.55), 0 4px 8px -4px rgba(0, 0, 0, 0.35);
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
    color: var(--text-primary);
    margin: 0 0 var(--space-3);
    font-weight: 600;
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }
p { margin: 0 0 var(--space-3); line-height: var(--leading-base); }
small { color: var(--text-muted); font-size: var(--text-xs); }
strong { font-weight: 600; }
code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 1px 5px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.page-heading { font-size: var(--text-2xl); margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.page-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: calc(-1 * var(--space-3)) 0 var(--space-5);
}
.section-heading {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.section-heading i { width: 16px; height: 16px; color: var(--brand-primary); }
.eyebrow {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* numeric helpers */
.num,
.stat__value,
.kv-list dd,
.lookup-table td.num,
.money,
.booking-card__footer strong,
.property-card__price {
    font-feature-settings: var(--num-tabular);
    font-variant-numeric: tabular-nums lining-nums;
}

/* ── Layout shell ───────────────────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr auto;
    grid-template-areas:
        "sidebar header"
        "sidebar main"
        "sidebar footer";
    min-height: 100vh;
}
.app-shell.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* Header */
.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-6);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-header__hamburger { display: none; }
.app-header__spacer { flex: 1 1 auto; }
.app-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}
.app-header__search {
    flex: 0 1 320px;
    position: relative;
    display: flex;
    align-items: center;
}
.app-header__search input {
    width: 100%;
    padding: 7px var(--space-3) 7px 34px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
[dir="rtl"] .app-header__search input { padding: 7px 34px 7px var(--space-3); }
.app-header__search input::placeholder { color: var(--text-muted); }
.app-header__search input:focus {
    outline: 0;
    background: var(--bg-surface);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.app-header__search i {
    position: absolute;
    left: var(--space-3);
    width: 16px; height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
[dir="rtl"] .app-header__search i { left: auto; right: var(--space-3); }

/* Sidebar */
.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width var(--t-normal);
}
[dir="rtl"] .app-sidebar { border-right: 0; border-left: 1px solid var(--border-color); }

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-5);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    min-height: var(--header-h);
    background: var(--bg-surface);
}
.app-sidebar__brand:hover { text-decoration: none; color: var(--text-primary); }
.app-sidebar__brand-mark {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: var(--text-base);
    flex-shrink: 0;
    letter-spacing: 0;
}
.app-sidebar__brand-logo { height: 28px; width: auto; flex-shrink: 0; }
.app-sidebar__brand-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--text-md);
    letter-spacing: -0.01em;
}
.app-sidebar.is-collapsed .app-sidebar__brand-name { display: none; }

.app-sidebar__nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-sidebar__group-label {
    padding: var(--space-3) var(--space-3) var(--space-1);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-soft);
}
.app-sidebar__nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--text-sm);
    transition: background var(--t-fast), color var(--t-fast);
}
.app-sidebar__nav-item:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    text-decoration: none;
}
.app-sidebar__nav-item.is-active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}
.app-sidebar__nav-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    background: var(--brand-primary);
}
[dir="rtl"] .app-sidebar__nav-item.is-active::before {
    left: auto;
    right: 0;
    border-radius: var(--radius-xs) 0 0 var(--radius-xs);
}
[data-theme="dark"] .app-sidebar__nav-item.is-active {
    background: var(--brand-100);
    color: var(--text-primary);
}
.app-sidebar__nav-item i {
    width: 18px; height: 18px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.85;
}
.app-sidebar__nav-item.is-active i { opacity: 1; color: var(--brand-primary); }
.app-sidebar.is-collapsed .app-sidebar__nav-label,
.app-sidebar.is-collapsed .app-sidebar__group-label { display: none; }
.app-sidebar.is-collapsed .app-sidebar__nav-item { justify-content: center; padding: var(--space-2); }

.app-sidebar__footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-color);
}
.app-sidebar__toggle {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    transition: background var(--t-fast), color var(--t-fast);
}
.app-sidebar__toggle:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* Main */
.app-main {
    grid-area: main;
    padding: var(--space-6);
    overflow-x: hidden;
    max-width: 100%;
}
.app-main > * + * { margin-top: 0; }

/* Footer */
.app-footer {
    grid-area: footer;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: var(--text-xs);
    flex-wrap: wrap;
    gap: var(--space-2);
}
.app-footer__brand strong {
    color: var(--text-primary);
    margin-inline-end: var(--space-2);
    font-weight: 600;
}
.app-footer__brand small { color: var(--text-muted); }

/* Sidebar mobile backdrop */
.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 40;
}
.app-sidebar-backdrop.is-active { display: block; }

/* ── Header chrome: icon-btn / lang-pill / user-menu ─────────────────────── */
.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0;
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
.icon-btn:focus-visible {
    outline: 0;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.icon-btn i { width: 18px; height: 18px; }

.lang-pill {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.lang-pill:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
    text-decoration: none;
    border-color: var(--border-strong);
}

.user-menu { position: relative; }
.user-menu__trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px var(--space-3) 4px 4px;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: background var(--t-fast), border-color var(--t-fast);
}
[dir="rtl"] .user-menu__trigger { padding: 4px 4px 4px var(--space-3); }
.user-menu__trigger:hover { background: var(--bg-surface-2); border-color: var(--border-strong); }
.user-menu__avatar {
    width: 28px; height: 28px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
}
.user-menu__name {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu__chevron { width: 14px; height: 14px; opacity: 0.6; }
.user-menu__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-3);
    min-width: 220px;
    padding: var(--space-1);
    z-index: 40;
}
[dir="rtl"] .user-menu__panel { right: auto; left: 0; }
.user-menu__panel-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 var(--space-1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-menu__panel a, .user-menu__panel button, .user-menu__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    width: 100%;
    background: transparent;
    border: 0;
    text-align: inherit;
    font-size: var(--text-sm);
    transition: background var(--t-fast);
}
.user-menu__panel a:hover, .user-menu__panel button:hover, .user-menu__item:hover {
    background: var(--bg-surface-2);
    text-decoration: none;
}
.user-menu__item--danger { color: var(--err-700); }
.user-menu__item--danger:hover { background: var(--err-50); }
.user-menu__panel a i, .user-menu__panel button i { width: 16px; height: 16px; opacity: 0.75; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 7px var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    line-height: var(--leading-tight);
    white-space: nowrap;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover {
    background: var(--bg-surface-2);
    border-color: var(--border-strong);
    text-decoration: none;
}
.btn:focus-visible {
    outline: 0;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.btn:active { transform: translateY(0.5px); }
.btn i { width: 15px; height: 15px; }

.btn--primary {
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-1);
}
.btn--primary:hover {
    background: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: var(--text-on-brand);
}
.btn--primary:active { background: var(--brand-primary-active); }

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn--ghost:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: transparent;
}

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

.btn--danger {
    background: var(--err-600);
    color: #fff;
    border-color: var(--err-600);
    box-shadow: var(--shadow-1);
}
.btn--danger:hover { background: var(--err-700); border-color: var(--err-700); color: #fff; }

.btn--success {
    background: var(--ok-600);
    color: #fff;
    border-color: var(--ok-600);
}
.btn--success:hover { background: var(--ok-700); border-color: var(--ok-700); color: #fff; }

.btn--warn {
    background: var(--warn-500, #f59e0b);
    border: 1px solid var(--warn-500, #f59e0b);
    color: #fff;
}
.btn--warn:hover { background: var(--warn-600, #d97706); border-color: var(--warn-600, #d97706); color: #fff; }

.btn--small {
    padding: 4px var(--space-2);
    font-size: var(--text-xs);
    gap: 4px;
}
.btn--small i { width: 13px; height: 13px; }
.btn--large {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
}
.btn--block { width: 100%; }
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button group (segmented) */
.btn-group {
    display: inline-flex;
    align-items: stretch;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    box-shadow: var(--shadow-1);
}
.btn-group .btn {
    border-radius: 0;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 6px var(--space-3);
    box-shadow: none;
}
[dir="rtl"] .btn-group .btn { border-right: 0; border-left: 1px solid var(--border-color); }
.btn-group .btn:last-child { border-right: 0; }
[dir="rtl"] .btn-group .btn:last-child { border-left: 0; }
.btn-group .btn:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
.btn-group .btn.is-active,
.btn-group .btn--primary {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-1);
    margin-bottom: var(--space-4);
}
.card > h2,
.card > h3,
.card > .section-heading { margin-top: 0; }
.card--linked { transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast); cursor: pointer; }
.card--linked:hover { box-shadow: var(--shadow-3); border-color: var(--border-strong); }
.card--inset { background: var(--bg-surface-2); }
.card--flush { padding: 0; }
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-5);
}
.card--flush .card__header { margin: 0; }
.card__header h2,
.card__header h3 { margin: 0; }
.card__hint {
    color: var(--text-muted);
    font-size: var(--text-xs);
    display: block;
    margin-top: 2px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.card-grid--stats     { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card-grid--detail    { grid-template-columns: repeat(auto-fit,  minmax(320px, 1fr)); }
.card-grid--properties{ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-grid--customers { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-grid--bookings  { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    inset-inline-start: 0;
    width: 3px;
    background: var(--brand-primary);
    opacity: 0.85;
}
.stat-card--ok::after    { background: var(--ok-500); }
.stat-card--warn::after  { background: var(--warn-500); }
.stat-card--err::after   { background: var(--err-500); }
.stat-card--muted::after { background: var(--ink-300); }
.stat-card .stat,
.stat-card > .stat__value,
.stat-card > .stat__label,
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    order: 1;
}
.stat__value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    order: 2;
}
.stat__value--small { font-size: var(--text-md); font-weight: 600; }
.stat__delta {
    order: 3;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.stat__delta--up   { color: var(--ok-700); }
.stat__delta--down { color: var(--err-700); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-input,
input[type="text"], input[type="email"], input[type="number"], input[type="date"],
input[type="time"], input[type="tel"], input[type="url"], input[type="password"],
input[type="search"], textarea, select {
    width: 100%;
    padding: 7px var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    line-height: var(--leading-tight);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.form-input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }
.form-input:hover, input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
.form-input:focus, input:focus, textarea:focus, select:focus {
    outline: 0;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.form-input:disabled, input:disabled, select:disabled, textarea:disabled {
    background: var(--bg-surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}
.form-input--invalid, .form-input.is-invalid {
    border-color: var(--err-500);
}
.form-input--invalid:focus, .form-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
textarea { min-height: 88px; resize: vertical; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-8);
}
[dir="rtl"] select {
    background-position: left var(--space-3) center;
    padding-right: var(--space-3);
    padding-left: var(--space-8);
}
.form-input--narrow { max-width: 180px; }
.form-input--wide   { width: 100%; }
.form-input--mono   { font-family: var(--font-mono); font-size: var(--text-sm); }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > span:first-child,
.form-row > label:first-child,
.form-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.form-row > span:first-child small,
.form-help {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 400;
}
.form-error {
    color: var(--err-700);
    font-size: var(--text-xs);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.form-required { color: var(--err-500); margin-inline-start: 2px; }
.form-row--wide { grid-column: 1 / -1; }

.form-grid { display: grid; gap: var(--space-4); }
.form-grid--2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.form--inline-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.form-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding-top: var(--space-4);
    margin-top: var(--space-2);
    border-top: 1px solid var(--border-color);
}
.inline-form { display: inline-block; }

/* Checkbox / radio */
input[type="checkbox"], input[type="radio"] {
    width: auto;
    accent-color: var(--brand-primary);
}
.checkbox-row, .radio-row {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--ink-300);
    border-radius: var(--radius-full);
    transition: background var(--t-fast);
}
.toggle__slider::before {
    content: "";
    position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-1);
    transition: transform var(--t-fast);
}
.toggle input:checked + .toggle__slider { background: var(--brand-primary); }
.toggle input:checked + .toggle__slider::before { transform: translateX(16px); }
[dir="rtl"] .toggle input:checked + .toggle__slider::before { transform: translateX(-16px); }

/* ── KV list ────────────────────────────────────────────────────────────── */
.kv-list {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: var(--space-2) var(--space-5);
    margin: 0;
    padding: 0;
    align-items: baseline;
}
.kv-list dt {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}
.kv-list dd {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
}
.kv-list dd a { color: var(--brand-primary); }

/* legacy ul/li/span pattern */
ul.kv-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
ul.kv-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
}
ul.kv-list li:last-child { border-bottom: 0; }
ul.kv-list li > span:first-child {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    flex: 0 0 auto;
}
ul.kv-list li > span:last-child {
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: right;
    flex: 0 0 auto;
    font-feature-settings: var(--num-tabular);
}
[dir="rtl"] ul.kv-list li > span:last-child { text-align: left; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.lookup-table-wrap {
    overflow-x: auto;
    margin: calc(-1 * var(--space-5));
    margin-top: 0;
    padding: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card.card--flush .lookup-table-wrap { margin: 0; border-radius: 0; }
.lookup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.lookup-table th, .lookup-table td {
    padding: 10px var(--space-4);
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}
[dir="rtl"] .lookup-table th, [dir="rtl"] .lookup-table td { text-align: right; }
.lookup-table th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.lookup-table tbody tr {
    transition: background var(--t-fast);
}
.lookup-table tbody tr:hover { background: var(--bg-surface-2); }
.lookup-table tbody tr:last-child td { border-bottom: 0; }
.lookup-table td.num,
.lookup-table th.num { text-align: right; font-feature-settings: var(--num-tabular); }
[dir="rtl"] .lookup-table td.num,
[dir="rtl"] .lookup-table th.num { text-align: left; }
.lookup-table td a { color: var(--brand-primary); font-weight: 500; }
.lookup-table td .btn--small + .btn--small { margin-inline-start: 4px; }

/* Lookup-table editor */
.cell-input {
    width: 100%;
    padding: 4px var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--text-sm);
}
.cell-input:focus {
    background: var(--bg-surface);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.cell-input--num {
    font-family: var(--font-mono);
    text-align: right;
    font-feature-settings: var(--num-tabular);
}
.lookup-actions { display: flex; gap: var(--space-1); justify-content: flex-end; }
.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: var(--space-1);
    display: inline-grid;
    place-items: center;
}
.drag-handle:active { cursor: grabbing; }

/* ── Pills / status pills ──────────────────────────────────────────────── */
.pill, .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.02em;
}
.status-pill { font-weight: 600; }
.pill--info        { background: var(--info-50);  color: var(--info-700); border-color: rgba(59,130,246,0.25); }
.pill--ok          { background: var(--ok-50);    color: var(--ok-700);   border-color: rgba(16,185,129,0.25); }
.pill--warn        { background: var(--warn-50);  color: var(--warn-700); border-color: rgba(245,158,11,0.25); }
.pill--err         { background: var(--err-50);   color: var(--err-700);  border-color: rgba(239,68,68,0.25); }
.pill--muted       { background: var(--bg-surface-2); color: var(--text-muted); border-color: var(--border-color); }
.pill--brand       { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }

.status-pill--active     { background: var(--ok-50);   color: var(--ok-700);   border-color: rgba(16,185,129,0.25); }
.status-pill--inactive   { background: var(--bg-surface-2); color: var(--text-muted); border-color: var(--border-color); }
.status-pill--maintenance{ background: var(--warn-50); color: var(--warn-700); border-color: rgba(245,158,11,0.25); }
.status-pill--vip        { background: rgba(217, 119, 6, 0.10); color: rgb(146,64,14); border-color: rgba(217,119,6,0.25); }

.status-pill--pending    { background: var(--warn-50); color: var(--warn-700); border-color: rgba(245,158,11,0.25); }
.status-pill--confirmed  { background: var(--info-50); color: var(--info-700); border-color: rgba(59,130,246,0.25); }
.status-pill--checked_in { background: var(--ok-50);   color: var(--ok-700);   border-color: rgba(16,185,129,0.25); }
.status-pill--completed  { background: var(--bg-surface-2); color: var(--text-secondary); border-color: var(--border-color); }
.status-pill--cancelled  { background: var(--err-50);  color: var(--err-700);  border-color: rgba(239,68,68,0.25); }
.status-pill--settled    { background: var(--ok-50);   color: var(--ok-700);   border-color: rgba(16,185,129,0.4); font-weight: 600; }
.status-pill--settled i  { width: 14px; height: 14px; }

/* ── Settlement panel ──────────────────────────────────────────────────── */
.settlement-card { border-width: 2px; }
.settlement-card--attention { border-color: rgba(245,158,11,0.4); }
.settlement-card--settled   { border-color: rgba(16,185,129,0.4); }
.settlement-settled {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    color: var(--ok-700);
}
.settlement-settled i { width: 28px; height: 28px; }
.settlement-concerns {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.settlement-concern {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-color);
}
.settlement-concern:first-child { border-top: none; }
.settlement-concern__row,
.settlement-concern {
    align-items: flex-start;
}
.settlement-concern__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}
.settlement-concern__label {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.settlement-concern__label i { width: 18px; height: 18px; flex-shrink: 0; }
.settlement-concern--money-in  .settlement-concern__label i { color: var(--warn-700); }
.settlement-concern--money-out .settlement-concern__label i { color: var(--err-700); }
.settlement-concern--deposit   .settlement-concern__label i { color: rgb(124,58,237); }
.settlement-concern > .btn,
.settlement-concern > a.btn { flex-shrink: 0; }
.settlement-concern--money-in,
.settlement-concern--money-out,
.settlement-concern--deposit {
    flex-direction: row;
    flex-wrap: wrap;
}
.settlement-deposit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
    width: 100%;
}

/* In-Property order statuses */
.status-pill--preparing  { background: var(--info-50); color: var(--info-700); border-color: rgba(59,130,246,0.25); }
.status-pill--ready      { background: rgba(124,58,237,0.10); color: rgb(91,33,182); border-color: rgba(124,58,237,0.25); }
.status-pill--delivered  { background: var(--ok-50);   color: var(--ok-700);   border-color: rgba(16,185,129,0.25); }

/* status-pill with leading dot */
.status-pill::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.pill::before { display: none; }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border: 1px solid;
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}
.flash::before {
    content: "";
    width: 4px;
    align-self: stretch;
    background: currentColor;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    opacity: 0.6;
}
.flash--ok   { background: var(--ok-50);   color: var(--ok-700);   border-color: rgba(16,185,129,0.25); }
.flash--err  { background: var(--err-50);  color: var(--err-700);  border-color: rgba(239,68,68,0.25); }
.flash--warn { background: var(--warn-50); color: var(--warn-700); border-color: rgba(245,158,11,0.25); }
.flash--info { background: var(--info-50); color: var(--info-700); border-color: rgba(59,130,246,0.25); }
.ok  { color: var(--ok-700); }
.bad { color: var(--err-700); }

/* ── Breadcrumbs ─────────────────────────────────────────────────────────── */
.breadcrumbs {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary, var(--text-200, #6b7280));
}
.breadcrumbs__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}
.breadcrumbs__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.breadcrumbs__link {
    color: var(--text-secondary, var(--text-200, #6b7280));
    text-decoration: none;
}
.breadcrumbs__link:hover,
.breadcrumbs__link:focus {
    color: var(--primary, var(--text-100, #111827));
    text-decoration: underline;
}
.breadcrumbs__current {
    color: var(--text-primary, var(--text-100, #111827));
    font-weight: 500;
}
.breadcrumbs__sep {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* ── Page-level patterns ────────────────────────────────────────────────── */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}
.page-toolbar > h1,
.page-toolbar > .page-heading {
    margin: 0;
    flex: 0 0 auto;
}
.page-toolbar > span[style*="flex"] { flex: 1 1 auto !important; }
.page-toolbar > .btn,
.page-toolbar > .pill,
.page-toolbar > .status-pill { flex: 0 0 auto; }

.filter-bar {
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    background: var(--bg-surface);
}
.filter-bar .form,
.form.form--inline-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    flex-direction: row !important;
}
.filter-bar .form-input,
.form--inline-grid > .form-input,
.form--inline-grid .form-input {
    width: auto;
    flex: 1 1 180px;
    min-width: 140px;
    max-width: 280px;
}
.filter-bar .form-input--narrow,
.form--inline-grid .form-input--narrow {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 160px;
}
.filter-bar input[type="hidden"],
.form--inline-grid input[type="hidden"] { display: none; }
.filter-bar .btn,
.form--inline-grid .btn { flex: 0 0 auto; }
.filter-bar .form > span[style*="flex"] { flex: 1 1 auto !important; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    text-align: center;
    color: var(--text-muted);
    gap: var(--space-2);
}
.empty-state-card {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}
.empty-state-card > i {
    color: var(--text-soft);
    opacity: 0.7;
    width: 48px; height: 48px;
}
.empty-state-card h2 { margin: 0; font-size: var(--text-xl); }
.empty-state-card p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 460px;
}
.empty-state-card .btn { margin-top: var(--space-2); }

/* ── Tab nav ────────────────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
}
.tab-nav__item {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--text-sm);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color var(--t-fast), border-color var(--t-fast);
}
.tab-nav__item:hover {
    color: var(--text-primary);
    text-decoration: none;
}
.tab-nav__item.is-active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    font-weight: 600;
}
.tab-content { padding-top: var(--space-3); }

/* ── Property card ──────────────────────────────────────────────────────── */
.property-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--t-normal), border-color var(--t-fast);
}
.property-card:hover {
    box-shadow: var(--shadow-3);
    border-color: var(--border-strong);
}
.property-card__media {
    aspect-ratio: 16 / 10;
    background: var(--bg-surface-2);
    display: block;
    position: relative;
    overflow: hidden;
}
.property-card__media img { width: 100%; height: 100%; object-fit: cover; }
.property-card__placeholder {
    display: grid;
    place-items: center;
    height: 100%; width: 100%;
    color: var(--text-soft);
}
.property-card__placeholder i { width: 48px; height: 48px; }
.property-card__status {
    position: absolute;
    top: var(--space-2);
    inset-inline-end: var(--space-2);
}
.property-card__body {
    padding: var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.property-card__body h3 {
    margin: 0 0 4px;
    font-size: var(--text-md);
    letter-spacing: -0.01em;
}
.property-card__body h3 a { color: inherit; }
.property-card__body h3 a:hover { color: var(--brand-primary); text-decoration: none; }
.property-card__type {
    color: var(--brand-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 var(--space-2);
}
.property-card__meta {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-1) 0 0;
    flex-wrap: wrap;
}
.property-card__meta span { display: inline-flex; align-items: center; gap: 4px; }
.property-card__meta i { width: 13px; height: 13px; color: var(--text-muted); }
.property-card__price {
    margin: var(--space-3) 0 0;
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
}
.property-card__price small { color: var(--text-muted); font-weight: 400; font-size: var(--text-xs); }
.property-card__actions {
    padding: var(--space-1);
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-2);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.property-card__actions .btn {
    flex: 1 1 auto;
    padding: 6px var(--space-2);
    font-size: var(--text-xs);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    justify-content: center;
    box-shadow: none;
}
.property-card__actions .btn:hover { background: var(--bg-surface); color: var(--text-primary); }
.property-card__actions .btn--view:hover   { color: var(--info-700); }
.property-card__actions .btn--book:hover   { color: var(--ok-700); }
.property-card__actions .btn--edit:hover   { color: var(--warn-700); }
.property-card__actions .btn--delete:hover { color: var(--err-700); }

/* ── Customer card ──────────────────────────────────────────────────────── */
.customer-card {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-areas: "avatar body" "actions actions";
    gap: var(--space-3);
    padding: var(--space-4);
}
.customer-card__avatar {
    grid-area: avatar;
    width: 48px; height: 48px;
    border-radius: var(--radius-full);
    background: var(--brand-50);
    color: var(--brand-700);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: var(--text-md);
    text-decoration: none;
    border: 1px solid var(--brand-100);
}
.customer-card__body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.customer-card__body h3 {
    margin: 0;
    font-size: var(--text-md);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.customer-card__body h3 a { color: inherit; }
.customer-card__body h3 a:hover { color: var(--brand-primary); text-decoration: none; }
.customer-card__email {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.customer-card__meta {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.customer-card__meta i { width: 13px; height: 13px; }
.customer-card__pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: var(--space-2);
}
.customer-card__actions {
    grid-area: actions;
    display: flex;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-1);
}
[dir="rtl"] .customer-card {
    grid-template-areas: "body avatar" "actions actions";
    grid-template-columns: 1fr 48px;
}

/* ── Booking card ───────────────────────────────────────────────────────── */
.booking-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    gap: var(--space-3);
    transition: box-shadow var(--t-normal), border-color var(--t-fast);
}
.booking-card:hover {
    box-shadow: var(--shadow-3);
    border-color: var(--border-strong);
}
.booking-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}
.booking-card__ref {
    font-weight: 700;
    font-size: var(--text-md);
    color: var(--brand-primary);
    letter-spacing: 0;
    font-feature-settings: var(--num-tabular);
    text-decoration: none;
}
.booking-card__ref:hover { text-decoration: none; color: var(--brand-primary-hover); }
.booking-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
.booking-card__body p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.booking-card__body p i { width: 14px; height: 14px; color: var(--text-muted); }
.booking-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-3);
}
.booking-card__footer strong {
    font-size: var(--text-md);
    color: var(--text-primary);
    font-weight: 700;
}
[dir="rtl"] .booking-card__header,
[dir="rtl"] .property-card__actions { flex-direction: row-reverse; }

/* ── Calendar ───────────────────────────────────────────────────────────── */
.calendar-card { padding: var(--space-4); }
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.calendar-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-cell {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.calendar-cell--header {
    background: transparent;
    border: 0;
    min-height: auto;
    text-align: center;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px;
}
.calendar-cell--empty {
    background: transparent;
    border-color: transparent;
}
.calendar-cell__num {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}
.calendar-cell__more {
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.booking-pill {
    display: block;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    line-height: 1.3;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    font-weight: 500;
}
.booking-pill:hover { text-decoration: none; opacity: 0.92; }
.booking-pill--pending    { background: var(--warn-500); }
.booking-pill--confirmed  { background: var(--info-500); }
.booking-pill--checked_in { background: var(--ok-500); }
.booking-pill--completed  { background: var(--ink-500); }
.booking-pill--cancelled  { background: var(--err-500); opacity: 0.55; text-decoration: line-through; }

/* ── Audit timeline ─────────────────────────────────────────────────────── */
.audit-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.audit-timeline__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-left: 2px solid var(--brand-200);
    padding-left: var(--space-4);
    margin-left: var(--space-1);
}
[dir="rtl"] .audit-timeline__item {
    border-left: 0;
    border-right: 2px solid var(--brand-200);
    padding-left: 0;
    padding-right: var(--space-4);
    margin-left: 0;
    margin-right: var(--space-1);
}
.audit-timeline__item i {
    width: 16px; height: 16px;
    color: var(--brand-600);
    flex-shrink: 0;
    margin-top: 2px;
}
.audit-timeline__item--cancelled { border-color: rgba(239,68,68,0.4); }
.audit-timeline__item--cancelled i { color: var(--err-500); }

/* ── Action panel ───────────────────────────────────────────────────────── */
.action-panel { padding: var(--space-4); }
.action-panel__buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

/* ── Image grid ─────────────────────────────────────────────────────────── */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}
.image-grid__cell {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.image-grid__cell img { width: 100%; height: 100%; object-fit: cover; }
.image-grid__main-badge {
    position: absolute;
    top: var(--space-1);
    inset-inline-start: var(--space-1);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}
.image-grid__actions {
    position: absolute;
    bottom: var(--space-1);
    inset-inline-end: var(--space-1);
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--t-fast);
}
.image-grid__cell:hover .image-grid__actions { opacity: 1; }
.image-grid__actions .btn {
    background: rgba(255,255,255,0.96);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* ── Image dropzone ─────────────────────────────────────────────────────── */
.image-dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.image-dropzone:hover {
    border-color: var(--brand-primary);
    background: var(--brand-50);
    color: var(--brand-700);
}

/* ── Image slider ──────────────────────────────────────────────────────── */
.image-slider {
    position: relative;
    background: var(--bg-surface-2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
}
.image-slider__track {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.image-slider__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
}
.image-slider__slide img { width: 100%; height: 100%; object-fit: cover; }
.image-slider__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.94);
    border: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-3);
    transition: background var(--t-fast), transform var(--t-fast);
    z-index: 2;
}
.image-slider__nav:hover { background: #fff; transform: translateY(-50%) scale(1.05); }
.image-slider__nav i { width: 18px; height: 18px; color: var(--text-primary); }
.image-slider__prev { inset-inline-start: var(--space-3); }
.image-slider__next { inset-inline-end: var(--space-3); }
.image-slider__dots {
    position: absolute;
    bottom: var(--space-3);
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 2;
}
.image-slider__dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    border: 0;
    cursor: pointer;
    padding: 0;
    transition: background var(--t-fast), transform var(--t-fast);
}
.image-slider__dot.is-active { background: #fff; transform: scale(1.3); }
.image-slider__counter {
    position: absolute;
    top: var(--space-3);
    inset-inline-end: var(--space-3);
    padding: 3px 9px;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    backdrop-filter: blur(6px);
    z-index: 2;
    font-feature-settings: var(--num-tabular);
}
.image-slider__empty {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--text-muted);
    gap: var(--space-2);
}

/* ── Theme presets / brand preview / color picker ──────────────────────── */
.brand-preview {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    background: var(--bg-surface-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.color-swatch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px var(--space-2);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: var(--text-xs);
}
.color-swatch__chip {
    width: 16px; height: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.theme-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}
.theme-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
    text-align: center;
    aspect-ratio: 1.6 / 1;
}
.theme-preset:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}
.theme-preset.is-active {
    border-color: var(--brand-primary);
    background: var(--brand-50);
    box-shadow: 0 0 0 3px var(--border-focus-ring);
}
.theme-preset__chips { display: flex; gap: 4px; }
.theme-preset__chip {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px var(--border-color);
}
.theme-preset__name {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
}
.color-input-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.color-input-row input[type="color"] {
    width: 40px; height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    flex: 0 0 auto;
    background: var(--bg-surface);
}
.color-input-row input[type="text"] {
    flex: 1 1 auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

/* ── Brand header card (used on certain pages) ─────────────────────────── */
.brand-header-card {
    background: var(--brand-primary);
    background-image:
        linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-active) 100%);
    color: #fff;
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-2);
}
.brand-header-card__logo {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
}
.brand-header-card__logo img { max-height: 36px; max-width: 36px; }
.brand-header-card__title { margin: 0; color: #fff; font-size: var(--text-xl); font-weight: 600; }
.brand-header-card__tagline {
    color: rgba(255,255,255,0.85);
    font-size: var(--text-sm);
    margin-top: 2px;
}

/* ── Receipt amount headline (Phase G) ─────────────────────────────────── */
.receipt-amount {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-2) 100%);
    border: 1px solid var(--border-color);
}

/* ── Auth (login / reset) ──────────────────────────────────────────────── */
body.auth-body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg-app);
}
.auth-wrap,
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.login-card,
.auth-wrap > .login-card {
    grid-column: 2;
    align-self: center;
    justify-self: center;
    width: 100%;
    max-width: 420px;
    padding: var(--space-8) var(--space-6);
    background: transparent;
    border: 0;
    box-shadow: none;
    margin: 0;
}
.login-card h1 {
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-2);
    letter-spacing: -0.02em;
}
.login-card .tenant {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0 0 var(--space-6);
}
.login-card form { display: flex; flex-direction: column; gap: var(--space-3); }
.login-card label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: block;
}
.login-card input { width: 100%; }
.login-card button[type="submit"] {
    margin-top: var(--space-3);
    background: var(--brand-primary);
    color: var(--text-on-brand);
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-md);
    padding: 10px var(--space-4);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--t-fast);
}
.login-card button[type="submit"]:hover { background: var(--brand-primary-hover); }
.login-card .error,
.login-card .form-error {
    background: var(--err-50);
    color: var(--err-700);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}

.lang-switch,
.lang-switch--auth {
    position: fixed;
    top: var(--space-4);
    inset-inline-end: var(--space-4);
    padding: 4px var(--space-3);
    background: rgba(255,255,255,0.94);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: background var(--t-fast), color var(--t-fast);
}
.lang-switch:hover { color: var(--text-primary); background: #fff; text-decoration: none; }

/* Auth side panel content (rendered in auth.php template) */
.auth-panel {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    overflow: hidden;
    padding: var(--space-12);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-6);
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.10), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.08), transparent 50%),
        linear-gradient(140deg, var(--brand-primary) 0%, var(--brand-primary-active) 100%);
}
.auth-panel__inner {
    max-width: 420px;
    margin-inline-start: auto;
    margin-inline-end: var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: 100%;
}
.auth-panel__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.auth-panel__brand-mark {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.18);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: var(--text-md);
}
.auth-panel__title {
    color: #fff;
    font-size: 2rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
    font-weight: 600;
}
.auth-panel__tagline {
    color: rgba(255,255,255,0.85);
    font-size: var(--text-md);
    line-height: 1.6;
    margin: 0;
}
.auth-panel__features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.auth-panel__features li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: rgba(255,255,255,0.92);
    font-size: var(--text-sm);
}
.auth-panel__features li::before {
    content: "";
    width: 16px; height: 16px;
    background: rgba(255,255,255,0.20);
    border-radius: 50%;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 11px;
}
.auth-panel__footer {
    color: rgba(255,255,255,0.75);
    font-size: var(--text-xs);
    margin-top: var(--space-4);
}

/* ── Misc utilities ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-right { text-align: right; }
[dir="rtl"] .text-right { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-ok  { color: var(--ok-600,  #16a34a); }
.text-err { color: var(--err-600, #dc2626); }
.no-margin { margin: 0 !important; }
.flex-spacer { flex: 1 1 auto; }

/* page-heading icon support */
.page-heading i {
    width: 22px; height: 22px;
    vertical-align: -3px;
    color: var(--brand-primary);
    margin-inline-end: var(--space-2);
}

/* ── Dark mode polish ──────────────────────────────────────────────────── */
[data-theme="dark"] .card { background: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .stat-card { background: var(--bg-surface); }
[data-theme="dark"] .lookup-table th { background: var(--bg-surface-2); color: var(--text-secondary); }
[data-theme="dark"] .lookup-table tbody tr:hover { background: var(--bg-surface-2); }
[data-theme="dark"] .filter-bar { background: var(--bg-surface); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .form-input::placeholder { color: var(--text-muted); }
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8499' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
}
[data-theme="dark"] .image-grid__actions .btn { background: var(--bg-surface); }
[data-theme="dark"] .lang-switch { background: rgba(15,23,42,0.7); color: var(--text-secondary); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .app-header__search { display: none; }
}

@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "footer";
    }
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform var(--t-normal);
        box-shadow: var(--shadow-4);
    }
    [dir="rtl"] .app-sidebar {
        inset: 0 0 0 auto;
        transform: translateX(100%);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-header__hamburger { display: grid; place-items: center; }
    .app-main { padding: var(--space-4); }
    .app-footer { flex-direction: column; text-align: center; padding: var(--space-3); }
    .card-grid--detail { grid-template-columns: 1fr; }
    .calendar-cell { min-height: 56px; padding: 4px; }
    .calendar-cell__num { font-size: var(--text-xs); }
    .booking-pill { font-size: 10px; }
    .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
    .kv-list { grid-template-columns: 1fr; gap: 2px var(--space-2); }
    .kv-list dd { padding-bottom: var(--space-2); }
    .lookup-table { font-size: var(--text-xs); }
    .lookup-table th, .lookup-table td { padding: 8px var(--space-3); }
    .page-toolbar { flex-direction: row; flex-wrap: wrap; }
    .page-toolbar > h1 { flex: 1 1 100%; }
    .filter-bar .form { flex-direction: column !important; align-items: stretch; }
    .filter-bar .form-input,
    .filter-bar .form-input--narrow { max-width: none; flex: 1 1 auto; }
    .card-grid--stats { grid-template-columns: repeat(2, 1fr); }
    .stat__value { font-size: 1.375rem; }

    /* Auth — collapse to single column */
    .auth-wrap,
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .auth-panel {
        grid-row: 1;
        padding: var(--space-6);
        gap: var(--space-3);
        min-height: 180px;
    }
    .auth-panel__inner {
        max-width: none;
        margin: 0;
        gap: var(--space-3);
    }
    .auth-panel__title { font-size: var(--text-xl); }
    .auth-panel__features { display: none; }
    .auth-panel__footer { display: none; }
    .login-card,
    .auth-wrap > .login-card {
        grid-row: 2;
        grid-column: 1;
        max-width: 460px;
        padding: var(--space-6) var(--space-5);
    }
}

/* End of design system */


/* ============================================================================
   Phase I — additional component styles (boot screens, amenities, chips, hints)
   These class names exist in views but were never explicitly styled.
   ========================================================================== */

/* Boot screen — used by home/index and error pages (403, 404, etc.) */
.boot-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-6);
    background: var(--bg-app);
}
.boot-card {
    width: 100%;
    max-width: 720px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    padding: var(--space-8) var(--space-7);
}
.boot-card h1 {
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-3);
}
.boot-card .footer-note {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--text-xs);
}
.boot-info {
    display: grid;
    grid-template-columns: minmax(160px, max-content) 1fr;
    gap: var(--space-2) var(--space-5);
    margin: var(--space-4) 0 0;
    padding: var(--space-4);
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.boot-info dt {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}
.boot-info dd {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-feature-settings: var(--num-tabular);
}
.boot-error {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--err-50);
    color: var(--err-700);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.auth-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.auth-bar .btn { margin-inline-start: auto; }

.check-line {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-color);
}
.check-line:last-child { border-bottom: 0; }
.perm-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px var(--space-3);
}
.perm-grid li {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    padding: 4px 0;
}

.form-hint {
    color: var(--text-muted);
    font-size: var(--text-xs);
    display: block;
    margin-top: 4px;
}

.amenity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-2);
}
.amenity-cell {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    cursor: pointer;
    font-size: var(--text-sm);
    transition: background var(--t-fast), border-color var(--t-fast);
}
.amenity-cell:hover {
    background: var(--bg-surface-2);
    border-color: var(--border-strong);
}
.amenity-cell input[type="checkbox"] { width: auto; margin: 0; }

.amenity-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px var(--space-2);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}
.chip i { width: 13px; height: 13px; color: var(--text-muted); }

.app-footer__meta { display: flex; align-items: center; gap: var(--space-3); }

/* End of Phase I addendum */


/* ============================================================================
   Phase I — slice 8: a11y polish (focus rings, skip link, error pages)
   ========================================================================== */

/* Skip-to-content link — visually hidden until focused.
   First tab-stop on every authed page so keyboard users can jump past
   the sidebar and header straight into <main>. */
.skip-link {
    position: absolute;
    top: -100px;
    inset-inline-start: var(--space-3);
    z-index: 10000;
    padding: var(--space-2) var(--space-4);
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    text-decoration: none;
    transition: top 120ms ease-out;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: var(--space-3);
    outline: 0;
    box-shadow: 0 0 0 3px var(--border-focus-ring), var(--shadow-2);
}

/* Make <main> non-outlined when focused via skip-link (we want the
   visual focus on the *content* the user lands on, not a frame around
   the whole panel). */
.app-main:focus { outline: 0; }
.app-main:focus-visible { outline: 0; }

/* Sidebar — focus rings on the brand link, nav items, and toggle. */
.app-sidebar__brand:focus-visible {
    outline: 0;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-md);
}
.app-sidebar__nav-item:focus-visible {
    outline: 0;
    background: var(--bg-surface-2);
    box-shadow: var(--shadow-focus);
}
.app-sidebar__toggle:focus-visible {
    outline: 0;
    background: var(--bg-surface-2);
    color: var(--text-primary);
    box-shadow: var(--shadow-focus);
}

/* Header — lang pill and user-menu trigger were missing focus styles. */
.lang-pill:focus-visible {
    outline: 0;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.user-menu__trigger:focus-visible {
    outline: 0;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}
.user-menu__item:focus-visible {
    outline: 0;
    background: var(--bg-surface-2);
    box-shadow: inset 0 0 0 2px var(--border-focus);
}

/* Generic anchor focus inside .app-main: rely on each element's existing
   styles, but provide a baseline so plain <a> links still get a visible
   focus outline. */
.app-main a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Error pages ─────────────────────────────────────────────────────────── */

/* Used inside .boot-card OR inside .app-main (403 wraps it in app shell;
   404/500 render layout-less). Either way we want a centered, generous
   layout. */
.error-page {
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}
.error-page__icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-4);
    background: var(--bg-surface-2);
    border-radius: 50%;
    color: var(--brand-primary);
}
.error-page__icon i {
    width: 36px;
    height: 36px;
    stroke-width: 1.75;
}
.error-page__code {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-2);
}
.error-page__title {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin: 0 0 var(--space-3);
    color: var(--text-primary);
}
.error-page__body {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin: 0 0 var(--space-4);
    line-height: 1.6;
}
.error-page__meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0 0 var(--space-5);
}
.error-page__meta code {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-primary);
    word-break: break-all;
}
.error-page__actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-5);
}
.error-page__debug {
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: start;
}
.error-page__debug summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}
.error-page__debug pre {
    margin: var(--space-3) 0 0;
    padding: var(--space-3);
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* End of slice 8 addendum */


/* ============================================================================
   Slice 9 — Login page logo (auth-panel + login-card brand surfaces)
   ========================================================================== */

/* Logo on the dark gradient panel (left side, hidden on small screens).
   Sized to be the dominant visual element above the headline — sits on
   a slim white card so dark-on-dark logos remain readable. */
.auth-panel__brand-logo {
    height: 88px;
    width: auto;
    max-width: 280px;
    background: rgba(255, 255, 255, 0.97);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    object-fit: contain;
}
/* When a logo is shown the inline brand-name text becomes redundant —
   keep it for screen readers, hide visually. */
.auth-panel__brand:has(.auth-panel__brand-logo) > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* End of slice 9 addendum */


/* ============================================================================
   Slice 11 — flatpickr date picker integration (booking form availability)
   Loaded via CDN on /bookings/new + /bookings/{id}/edit only.
   ========================================================================== */

/* Pending-overlap day cells get an amber tint inside the picker so the user
   can see the conflict before they click. Selectable; the soft-block confirm
   dialog still fires on selection. */
.flatpickr-day--pending {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
}
.flatpickr-day--pending::after {
    content: '';
    position: absolute;
    inset-inline-end: 4px;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--warn-500, #f59e0b);
}
.flatpickr-day--pending:hover {
    background: rgba(245, 158, 11, 0.28);
}

/* Confirmed/checked-in disabled days render with the picker's stock disabled
   styles, but we soften the strike-through and lift contrast so they read as
   "not available" rather than "broken". */
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    background: var(--bg-surface-2);
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    cursor: not-allowed;
    opacity: 0.55;
}

/* Make the picker's surface match the app's surface tokens so it sits well
   in both light and dark themes. */
.flatpickr-calendar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    color: var(--text-primary);
    font-family: inherit;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after { border-bottom-color: var(--border-color); }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month,
.flatpickr-weekdays { color: var(--text-primary); background: var(--bg-surface); }
.flatpickr-weekday { color: var(--text-muted); }
.flatpickr-day {
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}
.flatpickr-day:hover { background: var(--bg-surface-2); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}
.flatpickr-day.today {
    border-color: var(--brand-primary);
}
[data-theme="dark"] .flatpickr-calendar {
    background: var(--bg-surface-2);
}

/* ── Branded dialog (replaces alert/confirm in the booking form) ───────────── */

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    padding: var(--space-4);
    opacity: 0;
    transition: opacity 160ms ease-out;
}
.dialog-overlay.is-open { opacity: 1; }
[hidden].dialog-overlay { display: none; }

.dialog-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.32);
    width: 100%;
    max-width: 480px;
    transform: translateY(8px) scale(0.98);
    transition: transform 160ms ease-out;
    overflow: hidden;
}
.dialog-overlay.is-open .dialog-card {
    transform: translateY(0) scale(1);
}

.dialog-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5) var(--space-3);
}
.dialog-card__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dialog-card__icon i { width: 22px; height: 22px; stroke-width: 2; }

.dialog-card__icon--warning { background: rgba(245, 158, 11, 0.16); color: var(--warn-700, #b45309); }
.dialog-card__icon--danger  { background: rgba(239, 68, 68, 0.14);  color: var(--err-700,  #b91c1c); }
.dialog-card__icon--info    { background: rgba(37, 99, 235, 0.14);  color: var(--brand-primary); }

.dialog-card__title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.dialog-card__body {
    padding: 0 var(--space-5) var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.55;
}
.dialog-card__body p:first-child { margin-top: 0; }
.dialog-card__body p:last-child  { margin-bottom: 0; }

.dialog-list {
    margin: var(--space-3) 0 0;
    padding: var(--space-3);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    list-style: none;
}
.dialog-list li {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: 4px 0;
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.dialog-list li + li { border-top: 1px solid var(--border-color); padding-top: var(--space-2); margin-top: 4px; }
.dialog-list__range {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-inline-start: auto;
    white-space: nowrap;
}

.dialog-card__actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding: var(--space-3) var(--space-5) var(--space-5);
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-2);
}

/* End of slice 11 addendum */


/* ── Paid-in-Full stamp (Phase 6.3) ─────────────────────────────────── */
.paid-stamp {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 2px solid var(--ok-600, #16a34a);
    color: var(--ok-700, #15803d);
    background: var(--ok-50, #f0fdf4);
    border-radius: var(--radius-md, 8px);
    font-weight: 700;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.paid-stamp i {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}
.paid-stamp--corner {
    position: absolute;
    top: var(--space-3);
    inset-inline-end: var(--space-3);
    transform: rotate(-8deg);
    z-index: 5;
    border-width: 3px;
    padding: 6px 14px;
    background: rgba(240, 253, 244, 0.95);
    box-shadow: 0 4px 12px rgba(16, 163, 74, 0.15);
}
.paid-stamp--corner .paid-stamp__inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pill--ok {
    background: var(--ok-50, #f0fdf4);
    color: var(--ok-700, #15803d);
    border: 1px solid var(--ok-600, #16a34a);
}
