/*
 * Rently theme — "Navy + đá xám".
 * Single source of colours for Blade admin and the React app. Loaded AFTER Bootstrap + Mazer.
 * Spec: docs/superpowers/specs/2026-10-05-rently-ui-redesign-design.md §2.
 */

/* ========================================================================
 * 1. Tokens
 * ===================================================================== */
:root {
    --r-bg: #F4F5F3;
    --r-surface: #FFFFFF;
    --r-surface-2: #F9FAF8;
    --r-border: #E3E6E8;
    --r-text: #1F2A33;
    --r-text-2: #66707A;
    --r-text-3: #98A0A6;
    --r-primary: #2D8030;
    --r-primary-hover: #226B2A;
    --r-primary-soft: #E9F5E5;
    --r-primary-bright: #43A536;
    --r-primary-deep: #16492A;
    --r-accent: #C2693E;
    --r-accent-strong: #9C4A24;
    --r-accent-soft: #FBEADF;
    /* Status pairs: four clearly separated hues (emerald / blue / amber / red) so badges never
       read alike, nor like the brand green. Strong colour on its soft pair keeps ≥ 4.5:1. */
    --r-success: #13795B;
    --r-success-soft: #DFF3EA;
    --r-warning: #9A5B00;
    --r-warning-soft: #FCEFD4;
    --r-danger: #B42318;
    --r-danger-soft: #FDE7E4;
    --r-info: #1F64B0;
    --r-info-soft: #E3EEFB;

    --r-font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --r-fs-meta: 13px;
    --r-fs-body: 14px;
    --r-fs-md: 16px;
    --r-fs-card-title: 20px;
    --r-fs-page-title: 24px;
    --r-fs-kpi: 30px;

    --r-radius-card: 16px;
    --r-radius-control: 12px;
    --r-radius-pill: 999px;

    --r-shadow-sm: 0 1px 2px rgba(31, 42, 51, .04), 0 2px 8px rgba(31, 42, 51, .04);
    --r-shadow-md: 0 8px 24px rgba(31, 42, 51, .08);
    --r-shadow-none: none;
    --r-focus-ring: 0 0 0 3px var(--r-primary-soft);
    /* Buttons, chips, icon actions: visible on white and on --r-bg (navy ring behind a white gap). */
    --r-focus-ring-strong: 0 0 0 2px var(--r-surface), 0 0 0 4px var(--r-primary);
    --r-motion: 150ms ease-out;

    --r-sidebar-width: 248px;
    --r-sidebar-collapsed-width: 76px;
    --r-sb-motion: .24s cubic-bezier(.2, .8, .2, 1);

    /* Landing page (/) — soft green washes, glossy CTAs and the 3D device mockups. */
    --r-landing-hero-bg: radial-gradient(55% 75% at 88% 30%, #CFE8C6 0%, rgba(207, 232, 198, 0) 70%),
        radial-gradient(40% 60% at 55% 10%, #E4F2DE 0%, rgba(228, 242, 222, 0) 70%),
        linear-gradient(180deg, #EEF7EA 0%, #F7FBF5 100%);
    --r-landing-wash: linear-gradient(180deg, #F3F9F0 0%, #FFFFFF 100%);
    --r-landing-device-bg: radial-gradient(60% 60% at 50% 55%, #D3EBCB 0%, rgba(211, 235, 203, 0) 72%);
    --r-landing-cta-bg: linear-gradient(90deg, #12401F 0%, var(--r-primary-deep) 45%, var(--r-primary) 100%);
    --r-landing-bar: linear-gradient(180deg, var(--r-primary-bright) 0%, var(--r-primary) 100%);
    --r-landing-bar-alt: linear-gradient(180deg, #7FB6E6 0%, #3E86C9 100%);
    --r-landing-donut: conic-gradient(var(--r-primary) 0 85%, var(--r-primary-soft) 85% 100%);
    --r-landing-btn: linear-gradient(180deg, #4AAE3E 0%, var(--r-primary) 55%, #23692A 100%);
    --r-landing-btn-hover: linear-gradient(180deg, #43A536 0%, #226B2A 100%);
    --r-landing-icon: linear-gradient(160deg, #5DBB4C 0%, var(--r-primary) 60%, var(--r-primary-deep) 100%);
    --r-landing-halo: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #EEF7EA 45%, #DCEFD5 100%);
    --r-landing-step: radial-gradient(circle at 35% 30%, #5DBB4C 0%, var(--r-primary) 60%, #226B2A 100%);
    --r-landing-glass: linear-gradient(125deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 38%);
    --r-landing-metal: linear-gradient(180deg, #F2F4F5 0%, #CDD2D6 60%, #A9B0B6 100%);
    --r-landing-bezel: linear-gradient(145deg, #3A444C 0%, #11171C 100%);
    --r-landing-featured: linear-gradient(180deg, #F1F9EE 0%, #FFFFFF 60%);
    --r-landing-fade: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .55) 22%, #000000 45%);
    --r-landing-photo: linear-gradient(180deg, #8DC77F 0%, #4E9B47 55%, #2D6B34 100%);

    --r-shadow-lp-card: 0 2px 4px rgba(31, 42, 51, .03), 0 10px 28px rgba(45, 128, 48, .08);
    --r-shadow-lp-card-hover: 0 4px 8px rgba(31, 42, 51, .04), 0 18px 40px rgba(45, 128, 48, .14);
    --r-shadow-lp-btn: 0 6px 16px rgba(45, 128, 48, .32), inset 0 1px 0 rgba(255, 255, 255, .28);
    --r-shadow-lp-device: 0 30px 60px -12px rgba(22, 73, 42, .35), 0 18px 36px -18px rgba(0, 0, 0, .35);
    --r-shadow-lp-phone: -18px 28px 40px -14px rgba(22, 73, 42, .38), inset 0 0 0 1px rgba(255, 255, 255, .08);
    --r-shadow-lp-icon: 0 8px 18px rgba(45, 128, 48, .30), inset 0 2px 0 rgba(255, 255, 255, .25);
    --r-shadow-lp-halo: inset 0 -3px 6px rgba(45, 128, 48, .10), 0 6px 14px rgba(45, 128, 48, .10);
    --r-shadow-lp-ring: 0 0 0 2px var(--r-surface), 0 0 0 4px var(--r-primary-bright);
    /* Landing footer: deep green with a soft glow + 3D isometric towers */
    --r-landing-footer-bg: radial-gradient(60% 90% at 85% 100%, rgba(76, 166, 51, .35) 0%, rgba(76, 166, 51, 0) 70%),
        radial-gradient(40% 60% at 0% 0%, rgba(155, 217, 138, .12) 0%, rgba(155, 217, 138, 0) 70%),
        linear-gradient(180deg, #123B1E 0%, #0C2A15 100%);
    --r-landing-footer-line: rgba(255, 255, 255, .10);
    --r-landing-footer-text: rgba(255, 255, 255, .72);
    --r-landing-footer-card: rgba(255, 255, 255, .06);
    --r-landing-footer-card-hover: rgba(255, 255, 255, .11);
    --r-landing-tower-top: linear-gradient(135deg, #B9E8A8 0%, #6CC458 100%);
    --r-landing-tower-front: repeating-linear-gradient(180deg, rgba(222, 255, 205, .55) 0 3px, rgba(222, 255, 205, 0) 3px 11px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 5px, rgba(18, 59, 30, .55) 5px 8px),
        linear-gradient(180deg, #4CA633 0%, #24702E 100%);
    --r-landing-tower-side: repeating-linear-gradient(180deg, rgba(222, 255, 205, .30) 0 3px, rgba(222, 255, 205, 0) 3px 11px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 5px, rgba(10, 36, 18, .55) 5px 8px),
        linear-gradient(180deg, #2D8030 0%, #154A1F 100%);
    --r-landing-iso-glow: radial-gradient(closest-side, rgba(155, 217, 138, .45), rgba(155, 217, 138, 0));
    --r-shadow-lp-footer-card: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 14px 30px -14px rgba(0, 0, 0, .55);
    --r-landing-drop: drop-shadow(0 28px 32px rgba(22, 73, 42, .28)) drop-shadow(0 6px 10px rgba(0, 0, 0, .12));
    /* Landing motion layer (public/css/landing-motion.css). */
    --r-landing-shimmer: linear-gradient(100deg, var(--r-primary) 0%, var(--r-primary-bright) 30%, #9BD98A 50%, var(--r-primary-bright) 70%, var(--r-primary) 100%);
    --r-landing-spot: radial-gradient(closest-side, rgba(67, 165, 54, .16), rgba(67, 165, 54, 0));
    --r-landing-shine: linear-gradient(110deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, 0) 70%);
    --r-landing-progress: linear-gradient(90deg, var(--r-primary-bright), var(--r-primary));
    --r-landing-ring: conic-gradient(from 0deg, var(--r-primary-bright), #B9E8A8, var(--r-primary), var(--r-primary-deep), var(--r-primary-bright));
    --r-landing-orb: radial-gradient(circle at 30% 30%, rgba(155, 217, 138, .55), rgba(67, 165, 54, 0) 70%);
    --r-landing-glass-bg: rgba(255, 255, 255, .78);
    --r-landing-line: linear-gradient(90deg, var(--r-primary-bright), var(--r-primary));
    --r-landing-solid: linear-gradient(#000000 0 0);
    --r-landing-marquee-fade: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #000000 10%, #000000 90%, rgba(0, 0, 0, 0) 100%);
    --r-landing-scrim: rgba(16, 38, 24, .45);
    --r-landing-glass-dark: rgba(255, 255, 255, .12);
    --r-landing-glass-line: rgba(255, 255, 255, .22);
    --r-shadow-lp-focus: var(--r-focus-ring);
    /* Landing photo cards + section decor (public/css/landing-photos.css). */
    --r-landing-photo-fade: linear-gradient(180deg, rgba(22, 73, 42, 0) 35%, rgba(22, 73, 42, .55) 100%);
    --r-landing-photo-tint: linear-gradient(135deg, rgba(45, 128, 48, .18) 0%, rgba(22, 73, 42, .05) 60%);
    --r-landing-audience-fade: linear-gradient(180deg, rgba(10, 30, 18, 0) 30%, rgba(10, 30, 18, .55) 60%, rgba(10, 30, 18, .92) 100%);
    --r-landing-scene-fade: linear-gradient(180deg, rgba(243, 249, 240, 0) 0%, rgba(243, 249, 240, .15) 55%, rgba(255, 255, 255, .95) 100%);
    --r-landing-dots: radial-gradient(rgba(45, 128, 48, .14) 1.2px, transparent 1.2px);
    --r-landing-gridlines: linear-gradient(rgba(45, 128, 48, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(45, 128, 48, .07) 1px, transparent 1px);
    --r-landing-blob-a: radial-gradient(closest-side, rgba(155, 217, 138, .45), rgba(155, 217, 138, 0));
    --r-landing-blob-b: radial-gradient(closest-side, rgba(67, 165, 54, .22), rgba(67, 165, 54, 0));
    --r-landing-band: linear-gradient(180deg, #F3F9F0 0%, #E6F2E1 100%);
    --r-landing-grid-mask: radial-gradient(70% 80% at 50% 40%, #000000 0%, rgba(0, 0, 0, 0) 100%);
    --r-landing-tag-bg: rgba(255, 255, 255, .88);
    --r-landing-icon-glass: rgba(255, 255, 255, .2);
    --r-shadow-lp-photo-icon: 0 10px 22px rgba(22, 73, 42, .22), 0 0 0 5px var(--r-surface);
    --r-landing-flow-tint: linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(233, 245, 229, .12) 55%, rgba(45, 128, 48, .14) 100%);
    --r-landing-flow-dim: rgba(255, 255, 255, .35);
    --r-shadow-lp-flow: 0 30px 60px -18px rgba(22, 73, 42, .45), 0 0 0 1px rgba(22, 73, 42, .15);
    /* Glass header — mirrors the mobile app's bottom bar (mobile app app_bottom_navigation.dart). */
    --r-landing-glass-fill: linear-gradient(180deg, rgba(255, 255, 255, .58) 0%, rgba(255, 255, 255, .34) 100%);
    --r-landing-glass-sheen: linear-gradient(115deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .12) 28%, rgba(255, 255, 255, 0) 55%);
    --r-landing-glass-rim: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, .45) 100%);
    --r-shadow-lp-glass: 0 12px 30px rgba(0, 0, 0, .12), 0 1px 4px rgba(0, 0, 0, .06), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -1px 0 rgba(255, 255, 255, .25);
    --r-landing-drop-strong: drop-shadow(0 40px 40px rgba(22, 73, 42, .35)) drop-shadow(0 10px 14px rgba(0, 0, 0, .18));
    --r-landing-contact: radial-gradient(closest-side, rgba(22, 73, 42, .32), rgba(22, 73, 42, 0));
    --r-shadow-lp-glow: 0 0 0 1px rgba(67, 165, 54, .28), 0 22px 48px rgba(45, 128, 48, .20);
    --r-shadow-lp-pulse-a: 0 0 0 0 rgba(67, 165, 54, .45), 0 8px 18px rgba(45, 128, 48, .30);
    --r-shadow-lp-pulse-b: 0 0 0 14px rgba(67, 165, 54, 0), 0 8px 18px rgba(45, 128, 48, .30);
    --r-shadow-lp-chip: 0 4px 14px rgba(22, 73, 42, .08);
    --r-shadow-lp-nav: 0 10px 30px rgba(22, 73, 42, .10);
}

/* ========================================================================
 * 2. Base
 * ===================================================================== */
html, body {
    font-family: var(--r-font);
    font-size: var(--r-fs-body);
    line-height: 1.5;
    color: var(--r-text);
    background: var(--r-bg);
}

body { -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--r-font);
    color: var(--r-text);
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1, .h1 { font-size: 30px; }
h2, .h2 { font-size: var(--r-fs-page-title); }
h3, .h3 { font-size: var(--r-fs-page-title); }
h4, .h4 { font-size: var(--r-fs-card-title); }
h5, .h5 { font-size: var(--r-fs-md); }
h6, .h6 { font-size: var(--r-fs-body); }

.text-muted, .text-secondary { color: var(--r-text-2) !important; }
.text-primary { color: var(--r-primary) !important; }
.text-success { color: var(--r-success) !important; }
.text-warning { color: var(--r-warning) !important; }
.text-danger { color: var(--r-danger) !important; }
.text-info { color: var(--r-info) !important; }
.text-gray-500, .text-gray-600 { color: var(--r-text-2) !important; }
.small, small { font-size: var(--r-fs-meta); }

a { color: var(--r-primary); transition: color var(--r-motion); }
a:hover { color: var(--r-primary-hover); }

::selection { background: var(--r-primary-soft); color: var(--r-text); }

*:focus-visible {
    outline: 2px solid var(--r-primary);
    outline-offset: 2px;
}

.tabular-nums, .table td, .r-kpi-value { font-variant-numeric: tabular-nums; }

hr { border-color: var(--r-border); opacity: 1; }

/* ========================================================================
 * 3. Bootstrap variable bridge
 * ===================================================================== */
:root {
    --bs-body-font-family: var(--r-font);
    --bs-body-font-size: var(--r-fs-body);
    --bs-body-color: var(--r-text);
    --bs-body-bg: var(--r-bg);
    --bs-secondary-color: var(--r-text-2);
    --bs-border-color: var(--r-border);
    --bs-border-radius: var(--r-radius-control);
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: var(--r-radius-card);
    --bs-border-radius-xl: var(--r-radius-card);
    --bs-border-radius-pill: var(--r-radius-pill);
    --bs-link-color: var(--r-primary);
    --bs-link-hover-color: var(--r-primary-hover);
    --bs-primary: #2D8030;
    --bs-primary-rgb: 45, 128, 48;
    --bs-success: #13795B;
    --bs-success-rgb: 19, 121, 91;
    --bs-warning: #9A5B00;
    --bs-warning-rgb: 154, 91, 0;
    --bs-danger: #B42318;
    --bs-danger-rgb: 180, 35, 24;
    --bs-info: #1F64B0;
    --bs-info-rgb: 31, 100, 176;
    --bs-primary-bg-subtle: var(--r-primary-soft);
    --bs-success-bg-subtle: var(--r-success-soft);
    --bs-warning-bg-subtle: var(--r-warning-soft);
    --bs-danger-bg-subtle: var(--r-danger-soft);
    --bs-info-bg-subtle: var(--r-info-soft);
}

.bg-primary { background-color: var(--r-primary) !important; }
.bg-success { background-color: var(--r-success) !important; }
.bg-warning { background-color: var(--r-warning) !important; }
.bg-danger { background-color: var(--r-danger) !important; }
.bg-info { background-color: var(--r-info) !important; }
.bg-light, .bg-body-tertiary { background-color: var(--r-surface-2) !important; }
.bg-white { background-color: var(--r-surface) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--r-border) !important; }

/* ========================================================================
 * 4. Components
 * ===================================================================== */

/* --- Card --- */
.card {
    background: var(--r-surface);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card);
    box-shadow: var(--r-shadow-sm);
    margin-bottom: 16px;
}
.card .card-header,
.card .card-footer {
    background: transparent;
    border-color: var(--r-border);
    padding: 20px 24px;
}
.card .card-header { border-bottom: 0; padding-bottom: 8px; }
.card .card-header h4, .card .card-title {
    font-size: var(--r-fs-md);
    font-weight: 600;
    color: var(--r-text);
    margin-bottom: 0;
}
.card .card-body { padding: 20px 24px; }
.card.card-statistic { background: var(--r-surface); box-shadow: var(--r-shadow-sm); }

/* --- Buttons --- */
.btn {
    border-radius: var(--r-radius-control);
    font-weight: 500;
    font-size: var(--r-fs-body);
    padding: 8px 16px;
    box-shadow: none !important;
    transition: background-color var(--r-motion), border-color var(--r-motion), color var(--r-motion);
}
.btn-sm { padding: 5px 12px; font-size: var(--r-fs-meta); border-radius: 10px; }
.btn-lg { padding: 11px 20px; font-size: var(--r-fs-md); }
.btn.shadow-lg { box-shadow: none !important; }
.btn:focus-visible, .btn.shadow-lg:focus-visible { outline: none; box-shadow: var(--r-focus-ring-strong) !important; }

.btn-primary {
    --bs-btn-bg: var(--r-primary);
    --bs-btn-border-color: var(--r-primary);
    --bs-btn-hover-bg: var(--r-primary-hover);
    --bs-btn-hover-border-color: var(--r-primary-hover);
    --bs-btn-active-bg: var(--r-primary-hover);
    --bs-btn-active-border-color: var(--r-primary-hover);
    --bs-btn-disabled-bg: var(--r-primary);
    --bs-btn-disabled-border-color: var(--r-primary);
    background-color: var(--r-primary);
    border-color: var(--r-primary);
    color: var(--r-surface);
}
.btn-primary:hover, .btn-primary:active, .btn-primary.active, .btn-primary:focus {
    background-color: var(--r-primary-hover);
    border-color: var(--r-primary-hover);
    color: var(--r-surface);
}

.btn-danger { background-color: var(--r-danger); border-color: var(--r-danger); color: var(--r-surface); }
.btn-danger:hover, .btn-danger:active { background-color: var(--r-danger); border-color: var(--r-danger); filter: brightness(.92); }
.btn-success { background-color: var(--r-success); border-color: var(--r-success); color: var(--r-surface); }
.btn-success:hover, .btn-success:active { background-color: var(--r-success); border-color: var(--r-success); filter: brightness(.92); }
.btn-warning { background-color: var(--r-warning); border-color: var(--r-warning); color: var(--r-surface); }
.btn-info { background-color: var(--r-info); border-color: var(--r-info); color: var(--r-surface); }

/* `.btn.` prefix: Mazer ships `.btn.btn-secondary { color: #fff }` / `.btn.btn-light`, which outrank bare classes. */
.btn.btn-secondary, .btn.btn-light, .btn.btn-outline-secondary, .btn.btn-outline-light, .btn.btn-white {
    background: var(--r-surface);
    border: 1px solid var(--r-border);
    color: var(--r-text);
}
.btn.btn-secondary:hover, .btn.btn-light:hover, .btn.btn-outline-secondary:hover, .btn.btn-outline-light:hover,
.btn.btn-white:hover, .btn.btn-secondary:active, .btn.btn-secondary.active, .btn.btn-secondary:focus {
    background: var(--r-surface-2);
    border-color: var(--r-border);
    color: var(--r-text);
}

.btn-outline-primary { border-color: var(--r-primary); color: var(--r-primary); background: transparent; }
.btn-outline-primary:hover, .btn-outline-primary:active { background: var(--r-primary-soft); border-color: var(--r-primary); color: var(--r-primary); }
.btn-outline-danger { border-color: var(--r-danger); color: var(--r-danger); background: transparent; }
.btn-outline-danger:hover, .btn-outline-danger:active { background: var(--r-danger-soft); border-color: var(--r-danger); color: var(--r-danger); }
.btn-outline-success { border-color: var(--r-success); color: var(--r-success); }
.btn-outline-success:hover { background: var(--r-success-soft); border-color: var(--r-success); color: var(--r-success); }
.btn-outline-warning { border-color: var(--r-warning); color: var(--r-warning); }
.btn-outline-warning:hover { background: var(--r-warning-soft); border-color: var(--r-warning); color: var(--r-warning); }
.btn-outline-info { border-color: var(--r-info); color: var(--r-info); }
.btn-outline-info:hover { background: var(--r-info-soft); border-color: var(--r-info); color: var(--r-info); }

.btn.btn-light-primary { background: var(--r-primary-soft); color: var(--r-primary); border-color: transparent; }
.btn.btn-light-success { background: var(--r-success-soft); color: var(--r-success); border-color: transparent; }
.btn.btn-light-warning { background: var(--r-warning-soft); color: var(--r-warning); border-color: transparent; }
.btn.btn-light-danger { background: var(--r-danger-soft); color: var(--r-danger); border-color: transparent; }
.btn.btn-light-info { background: var(--r-info-soft); color: var(--r-info); border-color: transparent; }
.btn.btn-light-secondary { background: var(--r-surface-2); color: var(--r-text-2); border-color: var(--r-border); }

.btn-link { color: var(--r-primary); text-decoration: none; }
.btn-link:hover { color: var(--r-primary-hover); }

/* --- Forms --- */
.form-control, .form-select, .dataTable-input {
    background-color: var(--r-surface-2);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-control);
    color: var(--r-text);
    font-size: var(--r-fs-body);
    padding: 8px 12px;
    transition: border-color var(--r-motion), box-shadow var(--r-motion), background-color var(--r-motion);
}
.form-control-sm, .form-select-sm { padding: 5px 10px; font-size: var(--r-fs-meta); border-radius: 10px; }
.form-control-lg, .form-select-lg, .form-control.form-control-xl { padding: 11px 14px; font-size: var(--r-fs-md); }
.form-control::placeholder { color: var(--r-text-3); }
.form-control:focus, .form-select:focus, .dataTable-input:focus {
    background-color: var(--r-surface);
    border-color: var(--r-primary);
    box-shadow: var(--r-focus-ring);
    outline: 0;
}
.form-control:disabled, .form-select:disabled { background-color: var(--r-bg); color: var(--r-text-2); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--r-danger); }
.invalid-feedback { color: var(--r-danger); font-size: var(--r-fs-meta); }
.form-text { color: var(--r-text-2); font-size: var(--r-fs-meta); }
.form-label, .form-group label {
    color: var(--r-text);
    font-weight: 500;
    font-size: var(--r-fs-meta);
    margin-bottom: 6px;
}
.input-group-text {
    background: var(--r-surface-2);
    border-color: var(--r-border);
    color: var(--r-text-2);
    border-radius: var(--r-radius-control);
}
.form-check-input { border-color: var(--r-border); }
.form-check-input:checked { background-color: var(--r-primary); border-color: var(--r-primary); }
.form-check-input:focus { border-color: var(--r-primary); box-shadow: var(--r-focus-ring); }
.form-group[class*=has-icon-] .form-control:focus ~ .form-control-icon i { color: var(--r-primary); }
.form-group[class*=has-icon-] .form-control-icon i { color: var(--r-text-3); }

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--r-surface-2);
    --bs-table-striped-bg: var(--r-surface-2);
    color: var(--r-text);
    border-color: var(--r-border);
    margin-bottom: 0;
}
.table > thead > tr > th, .table thead th, .dataTable-table thead th {
    background: var(--r-surface-2);
    color: var(--r-text-2);
    font-size: var(--r-fs-meta);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--r-border) !important;
    padding: 12px 16px;
    white-space: nowrap;
}
.table > tbody > tr > td, .table td { padding: 12px 16px; border-color: var(--r-border); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background-color: var(--r-surface-2); --bs-table-accent-bg: var(--r-surface-2); }
.table.table-sm tr td, .table.table-sm tr th { padding: 8px 12px; }
.table-light, .table > thead.table-light > tr > th { --bs-table-bg: var(--r-surface-2); background: var(--r-surface-2); }
.card > .table-responsive:last-child .table tr:last-child td { border-bottom: 0; }

/* --- Badges (always soft) --- */
.badge {
    border-radius: var(--r-radius-pill);
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    line-height: 1.4;
}
.badge.bg-primary, .badge.bg-light-primary, .badge.text-bg-primary, .bg-light-primary { background-color: var(--r-primary-soft) !important; color: var(--r-primary) !important; }
.badge.bg-success, .badge.bg-light-success, .badge.text-bg-success, .bg-light-success { background-color: var(--r-success-soft) !important; color: var(--r-success) !important; }
.badge.bg-warning, .badge.bg-light-warning, .badge.text-bg-warning, .bg-light-warning { background-color: var(--r-warning-soft) !important; color: var(--r-warning) !important; }
.badge.bg-danger, .badge.bg-light-danger, .badge.text-bg-danger, .bg-light-danger { background-color: var(--r-danger-soft) !important; color: var(--r-danger) !important; }
.badge.bg-info, .badge.bg-light-info, .badge.text-bg-info, .bg-light-info { background-color: var(--r-info-soft) !important; color: var(--r-info) !important; }
.badge.bg-secondary, .badge.bg-light-secondary, .badge.bg-light, .badge.text-bg-secondary, .bg-light-secondary { background-color: var(--r-surface-2) !important; color: var(--r-text-2) !important; border: 1px solid var(--r-border); }
.badge.bg-dark { background-color: var(--r-text) !important; color: var(--r-surface) !important; }

/* --- Tabs & pills --- */
.nav-tabs {
    border-bottom: 1px solid var(--r-border);
    gap: 4px;
}
.nav-tabs .nav-link {
    border: 0;
    border-radius: 0;
    color: var(--r-text-2);
    font-weight: 500;
    padding: 10px 14px;
    position: relative;
    background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--r-text); text-shadow: none; border: 0; }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
    color: var(--r-primary);
    background: transparent;
    border: 0;
}
.nav-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    width: auto;
    background: var(--r-primary);
    box-shadow: none;
}
.nav-pills .nav-link { border-radius: var(--r-radius-pill); color: var(--r-text-2); font-weight: 500; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
    background: var(--r-primary-soft);
    color: var(--r-primary);
    box-shadow: none;
}

/* --- Pagination --- */
.pagination { gap: 4px; }
.page-item .page-link, .page-item:first-child .page-link, .page-item:last-child .page-link {
    border: 1px solid var(--r-border);
    border-radius: 10px;
    color: var(--r-text);
    background: var(--r-surface);
    font-size: var(--r-fs-meta);
    min-width: 34px;
    text-align: center;
}
.page-item:first-child, .page-item:last-child { margin: 0; }
.page-item:not(.active) .page-link:hover { background: var(--r-surface-2); color: var(--r-text); }
.page-item.active .page-link, .pagination.pagination-primary .page-item.active .page-link {
    background: var(--r-primary);
    border-color: var(--r-primary);
    color: var(--r-surface);
    box-shadow: none;
}
.page-item.disabled .page-link { color: var(--r-text-3); background: var(--r-surface); }

/* --- Dropdown --- */
.dropdown-menu {
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-control);
    box-shadow: var(--r-shadow-md);
    padding: 6px;
    font-size: var(--r-fs-body);
}
.dropdown-item {
    border-radius: 8px;
    color: var(--r-text);
    padding: 8px 12px;
    transition: background-color var(--r-motion);
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--r-surface-2); color: var(--r-text); }
.dropdown-item.active, .dropdown-item:active { background: var(--r-primary-soft); color: var(--r-primary); }
.dropdown-divider { border-color: var(--r-border); }
.dropdown-toggle::after { color: inherit; }

/* --- Modal --- */
.modal-content, .modal .modal-content {
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card);
    box-shadow: var(--r-shadow-md);
}
.modal-header { border-bottom-color: var(--r-border); padding: 18px 24px; }
.modal-header .modal-title { font-size: var(--r-fs-md); font-weight: 600; }
.modal-body { padding: 20px 24px; }
.modal-footer { border-top-color: var(--r-border); padding: 14px 24px; }
.modal-backdrop.show { opacity: .35; }

/* --- Alerts (soft) --- */
.alert { border: 0; border-radius: var(--r-radius-control); padding: 12px 16px; font-size: var(--r-fs-body); }
.alert-primary, .alert-light-primary { background: var(--r-primary-soft); color: var(--r-primary); }
.alert-success, .alert-light-success { background: var(--r-success-soft); color: var(--r-success); }
.alert-warning, .alert-light-warning { background: var(--r-warning-soft); color: var(--r-warning); }
.alert-danger, .alert-light-danger { background: var(--r-danger-soft); color: var(--r-danger); }
.alert-info, .alert-light-info { background: var(--r-info-soft); color: var(--r-info); }
.alert-secondary, .alert-light, .alert-light-secondary { background: var(--r-surface-2); color: var(--r-text-2); }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* --- List group --- */
.list-group-item { border-color: var(--r-border); color: var(--r-text); background: var(--r-surface); }
.list-group-item-action:hover { background: var(--r-surface-2); }
.list-group-item.active { background: var(--r-primary-soft); border-color: var(--r-border); color: var(--r-primary); }

/* --- Progress --- */
.progress { background: var(--r-primary-soft); border-radius: var(--r-radius-pill); height: 8px; }
.progress .progress-bar, .progress.progress-primary .progress-bar { background: var(--r-primary); border-radius: var(--r-radius-pill); }
.progress.progress-success .progress-bar { background: var(--r-success); }
.progress.progress-warning .progress-bar { background: var(--r-warning); }
.progress.progress-danger .progress-bar { background: var(--r-danger); }

/* --- Breadcrumb --- */
.breadcrumb { font-size: var(--r-fs-meta); margin-bottom: 0; }
.breadcrumb-item, .breadcrumb-item a { color: var(--r-text-2); }
.breadcrumb-item.active { color: var(--r-text); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--r-text-3); }

/* --- Avatar (Mazer) --- */
.avatar .avatar-content { background: var(--r-primary-soft); color: var(--r-primary); font-weight: 600; }
.avatar.bg-primary .avatar-content, .avatar.bg-warning .avatar-content { color: var(--r-surface); }

/* --- Mazer stats icons: soft tiles instead of loud colours --- */
.stats-icon { background: var(--r-primary-soft); border-radius: var(--r-radius-control); }
.stats-icon i { color: var(--r-primary); }
.stats-icon.purple, .stats-icon.blue { background: var(--r-info-soft); }
.stats-icon.purple i, .stats-icon.blue i { color: var(--r-info); }
.stats-icon.green { background: var(--r-success-soft); }
.stats-icon.green i { color: var(--r-success); }
.stats-icon.red { background: var(--r-danger-soft); }
.stats-icon.red i { color: var(--r-danger); }

/* --- Sonner toasts --- */
[data-sonner-toast] {
    font-family: var(--r-font) !important;
    border-radius: var(--r-radius-control) !important;
    border: 1px solid var(--r-border) !important;
    box-shadow: var(--r-shadow-md) !important;
    background: var(--r-surface) !important;
    color: var(--r-text) !important;
}
[data-sonner-toast][data-type="success"] [data-icon] { color: var(--r-success); }
[data-sonner-toast][data-type="error"] [data-icon] { color: var(--r-danger); }
[data-sonner-toast][data-type="warning"] [data-icon] { color: var(--r-warning); }
[data-sonner-toast][data-type="info"] [data-icon] { color: var(--r-info); }

/* ========================================================================
 * 5. Mazer shell
 * ===================================================================== */
.bi::before, [class^="bi-"]::before, [class*=" bi-"]::before { vertical-align: 0; }
/* Mazer fixes .bi at 1rem square, so larger icons overflow to the bottom-right of their box. */
.bi { width: 1em; height: 1em; }

#sidebar .sidebar-wrapper {
    width: var(--r-sidebar-width);
    background: var(--r-surface);
    border-right: 1px solid var(--r-border);
    box-shadow: none;
}
#sidebar:not(.active) .sidebar-wrapper { left: calc(-1 * var(--r-sidebar-width)); }
#sidebar .sidebar-header {
    padding: 20px 20px 16px;
    font-size: var(--r-fs-md);
    border-bottom: 1px solid var(--r-border);
}
#sidebar .sidebar-header img { height: 28px; }
#sidebar .sidebar-wrapper .menu { margin-top: 8px; padding: 8px 12px; font-weight: 500; }
#sidebar .sidebar-title, #sidebar .sidebar-wrapper .menu .sidebar-title {
    color: var(--r-text-3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    margin: 16px 0 6px;
    padding: 0 12px;
}
#sidebar .sidebar-item { margin: 2px 0; }
#sidebar .sidebar-item .sidebar-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 9px 12px !important;
    border-radius: var(--r-radius-control) !important;
    color: var(--r-text) !important;
    font-weight: 500 !important;
    font-size: var(--r-fs-body) !important;
    background: transparent !important;
    transition: background-color var(--r-motion), color var(--r-motion);
}
#sidebar .sidebar-item .sidebar-link span { margin-left: 0; color: inherit !important; }
#sidebar .sidebar-item .sidebar-link i,
#sidebar .sidebar-item .sidebar-link svg {
    color: var(--r-text-2) !important;
    font-size: 16px !important;
    width: 18px;
    text-align: center;
}
#sidebar .sidebar-item .sidebar-link:hover { background: var(--r-surface-2) !important; color: var(--r-text) !important; }
#sidebar .sidebar-item.active > .sidebar-link,
#sidebar .sidebar-item.active > .sidebar-link:hover {
    background: var(--r-primary-soft) !important;
    color: var(--r-primary) !important;
    font-weight: 600 !important;
}
#sidebar .sidebar-item.active > .sidebar-link i,
#sidebar .sidebar-item.active > .sidebar-link svg { color: var(--r-primary) !important; fill: currentColor; }
#sidebar .sidebar-item.has-sub > .sidebar-link::after,
#sidebar .sidebar-item.has-sub > .sidebar-link::before { content: none !important; display: none !important; }
#sidebar .submenu {
    list-style: none;
    padding: 2px 0 2px 8px;
    margin: 0 0 0 21px;
    border-left: 1px solid var(--r-border);
}
#sidebar .submenu .submenu-item { margin: 2px 0; }
#sidebar .submenu .submenu-item a,
#sidebar .submenu .submenu-item .submenu-link {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 7px 10px !important;
    border-radius: 10px !important;
    color: var(--r-text-2) !important;
    font-size: var(--r-fs-meta) !important;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: none !important;
    transition: background-color var(--r-motion), color var(--r-motion);
}
#sidebar .submenu .submenu-item a:hover { background: var(--r-surface-2) !important; color: var(--r-text) !important; margin-left: 0; }
#sidebar .submenu .submenu-item.active > a {
    background: var(--r-primary-soft) !important;
    color: var(--r-primary) !important;
    font-weight: 600;
}

