: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-subnav {
    margin: 2px 0 8px 10px;
    padding-left: 8px;
    border-left: 1px solid #374151;
}

.sidebar-subnav a {
    padding: 6px 10px;
    font-size: 13px;
}

.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);
}

.long-rental-nav a {
    min-height: 38px;
}

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

.module-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
}

.module-card strong {
    font-size: 17px;
}

.module-card span {
    color: var(--muted);
    font-weight: 400;
    line-height: 1.5;
}

.long-rental-sections {
    margin-top: 16px;
}

.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;
}

.tenant-partial,
.payment-partial {
    color: #854d0e;
    background: #fef9c3;
}

.tenant-overdue,
.payment-unpaid {
    color: var(--danger);
    background: #fff3f0;
}

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

.small-stat {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    font-size: 18px !important;
}

.spaced-panel {
    margin-top: 16px;
}

.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;
}

.settings-subsection {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.settings-subsection h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.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);
}

/* Design refresh */
:root {
    --bg: #f3f6f8;
    --text: #172033;
    --muted: #647084;
    --panel: #ffffff;
    --line: #dfe6ee;
    --accent: #0d9488;
    --accent-dark: #0f766e;
    --accent-soft: #e7f7f5;
    --ink: #101828;
    --sidebar: #0d1726;
    --sidebar-hover: #172337;
    --sidebar-line: #26364e;
    --danger: #b42318;
    --success: #067647;
    --warning: #b54708;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 12px 28px rgba(16, 24, 40, 0.08);
}

