@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --hb-primary: #1f6feb;
    --hb-primary-600: #165bc2;
    --hb-accent: #0f766e;
    --hb-bg: #f8fafc;
    --hb-surface: #ffffff;
    --hb-text: #0f172a;
    --hb-text-muted: #475569;
    --hb-border: #e2e8f0;
    --hb-danger: #dc2626;
    --hb-warning: #d97706;
    --hb-success: #0f766e;
    --hb-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
    --hb-shadow-md: 0 10px 28px rgba(15, 23, 42, 0.08);
    --bs-primary: var(--hb-primary);
    --bs-link-color: var(--hb-primary);
    --bs-link-hover-color: var(--hb-primary-600);
    --hb-vite-violet: #7c3aed;
    --hb-vite-blue: #2563eb;
    --hb-vite-cyan: #06b6d4;
    --hb-vite-form-bg: linear-gradient(180deg, rgba(255,255,255,.95), rgba(246,249,255,.92));
    --hb-vite-form-border: rgba(148, 163, 184, .22);
    --hb-vite-form-shadow: 0 16px 34px rgba(37, 99, 235, .08);
    --hb-vite-focus-ring: 0 0 0 0.24rem rgba(124, 58, 237, .12);
}

html, body {
    font-family: "Manrope", "Segoe UI Variable", "Segoe UI", sans-serif;
    background:
        radial-gradient(1000px 420px at 8% 0%, rgba(124, 58, 237, 0.10), transparent 58%),
        radial-gradient(900px 420px at 100% 0%, rgba(6, 182, 212, 0.08), transparent 56%),
        linear-gradient(180deg, #eef4ff 0%, #f6f8ff 42%, #eef6ff 100%);
    color: var(--hb-text);
}

a, .btn-link {
    color: var(--hb-primary);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: var(--hb-primary-600);
}

.content {
    padding-top: 1.1rem;
    position: relative;
}

/* ── Allow cat-dd (custom dropdowns) to float in non-scrollable modals ── */
.modal-dialog:not(.modal-dialog-scrollable) .modal-content { overflow: visible !important; }
.modal-dialog:not(.modal-dialog-scrollable) .modal-body    { overflow: visible !important; }
/* SearchSelect uses position:fixed — no overflow override needed */

.content::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(720px 280px at 18% 0%, rgba(124, 58, 237, 0.06), transparent 60%),
        radial-gradient(760px 360px at 100% 12%, rgba(6, 182, 212, 0.05), transparent 58%);
    z-index: -1;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--hb-text);
    font-weight: 700;
    letter-spacing: 0.01em;
}

h1:focus {
    outline: none;
}

.card, .modal-content, .table, .alert {
    border-radius: 12px;
}

.card, .modal-content {
    border: 1px solid var(--hb-border);
    box-shadow: var(--hb-shadow-sm);
}

.card {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.88));
    backdrop-filter: blur(14px);
}

.table {
    --bs-table-bg: transparent;
    border-color: var(--hb-border);
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--hb-border);
    overflow: hidden;
}

.table > :not(caption) > * > * {
    border-bottom-color: #e8eef6;
    padding: .72rem .78rem;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #f8fbff;
}

.table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f8fbff 0%, #f0f6ff 100%);
    color: #1f2937;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid #dbe5f2;
    white-space: nowrap;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #eef6ff;
}

.table-sm > :not(caption) > * > * {
    padding: .52rem .62rem;
}

.table td .btn,
.table th .btn {
    border-radius: 8px;
}

.table-responsive {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #dce6f3;
    background: linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
    overflow: auto;
}

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

/* Premium table experience across all features */
.table {
    font-size: .92rem;
}

.table > tbody > tr {
    transition: background-color .16s ease, transform .16s ease;
}

.table > tbody > tr:hover > * {
    background: #eef6ff !important;
}

.table td {
    color: #1e293b;
    font-weight: 500;
}

.table td strong,
.table td .fw-bold {
    color: #0f172a;
    font-weight: 700 !important;
}

.table td .text-muted,
.table td .text-secondary {
    color: #64748b !important;
}

.table .badge {
    padding: .35rem .58rem;
    font-size: .72rem;
    border: 1px solid rgba(15, 23, 42, .08);
}

.table .btn-sm {
    min-height: 30px;
    padding: .28rem .58rem;
    font-size: .78rem;
    font-weight: 700;
}

.table thead th:first-child,
.table tbody td:first-child {
    padding-left: .95rem;
}

.table thead th:last-child,
.table tbody td:last-child {
    padding-right: .95rem;
}

