/* O Senhorio  App CSS */
/* Movido de templates/base.html.twig (design system da app) */

            /* ===== Design Tokens ===== */
            :root {
                --parede: #EEE9DD;
                --parede-alt: #E5DECE;
                --ink: #20282A;
                --azulejo: #1D4A5E;
                --azulejo-dk: #123240;
                --latao: #B9822F;
                --latao-lt: #D9A855;
                --musgo: #5C7A5C;
                --barro: #B0603C;
            }

            /* ===== Reset & Base ===== */
            *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
            html { scroll-behavior: smooth; }
            body {
                font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
                display: flex;
                min-height: 100vh;
                background: var(--parede);
                color: var(--ink);
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
            }
            h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 500; }
            a { color: var(--azulejo); text-decoration: none; transition: color 0.15s; }
            a:hover { color: var(--azulejo-dk); }

            /* ===== Focus ===== */
            :focus-visible {
                outline: 3px solid var(--latao);
                outline-offset: 2px;
            }

            /* ===== Sidebar ===== */
            .sidebar {
                width: 240px;
                background: var(--azulejo-dk);
                color: var(--parede);
                padding: 24px 0;
                flex-shrink: 0;
                display: flex;
                flex-direction: column;
            }
            .sidebar-brand {
                padding: 0 20px 24px;
                display: flex;
                align-items: center;
                gap: 10px;
                border-bottom: 1px solid rgba(238, 233, 221, 0.1);
            }
            .sidebar-brand-icon {
                width: 32px;
                height: 32px;
                border-radius: 50%;
                background: var(--azulejo);
                display: grid;
                place-items: center;
                font-family: 'Big Shoulders Stencil', sans-serif;
                font-weight: 800;
                font-size: 14px;
                color: var(--parede);
            }
            .sidebar-brand-text {
                font-family: 'Big Shoulders Stencil', sans-serif;
                font-weight: 800;
                font-size: 16px;
                letter-spacing: 0.12em;
                text-transform: uppercase;
                color: var(--parede);
            }
            .sidebar nav {
                margin-top: 16px;
                flex: 1;
            }
            .sidebar nav a {
                display: flex;
                align-items: center;
                gap: 10px;
                padding: 11px 20px;
                color: rgba(238, 233, 221, 0.65);
                text-decoration: none;
                font-size: 14px;
                font-weight: 500;
                transition: background 0.15s, color 0.15s;
                border-left: 3px solid transparent;
            }
            .sidebar nav a:hover {
                background: rgba(238, 233, 221, 0.06);
                color: var(--parede);
            }
            .sidebar nav a.active {
                background: rgba(238, 233, 221, 0.08);
                color: var(--parede);
                border-left-color: var(--latao);
            }
            .sidebar .logout {
                margin-top: auto;
                border-top: 1px solid rgba(238, 233, 221, 0.1);
                padding-top: 12px;
            }
            .sidebar .logout a {
                display: flex;
                align-items: center;
                gap: 10px;
                padding: 11px 20px;
                color: rgba(238, 233, 221, 0.5);
                font-size: 14px;
                font-weight: 500;
                transition: color 0.15s;
            }
            .sidebar .logout a:hover { color: var(--barro); }

            /* ===== Main Content ===== */
            .main {
                flex: 1;
                min-width: 0;
                padding: 32px;
                overflow-x: auto;
                width: 100%;
                max-width: 100%;
            }
            body:not(:has(.sidebar)) .main {
                width: 100%;
                max-width: none;
                padding: 0;
            }
            body:not(:has(.sidebar)) {
                display: block;
            }

            /* ===== Typography ===== */
            .page-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 24px;
                flex-wrap: wrap;
                gap: 12px;
            }
            .page-header h1 {
                font-size: 1.75rem;
                color: var(--azulejo-dk);
            }
            .page-header-actions {
                display: flex;
                gap: 8px;
                align-items: center;
            }
            h1 { font-size: 1.75rem; color: var(--azulejo-dk); margin-bottom: 8px; }
            h2 { font-size: 1.25rem; color: var(--azulejo-dk); margin-bottom: 12px; }
            h3 { font-size: 1rem; font-family: 'Public Sans', sans-serif; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
            p { line-height: 1.6; color: rgba(32, 40, 42, 0.75); }

            /* ===== Cards ===== */
            .card {
                background: rgba(255, 255, 255, 0.5);
                border: 1px solid rgba(32, 40, 42, 0.08);
                border-radius: 12px;
                padding: 24px;
                width: 100%;
                max-width: none;
            }
            .stat-cards {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 20px;
                margin-top: 24px;
                width: 100%;
                max-width: none;
            }
            .stat-card {
                background: rgba(255, 255, 255, 0.5);
                border: 1px solid rgba(32, 40, 42, 0.08);
                border-radius: 12px;
                padding: 24px;
                min-width: 0;
                width: 100%;
                max-width: none;
            }
            .stat-card .stat-value {
                font-family: 'Fraunces', serif;
                font-size: 2rem;
                font-weight: 500;
                color: var(--azulejo-dk);
                line-height: 1.1;
            }
            .stat-card .stat-label {
                font-size: 13px;
                font-weight: 500;
                color: rgba(32, 40, 42, 0.55);
                margin-top: 4px;
            }
            .stat-card.stat-danger .stat-value { color: var(--barro); }
            .stat-card.stat-success .stat-value { color: var(--musgo); }
            .stat-card.stat-warning .stat-value { color: var(--latao); }
            .metrics-subtitle { font-size: 12px; color: rgba(32, 40, 42, 0.45); margin-top: 2px; }

            /* ===== Tables ===== */
            .table-wrap {
                background: rgba(255, 255, 255, 0.5);
                border: 1px solid rgba(32, 40, 42, 0.08);
                border-radius: 12px;
                overflow: hidden;
                margin-top: 16px;
                width: 100%;
                max-width: none;
            }
            table {
                width: 100%;
                border-collapse: collapse;
            }
            th, td {
                padding: 12px 16px;
                text-align: left;
                border-bottom: 1px solid rgba(32, 40, 42, 0.06);
            }
            th {
                font-size: 12px;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.04em;
                color: rgba(32, 40, 42, 0.5);
                background: rgba(229, 222, 206, 0.3);
            }
            td { font-size: 14px; color: var(--ink); }
            tbody tr:last-child td { border-bottom: none; }
            tbody tr:hover { background: rgba(229, 222, 206, 0.15); }

            /* ===== Buttons ===== */
            .btn {
                display: inline-flex;
                align-items: center;
                gap: 6px;
                padding: 8px 16px;
                border-radius: 8px;
                font-size: 14px;
                font-weight: 600;
                font-family: 'Public Sans', sans-serif;
                text-decoration: none;
                border: 1px solid transparent;
                cursor: pointer;
                transition: background 0.15s, border-color 0.15s, color 0.15s;
                line-height: 1.4;
            }
            .btn:hover { text-decoration: none; }
            .btn-primary {
                background: var(--latao);
                color: #fff;
                border-color: var(--latao);
            }
            .btn-primary:hover { background: var(--latao-lt); border-color: var(--latao-lt); color: #fff; }
            .btn-secondary {
                background: transparent;
                color: var(--azulejo-dk);
                border-color: rgba(32, 40, 42, 0.12);
            }
            .btn-secondary:hover { border-color: var(--azulejo); color: var(--azulejo); }
            .btn-danger {
                background: var(--barro);
                color: #fff;
                border-color: var(--barro);
            }
            .btn-danger:hover { background: #9a5233; border-color: #9a5233; color: #fff; }
            .btn-sm {
                padding: 4px 10px;
                font-size: 12px;
                border-radius: 6px;
            }
            .btn-disabled {
                display: inline-flex;
                align-items: center;
                gap: 6px;
                padding: 8px 16px;
                border-radius: 8px;
                font-size: 14px;
                font-weight: 600;
                font-family: 'Public Sans', sans-serif;
                background: rgba(32, 40, 42, 0.08);
                color: rgba(32, 40, 42, 0.35);
                border: 1px solid rgba(32, 40, 42, 0.08);
                cursor: not-allowed;
            }
            .btn.btn-disabled.btn-sm {
                padding: 4px 10px;
                font-size: 12px;
                border-radius: 6px;
            }
            /* Normaliza altura entre <a class="btn"> e <button class="btn">:
               ambos são inline-flex com mesma caixa, sem margem vertical
               dentro de page-header. Remove margin-top herdada de form .btn. */
            a.btn, button.btn {
                min-height: 34px;
                justify-content: center;
                box-sizing: border-box;
                vertical-align: middle;
                margin-top: 0;
            }
            a.btn.btn-sm, button.btn.btn-sm {
                min-height: 26px;
            }
            .page-header-actions .btn,
            .page-header-actions form .btn,
            form .page-header-actions .btn {
                margin-top: 0;
            }
            .page-header-actions form {
                display: inline-flex;
                margin: 0;
            }

            /* ===== Badges ===== */
            .badge {
                display: inline-block;
                font-size: 11px;
                font-weight: 600;
                padding: 2px 8px;
                border-radius: 99px;
            }
            .badge-occupied {
                color: var(--musgo);
                background: rgba(92, 122, 92, 0.12);
            }
            .badge-vacant {
                color: var(--barro);
                background: rgba(176, 96, 60, 0.12);
            }
            .badge-pending {
                color: var(--latao);
                background: rgba(185, 130, 47, 0.12);
            }
            .badge-paid {
                color: var(--musgo);
                background: rgba(92, 122, 92, 0.12);
            }

            /* ===== Alerts ===== */
            .alert {
                padding: 12px 16px;
                border-radius: 8px;
                margin-bottom: 16px;
                font-size: 14px;
                font-weight: 500;
            }
            .alert-success {
                background: rgba(92, 122, 92, 0.1);
                color: var(--musgo);
                border: 1px solid rgba(92, 122, 92, 0.2);
            }
            .alert-error, .alert-danger {
                background: rgba(176, 96, 60, 0.1);
                color: var(--barro);
                border: 1px solid rgba(176, 96, 60, 0.2);
            }
            .alert-info {
                background: rgba(29, 74, 94, 0.08);
                color: var(--azulejo);
                border: 1px solid rgba(29, 74, 94, 0.15);
            }

            /* ===== Forms ===== */
            .form-card {
                background: rgba(255, 255, 255, 0.5);
                border: 1px solid rgba(32, 40, 42, 0.08);
                border-radius: 12px;
                padding: 24px;
                width: 100%;
                max-width: none;
                box-sizing: border-box;
            }
            form label, .form-card label {
                display: block;
                margin-bottom: 4px;
                font-weight: 600;
                font-size: 13px;
                color: var(--ink);
            }
            form input[type="text"],
            form input[type="email"],
            form input[type="password"],
            form input[type="number"],
            form input[type="date"],
            form input[type="tel"],
            form select,
            form textarea {
                width: 100%;
                padding: 10px 14px;
                border: 1px solid rgba(32, 40, 42, 0.15);
                border-radius: 8px;
                font-size: 14px;
                font-family: 'Public Sans', sans-serif;
                color: var(--ink);
                background: #fff;
                margin-bottom: 16px;
                transition: border-color 0.15s;
            }
            form input:focus,
            form select:focus,
            form textarea:focus {
                outline: none;
                border-color: var(--azulejo);
                box-shadow: 0 0 0 3px rgba(29, 74, 94, 0.1);
            }
            form button[type="submit"],
            form .btn {
                margin-top: 8px;
            }

            /* ===== Detail rows ===== */
            .detail-row {
                display: flex;
                gap: 8px;
                margin-bottom: 8px;
                font-size: 14px;
                line-height: 1.5;
            }
            .detail-row strong {
                color: var(--ink);
                min-width: 160px;
                font-weight: 600;
            }
            .detail-row span {
                color: rgba(32, 40, 42, 0.7);
            }

            /* ===== Tooltip ===== */
            .tooltip-wrap {
                position: relative;
                cursor: help;
                display: inline-flex;
            }
            .tooltip-wrap .tooltip-icon {
                width: 22px;
                height: 22px;
                border-radius: 50%;
                background: rgba(32, 40, 42, 0.08);
                display: inline-flex;
                align-items: center;
                justify-content: center;
                font-size: 13px;
                font-weight: 600;
                color: rgba(32, 40, 42, 0.45);
            }
            .tooltip-wrap .tooltip-text {
                display: none;
                position: absolute;
                bottom: 130%;
                left: 50%;
                transform: translateX(-50%);
                background: var(--azulejo-dk);
                color: var(--parede);
                padding: 8px 14px;
                border-radius: 8px;
                font-size: 13px;
                white-space: nowrap;
                z-index: 10;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            }
            .tooltip-wrap:hover .tooltip-text { display: block; }

            /* ===== Empty state ===== */
            .empty-state {
                padding: 40px 20px;
                text-align: center;
                color: rgba(32, 40, 42, 0.4);
                font-size: 14px;
            }

            /* ===== Section divider ===== */
            .section-divider {
                border: none;
                border-top: 1px solid rgba(32, 40, 42, 0.08);
                margin: 24px 0;
            }

            /* ===== Actions row ===== */
            .actions-row {
                display: flex;
                gap: 8px;
                margin-top: 20px;
                flex-wrap: wrap;
            }

            /* ===== Room cards grid ===== */
            .room-grid {
                display: flex;
                flex-wrap: wrap;
                gap: 16px;
                margin-top: 16px;
            }
            .room-card {
                background: rgba(255, 255, 255, 0.5);
                border: 1px solid rgba(32, 40, 42, 0.08);
                border-radius: 12px;
                padding: 20px;
                width: 300px;
            }
            .room-card-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 8px;
            }
            .room-card-header h3 {
                margin-bottom: 0;
            }
            .room-card-header h3 a {
                color: var(--azulejo-dk);
                text-decoration: none;
            }
            .room-card-header h3 a:hover {
                color: var(--azulejo);
            }
            .room-card-meta {
                font-size: 13px;
                color: rgba(32, 40, 42, 0.5);
                margin-bottom: 10px;
            }
            .room-card-occupants {
                margin-bottom: 10px;
            }
            .room-card-occupant {
                font-size: 13px;
                padding: 5px 0;
                border-bottom: 1px solid rgba(32, 40, 42, 0.06);
                color: var(--ink);
            }
            .room-card-occupant:last-child { border-bottom: none; }
            .room-card-occupant .principal-tag {
                color: var(--azulejo);
                font-size: 11px;
                font-weight: 600;
            }
            .room-card-empty {
                font-size: 13px;
                color: rgba(32, 40, 42, 0.35);
                margin-bottom: 10px;
            }
            .room-card-capacity-full {
                font-size: 12px;
                color: var(--barro);
                margin-top: 8px;
                font-weight: 500;
            }
            .room-card-no-occupants {
                font-size: 12px;
                color: rgba(32, 40, 42, 0.35);
                margin-top: 8px;
            }

            /* ===== Login / Register centered ===== */
            .auth-page {
                display: flex;
                align-items: center;
                justify-content: center;
                min-height: 100vh;
                padding: 24px;
            }
            .auth-card {
                width: 100%;
                max-width: 420px;
            }
            .auth-card .auth-brand {
                display: flex;
                align-items: center;
                gap: 10px;
                margin-bottom: 32px;
                justify-content: center;
            }
            .auth-card .auth-brand-icon {
                width: 40px;
                height: 40px;
                border-radius: 50%;
                background: var(--azulejo);
                display: grid;
                place-items: center;
                font-family: 'Big Shoulders Stencil', sans-serif;
                font-weight: 800;
                font-size: 18px;
                color: var(--parede);
            }
            .auth-card .auth-brand-text {
                font-family: 'Big Shoulders Stencil', sans-serif;
                font-weight: 800;
                font-size: 20px;
                letter-spacing: 0.12em;
                text-transform: uppercase;
                color: var(--azulejo-dk);
            }
            .auth-card h1 {
                text-align: center;
                font-size: 1.5rem;
                margin-bottom: 24px;
            }

            /* ===== Mobile Header ===== */
            .mobile-header {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                height: 56px;
                background: var(--azulejo-dk);
                z-index: 100;
                padding: 0 16px;
                align-items: center;
                justify-content: space-between;
            }
            .mobile-header-brand {
                display: flex;
                align-items: center;
                gap: 8px;
            }
            .mobile-header-brand .sidebar-brand-icon {
                width: 28px;
                height: 28px;
                font-size: 12px;
            }
            .mobile-header-brand .sidebar-brand-text {
                font-size: 14px;
            }
            .mobile-menu-btn {
                background: none;
                border: none;
                color: var(--parede);
                cursor: pointer;
                padding: 8px;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            .sidebar-overlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.4);
                z-index: 199;
            }
            .sidebar-overlay.active { display: block; }

            /* ===== Responsive ===== */
            @media (max-width: 768px) {
                .mobile-header { display: flex; }

                .sidebar {
                    position: fixed;
                    top: 0;
                    left: -260px;
                    bottom: 0;
                    width: 260px;
                    z-index: 200;
                    transition: left 0.25s ease;
                    padding-top: 16px;
                }
                .sidebar.open { left: 0; }

                .main {
                    padding: 72px 16px 24px;
                }

                .page-header {
                    flex-direction: column;
                    align-items: flex-start;
                }
                .page-header-actions {
                    width: 100%;
                    flex-wrap: wrap;
                }

                .stat-cards { grid-template-columns: 1fr; }
                .stat-card { min-width: auto; }

                .room-card { width: 100%; }

                .detail-row {
                    flex-direction: column;
                    gap: 2px;
                }
                .detail-row strong { min-width: auto; }

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

                h1 { font-size: 1.4rem; }
                h2 { font-size: 1.1rem; }
            }