/* Brand block at the top of the sidebar */
.r-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; }
.r-brand img { height: 28px; width: auto; display: block; flex-shrink: 0; }
.r-brand-lg img { height: 44px; }
.r-brand-label {
    color: var(--r-text-2);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    border-left: 1px solid var(--r-border);
    padding-left: 8px;
    white-space: nowrap;
}


/* Current tenant card under the brand */
.r-tenant-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-control);
    background: var(--r-surface-2);
    min-width: 0;
}
.r-tenant-card img { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; background: var(--r-surface); flex-shrink: 0; }
.r-tenant-card-name { font-size: var(--r-fs-body); font-weight: 600; color: var(--r-text); line-height: 1.3; }
.r-tenant-card-meta { font-size: 12px; color: var(--r-text-2); line-height: 1.3; }

/* Topbar — sticky glass bar across #main: org/breadcrumb · quick search · chat · bell · user */
.r-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -20px -28px 20px;
    padding: 12px 28px;
    min-height: 68px;
    background: rgba(244, 245, 243, .78);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(227, 230, 232, .8);
}
@media (max-width: 1199.98px) {
    .r-topbar { margin: -16px -16px 16px; padding: 10px 16px; min-height: 60px; }
}
.r-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.r-topbar-org { align-items: center; gap: 10px; min-width: 0; }
.r-topbar-org-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: var(--r-radius-control);
    background: linear-gradient(135deg, var(--r-primary-bright), var(--r-primary-deep));
    color: #fff; font-size: 18px; box-shadow: var(--r-shadow-sm);
}
.r-topbar-org-name { display: block; font-weight: 700; color: var(--r-text); line-height: 1.25; max-width: 320px; }
.r-topbar-org-date { display: block; font-size: 12px; color: var(--r-text-2); line-height: 1.25; }
.r-topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.r-topbar-divider { width: 1px; height: 28px; background: var(--r-border); margin: 0 4px; }