body {
    background:
        linear-gradient(180deg, #f8fafc 0, var(--bg) 320px);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

.topbar {
    height: 60px;
    padding: 0 28px;
    border-bottom: 1px solid rgba(223, 230, 238, 0.9);
    box-shadow: var(--shadow-sm);
}

.brand-mark,
.sidebar-logo {
    background: #0d9488;
    box-shadow: inset 0 -10px 18px rgba(15, 118, 110, 0.35);
}

.app-shell {
    grid-template-columns: 278px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    min-height: 100vh;
    padding: 18px 14px;
    background: var(--sidebar);
    border-right: 1px solid #0b1220;
    box-shadow: 10px 0 28px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 4px 18px;
    padding: 12px 10px 16px;
    border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 800;
}

.sidebar-brand strong {
    display: block;
    color: #ffffff;
    font-size: 17px;
}

.sidebar-brand small {
    display: block;
    margin-top: 2px;
    color: #9aa7b8;
    font-size: 12px;
}

.sidebar-title {
    margin: 6px 10px 8px;
    color: #7f8da3;
    letter-spacing: 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    min-height: 38px;
    margin: 2px 0;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar a.active,
.sidebar a:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(1px);
}

.sidebar a.active {
    border-left: 0;
    box-shadow: inset 3px 0 0 #2dd4bf;
}

.sidebar-group {
    margin: 4px 0;
}

.sidebar-group summary {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #e5edf7;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    list-style: none;
    transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-group summary::-webkit-details-marker {
    display: none;
}

.sidebar-group summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid #7f8da3;
    border-bottom: 2px solid #7f8da3;
    transform: rotate(-45deg);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.sidebar-group[open] summary,
.sidebar-group summary:hover {
    background: #111f33;
    color: #ffffff;
}

.sidebar-group[open] summary::after {
    border-color: #2dd4bf;
    transform: rotate(45deg);
}

.sidebar-group[open] .sidebar-subnav {
    animation: sidebarReveal 0.16s ease;
}

@keyframes sidebarReveal {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-subnav {
    margin: 4px 0 10px 14px;
    padding-left: 10px;
    border-left: 1px solid var(--sidebar-line);
}

.sidebar-subnav a {
    min-height: 32px;
    padding: 7px 10px;
    color: #aebbd0;
    font-size: 13px;
}

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

.app-main {
    background: transparent;
}

.app-navbar {
    height: 64px;
    padding: 0 34px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(223, 230, 238, 0.9);
    box-shadow: var(--shadow-sm);
}

.app-navbar > span {
    font-weight: 800;
    color: var(--ink);
}

.content {
    width: min(1480px, 100%);
    padding: 34px;
}

.page-heading {
    align-items: center;
    margin-bottom: 22px;
}

.page-heading h1 {
    margin-top: 2px;
    color: var(--ink);
    font-size: 34px;
    letter-spacing: 0;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.quick-actions {
    gap: 9px;
}

.quick-actions a,
.account-shortcut,
.button-link,
button {
    min-height: 42px;
    border-radius: 8px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.quick-actions a,
.account-shortcut {
    border-color: #d8e1eb;
    background: rgba(255, 255, 255, 0.92);
}

.quick-actions a:hover,
.account-shortcut:hover,
.button-link.secondary:hover {
    border-color: #99d9d2;
    background: var(--accent-soft);
}

.button-link,
button {
    background: var(--accent);
}

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

.button-link.secondary {
    background: #ffffff;
    color: var(--accent-dark);
}

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

.stat-card,
.work-panel,
.table-panel,
.form-panel,
.filter-panel,
.calendar-toolbar,
.calendar-day,
.property-card,
.empty-state,
.detail-panel,
.receipt,
.export-card,
.notification-item,
.module-card {
    border-color: rgba(216, 225, 235, 0.95);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    position: relative;
    min-height: 124px;
    padding: 20px;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    bottom: 18px;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--accent);
}

.stat-card span {
    min-height: 20px;
    color: #66758a;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    color: #101828;
    font-size: 30px;
    line-height: 1.15;
}

.stats-layout,
.work-panel,
.spaced-panel {
    margin-top: 18px;
}

.table-panel {
    overflow: hidden;
}

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

th {
    padding: 13px 16px;
    background: #f8fafc;
    color: #66758a;
    font-size: 12px;
    letter-spacing: 0;
}

td {
    padding: 15px 16px;
    color: #263247;
}

tbody tr:hover {
    background: #f6fbfa;
}

.actions {
    gap: 10px;
}

.actions a {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
}

.form-panel {
    padding: 26px;
}

label {
    color: #1f2a3d;
    font-size: 14px;
}

input,
select,
textarea {
    border-color: #cfd8e3;
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.13);
}

.filter-panel {
    padding: 18px;
}

.status-pill,
.role-badge,
.notification-type {
    border-radius: 999px;
    font-size: 12px;
}

.reservation-pending,
.payment-pending,
.tenant-partial,
.payment-partial {
    color: #92400e;
    background: #fff7d6;
}

.reservation-confirmed,
.payment-paid,
.status-available {
    color: #047857;
    background: #def7ec;
}

.reservation-cancelled,
.payment-cancelled,
.tenant-overdue,
.payment-unpaid,
.status-maintenance {
    color: #b42318;
    background: #fee4e2;
}

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

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

.property-grid,
.module-grid {
    gap: 18px;
}

.property-card,
.module-card {
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.property-card:hover,
.module-card:hover {
    border-color: #b9d9d5;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.property-photo {
    background: #e8f3f1;
    color: var(--accent-dark);
}

.panel-title {
    background: #ffffff;
    font-size: 18px;
}

.notification-bell {
    border-color: #d8e1eb;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.notification-bell strong {
    background: #e11d48;
}

.theme-toggle {
    width: 42px;
    height: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d8e1eb;
    border-radius: 999px;
    background: #ffffff;
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    border-color: #99d9d2;
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.pagination {
    border-color: rgba(216, 225, 235, 0.95);
    box-shadow: var(--shadow-sm);
}

.alert {
    border-radius: 8px;
}

html[data-theme="dark"] {
    --bg: #111827;
    --text: #d7dee9;
    --muted: #9aa7b8;
    --panel: #172337;
    --line: #2c3a4f;
    --accent: #14b8a6;
    --accent-dark: #5eead4;
    --accent-soft: #123c3a;
    --ink: #f8fafc;
    --sidebar: #08111f;
    --sidebar-hover: #142033;
    --sidebar-line: #26364e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] body {
    background:
        linear-gradient(180deg, #0b1220 0, var(--bg) 340px);
    color: var(--text);
}

html[data-theme="dark"] .app-navbar,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .work-panel,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .form-panel,
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .calendar-toolbar,
html[data-theme="dark"] .calendar-day,
html[data-theme="dark"] .property-card,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .detail-panel,
html[data-theme="dark"] .receipt,
html[data-theme="dark"] .export-card,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .module-card,
html[data-theme="dark"] .pagination,
html[data-theme="dark"] .quick-actions a,
html[data-theme="dark"] .button-link.secondary,
html[data-theme="dark"] .account-shortcut,
html[data-theme="dark"] .notification-bell,
html[data-theme="dark"] .theme-toggle {
    border-color: #2c3a4f;
    background: #172337;
    color: var(--text);
}

html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .app-navbar > span,
html[data-theme="dark"] .stat-card strong,
html[data-theme="dark"] .property-body h2,
html[data-theme="dark"] .panel-title,
html[data-theme="dark"] .module-card strong,
html[data-theme="dark"] label,
html[data-theme="dark"] td,
html[data-theme="dark"] dd {
    color: var(--ink);
}

html[data-theme="dark"] th,
html[data-theme="dark"] .panel-title,
html[data-theme="dark"] .calendar-day header {
    background: #111c2e;
}

html[data-theme="dark"] tbody tr:hover {
    background: #13263a;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination strong {
    border-color: #334155;
    background: #0f1a2b;
    color: var(--ink);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7f8da3;
}

html[data-theme="dark"] .quick-actions a:hover,
html[data-theme="dark"] .account-shortcut:hover,
html[data-theme="dark"] .button-link.secondary:hover,
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .notification-bell:hover {
    border-color: #14b8a6;
    background: #123c3a;
    color: #ccfbf1;
}

html[data-theme="dark"] .role-badge,
html[data-theme="dark"] .notification-type {
    background: #123c3a;
    color: #99f6e4;
}

html[data-theme="dark"] .status-available,
html[data-theme="dark"] .reservation-confirmed,
html[data-theme="dark"] .payment-paid {
    background: #0f3a2d;
    color: #86efac;
}

html[data-theme="dark"] .reservation-pending,
html[data-theme="dark"] .payment-pending,
html[data-theme="dark"] .tenant-partial,
html[data-theme="dark"] .payment-partial,
html[data-theme="dark"] .status-occupied {
    background: #3a2a10;
    color: #fde68a;
}

html[data-theme="dark"] .reservation-cancelled,
html[data-theme="dark"] .payment-cancelled,
html[data-theme="dark"] .tenant-overdue,
html[data-theme="dark"] .payment-unpaid,
html[data-theme="dark"] .status-maintenance {
    background: #3b1717;
    color: #fecaca;
}

html[data-theme="dark"] .alert-success {
    color: #86efac;
    background: #0f3a2d;
    border-color: #166534;
}

html[data-theme="dark"] .alert-error {
    color: #fecaca;
    background: #3b1717;
    border-color: #7f1d1d;
}

/* UX consistency pass */
.sidebar-user-card {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-top: 14px !important;
    padding: 12px !important;
    border: 1px solid var(--sidebar-line);
    background: rgba(255, 255, 255, 0.035);
}

.sidebar-user-card span {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #14b8a6;
    color: #ffffff;
    font-weight: 900;
}

.sidebar-user-card div {
    min-width: 0;
}

.sidebar-user-card strong,
.sidebar-user-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-card strong {
    color: #ffffff;
    font-size: 13px;
}

.sidebar-user-card small {
    margin-top: 2px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
}

.dashboard-heading-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-grid .stat-card:nth-child(3n + 2)::before {
    background: #2563eb;
}

.stat-grid .stat-card:nth-child(3n)::before {
    background: #f59e0b;
}

.stat-grid .stat-card:nth-child(4n)::before {
    background: #10b981;
}

.filter-panel button,
.form-actions button {
    min-width: 112px;
}

.filter-panel label,
.form-grid label {
    min-width: 0;
}

.alert-error div + div,
.alert-success div + div {
    margin-top: 4px;
}

.actions a,
.actions button.link-danger {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #d8e1eb;
    border-radius: 7px;
    background: #ffffff;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 800;
}

.actions a:hover {
    border-color: #99d9d2;
    background: var(--accent-soft);
}

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

.actions button.link-danger:hover {
    border-color: #fecdca;
    background: #fff3f0;
}

.pagination a:hover {
    border-color: #99d9d2;
    background: var(--accent-soft);
}

.table-panel + .pagination {
    margin-top: 12px;
}

.work-panel table {
    margin-top: 12px;
}

.form-panel .hint {
    margin-top: -2px;
}

html[data-theme="dark"] .actions a,
html[data-theme="dark"] .actions button.link-danger {
    border-color: #334155;
    background: #0f1a2b;
}

html[data-theme="dark"] .actions a:hover {
    border-color: #14b8a6;
    background: #123c3a;
}

html[data-theme="dark"] .actions button.link-danger:hover {
    border-color: #7f1d1d;
    background: #3b1717;
}

html[data-theme="dark"] .sidebar-user-card {
    background: rgba(255, 255, 255, 0.045);
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 252px minmax(0, 1fr);
    }

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

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

    .filter-panel button {
        width: fit-content;
    }

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

@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;
        min-height: 0;
        padding: 14px;
    }

    .sidebar-brand,
    .sidebar-title,
    .sidebar-group,
    .sidebar-subnav {
        grid-column: 1 / -1;
    }

    .sidebar-brand {
        margin-bottom: 8px;
    }

    .sidebar-subnav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin: 0 0 8px;
        padding-left: 0;
        border-left: 0;
    }

    .sidebar-group summary {
        background: #111f33;
    }

    .content {
        padding: 22px 16px;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

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

    .dashboard-heading-actions {
        justify-content: flex-start;
    }

    .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 (max-width: 560px) {
    .sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar-subnav {
        grid-template-columns: 1fr;
    }

    .quick-actions,
    .actions,
    .form-actions,
    .receipt-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .quick-actions a,
    .actions a,
    .actions button.link-danger,
    .form-actions button,
    .button-link {
        width: 100%;
    }

    th,
    td {
        padding: 12px;
    }
}

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

    body {
        background: white;
    }

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

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