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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
       --sidebar: #101828;
    --sidebar-hover: #1d2939;
    --background: #f4f7fb;
    --surface: #ffffff;
    --text: #101828;
    --muted: #667085;
    --border: #e4e7ec;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --sidebar-width: 270px;
    --sidebar-collapsed: 84px;
    --topbar-height: 82px;
    --radius: 18px;
    --shadow: 0 12px 35px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: "Inter", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow: hidden;
    background: var(--sidebar);
    color: #ffffff;
    transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-header {
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    gap: 13px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    display: grid;
    min-width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    font-size: 22px;
}

.brand-text {
    display: flex;
    min-width: 170px;
    flex-direction: column;
}

.brand-text strong {
    font-size: 15px;
}

.brand-text span {
    margin-top: 3px;
    color: #98a2b3;
    font-size: 11px;
}

.sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    padding: 20px 12px;
}

.nav-link {
    position: relative;
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 14px;
    padding: 0 15px;
    border-radius: 13px;
    color: #cbd5e1;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link.active::before {
    position: absolute;
    left: -12px;
    width: 4px;
    height: 26px;
    border-radius: 0 8px 8px 0;
    background: #60a5fa;
    content: "";
}

.nav-link i {
    min-width: 20px;
    font-size: 19px;
    text-align: center;
}

.nav-text {
    white-space: nowrap;
}

.nav-badge {
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.app-wrapper {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 17px;
}

.menu-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 24px;
}

.menu-button:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
}

.page-eyebrow,
.section-eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.page-title {
    margin-top: 3px;
    font-size: 22px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 11px;
}

.user-avatar {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #ffffff;
    font-weight: 800;
}

.user-information {
    display: flex;
    flex-direction: column;
}

.user-information strong {
    max-width: 220px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-information span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.main-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px;
}

.welcome-card {
    display: flex;
    min-height: 160px;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    padding: 30px;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at right, rgba(255, 255, 255, 0.22), transparent 36%),
        linear-gradient(135deg, #1d4ed8, #4f46e5);
    box-shadow: var(--shadow);
    color: #ffffff;
}

.welcome-card .section-eyebrow {
    color: #bfdbfe;
}

.welcome-card h2 {
    margin-top: 9px;
    font-size: clamp(24px, 4vw, 34px);
}

.welcome-card p {
    margin-top: 9px;
    color: #dbeafe;
}

