/* Tables layout page */
.hgt-body {
    min-height: 100vh;
}

.hgt-page {
    max-width: 1600px;
}

.hgt-hall-tabs .nav-link {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}

.hgt-workspace {
    min-height: calc(100vh - 180px);
}

.hgt-sidebar {
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.hgt-sidebar .card-body {
    overflow-y: auto;
    flex: 1;
}

.hgt-unassigned-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hgt-room-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    cursor: grab;
    font-size: 0.85rem;
    user-select: none;
}

.hgt-room-chip:active {
    cursor: grabbing;
}

.hgt-room-chip--assigned {
    opacity: 0.45;
    cursor: default;
}

.hgt-room-num {
    font-weight: 700;
    min-width: 1.75rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 0.25rem;
    padding: 0.1rem 0.3rem;
}

.hgt-floor-card {
    min-height: 400px;
}

.hgt-floor-viewport {
    overflow: auto;
    max-height: calc(100vh - 200px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    background: #e9ecef;
    border-radius: 0.375rem;
}

.hgt-floor-zoom-wrap {
    transform-origin: top center;
    transition: transform 0.15s ease;
}

.hgt-table--wall-left {
    border-left: none;
    border-radius: 0 0.25rem 0.25rem 0;
}

.hgt-table--wall-right {
    border-right: none;
    border-radius: 0.25rem 0 0 0.25rem;
}

.hgt-table--wall-top {
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
}

.hgt-table--wall-bottom {
    border-bottom: none;
    border-radius: 0.25rem 0.25rem 0 0;
}

.hgt-floor-plan {
    position: relative;
    background: #faf8f5;
    border: 3px solid #868e96;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    min-width: 320px;
    box-sizing: border-box;
}

.hgt-floor-plan--stolovaya { aspect-ratio: 7 / 12; width: min(520px, 95vw); }
.hgt-floor-plan--naves { aspect-ratio: 8 / 7; width: min(760px, 95vw); }
.hgt-floor-plan--ulichnyy-naves { aspect-ratio: 1 / 1; width: min(560px, 95vw); }
.hgt-floor-plan--bar { aspect-ratio: 12.4 / 5.5; width: min(920px, 95vw); }

/* Schematic door / entrance */
.hgt-door-mark {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hgt-door-mark--bottom-center {
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
}

.hgt-door-mark--bottom-right {
    bottom: 0;
    right: 0;
    transform: translate(35%, 45%);
    align-items: flex-end;
}

.hgt-door-gap {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
    width: 14%;
    height: 4px;
    background: #e9ecef;
    z-index: 6;
}

.hgt-door-mark--bottom-right .hgt-door-gap {
    left: auto;
    right: 0;
    transform: translate(20%, 50%);
    width: 12%;
}

.hgt-door-frame {
    width: 2.4rem;
    height: 2rem;
    border: 2px solid #495057;
    border-top: none;
    border-radius: 0 0 0.35rem 0.35rem;
    background: #fff;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.hgt-door-mark--bottom-right .hgt-door-frame {
    width: 2rem;
    height: 1.75rem;
}

.hgt-door-leaf {
    position: absolute;
    bottom: 1px;
    left: 50%;
    width: 72%;
    height: 88%;
    border: 1px solid #6c757d;
    border-radius: 0 0 0.2rem 0.2rem;
    background: linear-gradient(135deg, #dee2e6 0%, #f8f9fa 100%);
    transform: translateX(-50%);
}

.hgt-door-mark--bottom-right .hgt-door-leaf {
    left: auto;
    right: 2px;
    transform: none;
    width: 65%;
}

.hgt-door-label {
    margin-top: 0.2rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: #495057;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.hgt-entrance {
    position: absolute;
    bottom: -1.6rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    letter-spacing: 0.05em;
}

.hgt-table {
    position: absolute;
    border: 2px solid rgba(0, 0, 0, 0.35);
    border-radius: 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
    padding: 2px;
    font-size: clamp(0.55rem, 1.2vw, 0.8rem);
    line-height: 1.15;
    box-sizing: border-box;
    transition: box-shadow 0.1s;
}

.hgt-table:active {
    cursor: grabbing;
}

.hgt-table--square {
    background: #8B4513;
    color: #fff;
}

.hgt-table--rect {
    background: #4a7c59;
    color: #fff;
}

.hgt-table--selected {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
    z-index: 10;
}

.hgt-table--over-capacity {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.5);
}

.hgt-table--merged {
    border-style: dashed;
}

.hgt-table-room {
    font-weight: 700;
    font-size: 1.1em;
}

.hgt-table-name {
    opacity: 0.95;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hgt-table-count {
    font-weight: 600;
}

.hgt-table-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #fd7e14;
    color: #fff;
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border-radius: 0.2rem;
    white-space: nowrap;
    z-index: 2;
}

.hgt-table-assignments {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    overflow: hidden;
}

.hgt-table-assign-item {
    padding: 1px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.hgt-table-assign-item:first-child {
    border-top: none;
}

.hgt-assignment-row {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
}

.hgt-merge-group {
    position: absolute;
    pointer-events: none;
    border: 2px dashed #0dcaf0;
    border-radius: 0.25rem;
    z-index: 1;
}

#hgtToast.toast-success { background: #198754; color: #fff; }
#hgtToast.toast-error { background: #dc3545; color: #fff; }

@media print {
    .d-print-none { display: none !important; }
    .hgt-body { background: #fff !important; }
    .hgt-page { max-width: none; padding: 0; }
    .hgt-floor-viewport {
        max-height: none;
        overflow: visible;
        padding: 0;
        background: #fff;
    }
    .hgt-floor-card { box-shadow: none !important; border: none; }
    .hgt-floor-card .card-body { padding: 0; }
    .hgt-table { cursor: default; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .col-lg-9 { width: 100% !important; max-width: 100% !important; }
}

@media (max-width: 991px) {
    .hgt-sidebar { max-height: 220px; margin-bottom: 0.5rem; }
    .hgt-floor-viewport { max-height: 55vh; }
}