.table tbody tr:nth-child(even) > td {
    background: #fcfdff;
}

.table tbody tr:nth-child(odd) > td {
    background: #ffffff;
}

.table-hover > tbody > tr:hover > td {
    background: #ecf5ff !important;
}

.table .form-control,
.table .form-select {
    min-height: 34px;
    border-radius: 8px;
}

@media (max-width: 992px) {
    .table {
        font-size: .86rem;
    }

    .table > :not(caption) > * > * {
        padding: .58rem .56rem;
    }
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all .18s ease;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--hb-vite-violet), var(--hb-vite-blue) 54%, var(--hb-vite-cyan));
    border-color: rgba(124, 58, 237, 0.86);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #1d4ed8 54%, #0891b2);
    border-color: #6d28d9;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: #93c5fd;
    color: var(--hb-primary-600);
}

.btn-outline-primary:hover {
    background: #eff6ff;
    border-color: var(--hb-primary);
    color: var(--hb-primary-600);
}

.form-control, .form-select, .input-group-text {
    border-radius: 14px;
    border-color: #d7e0ea;
    min-height: 42px;
    background: var(--hb-vite-form-bg);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.75),
        0 8px 18px rgba(15, 23, 42, .03);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(124, 58, 237, .45);
    box-shadow:
        var(--hb-vite-focus-ring),
        0 18px 34px rgba(37, 99, 235, .10);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,249,255,.96));
    transform: translateY(-1px);
}

.form-label {
    font-size: .86rem;
    font-weight: 800;
    color: #334155;
    letter-spacing: .01em;
}

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
    color: #7b8aa1;
    opacity: 1;
}

textarea.form-control {
    min-height: 104px;
    padding-top: .72rem;
    resize: vertical;
}

.input-group-text {
    border: 1px solid #d7e0ea;
    color: #475569;
}

.form-floating > .form-control,
.form-floating > .form-select {
    min-height: 50px;
    padding-top: 1.32rem;
    padding-bottom: .48rem;
}

.form-floating > label {
    color: #64748b;
    font-weight: 700;
}

.form-check-input {
    width: 1.08rem;
    height: 1.08rem;
    border-color: #a5b4c8;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
    margin-top: .15rem;
}

.form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
    box-shadow: 0 10px 22px rgba(79, 70, 229, .18);
}

.form-check-input:focus {
    box-shadow: var(--hb-vite-focus-ring);
}

.form-check-label {
    color: #334155;
    font-weight: 600;
    line-height: 1.35;
}

fieldset,
.edit-section-card,
.hb-form-section,
.hb-upload-section,
.rooms-shell,
.contracts-grid-shell,
.hb-grid-shell {
    position: relative;
}

.modal .form-control,
.modal .form-select,
.modal textarea.form-control,
.auth-card .form-control,
.auth-card .form-select,
.hb-drawer .form-control,
.hb-drawer .form-select {
    background:
        radial-gradient(140px 60px at 0% 0%, rgba(124, 58, 237, .06), transparent 70%),
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,249,255,.94));
}

