:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #eef5f1;
    --ink: #17211d;
    --muted: #66736d;
    --line: #dce4df;
    --brand: #12705a;
    --brand-dark: #0c4d3e;
    --accent: #2b7bbb;
    --warn: #b42318;
    --warn-bg: #fff1ef;
    --success: #137a46;
    --success-bg: #eaf7ef;
    --partial-bg: #fff7e3;
    --shadow: 0 16px 36px rgba(25, 38, 32, 0.09);
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-Regular.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-Medium.ttf') format('truetype');
    font-style: normal;
    font-weight: 500;
    font-display: block;
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-SemiBold.ttf') format('truetype');
    font-style: normal;
    font-weight: 600;
    font-display: block;
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-Bold.ttf') format('truetype');
    font-style: normal;
    font-weight: 700;
    font-display: block;
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-Bold.ttf') format('truetype');
    font-style: normal;
    font-weight: 800;
    font-display: block;
}

@font-face {
    font-family: 'IBM Plex Sans Thai';
    src: url('../../fonts/IBM_Plex_Sans_Thai/IBMPlexSansThai-Bold.ttf') format('truetype');
    font-style: normal;
    font-weight: 900;
    font-display: block;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html.fonts-loading body {
    visibility: hidden;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'IBM Plex Sans Thai', Tahoma, Arial, sans-serif;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 252px;
    padding: 22px;
    background: #101a16;
    color: #f8fbf9;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: #20a67d;
    font-weight: 800;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: 3px;
    color: #a8bab2;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-nav a {
    border-radius: 8px;
    padding: 12px 14px;
    color: #c7d5cf;
}

.side-nav a.active,
.side-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-user {
    display: grid;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    padding: 13px;
    color: #ffffff;
}

.sidebar-user span,
.sidebar-user small {
    color: #a8bab2;
    font-size: 12px;
}

.sidebar-user strong {
    font-size: 14px;
}

.sidebar-user a {
    margin-top: 6px;
    color: #8ee0c2;
    font-weight: 700;
}

.app-shell {
    width: min(1280px, calc(100% - 292px));
    margin-left: 252px;
    padding: 28px 28px 44px;
}

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

.top-actions {
    display: flex;
    gap: 14px;
    align-items: stretch;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 34px;
    line-height: 1.12;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
}

.subtitle {
    margin-bottom: 0;
    color: var(--muted);
}

.language-switcher,
.user-menu {
    min-width: 150px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px;
    box-shadow: var(--shadow);
}

.language-switcher {
    display: grid;
    gap: 8px;
}

.language-switcher label,
.user-menu span,
.user-menu small {
    color: var(--muted);
    font-size: 12px;
}

.user-menu strong,
.user-menu small,
.user-menu a {
    display: block;
    margin-top: 4px;
}

.user-menu a {
    color: var(--brand);
    font-weight: 700;
}

.text-link {
    display: inline-block;
    margin-top: 4px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
}

select,
input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

select[multiple] {
    min-height: 150px;
}

select[data-unit-select] {
    display: none;
}

label small {
    color: var(--muted);
    font-weight: 400;
    line-height: 1.35;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.notice,
.error-box {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--line);
}

.notice.success {
    color: var(--success);
    background: var(--success-bg);
}

.notice.error,
.error-box {
    color: var(--warn);
    background: var(--warn-bg);
}

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

.kpi-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.kpi-card {
    min-height: 126px;
    padding: 20px;
}

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

.kpi-card strong {
    display: block;
    margin-top: 12px;
    font-size: 28px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

table td {
    font-variant-numeric: tabular-nums;
}

.kpi-card-split {
    min-height: 126px;
}

.kpi-split-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 14px;
}

.kpi-split-values > div {
    min-width: 0;
}

.kpi-split-values small {
    margin-bottom: 8px;
    font-size: 12px;
}

.kpi-split-values strong {
    margin-top: 0;
    font-size: 20px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.kpi-card.danger strong {
    color: var(--warn);
}

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

.dashboard-actions {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-stack {
    display: grid;
    gap: 18px;
    align-content: start;
}

.panel {
    min-width: 0;
    overflow: hidden;
}

.panel.wide {
    grid-column: 1 / -1;
}

.panel-heading {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfb;
}

.panel-heading-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}

.tenant-search-form label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.tenant-search-form input {
    width: 240px;
    min-height: 32px;
    padding: 7px 10px;
    font-size: 13px;
}

.table-search {
    display: grid;
    gap: 4px;
    min-width: min(320px, 100%);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.table-search input {
    width: 320px;
    max-width: 100%;
    min-height: 32px;
    padding: 7px 10px;
    font-size: 13px;
}

.filter-summary {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.payment-form {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 14px;
    padding: 18px 20px 20px;
}

.payment-debt-field,
.payment-tenant-summary {
    grid-column: 1 / -1;
}

.payment-phone-field {
    grid-column: span 2;
}

.payment-tenant-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 10px 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.payment-tenant-summary strong {
    color: var(--ink);
}

.payment-unit-warning {
    grid-column: 1 / -1;
    border: 1px solid #f0b4b4;
    border-radius: 8px;
    background: #fff1f1;
    color: #9f1d1d;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
}

.management-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 20px 20px;
}

.management-form label {
    display: grid;
    align-content: start;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.management-form .form-wide {
    grid-column: span 2;
}

.management-form .checkbox-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.management-form .checkbox-line input {
    width: auto;
    margin-top: 3px;
}

.management-form .checkbox-line span {
    display: grid;
    gap: 3px;
}

.management-form .checkbox-line strong {
    color: var(--text);
    font-size: 13px;
}

.management-form .checkbox-line small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(10, 18, 15, 0.56);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(9, 15, 13, 0.28);
}

.modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfb;
}

.modal-heading h2 {
    margin: 0;
}

.modal-close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-weight: 800;
    line-height: 1;
}

.tenant-filter-modal {
    width: min(520px, 100%);
}

.tenant-filter-form {
    display: grid;
    gap: 16px;
    padding: 18px 20px 20px;
}

.tenant-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 14px 20px 0;
    border-bottom: 1px solid var(--line);
    background: #fbfcfb;
}