/* Quick search trigger (opens ⌘K palette) */
.r-search-trigger {
    display: inline-flex; align-items: center; gap: 10px;
    flex: 0 1 360px; min-width: 0; height: 42px; padding: 0 8px 0 14px;
    border: 1px solid var(--r-border); border-radius: var(--r-radius-pill);
    background: var(--r-surface); color: var(--r-text-3, #98A0A6);
    font-size: var(--r-fs-body); text-align: left;
    transition: border-color .15s, box-shadow .15s;
}
.r-search-trigger:hover { border-color: var(--r-primary); box-shadow: 0 0 0 3px var(--r-primary-soft); color: var(--r-text-2); }
.r-search-trigger > .bi { color: var(--r-text-2); }
.r-search-trigger-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.r-search-trigger kbd, .r-qj kbd {
    font-family: inherit; font-size: 11px; font-weight: 600; color: var(--r-text-2);
    background: var(--r-surface-2); border: 1px solid var(--r-border); border-bottom-width: 2px;
    border-radius: 6px; padding: 1px 6px; box-shadow: none;
}
@media (max-width: 767.98px) {
    .r-search-trigger { flex: 0 0 42px; width: 42px; padding: 0; justify-content: center; }
    .r-search-trigger-text, .r-search-trigger kbd { display: none; }
}

.r-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: var(--r-radius-pill);
    border: 1px solid var(--r-border);
    background: var(--r-surface);
    color: var(--r-text-2);
    font-size: 18px;
    transition: background .15s, color .15s, transform .1s;
}
.r-icon-btn:hover { background: var(--r-primary-soft); color: var(--r-primary); border-color: transparent; }
.r-icon-btn:active { transform: scale(.95); }