.row.g-2 > [class*="col"] > .form-label,
.row.g-3 > [class*="col"] > .form-label,
.row.g-4 > [class*="col"] > .form-label {
    margin-bottom: .42rem;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

.alert {
    border: 1px solid var(--hb-border);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #b91c1c;
}

.blazor-error-boundary {
    background: #991b1b;
    padding: 1rem 1rem 1rem 1.25rem;
    color: #fff;
    border-radius: 10px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #94a3b8;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Account/Auth premium skin */
.auth-wrap {
    min-height: calc(100vh - 56px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 28px 14px !important;
    background:
        radial-gradient(900px 420px at 10% 0%, rgba(59, 130, 246, 0.14), transparent 55%),
        radial-gradient(900px 420px at 100% 100%, rgba(15, 118, 110, 0.10), transparent 56%),
        linear-gradient(180deg, #f8fbff 0%, #f6f9fe 100%);
}

.auth-card {
    width: 100% !important;
    max-width: 560px !important;
    border-radius: 18px !important;
    border: 1px solid #d7e3f5 !important;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14) !important;
    background: #fff !important;
    overflow: hidden !important;
}

.auth-header {
    padding: 22px 24px !important;
    border-bottom: 1px solid #e4ebf6 !important;
    background: linear-gradient(120deg, #f9fbff 0%, #eef5ff 60%, #e8f7f3 100%) !important;
}

.auth-title {
    margin: 0 !important;
    font-size: 1.62rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
    color: #0f172a !important;
}

.auth-subtitle {
    margin: 6px 0 0 !important;
    color: #64748b !important;
    font-size: .95rem !important;
    font-weight: 600 !important;
}

.auth-body {
    padding: 24px !important;
}

.auth-card .form-control {
    min-height: 44px;
}

.auth-card .btn.btn-lg {
    min-height: 44px;
}

.auth-divider {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 16px 0 !important;
    color: #64748b !important;
    font-size: .86rem !important;
    font-weight: 700 !important;
}

.auth-divider::before,
.auth-divider::after {
    content: "" !important;
    flex: 1 !important;
    height: 1px !important;
    background: #dbe5f2 !important;
}

.auth-footer {
    margin-top: 14px !important;
    display: grid !important;
    gap: 7px !important;
    font-size: .95rem !important;
}

.auth-footer a {
    font-weight: 600;
}

.auth-side-note {
    margin-top: 14px !important;
    font-size: .9rem !important;
    color: #475569 !important;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%) !important;
    border: 1px solid #dce8f7 !important;
    border-radius: 12px !important;
    padding: 12px !important;
}

.auth-card .alert {
    border-radius: 10px;
}

.auth-card .position-relative .btn.btn-sm.btn-outline-secondary {
    border-radius: 9px;
    border-color: #bfd3ef;
    color: #33557d;
}

.auth-card .position-relative .btn.btn-sm.btn-outline-secondary:hover {
    background: #eff6ff;
}

.topbar .btn-outline-secondary,
.topbar .btn-outline-danger {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(244,248,255,.82));
    border-color: rgba(148, 163, 184, .24);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .07);
}

.topbar .btn-outline-secondary {
    color: #334155;
}

.topbar .btn-outline-danger {
    color: #be123c;
}

.topbar .btn-outline-secondary:hover,
.topbar .btn-outline-danger:hover {
    transform: translateY(-1px);
}

/* Softer Vite shell on business pages */
.dashboard-shell .dashboard-hero {
    background:
        radial-gradient(760px 260px at 12% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
        radial-gradient(620px 220px at 100% 0%, rgba(124, 58, 237, 0.14), transparent 62%),
        linear-gradient(135deg, rgba(255,255,255,.94) 0%, rgba(237,244,255,.92) 54%, rgba(234,250,246,.9) 100%) !important;
    color: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, .20) !important;
    box-shadow: 0 18px 36px rgba(37, 99, 235, .10) !important;
}

.dashboard-shell .dashboard-title,
.dashboard-shell .dashboard-subtitle,
.dashboard-shell .hero-filter label {
    color: #0f172a !important;
}

.dashboard-shell .dashboard-subtitle {
    opacity: .78;
}

.dashboard-shell .hero-chip {
    border-color: rgba(37, 99, 235, .14) !important;
    background: rgba(255,255,255,.72) !important;
    color: #1e3a8a !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.dashboard-shell .hero-filter {
    border-color: rgba(148, 163, 184, .18) !important;
    background: rgba(255,255,255,.62) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

.dashboard-shell .hero-filter .btn-light {
    background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
    border-color: #d7e3f5 !important;
    color: #0f172a !important;
}

.dashboard-shell .hero-filter .btn-outline-light {
    background: transparent !important;
    border-color: #bfd3ef !important;
    color: #1d4ed8 !important;
}

/* Shared toolbar/filter surfaces used across module pages */
.bulk-toolbar,
.list-toolbar,
.list-filters,
.sticky-subhead,
.sticky-subhead-2 {
    background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(246,250,255,.88)) !important;
    border: 1px solid rgba(148, 163, 184, .16) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .08) !important;
    backdrop-filter: blur(12px);
}

.list-toolbar,
.sticky-subhead {
    padding: .72rem .8rem !important;
}

.list-filters,
.sticky-subhead-2 {
    padding: .68rem .75rem !important;
}

.bulk-toolbar .btn,
.list-toolbar .btn,
.list-filters .btn {
    box-shadow: none;
}

.bulk-label,
.list-toolbar .text-muted,
.list-filters .text-muted {
    color: #5b6b84 !important;
}

.list-filters .form-control::placeholder,
.bulk-toolbar .form-control::placeholder,
.dashboard-shell .hero-filter input::placeholder {
    color: #64748b;
    opacity: 1;
}

/* Manage/Profile premium shell */
.manage-shell .manage-content > h3,
.manage-shell .manage-content > h4 {
    font-weight: 800;
    letter-spacing: .01em;
}

.manage-shell .manage-content .btn {
    font-weight: 700;
}

.manage-shell .manage-content .form-floating > label {
    color: #64748b;
    font-weight: 700;
}

.manage-shell .manage-content .alert {
    border-radius: 12px;
}

.manage-shell .manage-content .table {
    border-radius: 12px;
}

.manage-nav .nav-link {
    border-radius: 10px !important;
    font-weight: 700;
}

/* Unified modal form skin across app */
.modal.fade.show,
.modal.show.d-block {
    background:
        radial-gradient(900px 420px at 10% 0%, rgba(59, 130, 246, .14), transparent 55%),
        radial-gradient(900px 420px at 100% 100%, rgba(15, 118, 110, .10), transparent 56%),
        rgba(15, 23, 42, .42) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal .modal-dialog {
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
}

.modal .modal-content {
    border-radius: 24px;
    border: 1px solid rgba(191, 219, 254, .62);
    box-shadow:
        0 30px 70px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(255,255,255,.45) inset;
    overflow: hidden;
    background:
        radial-gradient(420px 180px at 0% 0%, rgba(124, 58, 237, .10), transparent 58%),
        radial-gradient(320px 160px at 100% 0%, rgba(6, 182, 212, .08), transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,249,255,.95));
    backdrop-filter: blur(18px);
}

.modal .modal-header {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(219, 229, 242, .9);
    background:
        radial-gradient(260px 120px at 0% 0%, rgba(124, 58, 237, .10), transparent 60%),
        linear-gradient(120deg, rgba(249,251,255,.98) 0%, rgba(238,245,255,.95) 60%, rgba(234,247,242,.92) 100%);
}

.modal .modal-title {
    font-size: 1.14rem;
    font-weight: 800;
    letter-spacing: .01em;
    color: #0f172a;
}

.modal .modal-body {
    padding: 1.05rem 1.15rem;
    background: transparent;
}

.modal .modal-footer {
    padding: .9rem 1.15rem 1.05rem;
    border-top: 1px solid rgba(226, 235, 246, .9);
    background: linear-gradient(180deg, rgba(251,253,255,.88), rgba(245,248,255,.96));
}

.modal .btn-close {
    opacity: .72;
}

.modal .btn-close:hover {
    opacity: 1;
}

.modal .form-label {
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 700;
    color: #334155;
}

.modal .form-control,
.modal .form-select,
.modal textarea.form-control {
    min-height: 40px;
    border-radius: 14px;
    border-color: rgba(203, 213, 225, .88);
}

.modal textarea.form-control {
    min-height: 96px;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.22rem rgba(31, 111, 235, 0.16);
}

.modal .nav-tabs {
    border-bottom-color: #dde6f2;
    gap: .35rem;
}

.modal .nav-tabs .nav-link {
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    color: #475569;
    font-weight: 700;
    padding: .48rem .82rem;
}

.modal .nav-tabs .nav-link.active {
    color: #0f172a;
    border-color: #dbe7f7 #dbe7f7 #ffffff;
    background: #ffffff;
}

.modal .tab-content {
    border: 1px solid #dbe7f7;
    border-radius: 0 16px 16px 16px;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,251,255,.92));
    padding: .9rem;
}