.modal-tab {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: -1px;
}

.modal-tab.active {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.modal-tab-panel {
    padding: 20px 22px;
}

.unit-picker-open {
    justify-self: start;
}

.selected-unit-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 30px;
}

.selected-unit-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 800;
}

.selected-unit-tag button {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

.selected-unit-empty {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.shared-quantity-field {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
    padding: 10px 12px;
}

.shared-quantity-field[hidden] {
    display: none;
}

.unit-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 18, 15, 0.56);
    backdrop-filter: blur(4px);
}

.unit-picker-backdrop[hidden] {
    display: none;
}

.unit-picker-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(9, 15, 13, 0.28);
    overflow: hidden;
}

.unit-picker-body {
    display: grid;
    gap: 14px;
    min-height: 0;
    padding: 16px 18px;
    overflow: auto;
}

.unit-picker-search {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.unit-picker-selected {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
    padding: 10px;
}

.unit-picker-list {
    display: grid;
    gap: 14px;
}

.unit-picker-group {
    display: grid;
    gap: 8px;
}

.unit-picker-group h3 {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.unit-picker-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
}

.unit-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 9px 10px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.unit-picker-option input {
    width: auto;
    margin: 0;
}

.unit-picker-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding: 14px 18px;
    background: #fbfcfb;
}

.unit-detail-modal {
    width: min(1120px, 100%);
}

.unit-detail-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 18px 20px 0;
}

.weekday-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px 20px 0;
}

.weekday-tab {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f5f7f6;
    color: var(--ink);
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 800;
}

.weekday-tab.active,
.weekday-tab:hover {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

.unit-detail-section {
    display: grid;
    gap: 12px;
    padding: 18px 20px 20px;
}

.unit-detail-section h3 {
    margin: 0;
}

.unit-detail-actions {
    justify-content: flex-end;
    padding: 0 20px 20px;
}

.unit-booking-list {
    display: grid;
    gap: 10px;
}

.unit-booking-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
    padding: 13px;
}

.unit-booking-main,
.unit-booking-meta,
.unit-booking-actions {
    display: grid;
    gap: 5px;
}