.welcome-icon {
    padding-right: 30px;
    font-size: 70px;
    opacity: 0.65;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 135px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-icon {
    display: grid;
    min-width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 16px;
    font-size: 23px;
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card span {
    font-size: 13px;
    font-weight: 600;
}

.stat-card strong {
    display: block;
    margin: 4px 0;
    font-size: 29px;
}

.stat-card small {
    font-size: 11px;
}

.stat-blue .stat-icon {
    background: #dbeafe;
    color: #2563eb;
}

.stat-purple .stat-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-orange .stat-icon {
    background: #ffedd5;
    color: #ea580c;
}

.stat-green .stat-icon {
    background: #dcfce7;
    color: #16a34a;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    margin-top: 22px;
}

.content-card {
    min-height: 310px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.card-header h3 {
    margin-top: 5px;
    font-size: 18px;
}

.text-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.empty-state {
    display: flex;
    min-height: 215px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--muted);
    text-align: center;
}

.empty-state i {
    margin-bottom: 12px;
    color: #cbd5e1;
    font-size: 42px;
}

.empty-state h4 {
    color: var(--text);
    font-size: 15px;
}

.empty-state p {
    max-width: 340px;
    margin-top: 7px;
    font-size: 13px;
    line-height: 1.6;
}

.flash-container {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 600;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-collapsed .app-wrapper {
    margin-left: var(--sidebar-collapsed);
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .nav-badge {
    display: none;
}

.sidebar-collapsed .sidebar-header,
.sidebar-collapsed .nav-link {
    justify-content: center;
}

.sidebar-collapsed .nav-link {
    padding: 0;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 1150px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: min(285px, 86vw);
        transform: translateX(-100%);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 950;
        display: block;
        background: rgba(15, 23, 42, 0.48);
    }

    .app-wrapper,
    .sidebar-collapsed .app-wrapper {
        margin-left: 0;
    }

    .topbar {
        padding: 12px 18px;
    }

    .main-content {
        padding: 20px 16px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .user-information {
        display: none;
    }

    .welcome-card {
        padding: 24px;
    }

    .welcome-icon {
        display: none;
    }

    .page-title {
        font-size: 18px;
    }

    .stat-card {
        min-height: 115px;
    }
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.content-header h2 {
    margin-top: 6px;
    font-size: 25px;
}

.content-header p,
.form-header p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
}

.table-card,
.form-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

td {
    color: var(--muted);
    font-size: 13px;
}

td strong {
    color: var(--text);
}

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

.status {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.actions-column,
.table-actions {
    text-align: center;
}

.icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--primary);
    cursor: pointer;
}

.icon-button-danger {
    color: var(--danger);
}

.icon-button-danger:hover {
    border-color: #fecaca;
    background: #fef2f2;
}

.btn-danger {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--danger);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.btn-danger:hover {
    background: #b91c1c;
}

.confirmation-details {
    display: grid;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--muted);
}

.confirmation-details strong {
    color: var(--text);
}

.form-container {
    display: flex;
    justify-content: center;
}

.form-card {
    width: 100%;
    max-width: 720px;
    padding: 28px;
}

.form-header {
    margin-bottom: 26px;
}

.form-header h2 {
    margin-top: 6px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.form-group label span {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

@media (max-width: 620px) {
    .content-header {
        align-items: stretch;
        flex-direction: column;
    }

    .content-header .btn-primary {
        width: 100%;
    }

    .form-card {
        padding: 22px 18px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn-primary,
    .form-actions .btn-secondary,
    .form-actions .btn-danger {
        width: 100%;
    }
}

.login-page {
    min-height: 100vh;
    overflow-x: hidden;
    background: #ffffff;
}

.login-wrapper {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1.15fr) minmax(420px, 0.85fr);
}

.login-presentation {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 42px 58px;
    background:
        radial-gradient(
            circle at 80% 15%,
            rgba(255, 255, 255, 0.18),
            transparent 27%
        ),
        linear-gradient(
            145deg,
            #172554 0%,
            #1d4ed8 50%,
            #4f46e5 100%
        );
    color: #ffffff;
}

.login-brand,
.mobile-login-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 13px;
}

.login-brand-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.17);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 23px;
    backdrop-filter: blur(12px);
}

.login-brand > div:last-child,
.mobile-login-brand > div:last-child {
    display: flex;
    flex-direction: column;
}

.login-brand strong,
.mobile-login-brand strong {
    font-size: 16px;
}

.login-brand span,
.mobile-login-brand span {
    margin-top: 3px;
    font-size: 11px;
    opacity: 0.75;
}

.presentation-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 650px;
    margin: auto 0;
    padding: 70px 0;
}