.modal .alert {
    border-radius: 10px;
}

.hb-drawer {
    border-left: 1px solid rgba(191, 219, 254, .5) !important;
    background:
        radial-gradient(260px 120px at 0% 0%, rgba(124, 58, 237, .08), transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,249,255,.96)) !important;
    box-shadow: -18px 0 48px rgba(15, 23, 42, .16) !important;
    backdrop-filter: blur(18px);
}

.hb-drawer-header {
    border-bottom: 1px solid rgba(226, 235, 246, .9) !important;
    background: linear-gradient(120deg, rgba(249,251,255,.96), rgba(238,245,255,.92), rgba(234,247,242,.90));
}

.hb-drawer-body {
    background: transparent;
}

.checkbox,
.form-check,
.form-switch {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    min-height: 0;
}

@media (max-width: 768px) {
    .modal .modal-header,
    .modal .modal-body,
    .modal .modal-footer {
        padding-left: .9rem;
        padding-right: .9rem;
    }

    .modal .modal-title {
        font-size: 1rem;
    }
}

/* =====================================================
   GLOBAL MOBILE RESPONSIVENESS
   Breakpoints: 576px (phone), 768px (tablet), 992px (desktop)
   ===================================================== */

/* --- Modal sizing: never overflow the screen --- */
.modal-dialog {
    max-width: min(520px, 96vw) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
.modal-dialog.modal-lg {
    max-width: min(800px, 96vw) !important;
}
.modal-dialog.modal-xl {
    max-width: min(1140px, 96vw) !important;
}
.modal-dialog.modal-sm {
    max-width: min(340px, 96vw) !important;
}

/* --- Drawers/panels: full-width on small phones --- */
.hb-drawer {
    width: min(380px, 96vw) !important;
}

/* --- Tables: always scrollable, never overflow page --- */
.table-responsive,
[class*="-table-wrap"],
[class*="-table-shell"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* --- Filter bars & toolbars: wrap gracefully --- */
.list-toolbar,
.list-filters,
.bulk-toolbar,
.sticky-subhead,
.sticky-subhead-2,
.or-filter-bar,
[class*="-filter-bar"],
[class*="-toolbar"] {
    flex-wrap: wrap !important;
    gap: .5rem !important;
}

@media (max-width: 992px) {
    /* Reduce table font and padding */
    .table {
        font-size: .82rem;
    }
    .table > :not(caption) > * > * {
        padding: .48rem .5rem;
    }
    /* Button groups in tables: wrap */
    .table td .btn-group,
    .table td > div {
        flex-wrap: wrap;
        gap: .2rem;
    }
}

@media (max-width: 768px) {
    /* --- Typography scale-down --- */
    h1 { font-size: 1.55rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.1rem !important; }

    /* --- Modals: full-screen feel on phones --- */
    .modal-dialog {
        margin: .5rem auto !important;
    }
    .modal .modal-content {
        border-radius: 16px !important;
    }
    .modal .tab-content {
        padding: .6rem !important;
    }
    .modal .nav-tabs .nav-link {
        padding: .38rem .55rem;
        font-size: .8rem;
    }

    /* --- Drawer: full-width on phone --- */
    .hb-drawer {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    /* --- Form rows: stack all columns --- */
    .row.g-2 > [class*="col-md"],
    .row.g-3 > [class*="col-md"],
    .row.g-4 > [class*="col-md"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .row.g-2 > .col-md-3,
    .row.g-2 > .col-md-4,
    .row.g-2 > .col-md-6,
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4,
    .row.g-3 > .col-md-6,
    .row.g-4 > .col-md-3,
    .row.g-4 > .col-md-4,
    .row.g-4 > .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* --- Admin tables: hide less-critical columns --- */
    .d-md-none-mobile { display: none !important; }

    /* --- Action buttons: stack vertically --- */
    .table td .btn-group {
        display: flex !important;
        flex-direction: column !important;
        gap: .2rem;
    }
    .table td .btn-group .btn {
        border-radius: 8px !important;
    }

    /* --- List/filter toolbars: full-width inputs --- */
    .list-filters .form-control,
    .list-filters .form-select,
    .list-toolbar .form-control,
    .list-toolbar .form-select {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* --- Two-col grids used on report/owner pages: stack --- */
    .or-two-col,
    [class*="-two-col"],
    [class*="-grid-2"] {
        grid-template-columns: 1fr !important;
    }

    /* --- KPI grids: 2-col on phones --- */
    .or-kpi-grid,
    [class*="-kpi-grid"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* --- Page containers: remove max-width caps --- */
    [class*="-page"],
    [class*="-shell"] {
        max-width: 100% !important;
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }

    /* --- Cards: less padding on small screens --- */
    .card-body {
        padding: .85rem !important;
    }

    /* --- Buttons with long labels: allow wrapping --- */
    .btn {
        white-space: normal;
        word-break: break-word;
    }

    /* --- Immo admin tables: key column hiding --- */
    .table .col-hide-mobile,
    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 576px) {
    /* --- Ultra-small phones: single-column everything --- */
    .or-kpi-grid,
    [class*="-kpi-grid"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* --- Modals: edge-to-edge --- */
    .modal-dialog {
        margin: .25rem !important;
        max-width: calc(100vw - .5rem) !important;
    }
    .modal .modal-content {
        border-radius: 14px !important;
    }

    /* --- Reduce form input size for tiny screens --- */
    .form-control,
    .form-select {
        min-height: 38px !important;
        font-size: .88rem !important;
    }
    .form-label {
        font-size: .78rem !important;
    }

    /* --- Tables: tighter cells --- */
    .table {
        font-size: .78rem;
    }
    .table > :not(caption) > * > * {
        padding: .35rem .4rem;
    }

    /* --- Header sections: compress --- */
    [class*="-header"],
    [class*="-hero"] {
        padding: 1rem !important;
    }

    /* --- Action bars at bottom of pages --- */
    [class*="-action-bar"],
    [class*="-footer-bar"] {
        flex-direction: column !important;
        gap: .5rem !important;
    }
    [class*="-action-bar"] .btn,
    [class*="-footer-bar"] .btn {
        width: 100% !important;
    }
}