/* Count badge on header icons: red gradient pill + white ring */
.r-count-badge {
    position: absolute; top: -3px; right: -3px;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-radius-pill); border: 2px solid var(--r-surface);
    background: linear-gradient(180deg, #FF5C5C, #E02D3C);
    color: #fff; font-size: 10px; font-weight: 800; line-height: 1;
    box-shadow: var(--r-shadow-sm);
}

/* ⌘K palette */
.r-qj-backdrop {
    position: fixed; inset: 0; z-index: 1080;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
    background: rgba(31, 42, 51, .35);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.r-qj {
    width: min(620px, 100%); overflow: hidden;
    background: var(--r-surface); border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card); box-shadow: var(--r-shadow-md);
}
.r-qj-search { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--r-border); }
.r-qj-search > .bi { font-size: 18px; color: var(--r-primary); }
.r-qj-search input { flex: 1; border: 0; outline: 0; font-size: 16px; color: var(--r-text); background: transparent; }
.r-qj-list { list-style: none; margin: 0; padding: 8px; max-height: 52vh; overflow-y: auto; }
.r-qj-item {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; border: 0; border-radius: var(--r-radius-control);
    background: transparent; color: var(--r-text); text-align: left;
}
.r-qj-item.is-active { background: var(--r-primary-soft); }
.r-qj-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 10px; background: var(--r-surface-2); color: var(--r-text-2);
}
.r-qj-item.is-active .r-qj-icon { background: var(--r-primary); color: #fff; }
.r-qj-label { flex: 1; font-weight: 600; }
.r-qj-group { font-size: 12px; color: var(--r-text-2); }
.r-qj-enter { color: var(--r-primary); opacity: 0; }
.r-qj-item.is-active .r-qj-enter { opacity: 1; }
.r-qj-empty { padding: 24px; text-align: center; color: var(--r-text-2); }
.r-qj-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--r-border); font-size: 12px; color: var(--r-text-2); background: var(--r-surface-2); }
.r-qj-foot kbd { margin-right: 4px; }