.presentation-eyebrow {
    display: inline-flex;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.presentation-content h1 {
    max-width: 620px;
    margin-top: 24px;
    font-size: clamp(37px, 5vw, 61px);
    line-height: 1.06;
}

.presentation-content > p {
    max-width: 580px;
    margin-top: 22px;
    color: #dbeafe;
    font-size: 16px;
    line-height: 1.75;
}

.presentation-features {
    display: flex;
    flex-wrap: wrap;
    gap: 13px;
    margin-top: 34px;
}

.presentation-features div {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.presentation-features i {
    color: #bfdbfe;
    font-size: 17px;
}

.presentation-decoration {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.decoration-one {
    right: -160px;
    bottom: -180px;
    width: 520px;
    height: 520px;
}

.decoration-two {
    right: 30px;
    bottom: -80px;
    width: 280px;
    height: 280px;
}

.login-form-section {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 42px;
    background: #ffffff;
}

.login-form-container {
    width: 100%;
    max-width: 430px;
}

.mobile-login-brand {
    display: none;
    margin-bottom: 50px;
    color: var(--text);
}

.mobile-login-brand .login-brand-icon {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
}

.mobile-login-brand span {
    color: var(--muted);
}

.login-heading {
    margin-bottom: 30px;
}

.login-heading h2 {
    margin-top: 8px;
    font-size: 34px;
}

.login-heading p {
    margin-top: 9px;
    color: var(--muted);
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 20px;
}

.login-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.input-with-icon {
    position: relative;
}

.input-with-icon > i {
    position: absolute;
    top: 50%;
    left: 15px;
    color: #98a2b3;
    font-size: 18px;
    transform: translateY(-50%);
}

.input-with-icon input {
    width: 100%;
    height: 51px;
    padding: 0 48px 0 46px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    transition: 0.2s ease;
}

.input-with-icon input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 14px;
    border: 0;
    background: transparent;
    color: #98a2b3;
    cursor: pointer;
    font-size: 18px;
    transform: translateY(-50%);
}

.login-button {
    display: flex;
    width: 100%;
    height: 52px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 13px 24px rgba(37, 99, 235, 0.23);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
    transition: 0.2s ease;
}

.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.3);
}

.login-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
    color: var(--muted);
    font-size: 11px;
}

.login-security i {
    color: var(--success);
    font-size: 15px;
}

@media (max-width: 980px) {
    .login-wrapper {
        grid-template-columns: 1fr;
    }

    .login-presentation {
        display: none;
    }

    .login-form-section {
        padding: 30px 20px;
    }

    .mobile-login-brand {
        display: flex;
    }
}

@media (max-width: 480px) {
    .login-form-section {
        align-items: flex-start;
        padding-top: 38px;
    }

    .mobile-login-brand {
        margin-bottom: 55px;
    }

    .login-heading h2 {
        font-size: 29px;
    }
}

.wide-form {
    max-width: 920px;
}

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

.full-width {
    grid-column: 1 / -1;
}

.area-label {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }
}

.form-group input[readonly] {
    background: #f8fafc;
    color: var(--muted);
    cursor: not-allowed;
}

.user-table {
    display: flex;
    align-items: center;
    gap: 11px;
}

.user-table-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--primary);
    font-weight: 800;
}