.unit-booking-main strong {
    overflow-wrap: anywhere;
}

.unit-booking-main span,
.unit-booking-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.unit-booking-actions {
    justify-items: end;
}

.unit-booking-actions strong {
    white-space: nowrap;
}

.empty-state {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 16px;
    font-weight: 700;
}

.payment-form label {
    display: grid;
    align-content: start;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.payment-form small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.payment-form .form-wide {
    grid-column: span 2;
}

.payment-form .button {
    align-self: end;
    min-height: 42px;
}

.compact-table th,
.compact-table td {
    padding: 11px 12px;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
}

.recent-tenants-panel .table-wrap {
    overflow-x: hidden;
}

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

body:has(.tenant-table) .app-shell {
    width: calc(100% - 252px);
    max-width: none;
}

body:has(.report-table) .app-shell {
    width: calc(100% - 252px);
    max-width: none;
}

body:has(.stand-lines) .app-shell {
    width: calc(100% - 252px);
    max-width: none;
}

.tenant-table-wrap {
    width: 100%;
}

.report-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.payments-table-wrap {
    overflow-x: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

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

.tenant-table {
    min-width: 1260px;
}

.report-table {
    min-width: 1180px;
}

.report-table th,
.report-table td {
    padding: 14px 16px;
    white-space: normal;
    word-break: break-word;
}

.tenant-table th,
.tenant-table td {
    padding: 13px 14px;
}

.tenant-table th:nth-child(1),
.tenant-table td:nth-child(1) {
    min-width: 230px;
}

.tenant-table th:nth-child(5),
.tenant-table td:nth-child(5) {
    min-width: 190px;
}

.tenant-table th:nth-child(10),
.tenant-table td:nth-child(10) {
    min-width: 145px;
}

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

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.status,
.closed-label {
    display: inline-block;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.closed-label,
.status.paid {
    background: var(--success-bg);
    color: var(--success);
}

.status.partial {
    background: var(--partial-bg);
    color: #785300;
}

.status.neutral,
.status.vacant {
    background: #edf2f7;
    color: #425466;
}

.status.occupied {
    background: var(--success-bg);
    color: var(--success);
}

.status.maintenance {
    background: var(--partial-bg);
    color: #785300;
}

.status.inactive {
    background: #eef0f2;
    color: #6b7280;
}

.status.unpaid,
.status.overdue {
    background: var(--warn-bg);
    color: var(--warn);
}

.list {
    display: grid;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row strong,
.list-row span {
    display: block;
}

.list-row span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.list-row b {
    white-space: nowrap;
}

.compact-list .list-row {
    padding-top: 13px;
    padding-bottom: 13px;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: 11px 14px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

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

.button.secondary {
    border: 1px solid var(--line);
    background: #f5f7f6;
    color: var(--ink);
}

.button.secondary:hover {
    background: #e9efec;
}

.danger-button {
    background: var(--warn);
}

.danger-button:hover {
    background: #8f1f16;
}

.button.compact {
    padding: 8px 10px;
    font-size: 12px;
}

.button.primary {
    width: 100%;
}

.inline-form {
    margin: 0;
}

.action-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.payments-table {
    min-width: 0;
    table-layout: fixed;
}

.payments-table th,
.payments-table td {
    padding: 11px 12px;
    white-space: normal;
}

.payments-table th:nth-child(1),
.payments-table td:nth-child(1) {
    width: 96px;
}

.payments-table th:nth-child(2),
.payments-table td:nth-child(2) {
    width: 24%;
}

.payments-table th:nth-child(3),
.payments-table td:nth-child(3) {
    width: 94px;
}

.payments-table th:nth-child(4),
.payments-table td:nth-child(4),
.payments-table th:nth-child(5),
.payments-table td:nth-child(5) {
    width: 18%;
}

.payments-table th:nth-child(6),
.payments-table td:nth-child(6) {
    width: 215px;
}

.payments-table .action-group {
    flex-wrap: wrap;
}

.cell-subtext {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.upload-summary {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8faf9;
}

.upload-summary strong,
.upload-summary span {
    display: block;
}

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

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background: linear-gradient(135deg, #eff6f2 0%, #f7f9fb 58%, #eaf1f7 100%);
}

.auth-shell {
    width: min(430px, calc(100% - 28px));
}

.auth-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 28px;
    box-shadow: var(--shadow);
}

.brand-block {
    margin-bottom: 22px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.demo-users {
    display: grid;
    gap: 5px;
    margin-top: 18px;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
}

.demo-users strong {
    color: var(--ink);
}

.settings-help {
    margin-top: 18px;
}

.settings-copy {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    color: var(--muted);
}

.settings-copy p {
    margin: 0;
}

.active-contract-box {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.active-contract-box h3 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
}

.active-contract-list {
    display: grid;
    gap: 8px;
}

.active-contract-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 10px;
}

.active-contract-row div {
    display: grid;
    gap: 3px;
}

.active-contract-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stand-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #edf5f1 100%);
    padding: 16px;
    box-shadow: var(--shadow);
}

.stand-date-form {
    display: flex;
    gap: 10px;
    align-items: end;
}

.stand-date-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stand-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stand-summary span {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 9px 11px;
}

.stand-legend {
    position: sticky;
    top: 10px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    padding: 10px 12px;
    backdrop-filter: blur(2px);
}

.stand-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stand-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid transparent;
}

.stand-legend-swatch.reserved {
    border-color: #2a66b1;
    background: #dce8fa;
}

.stand-legend-swatch.available {
    border-color: #5c8f2f;
    background: #e5f1d7;
}

.stand-legend-swatch.maintenance {
    border-color: #a35d12;
    background: #f6dfbf;
}

.stand-lines {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
    align-items: start;
}

.stand-line {
    display: grid;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    padding: 16px;
    box-shadow: 0 14px 30px rgba(22, 44, 35, 0.08);
    align-content: start;
}

.stand-line-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 0 2px 10px;
}

.stand-line-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
}

.stand-line-heading span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    padding: 6px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.stand-line-track {
    display: grid;
    gap: 10px;
}

.stand-line-shared {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stand-shared-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink);
    padding: 6px 10px;
    text-decoration: none;
    font-size: 12px;
}