/* Initials avatar + user menu toggle */
.r-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--r-radius-pill);
    background: var(--r-primary-soft);
    color: var(--r-primary);
    font-size: var(--r-fs-meta);
    font-weight: 600;
}
.r-user-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 3px 12px 3px 3px;
    border: 1px solid transparent;
    border-radius: var(--r-radius-pill);
    background: transparent;
    color: var(--r-text);
    max-width: 240px;
}
.r-user-toggle:hover, .r-user-toggle[aria-expanded="true"] { background: var(--r-surface); border-color: var(--r-border); }
.r-user-toggle::after { display: none; }
.r-user-name { font-size: var(--r-fs-body); font-weight: 600; line-height: 1.2; }
.r-user-role { font-size: 12px; color: var(--r-text-2); line-height: 1.2; }
.r-user-caret { font-size: 12px; color: var(--r-text-2); transition: transform .2s; }
.r-user-toggle[aria-expanded="true"] .r-user-caret { transform: rotate(180deg); }
/* Avatar with brand gradient ring */
.r-avatar-ring {
    background:
        linear-gradient(var(--r-primary-soft), var(--r-primary-soft)) padding-box,
        linear-gradient(135deg, var(--r-primary-bright), var(--r-primary-deep)) border-box;
    border: 2px solid transparent;
    font-weight: 700;
}
/* User dropdown card */
.r-user-menu {
    width: 280px; padding: 8px; border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card); box-shadow: var(--r-shadow-md);
}
.r-user-menu-head { display: flex; align-items: flex-start; gap: 12px; padding: 10px 10px 12px; }
.r-user-menu-head .r-avatar { width: 44px; height: 44px; font-size: var(--r-fs-body); }
.r-user-menu-org {
    display: flex; align-items: center; gap: 8px; margin: 0 4px 6px; padding: 8px 10px;
    border-radius: var(--r-radius-control); background: var(--r-surface-2);
    font-size: 13px; color: var(--r-text-2);
}
.r-user-menu-item { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 9px 10px; font-weight: 500; }
.r-user-menu-item .bi { font-size: 16px; color: var(--r-text-2); }
.r-user-menu-item.is-danger, .r-user-menu-item.is-danger .bi { color: var(--r-danger); }
.r-user-menu-item.is-danger:hover { background: var(--r-danger-soft); }

/* Off-canvas sidebar backdrop (phones, below 768px) */
.r-backdrop { position: fixed; inset: 0; z-index: 8; background: rgba(31, 42, 51, .35); }

/* Renter area header */
.r-renter-header { background: var(--r-surface); border-bottom: 1px solid var(--r-border); }
.r-renter-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 10px; flex-shrink: 0; }