.user-table > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-table span {
    color: var(--muted);
    font-size: 11px;
}

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.access-denied-card {
    display: flex;
    min-height: 480px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.access-denied-icon {
    display: grid;
    width: 86px;
    height: 86px;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 26px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 38px;
}

.error-code {
    color: #dc2626;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.access-denied-card h2 {
    max-width: 600px;
    margin-top: 10px;
    font-size: 25px;
}

.access-denied-card p {
    max-width: 540px;
    margin: 12px 0 25px;
    color: var(--muted);
    line-height: 1.7;
}

.house-context {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
    padding: 9px 13px;
    border: 1px solid #bfdbfe;
    border-radius: 13px;
    background: #eff6ff;
    color: #1d4ed8;
}

.house-context > i {
    font-size: 19px;
}

.house-context > div {
    display: flex;
    flex-direction: column;
}

.house-context span {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.house-context strong {
    max-width: 180px;
    overflow: hidden;
    margin-top: 2px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .house-context {
        margin-right: 0;
        padding: 8px 10px;
    }

    .house-context span {
        display: none;
    }

    .house-context strong {
        max-width: 105px;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 700px) {
    .header-actions {
        width: 100%;
        flex-direction: column-reverse;
    }

    .header-actions .btn-primary,
    .header-actions .btn-secondary {
        width: 100%;
    }
}

.casas-fieldset {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.casas-fieldset legend {
    margin-bottom: 8px;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
}

.casas-description {
    margin: 0 0 16px;
    color: var(--muted, #64748b);
    font-size: 13px;
    line-height: 1.6;
}

.casas-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.casas-fieldset .casa-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border, #dbe2ea);
    border-radius: 12px;
    background: var(--surface, #ffffff);
    cursor: pointer;
}

.casas-fieldset .casa-option input[type="checkbox"] {
    appearance: auto;
    display: inline-block;
    position: static;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    box-shadow: none;
    accent-color: #2563eb;
    cursor: pointer;
}

.casa-option-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.casa-option-text strong {
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.casa-option-text small {
    color: var(--muted, #64748b);
    font-size: 11px;
}

.casas-fieldset .casa-option:has(input:checked) {
    border-color: #2563eb;
}

.casas-fieldset .casa-option:focus-within {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@media (max-width: 700px) {
    .casas-options {
        grid-template-columns: 1fr;
    }
}

.login-presentation-clean {
    align-items: center;
    justify-content: center;
}

.login-presentation-clean .login-brand {
    flex-direction: column;
    text-align: center;
}

.login-presentation-clean .login-brand-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 30px;
}

.login-presentation-clean .login-brand strong {
    font-size: 25px;
}

/* =====================================================
   RESPONSIVIDADE GLOBAL
   Mantém o layout de desktop e adapta tablet/celular.
===================================================== */

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

.sidebar-nav {
    min-height: 0;
}

.sidebar-footer {
    flex: 0 0 auto;
}

.topbar-left,
.user-area,
.content-header > div,
.card-header > div,
.dashboard-grid > *,
.content-grid > *,
.form-grid > * {
    min-width: 0;
}

.search-card {
    margin-bottom: 22px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-card form,
.report-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 16px 20px;
}

.search-card .form-group,
.report-filters .form-group {
    min-width: 0;
    margin-bottom: 0;
}

.search-card .form-actions,
.report-filters .form-actions {
    grid-column: 1 / -1;
    margin-top: 0;
}

.search-card.solicitacoes-search form {
    grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) auto;
}

.search-card.solicitacoes-search .form-actions {
    grid-column: auto;
}

.search-card.historico-filtros form {
    grid-template-columns: minmax(160px, 1.5fr) minmax(160px, 1.5fr) repeat(2, minmax(130px, 1fr)) auto;
}

.search-card.historico-filtros .form-actions {
    grid-column: auto;
}

.historico-aviso {
    padding: 16px;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .search-card.historico-filtros form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .search-card.historico-filtros .form-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .search-card.historico-filtros form {
        grid-template-columns: 1fr;
    }
}

.solicitacao-historico {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.solicitacao-historico h3 {
    margin-bottom: 20px;
}

.solicitacao-timeline {
    margin: 0 0 0 8px;
    padding: 0 0 0 22px;
    border-left: 2px solid var(--border);
    list-style: none;
}

.solicitacao-timeline li {
    position: relative;
    padding: 0 0 24px 10px;
}

.solicitacao-timeline li:last-child {
    padding-bottom: 0;
}

.solicitacao-timeline li::before {
    position: absolute;
    top: 4px;
    left: -29px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    content: "";
}

.solicitacao-timeline li.pendente::before {
    background: var(--warning);
}

.solicitacao-timeline strong,
.solicitacao-timeline span {
    display: block;
}

.solicitacao-timeline span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.solicitacao-timeline p {
    margin-top: 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .search-card.solicitacoes-search form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-card.solicitacoes-search .form-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .search-card.solicitacoes-search form {
        grid-template-columns: 1fr;
    }
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.report-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.report-card span,
.report-card strong {
    display: block;
}

.report-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.report-card strong {
    margin-top: 6px;
    font-size: 24px;
}

.report-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.report-section-title {
    margin-bottom: 14px;
}

.table-card {
    max-width: 100%;
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 760px;
}

th,
td {
    vertical-align: middle;
}

td {
    overflow-wrap: normal;
    word-break: normal;
}

.table-actions {
    white-space: nowrap;
}

.alert span,
.content-header p,
.empty-state p {
    overflow-wrap: anywhere;
}

.menu-mobile-open {
    overflow: hidden;
}

@media (max-width: 1200px) {
    .report-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar-collapsed .sidebar {
        width: min(285px, 86vw);
    }

    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .nav-text,
    .sidebar-collapsed .nav-badge {
        display: initial;
    }

    .sidebar-collapsed .brand-text {
        display: flex;
    }

    .sidebar-collapsed .sidebar-header,
    .sidebar-collapsed .nav-link {
        justify-content: flex-start;
    }

    .sidebar-collapsed .nav-link {
        padding: 0 15px;
    }

    .topbar {
        gap: 16px;
    }

    .main-content {
        max-width: 100vw;
    }

    .report-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    :root {
        --topbar-height: 70px;
        --radius: 15px;
    }

    .topbar {
        min-height: var(--topbar-height);
        padding: 10px 12px;
    }

    .topbar-left {
        gap: 10px;
    }

    .menu-button {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .page-eyebrow {
        display: none;
    }

    .page-title {
        max-width: 38vw;
        overflow: hidden;
        font-size: 17px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-area {
        gap: 8px;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }

    .house-context {
        max-width: 33vw;
    }

    .house-context strong {
        max-width: 23vw;
    }

    .main-content {
        padding: 18px 12px 28px;
    }

    .content-header {
        gap: 16px;
        margin-bottom: 18px;
    }

    .content-header h2,
    .form-header h2 {
        font-size: 21px;
        overflow-wrap: anywhere;
    }

    .header-actions {
        align-items: stretch;
    }

    .header-actions .btn-primary,
    .header-actions .btn-secondary,
    .content-header > .btn-primary,
    .content-header > .btn-secondary {
        width: 100%;
    }

    .welcome-card {
        min-height: 0;
        padding: 22px 18px;
    }

    .welcome-card h2 {
        font-size: 24px;
    }

    .dashboard-grid {
        gap: 12px;
        margin-top: 16px;
    }

    .stat-card {
        min-height: 104px;
        padding: 17px;
    }

    .content-grid {
        gap: 14px;
        margin-top: 16px;
    }

    .content-card,
    .report-card {
        min-height: 0;
        padding: 17px;
    }

    .card-header {
        align-items: flex-start;
        gap: 10px;
    }

    .search-card {
        padding: 16px;
    }

    .search-card form,
    .report-filters {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .search-card .form-actions,
    .report-filters .form-actions {
        grid-column: auto;
    }

    .form-card {
        padding: 20px 16px;
    }

    .form-header {
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 48px;
        font-size: 16px;
    }

    .form-actions {
        gap: 10px;
        margin-top: 22px;
    }

    .btn-primary,
    .btn-secondary {
        min-height: 46px;
        white-space: normal;
        text-align: center;
    }

    .table-responsive table {
        min-width: 960px;
        table-layout: auto;
    }

    th,
    td {
        padding: 14px 15px;
        min-width: 110px;
        word-break: normal;
        overflow-wrap: normal;
    }

    th:first-child,
    td:first-child {
        min-width: 170px;
    }

    .actions-column,
    .table-actions {
        min-width: 90px;
    }

    .report-summary {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .alert {
        align-items: flex-start;
        gap: 12px;
    }

    .alert-close {
        flex: 0 0 auto;
        padding: 3px;
    }

    .access-denied-card {
        min-height: 400px;
        padding: 30px 18px;
    }
}

@media (max-width: 480px) {
    .house-context {
        display: none;
    }

    .page-title {
        max-width: 50vw;
    }

    .dashboard-grid,
    .report-summary {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
    }

    .text-link {
        align-self: flex-start;
    }

    .table-responsive table {
        min-width: 960px;
    }

    .empty-state {
        min-height: 180px;
        padding: 24px 16px;
    }
}

@media print {
    .sidebar,
    .sidebar-overlay,
    .topbar,
    .no-print {
        display: none !important;
    }

    .app-wrapper {
        margin-left: 0 !important;
    }

    .main-content {
        max-width: none;
        padding: 0;
    }

    .table-responsive {
        overflow: visible;
    }

    .table-responsive table {
        min-width: 0;
    }
}

/* Agenda de testes */
.agenda-header,
.agenda-toolbar,
.agenda-legenda,
.agenda-acoes {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.agenda-toolbar { justify-content: center; margin-bottom: 16px; }
.agenda-legenda { justify-content: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.agenda-status { display: inline-flex; align-items: center; width: fit-content; padding: 6px 10px; border-radius: 999px; font-size: .75rem; font-style: normal; font-weight: 700; }
.status-agendado { background: #e0e7ff; color: #3730a3; }
.status-em_andamento { background: #dbeafe; color: #1d4ed8; }
.status-aguardando_resultado { background: #fef3c7; color: #92400e; }
.status-concluido { background: #dcfce7; color: #166534; }
.status-cancelado { background: #fee2e2; color: #991b1b; }
.agenda-calendario { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.agenda-semana-cabecalho, .agenda-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.agenda-semana-cabecalho strong { padding: 12px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--border); }
.agenda-dia { min-height: 145px; padding: 9px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.agenda-dia:nth-child(7) { border-right: 0; }
.agenda-dia.fora-mes { background: #f8fafc; }
.agenda-dia.hoje { box-shadow: inset 0 0 0 2px var(--primary); }
.agenda-numero { width: 28px; height: 28px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 50%; font-weight: 700; }
.agenda-dia.hoje .agenda-numero { color: #fff; background: var(--primary); }
.agenda-eventos { display: grid; gap: 6px; }
.agenda-evento { display: grid; gap: 2px; padding: 7px; border-left: 3px solid currentColor; border-radius: 7px; text-decoration: none; font-size: .74rem; }
.agenda-evento span, .agenda-evento small { overflow: hidden; color: inherit; text-overflow: ellipsis; white-space: nowrap; }
.agenda-evento em { margin-top: 2px; font-size: .65rem; font-style: normal; font-weight: 700; text-transform: uppercase; }
.agenda-evento:hover { filter: brightness(.97); transform: translateY(-1px); }
.agenda-detalhes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.agenda-detalhes > div { display: grid; gap: 5px; }
.agenda-detalhes span { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.agenda-detalhes .full-width { grid-column: 1 / -1; }
.agenda-acoes { justify-content: flex-end; margin-top: 18px; }
.agenda-acoes form { margin: 0; }
.agenda-contador { display: inline-grid; min-width: 22px; height: 22px; place-items: center; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.22); font-size: .72rem; }
.empty-inline { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 16px; border: 1px solid #bbf7d0; border-radius: 12px; background: #f0fdf4; color: #166534; }

@media (max-width: 760px) {
    .agenda-header { align-items: flex-start; flex-direction: column; }
    .agenda-calendario { overflow-x: auto; }
    .agenda-semana-cabecalho, .agenda-semana { min-width: 760px; }
    .agenda-detalhes { grid-template-columns: 1fr; }
    .agenda-detalhes .full-width { grid-column: auto; }
    .agenda-acoes { align-items: stretch; flex-direction: column; }
    .agenda-acoes a, .agenda-acoes button { width: 100%; }
}

/* Correção específica dos filtros de relatórios */
.report-filters {
    display: block;
    padding: 20px;
}

.report-filters > form {
    display: block;
    width: 100%;
}

.report-filters .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.report-filters .form-group {
    margin-bottom: 0;
}

.report-filters .form-actions {
    display: flex;
    grid-column: auto;
    justify-content: flex-end;
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .report-filters .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .report-filters {
        padding: 16px;
    }

    .report-filters .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .report-filters .form-group {
        margin-bottom: 16px;
    }

    .report-filters .form-actions {
        flex-direction: column-reverse;
        margin-top: 4px;
    }

    .report-filters .form-actions .btn-primary,
    .report-filters .form-actions .btn-secondary {
        width: 100%;
    }
}