.stand-shared-chip strong {
    font-size: 13px;
}

.stand-shared-chip.available span {
    color: var(--muted);
}

.stand-slot {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7faf8 100%);
    padding: 12px 14px;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.stand-slot:hover {
    border-color: var(--brand);
    box-shadow: 0 18px 30px rgba(22, 44, 35, 0.1);
    transform: translateY(-1px);
}

.stand-slot.reserved {
    border-color: #2a66b1;
    background: linear-gradient(180deg, #eef4fd 0%, #ffffff 100%);
}

.stand-slot.available {
    border-color: #5c8f2f;
    background: linear-gradient(180deg, #f4faec 0%, #ffffff 100%);
}

.stand-slot.maintenance {
    border-color: #a35d12;
    background: linear-gradient(180deg, #fdf3e7 0%, #ffffff 100%);
}

.stand-slot-top,
.stand-slot-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.stand-slot-top strong {
    color: var(--ink);
    font-size: 20px;
}

.stand-slot-top span {
    border-radius: 999px;
    background: #e9f4ef;
    color: #2c5f23;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 900;
}

.stand-slot.reserved .stand-slot-top span {
    background: #dce8fa;
    color: #1f4f8f;
}

.stand-slot.available .stand-slot-top span {
    background: #e5f1d7;
    color: #3f6e1f;
}

.stand-slot.maintenance .stand-slot-top span {
    background: #f6dfbf;
    color: #8a4d0f;
}

.stand-slot-tenant {
    min-height: 18px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.stand-slot-meta {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stand-modal {
    max-width: 620px;
}

.stand-modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.stand-modal-stat {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.stand-modal-stat span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stand-modal-stat strong {
    color: var(--ink);
    font-size: 15px;
}

@media (max-width: 1040px) {
    .sidebar {
        position: static;
        display: grid;
        gap: 16px;
        width: auto;
        padding: 16px;
    }

    .side-nav {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .app-shell {
        width: min(100% - 24px, 1280px);
        margin: 0 auto;
        padding: 22px 0 36px;
    }

    .content-grid,
    .dashboard-actions,
    .topbar {
        display: grid;
    }

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

    .payment-form {
        grid-template-columns: 1fr 1fr;
    }

    .management-form {
        grid-template-columns: 1fr 1fr;
    }

    .payment-form .form-wide {
        grid-column: span 2;
    }

    .management-form .form-wide {
        grid-column: span 2;
    }

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

    .kpi-split-values {
        gap: 14px;
    }
}

@media (max-width: 640px) {
    .modal-tabs {
        overflow-x: auto;
        padding-bottom: 0;
    }

    .modal-tab {
        white-space: nowrap;
    }

    .side-nav {
        grid-template-columns: 1fr 1fr;
    }

    .top-actions {
        display: grid;
    }

    .payment-form {
        grid-template-columns: 1fr;
    }

    .management-form {
        grid-template-columns: 1fr;
    }

    .payment-form .form-wide {
        grid-column: span 1;
    }

    .management-form .form-wide {
        grid-column: span 1;
    }

    .form-actions {
        display: grid;
    }

    h1 {
        font-size: 27px;
    }

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

    .kpi-split-values {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stand-toolbar,
    .stand-date-form {
        display: grid;
    }

    .stand-legend {
        position: static;
        justify-content: flex-start;
    }

    .active-contract-row {
        display: grid;
    }

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

    .unit-detail-summary {
        grid-template-columns: 1fr;
    }

    .unit-booking-card {
        grid-template-columns: 1fr;
    }

    .unit-booking-actions {
        justify-items: start;
    }

    .unit-picker-backdrop {
        padding: 0;
        place-items: stretch;
    }

    .unit-picker-dialog {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .unit-picker-options {
        grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    }
}

:root {
    --page-gutter: clamp(18px, 3vw, 32px);
    --panel-padding: clamp(16px, 2vw, 24px);
    --surface-tint: #f7fbf9;
    --line-strong: #c8d7cf;
}

body {
    overflow-x: hidden;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.45;
}

::selection {
    background: rgba(18, 112, 90, 0.18);
}

input,
select,
button,
.button {
    min-height: 44px;
}

.app-shell {
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
}

.panel,
.language-switcher,
.user-menu {
    border-color: var(--line-strong);
}

.topbar-copy {
    min-width: 0;
}

.topbar-context {
    display: none;
    width: fit-content;
    margin-bottom: 10px;
    border: 1px solid rgba(18, 112, 90, 0.14);
    border-radius: 999px;
    background: rgba(18, 112, 90, 0.08);
    padding: 6px 10px;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
}

.menu-toggle,
.sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
}

.menu-toggle {
    position: relative;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.menu-toggle span {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease, top 180ms ease;
}

.menu-toggle span:nth-child(1) {
    top: 15px;
}

.menu-toggle span:nth-child(2) {
    top: 22px;
}

.menu-toggle span:nth-child(3) {
    top: 29px;
}

body.sidebar-open .menu-toggle span:nth-child(1) {
    top: 22px;
    transform: rotate(45deg);
}

body.sidebar-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .menu-toggle span:nth-child(3) {
    top: 22px;
    transform: rotate(-45deg);
}

.sidebar-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    margin-left: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(16, 26, 22, 0.46);
    backdrop-filter: blur(3px);
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(32, 166, 125, 0.18), transparent 32%),
        linear-gradient(180deg, #edf5f1 0%, #f7faf8 100%);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 460px);
    align-items: stretch;
    gap: clamp(24px, 4vw, 40px);
    width: min(1100px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(22px, 4vw, 40px) 0;
}

.auth-hero,
.auth-panel {
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 28px;
    box-shadow: 0 22px 50px rgba(18, 41, 32, 0.12);
}

.auth-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(43, 123, 187, 0.16), transparent 28%),
        linear-gradient(145deg, #10372d 0%, #12705a 55%, #1a8f70 100%);
    color: #f7fffb;
}

.auth-hero-panel {
    display: grid;
    align-content: space-between;
    min-height: 100%;
    padding: clamp(28px, 4vw, 42px);
}

.auth-kicker {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-hero h1 {
    max-width: 12ch;
    margin-bottom: 12px;
    color: #ffffff;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 0.98;
}

.auth-hero .subtitle {
    max-width: 54ch;
    color: rgba(255, 255, 255, 0.82);
}

.auth-highlights {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

.auth-highlight {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    padding: 16px 18px;
}

.auth-highlight strong {
    font-size: 15px;
}

.auth-highlight span {
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
}

.auth-panel {
    display: grid;
    align-content: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.96);
    padding: clamp(24px, 4vw, 36px);
}

.auth-panel-badge {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 14px;
    border-radius: 999px;
    background: rgba(18, 112, 90, 0.1);
    padding: 7px 12px;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
}

.auth-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-locale-form {
    margin-bottom: 12px;
}

.auth-locale-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.promptpay-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: 20px;
}

.promptpay-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
}

.promptpay-card {
    display: grid;
    gap: 14px;
}

.promptpay-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.promptpay-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(18, 112, 90, 0.08);
    padding: 7px 12px;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
}

.promptpay-amount {
    color: var(--brand-dark);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 900;
    line-height: 1;
}

.promptpay-copy {
    margin-bottom: 0;
    color: var(--muted);
}

.promptpay-qr-frame {
    display: grid;
    place-items: center;
    min-height: 356px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(18, 112, 90, 0.03), rgba(18, 112, 90, 0.01)),
        #ffffff;
    padding: 18px;
}

.promptpay-qr-image {
    width: min(100%, 320px);
    height: auto;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(23, 33, 29, 0.12);
}

.promptpay-qr-fallback {
    gap: 10px;
    text-align: center;
    color: var(--muted);
}

.promptpay-countdown {
    border-radius: 14px;
    background: #f1f7f4;
    padding: 12px 14px;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 800;
}

.promptpay-meta {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.promptpay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.responsive-table td::before {
    content: none;
}

@media (max-width: 1040px) {
    .app-shell {
        width: min(100%, 1280px);
        padding-left: var(--page-gutter);
        padding-right: var(--page-gutter);
    }

    .dashboard-actions,
    .content-grid,
    .promptpay-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-hero h1 {
        max-width: 16ch;
    }
}

@media (max-width: 760px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        width: min(82vw, 300px);
        transform: translateX(-108%);
        transition: transform 200ms ease;
    }

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

    .sidebar-close,
    .menu-toggle,
    .topbar-context {
        display: inline-flex;
    }

    .topbar {
        align-items: center;
    }

    .topbar .eyebrow,
    .topbar h1,
    .topbar .subtitle {
        display: none;
    }

    .topbar-copy {
        display: flex;
        align-items: center;
        min-height: 46px;
    }

    .app-shell {
        margin-left: 0;
        width: 100%;
    }

    .list-row,
    .stand-slot-top,
    .stand-slot-meta {
        align-items: flex-start;
    }

    .list-row {
        flex-direction: column;
    }

    .payment-form {
        grid-template-columns: 1fr;
    }

    .payment-phone-field,
    .payment-debt-field,
    .payment-tenant-summary,
    .payment-friday-options {
        grid-column: 1;
    }
}

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

    .management-form .form-wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        width: min(100% - 20px, 1100px);
        padding: 10px 0 20px;
    }

    .auth-hero,
    .auth-panel {
        border-radius: 22px;
    }

    .promptpay-qr-frame {
        min-height: 280px;
    }

    .promptpay-actions {
        display: grid;
    }

    table.responsive-table {
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    table.responsive-table thead {
        display: none;
    }

    table.responsive-table tbody,
    table.responsive-table tr,
    table.responsive-table td {
        display: block;
        width: 100%;
    }

    table.responsive-table tr {
        border: 1px solid var(--line);
        border-radius: 18px;
        background: var(--surface);
        padding: 8px 14px;
        box-shadow: 0 12px 26px rgba(25, 38, 32, 0.07);
    }

    table.responsive-table td {
        padding: 10px 0;
        border: 0;
    }

    table.responsive-table td + td {
        border-top: 1px solid rgba(220, 228, 223, 0.75);
    }

    table.responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    table.responsive-table td .action-group,
    table.responsive-table td .inline-form,
    table.responsive-table td .button {
        width: 100%;
    }

    table.responsive-table td .action-group {
        display: grid;
    }
}