/* Sidebar nav counters */
.r-nav-count {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: var(--r-radius-pill);
    background: var(--r-warning-soft);
    color: var(--r-warning);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

#main { margin-left: var(--r-sidebar-width); padding: 20px 28px; }
#main.layout-navbar { padding: 0; }
@media screen and (max-width: 767.98px) {
    /* Drawer nằm trên header sticky (z 20) để logo không bị che. */
    #sidebar .sidebar-wrapper { left: calc(-1 * var(--r-sidebar-width)); z-index: 40; }
    .r-backdrop { z-index: 35; }
    #sidebar.active .sidebar-wrapper { left: 0; box-shadow: var(--r-shadow-md); }
    #main { margin-left: 0; padding: 16px; }
}
/* Collapsible sidebar (iPad + desktop ≥768px): chỉ còn logo-mark + icon, tooltip tên mục */
.r-brand-mark { display: none !important; }
.r-sb-tip {
    position: fixed;
    left: calc(var(--r-sidebar-collapsed-width) + 6px);
    z-index: 1060;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--r-text);
    color: var(--r-surface);
    font-size: var(--r-fs-meta);
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--r-shadow-md);
    animation: r-sb-tip-in .14s ease-out;
}
@keyframes r-sb-tip-in { from { opacity: 0; transform: translate(-4px, -50%); } }
@media screen and (min-width: 768px) {
    /* Mazer ẩn sidebar dưới 1200px — từ khổ iPad giữ sidebar cố định. */
    #sidebar .sidebar-wrapper { position: fixed; left: 0; transition: width var(--r-sb-motion), left var(--r-sb-motion); overflow-x: hidden; }
    #main { margin-left: var(--r-sidebar-width); transition: margin-left var(--r-sb-motion); }
    .r-sb-collapsed #sidebar .sidebar-wrapper { width: var(--r-sidebar-collapsed-width); }
    .r-sb-collapsed #main { margin-left: var(--r-sidebar-collapsed-width); }
    .r-sb-collapsed #sidebar .sidebar-header { padding: 20px 0 16px; display: flex; justify-content: center; }
    .r-sb-collapsed .r-brand { justify-content: center; }
    .r-sb-collapsed .r-brand-full { display: none !important; }
    .r-sb-collapsed .r-brand-mark { display: block !important; height: 40px !important; }
    .r-sb-collapsed #sidebar .sidebar-wrapper .menu { padding: 8px 14px; }
    .r-sb-collapsed #sidebar .menu > .sidebar-title:first-child { display: none; }
    .r-sb-collapsed #sidebar .sidebar-title {
        height: 1px;
        margin: 14px 8px 10px;
        padding: 0;
        overflow: hidden;
        font-size: 0;
        background: var(--r-border);
    }
    .r-sb-collapsed #sidebar .sidebar-item .sidebar-link {
        position: relative;
        justify-content: center;
        padding: 11px 0 !important;
    }
    .r-sb-collapsed #sidebar .sidebar-item .sidebar-link i { font-size: 18px !important; width: 20px; }
    .r-sb-collapsed #sidebar .sidebar-item .sidebar-link > span,
    .r-sb-collapsed #sidebar .sidebar-item .sidebar-link > .ms-auto { display: none; }
    .r-sb-collapsed #sidebar .sidebar-item .sidebar-link > .r-nav-count {
        display: block;
        position: absolute;
        top: 6px;
        right: 8px;
        min-width: 0;
        width: 9px;
        height: 9px;
        padding: 0;
        font-size: 0;
        background: var(--r-warning);
        box-shadow: 0 0 0 2px var(--r-surface);
    }
}
@media screen and (min-width: 768px) and (max-width: 1199px) {
    #main { padding: 16px 20px; }
    .r-topbar { margin: -16px -20px 16px; padding: 12px 20px; }
}
/* Header không bao giờ bóp méo nút tròn; khổ hẹp (iPad dọc) ẩn bớt chữ. */
.r-topbar .r-icon-btn, .r-topbar .r-sb-trigger, .r-topbar-org-icon { flex-shrink: 0; }
@media (max-width: 991.98px) {
    .r-topbar-org > .min-w-0 { display: none; }
    .r-search-trigger { flex: 0 0 42px; width: 42px; padding: 0; justify-content: center; }
    .r-search-trigger-text, .r-search-trigger kbd { display: none; }
}

/* Nút thu/mở sidebar trên header: khung + panel trái co giãn + mũi tên xoay */
.r-sb-icon { display: block; overflow: visible; }
.r-sb-icon-frame { fill: none; stroke: currentColor; stroke-width: 1.7; }
.r-sb-icon-panel {
    fill: var(--r-primary);
    opacity: .9;
    transform-box: fill-box;
    transform-origin: left center;
    transform: scaleX(.5);
    transition: transform var(--r-sb-motion), fill var(--r-motion);
}
.r-sb-icon-arrow {
    fill: none;
    stroke: var(--r-primary);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform var(--r-sb-motion);
}
.r-sb-trigger.is-expanded .r-sb-icon-panel { transform: scaleX(1); }
.r-sb-trigger.is-expanded .r-sb-icon-arrow { transform: rotate(180deg); }
.r-sb-trigger:hover .r-sb-icon-arrow { stroke: var(--r-primary-deep); }
.r-sb-trigger:active { transform: scale(.94); }

/* Logo cố định khi cuộn sidebar; thanh cuộn ẩn hẳn (vẫn cuộn bằng chuột/cảm ứng) */
#sidebar .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--r-surface);
}
#sidebar .sidebar-wrapper { scrollbar-width: none; -ms-overflow-style: none; }
#sidebar .sidebar-wrapper::-webkit-scrollbar { display: none; width: 0; height: 0; }

@media (prefers-reduced-motion: reduce) {
    #sidebar .sidebar-wrapper, #main, .r-sb-icon-panel, .r-sb-icon-arrow { transition: none !important; }
}
#app #main { min-height: 100vh; display: flex; flex-direction: column; }
#app #main > footer { margin-top: auto; }

.page-heading { margin: 0 0 24px; }
.page-heading h3 { font-size: var(--r-fs-page-title); font-weight: 600; margin-bottom: 4px; }
.page-heading .text-subtitle { color: var(--r-text-2); font-size: var(--r-fs-body); }

/* Mazer auth page */
#auth { background: var(--r-bg); }
#auth #auth-left { padding: 48px; }
#auth #auth-left .auth-title { font-size: 30px; font-weight: 700; color: var(--r-text); margin-bottom: 8px; }
#auth #auth-left .auth-subtitle { color: var(--r-text-2); font-size: var(--r-fs-md); }
#auth #auth-right { background: var(--r-primary); }
.r-auth-logo { height: 36px; width: auto; }
.r-auth-mark { width: 120px; height: 120px; border-radius: 32px; background: var(--r-surface); padding: 12px; }
.r-auth-tagline { color: var(--r-primary-soft); font-size: var(--r-fs-md); line-height: 1.6; }

/* Login (React /login) — split screen: friendly form on the left, product visual on the right. */
.r-login {
    --r-login-overlay: linear-gradient(160deg, rgba(22, 73, 42, .92) 0%, rgba(45, 128, 48, .80) 55%, rgba(67, 165, 54, .70) 100%);
    --r-login-glass: rgba(255, 255, 255, .14);
    --r-login-glass-border: rgba(255, 255, 255, .28);
    --r-login-form-bg: radial-gradient(70% 60% at 0% 0%, #EAF5E5 0%, rgba(234, 245, 229, 0) 70%), var(--r-bg);
    --r-login-btn: linear-gradient(180deg, #4AAE3E 0%, var(--r-primary) 55%, #23692A 100%);
    --r-shadow-login-card: 0 1px 2px rgba(31, 42, 51, .04), 0 24px 60px rgba(22, 73, 42, .10);
    --r-shadow-login-btn: 0 10px 24px rgba(45, 128, 48, .30), inset 0 1px 0 rgba(255, 255, 255, .25);
    --r-shadow-login-shot: 0 30px 60px rgba(0, 0, 0, .30);
    display: grid;
    grid-template-columns: minmax(420px, 46%) 1fr;
    min-height: 100vh;
    background: var(--r-login-form-bg);
}
.r-login-form-side { display: flex; flex-direction: column; padding: 28px clamp(20px, 5vw, 64px); }
.r-login-top { display: flex; align-items: center; justify-content: space-between; }
.r-login-brand img { height: 40px; width: auto; display: block; }
.r-login-back { display: inline-flex; align-items: center; gap: 6px; color: var(--r-text-2); font-weight: 500; text-decoration: none; padding: 8px 14px; border-radius: var(--r-radius-pill); transition: background var(--r-motion), color var(--r-motion); }
.r-login-back:hover { background: var(--r-surface); color: var(--r-primary); }

.r-login-card {
    width: 100%; max-width: 440px;
    margin: auto;
    padding: 36px 36px 28px;
    background: var(--r-surface);
    border: 1px solid var(--r-border);
    border-radius: 24px;
    box-shadow: var(--r-shadow-login-card);
    animation: r-login-in .6s cubic-bezier(.2, .8, .2, 1) both;
}
.r-login-hello { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-radius-pill); background: var(--r-primary-soft); color: var(--r-primary); font-size: 12px; font-weight: 600; }
.r-login-title { font-size: 26px; font-weight: 700; color: var(--r-text); margin: 14px 0 6px; letter-spacing: -.02em; }
.r-login-subtitle { color: var(--r-text-2); margin: 0 0 16px; }
.r-login-roles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.r-login-roles span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-radius-pill); border: 1px solid var(--r-border); background: var(--r-surface-2); color: var(--r-text-2); font-size: 12px; font-weight: 500; }
.r-login-roles i { color: var(--r-primary); }

.r-login-field { margin-bottom: 18px; }
.r-login-field label { display: block; font-weight: 600; font-size: var(--r-fs-meta); color: var(--r-text); margin-bottom: 7px; }
.r-login-label-row { display: flex; align-items: baseline; justify-content: space-between; }
.r-login-link { border: 0; background: none; padding: 0; color: var(--r-primary); font-size: var(--r-fs-meta); font-weight: 600; cursor: pointer; }
.r-login-link:hover { text-decoration: underline; }
.r-login-input {
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 14px;
    background: var(--r-surface-2);
    border: 1.5px solid var(--r-border);
    border-radius: 14px;
    transition: border-color var(--r-motion), background var(--r-motion), box-shadow var(--r-motion);
}
.r-login-input > i { color: var(--r-text-3); font-size: 18px; transition: color var(--r-motion); }
.r-login-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--r-text); }
.r-login-input input::placeholder { color: var(--r-text-3); }
.r-login-input:hover { border-color: var(--r-text-3); }
.r-login-input:focus-within { background: var(--r-surface); border-color: var(--r-primary); box-shadow: var(--r-focus-ring); }
.r-login-input:focus-within > i { color: var(--r-primary); }
.r-login-input.is-invalid { border-color: var(--r-danger); background: var(--r-danger-soft); }
.r-login-input.is-invalid > i { color: var(--r-danger); }
.r-login-eye { border: 0; background: none; color: var(--r-text-3); font-size: 18px; padding: 6px; margin-right: -6px; border-radius: 8px; cursor: pointer; }
.r-login-eye:hover { color: var(--r-primary); background: var(--r-primary-soft); }
.r-login-error, .r-login-hint { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: var(--r-fs-meta); }
.r-login-hint[hidden] { display: none; }
.r-login-error { color: var(--r-danger); }
.r-login-hint { color: var(--r-warning); }
.r-login-help { display: flex; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--r-info-soft); color: var(--r-info); font-size: var(--r-fs-meta); line-height: 1.5; animation: r-login-in .3s ease both; }
.r-login-alert { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--r-danger-soft); color: var(--r-danger); font-size: var(--r-fs-meta); margin-bottom: 14px; animation: r-login-shake .4s ease; }

