:root {
    --bg: #f6f7fb;
    --text: #1f2937;
    --muted: #667085;
    --panel: #ffffff;
    --line: #e4e7ec;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --danger: #b42318;
    --success: #067647;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--accent);
    color: white;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 36px auto;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: stretch;
    padding: 36px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.1;
}

.lead {
    max-width: 680px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.status-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafafa;
}

.status-card p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.status-dot {
    width: 12px;
    height: 12px;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--danger);
    flex: 0 0 auto;
}

.status-dot.is-ok {
    background: var(--success);
}

.modules {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.modules article {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.modules h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.modules p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.footer {
    width: min(1120px, calc(100% - 32px));
    margin: 28px auto;
    color: var(--muted);
    font-size: 14px;
}

.auth-page {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.login-panel {
    width: min(460px, 100%);
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.form-card {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
    font: inherit;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
    font: inherit;
    resize: vertical;
}

select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
    background: white;
    font: inherit;
}

button {
    height: 44px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-top: 18px;
}

.alert-error {
    color: var(--danger);
    background: #fff3f0;
    border: 1px solid #fecdca;
}

.alert-success {
    color: var(--success);
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.hint {
    color: var(--muted);
    font-size: 14px;
}

.app-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    padding: 16px 12px;
    background: #111827;
    color: white;
    position: sticky;
    top: 0;
    align-self: start;
    min-height: calc(100vh - 64px);
    overflow: visible;
}

.sidebar-title {
    margin: 0 8px 10px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.2;
}

.sidebar a.active,
.sidebar a:hover {
    background: #1f2937;
    color: white;
}

.sidebar a.active {
    border-left: 3px solid #2dd4bf;
}

.sidebar-logout {
    margin-top: 6px;
    color: #fecaca !important;
}

.sidebar-logout:hover {
    background: #3f1d1d !important;
    color: white !important;
}

.app-main {
    min-width: 0;
}

.app-navbar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.logout-link {
    color: var(--danger);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 14px;
}

.content {
    padding: 28px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.page-heading h1 {
    font-size: 30px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.quick-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--accent-dark);
}

.role-badge {
    padding: 8px 12px;
    border-radius: 999px;
    background: #e6fffb;
    color: var(--accent-dark);
    font-weight: 700;
}

.dashboard-heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-shortcut {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--accent-dark);
}

.notification-bell {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    font-size: 20px;
}

.notification-bell:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.notification-bell strong {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--panel);
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 11px;
    line-height: 1;
}

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

.stat-card,
.work-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-card {
    padding: 18px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 32px;
}

.work-panel {
    margin-top: 16px;
    padding: 22px;
}

.work-panel h2 {
    margin: 0 0 8px;
}

.work-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
}

.button-link.secondary {
    background: white;
    color: var(--accent-dark);
    border: 1px solid var(--line);
}

.table-panel,
.form-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    font-size: 14px;
}

.pagination div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.pagination a,
.pagination strong {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
}

