@import url('https://fonts.googleapis.com/css2?family=Cabinet+Grotesk:wght@400;500;600;700&display=swap');

:root {
    font-family: 'Cabinet Grotesk', system-ui, sans-serif;
    color: #1f2937;
    background: #f5f6f8;
    --accent: #0059ff;
    --accent-soft: rgba(0, 89, 255, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--accent);
    color: #fff;
    gap: 16px;
}

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

.topbar .brand {
    color: inherit;
    text-decoration: none;
}

.brand img {
    height: 32px;
    width: auto;
}

.brand-name {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.user-info {
    font-size: 0.9rem;
}

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

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: right;
}

.user-name {
    font-weight: 600;
}

.user-email {
    font-size: 0.82rem;
    opacity: 0.85;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.user-actions .logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    border: 1px solid #fff;
    color: #fff;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.user-actions .logout:hover,
.user-actions .logout:focus {
    background: #1b63ff;
    color: #fff;
    transform: translateY(-1px);
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-link .icon,
.icon-button .icon {
    font-size: 1.1rem;
    line-height: 1;
}

.btn .icon + .btn-text {
    margin-left: 8px;
}

.user-actions .logout.icon-link {
    padding: 6px 10px;
    min-width: 38px;
    justify-content: center;
}

.admin-page {
    background: #f5f6f8;
}

.admin-shell {
    min-height: 100vh;
    display: flex;
}

.admin-sidebar {
    width: 210px;
    background: var(--accent);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 0 10px 14px;
    gap: 16px;
    transition: width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
}

.admin-sidebar.is-collapsed {
    width: 64px;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 90px;
    padding: 10px 6px 0;
    gap: 10px;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    width: 100%;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}

.admin-sidebar.is-collapsed .sidebar-brand {
    justify-content: center;
}

.admin-sidebar.is-collapsed .sidebar-brand .brand-name {
    display: none;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #fff;
    background: var(--accent);
    color: inherit;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    justify-content: center;
    width: 100%;
}

.sidebar-toggle-icon {
    font-size: 17px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.admin-sidebar.is-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.admin-sidebar.is-collapsed .sidebar-toggle-text {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-user .icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-user-menu {
    position: relative;
    align-self: stretch;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    font: inherit;
    transition: background 0.2s ease, transform 0.2s ease;
}

.user-menu-trigger:focus,
.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateX(2px);
}

.user-menu-text {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.user-menu-caret {
    align-self: flex-start;
    margin-top: 4px;
    font-size: 16px;
    transition: transform 0.2s ease;
}

.user-menu-dropdown {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    width: max-content;
    min-width: 0;
    background: #fff;
    color: #1f2937;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    padding: 10px;
    display: grid;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 40;
}

.user-menu-profile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 10px 10px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 6px;
}

.user-menu-name {
    font-weight: 600;
}

.user-menu-email {
    font-size: 0.85rem;
    color: #6b7280;
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown a:focus {
    background: #f3f4f6;
}

.sidebar-user-menu.is-open .user-menu-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    border: 1px solid #0156f5;
}

.sidebar-user-menu.is-open .user-menu-caret {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    color: inherit;
    font-weight: 500;
    position: relative;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus {
    background: rgba(255, 255, 255, 0.16);
    transform: translateX(2px);
}

.sidebar-nav .icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.admin-sidebar.is-collapsed .sidebar-nav a {
    justify-content: center;
}

.admin-sidebar.is-collapsed .sidebar-nav .nav-text {
    display: none;
}

.admin-sidebar.is-collapsed .user-menu-trigger {
    justify-content: center;
}

.admin-sidebar.is-collapsed .user-menu-text {
    display: none;
}

.admin-sidebar.is-collapsed .user-menu-caret {
    display: none;
}

.admin-map {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    min-height: 65vh;
}

.admin-map-frame {
    width: 100%;
    height: 70vh;
    border: none;
    display: block;
}

.public-map {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    min-height: 80vh;
}

.public-map-frame {
    width: 100%;
    height: 80vh;
    border: none;
    display: block;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    flex-shrink: 0;
}

.alert-stack {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.alert-stack .alert {
    margin: 0;
    pointer-events: auto;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 24px;
}

.dashboard-hero {
    position: relative;
    overflow: hidden;
    padding: 28px;
    color: #f8fafc;
    background-position: center;
    background-size: cover;
}

.dashboard-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.55), transparent 55%);
    pointer-events: none;
}

.dashboard-hero__content {
    position: relative;
    z-index: 1;
}

.dashboard-hero__eyebrow {
    margin: 0 0 8px;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.75;
}

.dashboard-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.dashboard-hero__subtitle {
    margin: 0;
    max-width: 520px;
    font-size: 1rem;
    line-height: 1.5;
}

.dashboard-hero.is-morning {
    background-image: linear-gradient(135deg, rgba(49, 46, 129, 0) 0%, rgba(30, 41, 59, 0) 55%, rgba(15, 23, 42, 0) 100%), url("../img/rano.png")
}

.dashboard-hero.is-afternoon {
    background-image: linear-gradient(135deg, rgba(49, 46, 129, 0) 0%, rgba(30, 41, 59, 0) 55%, rgba(15, 23, 42, 0) 100%), url("../img/den.png")
}

.dashboard-hero.is-evening {
    color: #f8fafc;
    background-image: linear-gradient(135deg, rgba(49, 46, 129, 0) 0%, rgba(30, 41, 59, 0) 55%, rgba(15, 23, 42, 0) 100%), url("../img/vecer.png")
}

.dashboard-hero.is-night {
    color: #f8fafc;
    background-image: linear-gradient(135deg, rgba(49, 46, 129, 0) 0%, rgba(30, 41, 59, 0) 55%, rgba(15, 23, 42, 0) 100%), url("../img/noc.png")
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

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

.apartment-cards {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 16px;
}

.apartment-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.apartment-card:hover,
.apartment-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
    border-color: #cbd5f5;
}

.apartment-card.is-inactive {
    opacity: 0.7;
}

.apartment-card__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.apartment-card__header h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.apartment-card__header p {
    margin: 0;
    color: #475569;
}

.apartment-card__status {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.apartment-card__status.is-active {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.apartment-card__status.is-inactive {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.apartment-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
}

.apartment-card__free-rooms {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e9f7ee;
    background: #e9f7ee;
    color: #14532d;
    font-size: 12px;
}

.apartment-card__link {
    color: var(--accent);
    font-weight: 600;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.table-controls .btn {
    background: var(--accent);
    border: 1px solid transparent;
    color: #fff;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(0, 89, 254, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.table-controls .btn:hover,
.table-controls .btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0, 89, 254, 0.28);
}

.is-hidden {
    display: none !important;
}

.table th,
.table td {
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.table th:last-child,
.table td:last-child {
    border-right: none;
}

.table th {
    padding: 2px 3px;
}

.table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
    box-shadow: inset 0 -1px 0 #e5e7eb;
}

.table th.is-resizable {
    position: relative;
}

.table th .column-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
}

.is-resizing {
    cursor: col-resize;
}

.table th.is-draggable {
    cursor: grab;
}

.table th.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.table td {
    padding: 0;
}

.table .cell-view {
    display: block;
    padding: 2px 3px;
    box-sizing: border-box;
}

.table tbody tr:nth-child(odd) {
    background: #fff;
}

.table tbody tr:nth-child(even) {
    background: #f3f4f6;
}

.table tbody tr.is-editing:nth-child(odd) {
    background: #fee2e2;
}

.table tbody tr.is-editing:nth-child(even) {
    background: #fecaca;
}

.table tr.is-active {
    background: #ecfdf3;
}

.table tr.is-active td {
    border-bottom-color: #bbf7d0;
}

.table tr.is-active .checkbox-inline input[type='checkbox'] {
    accent-color: #16a34a;
}

.table tbody tr.is-active.is-editing:nth-child(odd) {
    background: #fee2e2;
}

.table tbody tr.is-active.is-editing:nth-child(even) {
    background: #fecaca;
}

.table .cell-edit {
    display: none;
}

.table tr.is-editing .cell-view {
    display: none;
}

.table tr.is-editing .cell-edit {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 26px;
    padding: 0 3px;
    box-sizing: border-box;
}

.table input[type='checkbox'] {
    width: 24px;
    height: 24px;
    margin: 0;
}

.table tr.is-editing .checkbox-label {
    display: none;
}

.table tr.is-editing td {
    padding: 0;
    text-align: center;
}

.table td.is-invalid .cell-edit,
.table td.is-invalid .cell-edit input[type='text'],
.table td.is-invalid .cell-edit input[type='number'],
.table td.is-invalid .cell-edit input[type='email'],
.table td.is-invalid .cell-edit input[type='tel'],
.table td.is-invalid .cell-edit select,
.table td.is-invalid .cell-edit textarea {
    border: 2px solid #dc2626;
    background: #fee2e2;
}

.table .cell-edit input[type='text'],
.table .cell-edit input[type='number'],
.table .cell-edit input[type='email'],
.table .cell-edit input[type='tel'],
.table .cell-edit select {
    width: 100%;
    min-width: 140px;
    min-height: 24px;
    height: 24px;
    padding: 0 4px;
    text-align: center;
}

.table .cell-edit textarea {
    width: 100%;
    min-width: 180px;
    min-height: 24px;
    height: 24px;
    padding: 0 4px;
    text-align: center;
}

.table .cell-edit select {
    text-align-last: center;
}

.table tr.is-editing .phone-input {
    justify-content: center;
}

.table td.equipment-cell {
    background: #fef3c7;
}

.table tr.is-editing td.equipment-cell,
.table tr.is-editing td.equipment-cell .cell-edit {
    background: #fef3c7;
}

.table td.tenant-cell {
    background: #dbeafe;
}

.table tr.is-editing td.tenant-cell,
.table tr.is-editing td.tenant-cell .cell-edit {
    background: #dbeafe;
}

.table th.equipment-header {
    text-align: center;
    background: #fef3c7;
}

.table th.tenant-header {
    text-align: center;
    background: #dbeafe;
}

.table th.sortable {
    position: relative;
}

.table th .sort-button {
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.table th.sortable .sort-button::after {
    content: '↕';
    font-size: 0.85em;
    opacity: 0.4;
}

.table th.is-sorted-asc .sort-button::after {
    content: '↑';
    opacity: 0.75;
}

.table th.is-sorted-desc .sort-button::after {
    content: '↓';
    opacity: 0.75;
}

.table .btn {
    background: none;
    color: var(--accent);
}

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

.table.is-editing th.table-actions,
.table.is-editing td.table-actions,
.table.is-editing th.table-management,
.table.is-editing td.table-management,
.table.is-editing th.table-images,
.table.is-editing td.table-images {
    display: none;
}

.table td.table-actions .inline-form,
.table td.table-management .apartment-links {
    justify-content: center;
}

.table .btn.table-action {
    border-radius: 0;
    background: none;
    border: none;
    padding: 2px;
}

.table .btn.table-action.btn-primary {
    color: #2563eb;
    text-decoration: none;
}

.table .btn.table-action.btn-secondary {
    color: #111827;
    text-decoration: none;
}

.table .btn.table-action.table-action--images {
    color: #111827;
    text-decoration: none;
}

.table .btn.table-action.table-action--images:hover,
.table .btn.table-action.table-action--images:focus {
    background: none;
    color: #111827;
}

.table .btn.table-action.btn-warning {
    color: #111827;
    text-decoration: none;
}

.table .btn.table-action.btn-danger {
    color: #dc2626;
    text-decoration: none;
}

.status-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.status-checkbox input[type='checkbox'] {
    width: 24px;
    height: 24px;
    accent-color: #16a34a;
    cursor: default;
}

.status-checkbox input[type='checkbox']:disabled,
.status-checkbox-input:disabled {
    opacity: 1;
}

.status-checkbox--no input[type='checkbox'] {
    accent-color: #9ca3af;
}

.status-checkbox--accent input[type='checkbox'] {
    accent-color: #f59e0b;
}

.form-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.phone-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.phone-input select {
    min-width: 60px;
}

.phone-input input {
    flex: 1;
    min-width: 160px;
}

.form-structured {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-section {
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 14px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #0f172a;
}

.form-hint {
    font-size: 0.82rem;
    color: #64748b;
}

.form-actions {
    display: flex;
    justify-content: stretch;
    gap: 12px;
}

.form-actions .btn {
    width: 100%;
    justify-content: center;
}

.toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 500;
}

.form-grid label:not(.checkbox-inline) {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.form-grid label.is-invalid:not(.checkbox-inline),
.form-block.is-invalid {
    border-color: #dc2626;
    background: #fee2e2;
}

.form-grid label:not(.checkbox-inline) input,
.form-grid label:not(.checkbox-inline) select,
.form-grid label:not(.checkbox-inline) textarea {
    width: 100%;
    background: #fff;
}

.form-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.form-label {
    font-weight: 600;
}

input,
select,
textarea {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #dc2626;
    background: #fee2e2;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

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

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 89, 255, 0.15);
}

input[type='number'] {
    -moz-appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

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

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-warning {
    background: #f59e0b;
    color: #111827;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-link {
    color: var(--accent);
    text-decoration: underline;
}

.btn-link.icon-link {
    text-decoration: none;
    padding: 8px;
    min-width: auto;
}

.apartment-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    border-left-width: 4px;
    margin-bottom: 12px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.alert__text {
    flex: 1;
}

.alert__close {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf3 0%, #dcfce7 100%);
    color: #166534;
    border-color: #86efac;
}

.alert-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border-color: #fca5a5;
}

.alert-hidden {
    opacity: 0;
    transform: translateY(-6px);
}

.alert::before {
    content: '';
    width: 10px;
    height: 10px;
    margin-top: 4px;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

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

    .topbar {
        padding: 12px 16px;
    }

    .user-actions {
        width: 100%;
        justify-content: space-between;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .form-actions .btn,
    .inline-form .btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .admin-shell {
        flex-direction: column;
        padding-bottom: 74px;
    }

    .admin-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 64px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 0 12px;
        z-index: 20;
        overflow-x: auto;
        overflow-y: visible;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .admin-sidebar.is-collapsed {
        width: 100%;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-start;
        gap: 0;
        flex-wrap: nowrap;
        min-width: max-content;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav a {
        flex-direction: column;
        gap: 4px;
        padding: 8px 10px;
        font-size: 12px;
        flex: 0 0 auto;
    }

    .admin-sidebar.is-collapsed .sidebar-nav .nav-text {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .sidebar-footer {
        margin-top: 0;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
    }

    .user-menu-trigger {
        flex-direction: column;
        gap: 4px;
        padding: 8px 10px;
        font-size: 12px;
        justify-content: center;
        text-align: center;
    }

    .user-menu-trigger .icon {
        font-size: 18px;
        width: 20px;
        text-align: center;
    }

    .user-menu-text {
        font-size: inherit;
        white-space: nowrap;
        text-align: center;
    }

    .user-menu-text .user-email {
        font-size: 0.72rem;
    }

    .user-menu-dropdown {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 84px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 96px);
        overflow-y: auto;
    }
}

@media (max-width: 900px) {
    .table th,
    .table td {
        padding-left: 5px;
        padding-right: 5px;
    }

    .table th {
        padding: 2px 3px;
    }

    .table .cell-view {
        padding: 2px 3px;
    }

    .table tr.is-editing .cell-edit {
        padding: 3px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 0.94rem;
    }

    .container {
        padding: 12px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
    }

    .user-info {
        width: 100%;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .user-meta {
        text-align: left;
    }

    .card {
        padding: 14px;
        margin-bottom: 16px;
    }

    .dashboard-hero {
        padding: 16px;
    }

    .admin-shell {
        padding-bottom: 86px;
    }

    .admin-sidebar {
        height: 72px;
        padding: 0 8px;
    }

    .sidebar-nav a {
        min-width: 64px;
    }

    .sidebar-footer {
        gap: 4px;
    }

    .user-menu-trigger {
        min-width: 64px;
    }

    .form-grid label:not(.checkbox-inline),
    .form-block {
        padding: 6px 8px;
    }

    .auth-card {
        padding: 20px;
    }

    .auth-card .btn {
        width: 100%;
    }

    .form-section {
        padding: 10px;
    }

    input,
    select,
    textarea {
        padding: 5px 6px;
    }

    .btn {
        padding: 6px 12px;
    }
}

@media (max-width: 520px) {
    .layout {
        grid-template-rows: auto minmax(280px, 45vh);
    }

    .tile-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .tile .right {
        align-items: flex-start;
        width: 100%;
    }

    .panel-cover {
        height: 120px;
    }
}

.checkbox-inline {
    display: flex;
    gap: 4px;
    align-items: center;
    font-weight: 400;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
}

.checkbox-group--spaced {
    margin-top: 12px;
}

.checkbox-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    min-height: 40px;
}

.checkbox-icon,
.equipment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #000000;
}

.checkbox-icon svg,
.equipment-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.checkbox-tile input {
    width: 18px;
    height: 18px;
}

.checkbox-tile:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.checkbox-tile:has(input:checked) {
    border-color: rgba(0, 89, 255, 0.4);
    background: rgba(0, 89, 255, 0.08);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.modal.is-open {
    display: flex;
}

.modal-content {
    position: relative;
    width: min(720px, 100%);
    max-height: 90vh;
    overflow: auto;
    margin-bottom: 0;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.modal-iframe .modal-content {
    width: min(960px, 100%);
    padding: 0;
    overflow: hidden;
}

.modal-iframe iframe {
    display: block;
    width: 100%;
    height: min(80vh, 720px);
    border: 0;
    background: #ffffff;
}

.popup-frame .popup-main {
    padding: 32px 20px 48px;
}

.popup-frame {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.popup-frame .card {
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.user-detail-trigger {
    padding: 0;
    font-weight: 600;
}

.user-detail-grid {
    display: grid;
    gap: 20px;
    margin-top: 16px;
    grid-template-columns: minmax(0, 1fr);
}

.user-detail-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    display: grid;
    gap: 16px;
}

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

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 89, 255, 0.12);
    color: #1d4ed8;
    font-weight: 700;
    letter-spacing: 1px;
}

.user-detail-email {
    font-weight: 700;
    font-size: 1.05rem;
}

.user-detail-id {
    color: #64748b;
    font-size: 0.9rem;
}

.user-detail-meta {
    display: grid;
    gap: 12px;
    margin: 0;
}

.user-detail-meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.user-detail-meta dt {
    font-weight: 600;
    color: #0f172a;
}

.user-detail-meta dd {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-detail-actions {
    display: grid;
    gap: 12px;
}

.user-detail-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

@media (min-width: 780px) {
    .modal-content {
        width: min(860px, 100%);
    }

    .user-detail-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.modal-close:hover {
    transform: translateY(-1px);
    background: #f8fafc;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    inset: -40% -20%;
    background-image: var(--auth-logo-url);
    background-size: 120px 120px;
    background-repeat: repeat;
    opacity: 0.06;
    filter: grayscale(1);
    animation: auth-float 28s linear infinite;
    pointer-events: none;
}

.auth-page::after {
    inset: -30% -10%;
    background-size: 180px 180px;
    opacity: 0.04;
    animation-duration: 36s;
}

.auth-card {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    width: min(360px, 90%);
}

.auth-card form {
    display: grid;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.auth-card {
    position: relative;
    z-index: 1;
}

@keyframes auth-float {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(-4%, -6%, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

.public-page {
    background: #f6f7fb;
    color: #0f172a;
}

.layout {
    --sidebar-width: clamp(280px, 32vw, 520px);
    height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 12px;
    padding: 12px;
    position: relative;
}

@media (max-width: 900px) {
    .layout {
        height: auto;
        min-height: 100vh;
        grid-template-columns: 1fr;
        grid-template-rows: clamp(320px, 45vh, 520px) auto;
        padding: 10px;
    }

    .map-wrap {
        order: 1;
    }

    .sidebar {
        order: 2;
    }
}

.sidebar {
    background: #ffffff;
    border-radius: 16px;
    overflow: visible;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    border: 1px solid #e8edf5;
    min-height: 420px;
    height: 100%;
    width: 100%;
    z-index: 700;
    position: relative;
}

@media (max-width: 900px) {
    .sidebar {
        min-height: auto;
    }
}

.sidebar-top {
    padding: 14px 14px 10px;
    border-bottom: 1px solid #e8edf5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border-radius: 16px 16px 0 0;
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 0.2px;
}

.sync-pill {
    font-size: 12px;
    color: #64748b;
    background: #f3f6ff;
    border: 1px solid #e5ecff;
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 700;
}

.search {
    width: 100%;
    border: 1px solid #e8edf5;
    background: #fff;
    padding: 10px 12px;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    font-weight: 650;
}

.search:focus {
    border-color: #cfe0ff;
    box-shadow: 0 0 0 4px rgba(0, 89, 254, 0.1);
}


.room-sort {
    width: 100%;
    border: 1px solid #e8edf5;
    background: #fff;
    padding: 10px 12px;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    font-weight: 400;
    color: #0f172a;
}

.room-sort:focus {
    border-color: #cfe0ff;
    box-shadow: 0 0 0 4px rgba(0, 89, 254, 0.1);
}

.sidebar-body {
    padding: 14px;
    flex: 1;
    overflow: auto;
}

@media (max-width: 900px) {
    .sidebar-body {
        flex: 1;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-empty {
    padding: 16px;
    border-radius: 14px;
    border: 1px dashed #cbd5f5;
    background: #f8fafc;
    color: #64748b;
    font-weight: 650;
    font-size: 14px;
    text-align: center;
    display: none;
}

.list-empty.is-visible {
    display: block;
}

.tile {
    border: 1px solid #e8edf5;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.03);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
}

.tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    border-color: #dbeafe;
}

.tile.active {
    border-color: #cfe0ff;
    box-shadow: 0 12px 26px rgba(0, 89, 254, 0.1);
}

.tile-top {
    display: flex;
    gap: 10px;
    padding: 10px;
    align-items: center;
}

@media (max-width: 900px) {
    .tile-top {
        display: grid;
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-rows: auto auto;
        align-items: center;
    }

    .tile-top .thumb {
        grid-row: 1 / span 2;
    }

    .tile-main {
        grid-column: 2;
        grid-row: 1;
    }

    .tile-count {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }
}

.thumb {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e8edf5;
    flex: 0 0 auto;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb--sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.apartment-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.apartment-images-preview .thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.apartment-images-preview__item,
.apartment-images-preview__item img {
    cursor: pointer;
}

.tile-main {
    min-width: 0;
    flex: 1;
}

.addr {
    font-weight: 950;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta {
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 650;
}

.right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}

.tile-count {
    min-width: 44px;
    max-width: 140px;
    padding: 6px 10px;
    height: auto;
    border-radius: 999px;
    background: #22c55e;
    color: #ffffff;
    font-weight: 900;
    font-size: 11px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
    text-align: center;
    white-space: normal;
}

.occ {
    min-width: 44px;
    padding: 4px 8px;
    height: auto;
    font-weight: 950;
    font-size: 12px;
    color: #0f172a;
    background: #fbfcff;
    border: 1px solid #e8edf5;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.occ-count {
    font-size: 13px;
}

.occ-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.tile-panel {
    display: none;
    border-top: 1px solid #e8edf5;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.tile.active .tile-panel {
    display: block;
}

.panel-cover {
    width: 100%;
    height: 150px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8edf5;
    background: #f1f5f9;
}

.panel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.panel-title {
    margin-top: 10px;
    font-weight: 950;
    font-size: 16px;
    line-height: 1.2;
}

.panel-sub {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
    font-weight: 650;
}

.panel-desc {
    margin-top: 12px;
    background: #ffffff;
    border: 1px solid #e8edf5;
    border-radius: 16px;
    padding: 12px 14px;
}

.panel-desc-label {
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin-bottom: 6px;
}

.panel-desc-text {
    font-size: 13px;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.4;
}

.panel-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-top: 12px;
}

.panel-status {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    min-width: 180px;
}

.contact-panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    margin-top: 12px;
}

.contact-label {
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
}

.contact-phone {
    font-weight: 900;
    font-size: 13px;
    color: #0f172a;
}

.contact-email {
    font-weight: 600;
    font-size: 12px;
    color: #2563eb;
    text-decoration: none;
}

.contact-email:hover {
    text-decoration: underline;
}

.btn.icon-button {
    min-width: 44px;
    height: 44px;
    padding: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 14px;
    background: #0059fe;
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 44px;
    min-width: 130px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.pill-green {
    background: #e9f7ee;
    border-color: #cfeedd;
    color: #14532d;
}

.pill-red {
    background: #ffe9e9;
    border-color: #ffd0d0;
    color: #7f1d1d;
}

.kpis {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.kpi {
    flex: 1;
    min-width: 120px;
    background: #fbfcff;
    border: 1px solid #e8edf5;
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 44px;
}

.kpi .label {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.1;
}

.kpi .value {
    margin-top: 2px;
    font-weight: 950;
    font-size: 14px;
    line-height: 1.1;
}

.benefits {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.benefit {
    background: #f4f6fb;
    border: 1px solid #e8edf5;
    color: #0f172a;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.rooms {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.room {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    align-items: flex-start;
    border-radius: 14px;
    border: 1px solid #e8edf5;
    background: #fff;
    font-size: 12px;
    font-weight: 900;
}

.room-thumb {
    width: fit-content;
    max-width: 100%;
    height: 120px;
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.room-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.room-name {
    font-size: 13px;
    margin: 0;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
}

.room-area {
    color: #475569;
    margin: 0;
}

.room-price {
    color: #0059fe;
    font-weight: 950;
    margin: 0;
}

.room-availability {
    color: #0f172a;
    font-weight: 800;
    margin: 2px 0 0;
}

@media (max-width: 640px) {
    .panel-info {
        grid-template-columns: minmax(0, 1fr);
    }

    .contact-actions {
        min-width: 0;
    }

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

.map-wrap {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    position: relative;
    border: 1px solid #e8edf5;
    min-height: 520px;
    height: 100%;
}

.list-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px 12px 0 0;
    border: 1px solid #dbe5f3;
    border-bottom: 0;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    color: #1e293b;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    align-self: center;
    margin: 0;
    position: absolute;
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    z-index: 900;
}

@media (min-width: 901px) {
    .list-toggle {
        transform: translateY(-50%) rotate(90deg);
        transform-origin: center;
    }
}

.list-toggle__icon {
    font-size: 11px;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.list-toggle.is-collapsed .list-toggle__icon {
    transform: rotate(180deg);
}

.map-empty {
    position: absolute;
    inset: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 16px;
    border: 1px dashed #cbd5f5;
    background: rgba(248, 250, 252, 0.94);
    color: #475569;
    font-weight: 700;
    padding: 20px;
    z-index: 600;
}

.map-empty.is-visible {
    display: flex;
}

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0, 89, 254, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 800;
    font-weight: 800;
    color: #0f172a;
    overflow: hidden;
}

.page-loading {
    position: fixed;
    inset: 0;
    border-radius: 0;
    z-index: 1200;
    background: rgba(0, 89, 254, 0.52);
}

.map-loading.is-active {
    opacity: 1;
    pointer-events: auto;
}

.map-loading__logo-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 1.1s ease-in-out;
    z-index: 0;
}

.map-loading__logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    animation: map-logo-spin 1.4s linear infinite;
    object-fit: cover;
}

.map-loading__text {
    position: relative;
    z-index: 1;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}

.page-loading .map-loading__logo-wrap {
    animation: map-logo-fly 6s ease-in-out infinite;
}

.page-loading .map-loading__logo-wrap:nth-child(1) {
    animation-duration: 7s;
    top: 12%;
    left: 10%;
}

.page-loading .map-loading__logo-wrap:nth-child(2) {
    animation-duration: 6.2s;
    animation-delay: -1.4s;
    top: 20%;
    left: 65%;
}

.page-loading .map-loading__logo-wrap:nth-child(3) {
    animation-duration: 5.6s;
    animation-delay: -2.2s;
    top: 55%;
    left: 18%;
}

.page-loading .map-loading__logo-wrap:nth-child(4) {
    animation-duration: 6.8s;
    animation-delay: -3s;
    top: 65%;
    left: 70%;
}

.page-loading .map-loading__logo-wrap:nth-child(5) {
    animation-duration: 5.2s;
    animation-delay: -1.8s;
    top: 35%;
    left: 40%;
}

@keyframes map-logo-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes map-logo-fly {
    0% {
        transform: translate(-10%, -10%) rotate(0deg);
    }
    25% {
        transform: translate(60%, -30%) rotate(8deg);
    }
    50% {
        transform: translate(40%, 50%) rotate(-6deg);
    }
    75% {
        transform: translate(-30%, 40%) rotate(10deg);
    }
    100% {
        transform: translate(-10%, -10%) rotate(0deg);
    }
}

#map {
    width: 100%;
    height: 100%;
    min-height: 520px;
    display: block;
}

@media (max-width: 900px) {
    .map-wrap {
        min-height: 240px;
        height: auto;
    }

    .layout {
        height: auto;
        min-height: 100vh;
        grid-template-rows: clamp(240px, 45vh, 520px) auto;
        padding: 10px;
    }

    .list-toggle {
        order: 3;
        width: max-content;
        top: -14px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 16px;
        border-radius: 999px;
        border: 1px solid #d4e2fb;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
        font-family: inherit;
        font-size: 13px;
        font-weight: 700;
        line-height: 1;
        letter-spacing: 0.01em;
        z-index: 1400;
    }

    .list-toggle__icon {
        font-size: 11px;
        opacity: 0.7;
    }

    .sidebar {
        width: auto;
        max-height: none;
        position: fixed;
        inset: 56px 10px 10px;
        height: auto;
        transform: none;
        transition: transform 0.25s ease;
        border-radius: 16px;
        z-index: 1300;
        overflow: visible;
    }

    .sidebar-top {
        order: 0;
    }

    .sidebar-body {
        order: 2;
    }

    #map {
        min-height: 240px;
        height: 100%;
    }
}

@media (max-width: 900px) {
    .map-wrap {
        border-radius: 16px;
        border: 1px solid #e8edf5;
    }
}

@media (max-width: 900px) {
    body.mobile-list-open .layout {
        grid-template-rows: 1fr;
    }

    body.mobile-list-open .map-wrap {
        min-height: calc(100vh - 20px);
    }
}

body.list-collapsed .sidebar {
    position: absolute;
    left: 12px;
    top: 12px;
    bottom: 12px;
    width: var(--sidebar-width);
    height: auto;
    transform: translateX(calc(-100% + 32px));
    transition: transform 0.2s ease;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body.list-collapsed .sidebar-top,
body.list-collapsed .sidebar-body {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.list-collapsed .list-toggle {
    position: absolute;
    top: 50%;
    right: -42px;
    transform: translateY(-50%);
    transform-origin: center;
    z-index: 750;
    margin: 0;
    border-radius: 12px 12px 0 0;
}

@media (min-width: 901px) {
    body.list-collapsed .list-toggle {
        left: auto;
        right: -32px;
        transform: translateY(-50%) rotate(90deg);
    }
}

body.list-collapsed .layout {
    grid-template-columns: 1fr;
}

@media (max-width: 900px) {
    body.list-collapsed .sidebar {
        display: flex;
        position: absolute;
        inset: auto;
        left: 10px;
        right: 10px;
        bottom: 10px;
        transform: none;
        max-height: 72px;
        width: auto;
        z-index: 1200;
    }

    body.list-collapsed .layout {
        grid-template-rows: minmax(0, 1fr) auto;
    }

    body.list-collapsed .list-toggle {
        position: fixed;
        top: auto;
        right: auto;
        left: 50%;
        bottom: 12px;
        transform: translateX(-50%);
        margin: 0;
        z-index: 1350;
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
        border-radius: 999px;
    }
}

@media (max-width: 900px) {
    body.list-collapsed .map-wrap {
        min-height: clamp(320px, 70vh, 640px);
    }
}

.leaflet-top.leaflet-left {
    left: auto;
    right: 12px;
}

.logo-marker {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    user-select: none;
    position: relative;
}

.logo-marker img {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: block;
}

.logo-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 18px;
    height: 4px;
    background: var(--ring-color, #2ecc71);
    border-radius: 999px;
    transform: translateX(-50%);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.cluster-pie {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
    transform: rotate(-10deg);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cluster-center {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #0059fe;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 1000;
    font-size: 16px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    border: 2px solid #fff;
    letter-spacing: 0.2px;
}

.apartment-gallery {
    margin: 0 0 12px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid #e8edf5;
    background: #f8fafc;
}

.apartment-gallery-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.apartment-gallery-item {
    flex: 0 0 150px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.apartment-gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

.apartment-gallery--single .apartment-gallery-track {
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.apartment-gallery--single .apartment-gallery-item {
    flex: 1 0 100%;
}

.apartment-gallery--single .apartment-gallery-item img {
    border-radius: 0;
}

.apartment-gallery--placeholder .apartment-gallery-item img {
    height: auto;
    object-fit: contain;
}

@media (max-width: 900px) {
    .apartment-gallery-track {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        -webkit-overflow-scrolling: touch;
    }

    .apartment-gallery-item {
        flex: 0 0 140px;
        width: auto;
    }
}

.apartment-images-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.apartment-images-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e9f2;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #0059fe;
    transition: width 0.2s ease;
}

.progress-text {
    font-weight: 600;
    min-width: 44px;
}

.apartment-images-queue {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.apartment-upload-item {
    background: #f6f8fc;
    border-radius: 10px;
    padding: 8px 10px;
    display: grid;
    gap: 6px;
}

.apartment-upload-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.apartment-upload-bar {
    height: 6px;
    background: #e1e6f0;
    border-radius: 999px;
    overflow: hidden;
}

.apartment-upload-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #22c55e;
    transition: width 0.2s ease;
}

.apartment-upload-status {
    font-size: 12px;
    color: #6b7280;
}

.apartment-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.apartment-images-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #6b7280;
}

.apartment-images-empty {
    color: #6b7280;
    padding: 12px;
    font-size: 14px;
}

.apartment-image-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f2f4f8;
    cursor: grab;
}

.apartment-image-item.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.apartment-image-item.is-drag-over {
    outline: 2px dashed #2563eb;
    outline-offset: 2px;
}

.apartment-image-handle {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: grab;
    z-index: 2;
}

.apartment-image-handle .fa {
    font-size: 12px;
}

.apartment-image-order {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.apartment-image-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.apartment-image-actions {
    position: absolute;
    top: 8px;
    right: 8px;
}

.lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2000;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.lightbox-control {
    border: none;
    background: var(--accent);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.lightbox-control:hover {
    background: #0047cc;
}

.lightbox-control.is-disabled,
.lightbox-control:disabled {
    opacity: 0.35;
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
}

.lightbox-prev {
    position: absolute;
    left: 14px;
}

.lightbox-next {
    position: absolute;
    right: 14px;
}

@media (max-width: 700px) {
    .lightbox-content {
        padding: 16px;
    }

    .lightbox-control {
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }
}