.btn.r-login-submit {
    width: 100%; height: 52px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 14px;
    background: var(--r-login-btn);
    font-size: var(--r-fs-md); font-weight: 600;
    box-shadow: var(--r-shadow-login-btn);
    transition: transform var(--r-motion), box-shadow var(--r-motion), filter var(--r-motion);
}
.btn.r-login-submit:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); box-shadow: var(--r-shadow-login-btn); }
.btn.r-login-submit .bi-arrow-right { transition: transform var(--r-motion); }
.btn.r-login-submit:hover .bi-arrow-right { transform: translateX(4px); }
.btn.r-login-submit:disabled { opacity: .75; }
.r-login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 0; padding-top: 18px; border-top: 1px dashed var(--r-border); color: var(--r-text-2); font-size: var(--r-fs-meta); text-align: center; }
.r-login-foot i { color: var(--r-primary); }
.r-login-copy { margin: 20px 0 0; text-align: center; color: var(--r-text-3); font-size: 12px; }

.r-login-visual {
    position: relative;
    margin: 16px 16px 16px 0;
    border-radius: 28px;
    overflow: hidden;
    background: var(--r-login-overlay), url('/images/landing/hero-bg.jpg') center / cover no-repeat;
    color: var(--r-surface);
}
.r-login-visual-inner { position: relative; height: 100%; display: flex; flex-direction: column; padding: clamp(32px, 4vw, 56px); gap: 28px; }
.r-login-visual-inner.is-centered { justify-content: center; max-width: 620px; margin: 0 auto; gap: 36px; }
.r-login-visual-inner.is-centered .r-login-highlights { grid-template-columns: 1fr; }
.r-login-visual-inner.is-centered .r-login-highlights li { align-items: center; padding: 16px 18px; }
.r-login-visual-inner.is-centered .r-login-hl-icon { width: 42px; height: 42px; font-size: 19px; border-radius: 12px; }
.r-login-visual-inner.is-centered .r-login-highlights b { font-size: var(--r-fs-md); }
.r-login-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-radius-pill); background: var(--r-login-glass); border: 1px solid var(--r-login-glass-border); font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.r-login-visual-copy h2 { color: var(--r-surface); font-size: clamp(28px, 2.6vw, 40px); font-weight: 700; line-height: 1.2; margin: 16px 0 10px; letter-spacing: -.02em; }
.r-login-visual-copy h2 span { color: var(--r-primary-soft); }
.r-login-visual-copy p { max-width: 460px; margin: 0; opacity: .88; font-size: 15px; line-height: 1.6; }

.r-login-shots { position: relative; flex: 1; min-height: 240px; }
.r-login-shot { position: absolute; display: block; background: var(--r-surface); box-shadow: var(--r-shadow-login-shot); }
.r-login-shot.is-web { left: 0; top: 0; width: 80%; max-height: 100%; object-fit: cover; object-position: top; border-radius: 14px; border: 6px solid var(--r-text); animation: r-login-float 7s ease-in-out infinite; }
.r-login-shot.is-phone { right: 2%; top: 6%; bottom: 0; height: 94%; width: auto; aspect-ratio: 9 / 19.5; object-fit: cover; object-position: top; border-radius: 26px; border: 6px solid var(--r-text); animation: r-login-float 6s ease-in-out -2s infinite; }

.r-login-highlights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.r-login-highlights li { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--r-login-glass); border: 1px solid var(--r-login-glass-border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.r-login-highlights b { display: block; font-size: var(--r-fs-meta); margin-bottom: 2px; }
.r-login-highlights small { display: block; font-size: 12px; opacity: .85; line-height: 1.45; }
.r-login-hl-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--r-surface); color: var(--r-primary); font-size: 16px; }

@keyframes r-login-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes r-login-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes r-login-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 1199.98px) { .r-login-highlights { grid-template-columns: 1fr; } .r-login-shots { display: none; } }
@media (max-width: 991.98px) {
    .r-login { grid-template-columns: 1fr; }
    .r-login-visual { display: none; }
}
@media (max-width: 575.98px) {
    .r-login-form-side { padding: 18px 16px; }
    .r-login-card { padding: 26px 20px 22px; border-radius: 20px; margin-top: 24px; }
    .r-login-title { font-size: 22px; }
    .r-login-back span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .r-login-card, .r-login-shot, .r-login-help, .r-login-alert { animation: none; }
}

/* Roomy type scale (Blade admin + React staff app, body.r-roomy): bigger text, logo and controls for desktop monitors. */
.r-roomy {
    --r-fs-meta: 14px;
    --r-fs-body: 15px;
    --r-fs-md: 17px;
    --r-fs-card-title: 21px;
    --r-fs-page-title: 28px;
    --r-fs-kpi: 34px;
    --r-sidebar-width: 296px;
}
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-header {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 18px 24px 16px;
}
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-header img,
.r-roomy #app:not(.r-sb-collapsed) .r-brand-full,
.r-roomy #app:not(.r-sb-collapsed) .r-brand img { height: 68px; }
.r-roomy .r-brand { justify-content: center; }
#sidebar .sidebar-header .sidebar-hide { margin-left: auto; }
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-title, .r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-wrapper .menu .sidebar-title { font-size: 12px; margin: 22px 0 8px; }
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-item .sidebar-link { padding: 12px 14px !important; gap: 14px; }
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-item .sidebar-link i,
.r-roomy #app:not(.r-sb-collapsed) #sidebar .sidebar-item .sidebar-link svg { font-size: 21px !important; width: 24px; }
.r-roomy .r-page-header .r-page-subtitle { font-size: var(--r-fs-md); }
.r-roomy .r-user-role, .r-roomy .r-user-caret, .r-roomy .r-topbar-org-date, .r-roomy .r-tenant-card-meta { font-size: 13px; }
.r-roomy .r-user-toggle .r-avatar { width: 44px; height: 44px; font-size: var(--r-fs-body); }
.r-roomy .r-badge { font-size: 13px; padding: 5px 13px; }
.r-roomy .table > thead > tr > th, .r-roomy .table thead th { padding: 14px 12px; white-space: normal; }
.r-roomy .table > tbody > tr > td, .r-roomy .table td { padding: 15px 12px; }
.r-roomy .btn { padding: 10px 20px; }
.r-roomy .btn-sm { padding: 7px 15px; }
.r-roomy .form-control, .r-roomy .form-select { padding: 11px 15px; }
.r-roomy .form-control-sm, .r-roomy .form-select-sm { padding: 8px 13px; }
/* Admin quick jump (topbar search over the sidebar entries) */
.r-jump {
    position: relative; align-items: center; gap: 10px;
    flex: 0 1 440px; min-width: 0; height: 46px; padding: 0 10px 0 16px; margin: 0 auto;
    border: 1px solid var(--r-border); border-radius: var(--r-radius-pill);
    background: var(--r-surface); color: var(--r-text-2);
    transition: border-color var(--r-motion), box-shadow var(--r-motion);
}
.r-jump:focus-within { border-color: var(--r-primary); box-shadow: var(--r-focus-ring); }
.r-jump > .bi { color: var(--r-text-2); }
.r-jump input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: var(--r-fs-body); color: var(--r-text); }
.r-jump input::placeholder { color: var(--r-text-3); }
.r-jump input::-webkit-search-cancel-button { display: none; }
.r-jump kbd {
    font-family: inherit; font-size: 12px; font-weight: 600; color: var(--r-text-2);
    background: var(--r-surface-2); border: 1px solid var(--r-border); border-bottom-width: 2px;
    border-radius: 6px; padding: 1px 7px; box-shadow: none;
}
.r-jump:focus-within kbd { display: none; }
.r-jump-list {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
    margin: 0; padding: 6px; list-style: none; max-height: 360px; overflow-y: auto;
    background: var(--r-surface); border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card); box-shadow: var(--r-shadow-md);
}
.r-jump-list[hidden] { display: none; }
.r-jump-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--r-radius-control); color: var(--r-text); font-weight: 500; cursor: pointer;
}
.r-jump-item i { color: var(--r-text-2); font-size: 18px; width: 22px; text-align: center; }
.r-jump-item.is-active, .r-jump-item:hover { background: var(--r-primary-soft); color: var(--r-primary); }
.r-jump-item.is-active i, .r-jump-item:hover i { color: var(--r-primary); }
.r-jump-empty { padding: 14px 12px; color: var(--r-text-2); text-align: center; }