.pagination strong {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.pagination em {
    font-style: normal;
    color: var(--muted);
}

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

tbody tr:hover {
    background: #f9fafb;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

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

.actions form {
    margin: 0;
}

.link-danger {
    height: auto;
    padding: 0;
    background: transparent;
    color: var(--danger);
    font-weight: 700;
}

.link-danger:hover {
    background: transparent;
}

.form-panel {
    padding: 22px;
}

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

.permissions-panel {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.permissions-panel h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 600;
}

.check-row input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

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

.filter-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.client-filter {
    grid-template-columns: minmax(0, 1fr) auto;
}

.reservation-filter {
    grid-template-columns: 170px 170px 220px auto;
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.segmented a,
.calendar-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
}

.segmented a.active {
    background: var(--accent);
    color: white;
}

.calendar-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.calendar-nav form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-grid.one-day {
    grid-template-columns: minmax(0, 1fr);
}

.calendar-grid.one-week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-day {
    min-height: 170px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.calendar-day.outside-month {
    opacity: 0.62;
}

.calendar-day header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #f9fafb;
    border-bottom: 1px solid var(--line);
}

.calendar-events {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.calendar-event {
    display: grid;
    gap: 3px;
    padding: 8px;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}

.calendar-event span {
    color: var(--muted);
}

.calendar-empty {
    color: var(--muted);
    font-size: 13px;
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.property-card,
.empty-state,
.detail-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.property-card {
    overflow: hidden;
}

.property-photo {
    height: 170px;
    display: grid;
    place-items: center;
    background: #eef4f3;
    color: var(--accent-dark);
    font-size: 46px;
    font-weight: 700;
}

.property-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-body {
    padding: 16px;
}

.property-title-row,
.heading-actions {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
}

.property-body h2 {
    margin: 0;
    font-size: 20px;
}

.property-body p {
    color: var(--muted);
    line-height: 1.5;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.status-available {
    color: var(--success);
    background: #ecfdf3;
}

.status-occupied {
    color: #9a3412;
    background: #fff7ed;
}

.status-maintenance {
    color: var(--danger);
    background: #fff3f0;
}

.reservation-pending {
    color: #854d0e;
    background: #fef9c3;
}

.reservation-confirmed {
    color: var(--success);
    background: #ecfdf3;
}

.reservation-cancelled {
    color: var(--danger);
    background: #fff3f0;
}

.reservation-completed {
    color: #344054;
    background: #f2f4f7;
}

.payment-pending {
    color: #854d0e;
    background: #fef9c3;
}

.payment-paid {
    color: var(--success);
    background: #ecfdf3;
}

.payment-cancelled {
    color: var(--danger);
    background: #fff3f0;
}

.compact-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stats-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.panel-title {
    margin: 0;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
}

.bar-list {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.bar-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) 110px;
    gap: 10px;
    align-items: center;
}

.bar-row span {
    color: var(--muted);
    font-size: 13px;
}

.bar-row div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f6;
}

.bar-row i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
}

.bar-row strong {
    text-align: right;
}

.notification-list {
    display: grid;
    gap: 12px;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.notification-item.is-read {
    opacity: 0.68;
}

.notification-item h2 {
    margin: 10px 0 6px;
    font-size: 18px;
}

.notification-item p {
    margin: 0 0 8px;
    color: var(--muted);
}

.notification-item small {
    color: var(--muted);
}

.notification-type {
    color: var(--accent-dark);
    background: #e6fffb;
}

.notification-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.receipt-page {
    width: min(920px, calc(100% - 32px));
    margin: 32px auto;
}

.receipt {
    padding: 34px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.receipt-header,
.receipt-footer,
.receipt-total {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.receipt-header {
    align-items: flex-start;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.receipt-header h1 {
    margin-top: 14px;
    font-size: 30px;
}

.receipt-header p,
.receipt-meta span,
.receipt-grid p,
.receipt-notes p {
    color: var(--muted);
}

.receipt-meta {
    display: grid;
    gap: 8px;
    text-align: right;
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.receipt-grid article {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.receipt-grid h2,
.receipt-notes h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.receipt-grid p {
    margin: 6px 0;
}

.receipt-table {
    margin-top: 16px;
}

.receipt-total {
    align-items: center;
    margin-top: 20px;
    padding: 18px;
    background: #f9fafb;
    border-radius: 8px;
}

.receipt-total strong {
    font-size: 22px;
}

.receipt-notes {
    margin-top: 20px;
}

.receipt-footer {
    margin-top: 42px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.receipt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

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

.export-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.export-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.export-card p {
    margin: 0;
    color: var(--muted);
}

.backup-table {
    margin-top: 16px;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 24px;
    color: var(--muted);
}

.full-field {
    margin-top: 16px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 16px;
}

.detail-panel {
    padding: 20px;
}

dl {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
    margin: 18px 0;
}

dt {
    color: var(--muted);
    font-weight: 700;
}

dd {
    margin: 0;
}

.photo-grid {
    display: grid;
    gap: 12px;
}

.photo-grid figure {
    margin: 0;
}

.photo-grid img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.muted {
    color: var(--muted);
}

@media (max-width: 820px) {
    .topbar {
        padding: 0 16px;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    h1 {
        font-size: 32px;
    }

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

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        position: static;
        height: auto;
    }

    .sidebar-title {
        grid-column: 1 / -1;
    }

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

    .form-grid,
    .permission-grid,
    .filter-panel,
    .property-grid,
    .detail-layout,
    .stats-layout,
    .receipt-grid,
    .export-grid,
    .calendar-grid,
    .calendar-grid.one-week {
        grid-template-columns: 1fr;
    }

    .calendar-toolbar,
    .calendar-nav,
    .notification-item,
    .export-card {
        align-items: stretch;
        flex-direction: column;
    }

    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-row strong {
        text-align: left;
    }
}

@media print {
    .topbar,
    .footer,
    .no-print {
        display: none;
    }

    body {
        background: white;
    }

    .receipt-page {
        width: 100%;
        margin: 0;
    }

    .receipt {
        border: 0;
        padding: 0;
    }
}