/* Hard-coded small text elsewhere in the shell (quick-jump, nav counters, kbd hints) follows the roomy scale too. */
.r-roomy .r-qj-group, .r-roomy .r-qj-foot, .r-roomy .r-search-trigger kbd, .r-roomy .r-sb-tip { font-size: 12px; }
.r-roomy .r-nav-count { font-size: 11px; }
.r-roomy .badge { font-size: 12px; font-weight: 500; padding: 6px 12px; }
.r-roomy .table td:first-child, .r-roomy .table th:first-child { min-width: 150px; }
.r-roomy .table td:not(:first-child) a { overflow-wrap: anywhere; }
.r-roomy .small, .r-roomy small, .r-roomy .form-text { font-size: var(--r-fs-meta); }
.r-roomy .dropdown-menu, .r-roomy .dropdown-item, .r-roomy .nav-link, .r-roomy .page-link { font-size: var(--r-fs-body); }

/* ========================================================================
 * 6. Utilities
 * ===================================================================== */
.r-card {
    background: var(--r-surface);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card);
    box-shadow: var(--r-shadow-sm);
    padding: 20px 24px;
}

.r-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 16px;
}
.r-page-header h1, .r-page-header h2, .r-page-header h3, .r-page-header .r-page-title {
    font-size: var(--r-fs-page-title);
    font-weight: 600;
    margin: 0;
}
.r-page-header .r-page-subtitle { color: var(--r-text-2); margin: 4px 0 0; }
.r-page-header .r-page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }

.r-section-title {
    font-size: var(--r-fs-md);
    font-weight: 600;
    color: var(--r-text);
    margin: 0 0 12px;
}

.r-kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.r-kpi-label { color: var(--r-text-2); font-size: var(--r-fs-meta); font-weight: 500; }
.r-kpi-value {
    font-size: var(--r-fs-kpi);
    font-weight: 600;
    line-height: 1.2;
    color: var(--r-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.r-kpi-value.is-compact { font-size: clamp(18px, 1.4vw, var(--r-fs-page-title)); }
.r-kpi-trend { font-size: var(--r-fs-meta); color: var(--r-text-2); }
.r-kpi-trend.is-up { color: var(--r-success); }
.r-kpi-trend.is-down { color: var(--r-danger); }

.r-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: var(--r-radius-pill);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    padding: 4px 10px;
    white-space: nowrap;
}
.r-badge-primary { background: var(--r-primary-soft); color: var(--r-primary); }
.r-badge-success { background: var(--r-success-soft); color: var(--r-success); }
.r-badge-warning { background: var(--r-warning-soft); color: var(--r-warning); }
.r-badge-danger { background: var(--r-danger-soft); color: var(--r-danger); }
.r-badge-info { background: var(--r-info-soft); color: var(--r-info); }
.r-badge-accent { background: var(--r-accent-soft); color: var(--r-accent-strong); }
.r-badge-neutral { background: var(--r-surface-2); color: var(--r-text-2); border: 1px solid var(--r-border); }

.r-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 12px;
}
/* Status chips sharing the row with search/selects */
.r-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.r-filter-bar .r-filter-end { margin-left: auto; }
@media (max-width: 575.98px) {
    /* Phones: search takes the full row, selects pair up two per row. */
    .r-filter-bar .r-filter-search { flex: 1 1 100%; max-width: none; }
    .r-filter-bar > .form-select, .r-filter-bar > .form-control:not(.r-filter-search) { flex: 1 1 calc(50% - 6px); min-width: 0; }
}
.r-filter-bar .form-control, .r-filter-bar .form-select { width: auto; min-width: 180px; }
.r-filter-bar .r-filter-search { flex: 1 1 240px; max-width: 360px; }

.r-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-pill);
    background: var(--r-surface);
    color: var(--r-text-2);
    font-size: var(--r-fs-meta);
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color var(--r-motion), color var(--r-motion), border-color var(--r-motion);
}
.r-chip:hover { background: var(--r-surface-2); color: var(--r-text); }
.r-chip.is-active { background: var(--r-primary-soft); border-color: var(--r-primary-soft); color: var(--r-primary); }
.r-chip:focus-visible { outline: none; box-shadow: var(--r-focus-ring-strong); }

.r-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 40px 16px;
    color: var(--r-text-2);
}
.r-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--r-radius-pill);
    background: var(--r-primary-soft);
    color: var(--r-primary);
    font-size: 24px;
}

.r-skeleton {
    display: block;
    border-radius: 8px;
    background: var(--r-border);
    min-height: 12px;
    animation: r-skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes r-skeleton-pulse {
    0%, 100% { opacity: .55; }
    50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .r-skeleton { animation: none; }
}

.r-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    background: var(--r-bg);
    border-top: 1px solid var(--r-border);
}

.r-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.min-w-0 { min-width: 0 !important; }

/* Mazer narrows .container gutters to 10.5px; keep a 16px side gutter on phones. */
@media (max-width: 575.98px) {
    .container, .container-fluid { padding-left: 16px; padding-right: 16px; }
}

/* Bootstrap shadow utilities mapped to the only two allowed elevations */
.shadow-sm { box-shadow: var(--r-shadow-sm) !important; }
.shadow, .shadow-lg { box-shadow: var(--r-shadow-md) !important; }

.r-avatar-lg { width: 64px; height: 64px; font-size: var(--r-fs-card-title); }

/* Horizontally scrollable tab strip (many tabs on narrow screens) */
.r-tabs-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.r-tabs-scroll::-webkit-scrollbar { display: none; }
.r-tabs-scroll > .nav-tabs { flex-wrap: nowrap; white-space: nowrap; min-width: max-content; }

/* Ghost icon button for table row actions */
.r-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--r-text-2);
    transition: background-color var(--r-motion), color var(--r-motion);
}
.r-icon-action:hover { background: var(--r-surface-2); color: var(--r-primary); }
.r-icon-action.is-danger:hover { background: var(--r-danger-soft); color: var(--r-danger); }
.r-icon-action:focus-visible { outline: none; box-shadow: var(--r-focus-ring-strong); }

/* Room-map tiles tinted by status */
.r-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.r-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-control);
    background: var(--r-surface);
    color: var(--r-text);
    text-decoration: none;
    transition: border-color var(--r-motion);
}
.r-tile:hover { border-color: var(--r-primary); color: var(--r-text); }
.r-tile-success { background: var(--r-success-soft); }
.r-tile-warning { background: var(--r-warning-soft); }
.r-tile-danger { background: var(--r-danger-soft); }
.r-tile-info { background: var(--r-info-soft); }
.r-tile-accent { background: var(--r-accent-soft); }
.r-tile-neutral { background: var(--r-surface-2); }
.r-tile-code { font-weight: 600; }
.r-tile-renter { font-size: var(--r-fs-meta); color: var(--r-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-tile-price { font-size: var(--r-fs-meta); font-variant-numeric: tabular-nums; }

/* Contract template editor (Cấu hình › Mẫu hợp đồng) */
.ct-paper {
    background: var(--r-surface);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius-card);
    padding: 40px 48px;
    min-height: 60vh;
    font-family: "Times New Roman", var(--r-font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--r-text);
    overflow-wrap: anywhere;
}
.ct-paper .ProseMirror { outline: none; min-height: 50vh; }
.ct-paper p { margin: 0 0 6px; }
.ct-paper ol, .ct-paper ul { margin: 0 0 6px; padding-left: 24px; }
.ct-paper h1, .ct-paper h2, .ct-paper h3 { margin: 12px 0 6px; }
.ct-paper h1, .ct-paper h2, .ct-paper h3 { font-family: inherit; }
.ct-paper h1 { font-size: 22px; }
.ct-paper h2 { font-size: 17px; text-transform: uppercase; }
.ct-paper h3 { font-size: 15px; font-style: italic; }
.ct-paper table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.ct-paper td, .ct-paper th { border: 1px solid var(--r-border); padding: 4px 8px; vertical-align: top; }
.ct-paper .ct-table th { background: var(--r-surface-2); }
.ct-var {
    display: inline-block;
    padding: 0 8px;
    border-radius: var(--r-radius-pill);
    background: var(--r-primary-soft);
    color: var(--r-primary);
    font-family: var(--r-font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
    white-space: nowrap;
}
.ct-block {
    margin: 8px 0;
    padding: 10px 14px;
    border: 1px dashed var(--r-border);
    border-radius: var(--r-radius-control);
    background: var(--r-surface-2);
    color: var(--r-text-2);
    font-family: var(--r-font);
    font-size: 13px;
}
.ct-if {
    position: relative;
    margin: 10px 0;
    padding: 24px 12px 6px;
    border: 1px dashed var(--r-warning);
    border-radius: var(--r-radius-control);
}
.ct-if::before {
    content: "Chỉ hiện khi: " attr(data-label);
    position: absolute;
    top: 4px;
    left: 12px;
    right: 12px;
    font-family: var(--r-font);
    font-size: 12px;
    color: var(--r-warning);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ProseMirror-selectednode.ct-var, .ProseMirror-selectednode.ct-block { box-shadow: var(--r-focus-ring); }
@media (min-width: 1200px) {
    .ct-sidepanel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}
@media (max-width: 575.98px) {
    .ct-paper { padding: 20px 16px; }
}

/* ========================================================================
 * 7. Print
 * ===================================================================== */
@media print {
    html, body { background: #fff; }
    .card, .r-card { box-shadow: none; border: 0; }
}
