/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    color: #333;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #d0d0d0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.4rem;
    color: #1a73e8;
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.controls select {
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
}

.btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #1a73e8;
    color: #1a73e8;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    background: #1a73e8;
    color: #fff;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.active {
    background: #1a73e8;
    color: #fff;
}

.file-upload {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #34a853;
    color: #34a853;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover {
    background: #34a853;
    color: #fff;
}

.file-upload input {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.search-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.search-group input {
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 200px;
}

.search-group input:focus {
    outline: none;
    border-color: #1a73e8;
}

.header-search {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 350px;
}

.header-search input {
    width: 280px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn-small {
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-small:hover {
    background: #f5f5f5;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sidebar-toggle:hover,
.sidebar-toggle:active {
    background: #f5f5f5;
    border-color: #1a73e8;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 200px;
    max-width: 500px;
    background: #ffffff;
    border-right: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: #1a73e8;
}

.sidebar.hidden {
    display: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .header-search {
        order: 3;
        width: 100%;
        max-width: none;
    }
    
    .header-search input {
        width: 100%;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-group {
        display: none;
    }
    
    /* Larger touch target for sidebar resize on mobile */
    .sidebar-resize-handle {
        width: 20px;
        right: -10px;
        background: rgba(26, 115, 232, 0.2);
    }
    
    .sidebar-resize-handle::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 4px;
        height: 40px;
        background: #1a73e8;
        border-radius: 2px;
    }
}

.sidebar h2 {
    padding: 16px;
    font-size: 1.1rem;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.search-box {
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    color: #333;
    border-radius: 4px;
}

.search-box input[type="text"]:focus {
    outline: none;
    border-color: #1a73e8;
}

.upload-employees-btn {
    padding: 6px 10px;
    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.upload-employees-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
}

.upload-employees-btn input {
    display: none;
}

.filter-toggles {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    flex-wrap: wrap;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s;
}

.filter-toggle:hover {
    border-color: #1a73e8;
}

.filter-toggle input {
    margin: 0;
    cursor: pointer;
}

.filter-toggle input:checked + span {
    color: #1a73e8;
    font-weight: 500;
}

.employee-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.employee-area.drop-target {
    background: rgba(52, 168, 83, 0.15);
    border: 2px dashed #34a853;
}

.sidebar-summary {
    padding: 10px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.75rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 4px 6px;
    text-align: left;
    white-space: nowrap;
}

.stats-table th {
    font-weight: 600;
    color: #5f6368;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.8rem;
}

.stats-table .stat-number {
    text-align: right;
    font-weight: 600;
    color: #1a73e8;
}

.stats-table .stat-icon {
    margin-right: 4px;
}

.stats-table .stats-total {
    border-top: 1px solid #e0e0e0;
    background: #f0f0f0;
}

.stats-table .stats-total td {
    padding-top: 6px;
}

.stats-table .stats-unassigned td {
    color: #ea4335;
}

.stats-table .stats-unassigned .stat-number {
    color: #ea4335;
}

.stats-table .stat-row {
    cursor: pointer;
}

.stats-table .stat-row:hover {
    background: #e8f0fe;
}

.stats-table .stat-row label {
    cursor: pointer;
}

.stats-table .stat-row input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

/* Filter chips for office types */
.stats-filters {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e0e0e0;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 12px;
    background: #f0f0f0;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.filter-chip:hover {
    background: #e0e0e0;
}

.filter-chip input {
    display: none;
}

.filter-chip:has(input:not(:checked)) {
    opacity: 0.4;
}

/* Stats display with grouped sliders */
.stats-display {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

.stats-group {
    margin-bottom: 10px;
}

.stats-group-header {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stats-row {
    display: grid;
    grid-template-columns: 26px 1fr 32px;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.stats-row .stats-icon {
    font-size: 1rem;
    text-align: center;
}

.stats-row .stats-track {
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    background: #e0e0e0;
}

.stats-row .stats-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: default;
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.stats-row .stats-segment .num {
    margin-left: 2px;
}

.stats-row .stats-segment .diff {
    font-size: 0.6rem;
    margin-left: 2px;
    color: #ffeb3b;
    font-weight: 600;
}

.stats-row .stats-total {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    text-align: right;
}

/* Window colors */
.stats-row.window .stats-segment.single { background: #388e3c; }
.stats-row.window .stats-segment.double { background: #81c784; }

/* Interior colors */
.stats-row.interior .stats-segment.single { background: #f57c00; }
.stats-row.interior .stats-segment.double { background: #ffb74d; }

/* Tooltip on hover */
.stats-row .stats-segment[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 4px;
}

.stats-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #666;
}

.stats-footer .stats-unassigned {
    color: #d32f2f;
    font-weight: 500;
}

/* Audit mode toggle */
.audit-mode-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 6px;
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
    user-select: none;
}

.audit-mode-toggle input {
    margin: 0;
    cursor: pointer;
}

body.audit-mode .audit-mode-toggle {
    color: #d32f2f;
    font-weight: 500;
}

/* Session actions - always visible below stats */
.session-actions-main {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    justify-content: flex-start;
}

/* Hide session actions in Original session */
body.session-original .session-actions-main {
    display: none;
}

/* Hide allocation controls in Original session (even in experimental mode) */
body.session-original .allocation-controls,
body.session-original.experimental-mode .allocation-controls.experimental-feature {
    display: none !important;
}

.allocation-controls {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

/* Allocation controls is now experimental - use block display when shown */
body.experimental-mode .allocation-controls.experimental-feature {
    display: block !important;
}

/* Stacked bar pool sections */
.pool-section {
    margin-bottom: 12px;
}

.pool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pool-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: #333;
}

.pool-total {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.stacked-bar {
    position: relative;
    height: 32px;
    background: #e0e0e0;
    border-radius: 5px;
    display: flex;
    overflow: visible;
}

.bar-single {
    background: linear-gradient(135deg, #4285f4, #1a73e8);
    border-radius: 5px 0 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    min-width: 0;
    transition: width 0.15s;
}

.bar-double {
    background: linear-gradient(135deg, #34a853, #0d652d);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    min-width: 0;
    transition: width 0.15s;
}

.bar-empty {
    background: linear-gradient(135deg, #9e9e9e, #757575);
    border-radius: 0 5px 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    min-width: 0;
    transition: width 0.15s;
}

/* Hide empty segment when it has no width */
.bar-empty:empty, .bar-empty[style*="width: 0"] {
    display: none;
}

.bar-divider {
    position: absolute;
    width: 8px;
    height: 40px;
    background: white;
    border: 2px solid #333;
    border-radius: 4px;
    top: -4px;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    touch-action: none;
}

.bar-divider:hover {
    background: #f0f0f0;
    transform: scaleX(1.1);
}

.bar-divider.dragging {
    background: #e0e0e0;
    transform: scaleX(1.2);
}

.session-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.btn-reassign {
    flex: 1;
    padding: 10px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-reassign:hover {
    background: #1557b0;
}

.btn-shuffle {
    padding: 8px 12px;
    background: #673ab7;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-shuffle:hover:not(:disabled) {
    background: #512da8;
}

.btn-shuffle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9e9e9e;
}

.btn-undo, .btn-reset {
    padding: 8px 12px;
    background: #f1f3f4;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-undo:hover:not(:disabled), .btn-reset:hover {
    background: #e8eaed;
}

.btn-undo:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.employee-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.employee-card {
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: default;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.employee-card:hover {
    border-color: #1a73e8;
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.employee-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.employee-card .status-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-left: auto;
}

.employee-card .emp-checkbox {
    pointer-events: auto;
}

/* Drag handle for sidebar employees */
.drag-handle {
    cursor: grab;
    color: #999;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.drag-handle:hover {
    color: #1a73e8;
    background: #e8f0fe;
}

.drag-handle:active {
    cursor: grabbing;
    color: #174ea6;
}

.employee-card .name,
.employee-card .room-badge,
.employee-card .status-icon,
.employee-card .years-badge {
    pointer-events: none;
}

.employee-card .name {
    font-weight: 500;
    color: #333;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.employee-card .room-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: #e8f0fe;
    border-radius: 3px;
    color: #1a73e8;
    flex-shrink: 0;
    min-width: 42px;
    text-align: center;
}

.employee-card .years-badge {
    font-size: 0.65rem;
    padding: 2px 5px;
    background: #fef7e0;
    border-radius: 3px;
    color: #b06000;
    flex-shrink: 0;
}

/* Status colors for employee cards */
.employee-card.status-window-single {
    border-left: 4px solid #34a853;
    background: linear-gradient(90deg, rgba(52, 168, 83, 0.12) 0%, rgba(52, 168, 83, 0.03) 100%);
}

.employee-card.status-window-shared {
    border-left: 4px solid #81c995;
    background: linear-gradient(90deg, rgba(129, 201, 149, 0.15) 0%, rgba(129, 201, 149, 0.05) 100%);
}

.employee-card.status-interior-single {
    border-left: 4px solid #1a73e8;
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.12) 0%, rgba(26, 115, 232, 0.03) 100%);
}

.employee-card.status-interior-shared {
    border-left: 4px solid #8ab4f8;
    background: linear-gradient(90deg, rgba(138, 180, 248, 0.15) 0%, rgba(138, 180, 248, 0.05) 100%);
}

.employee-card.status-unassigned {
    border-left: 4px solid #ea4335;
    background: linear-gradient(90deg, rgba(234, 67, 53, 0.12) 0%, rgba(234, 67, 53, 0.03) 100%);
}

.employee-card .manager-icon {
    font-size: 0.9rem;
    margin-right: 4px;
}

.employee-card.is-manager {
    border-left-width: 5px;
    font-weight: 500;
}

/* Moved employees */
.employee-card.has-moved .name {
    font-style: italic;
}

.employee-card.has-moved .room-badge {
    background: #fce8e6;
    color: #c5221f;
    font-size: 0.6rem;
}
}

.employee-card.selected {
    background: #e3f2fd !important;
    border: 2px solid #1a73e8;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.employee-card.hover-highlight {
    background: #fff3e0 !important;
    border: 2px solid #f57c00;
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

.employee-card:hover {
    cursor: pointer;
    filter: brightness(0.97);
}

/* Legend inline in sidebar */
.legend-inline {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    background: #fafafa;
}

.legend-inline .legend-icon {
    cursor: help;
}

/* Assigned room groups */
.assigned-room {
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.assigned-room .room-header {
    padding: 6px 10px;
    background: #e8f0fe;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1a73e8;
}

.assigned-room .employee-card {
    margin: 4px;
    margin-bottom: 4px;
}

/* Floor Plan Container */
.floor-plan-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #e8eaed;
}

.view-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
}

.view-wrapper.side-by-side {
    display: flex;
    gap: 4px;
}

.view-wrapper.side-by-side .floor-plan-view,
.view-wrapper.side-by-side .reference-view {
    flex: 1;
    width: 50%;
}

.floor-plan-view {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.floor-plan-view:active {
    cursor: grabbing;
}

#floor-svg {
    display: block;
    transform-origin: 0 0;
    transition: none;
    pointer-events: none; /* Let HTML overlays handle interactions */
}

/* Occupant overlay container - positioned over SVG */
.occupant-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* Let clicks through to SVG, except on badges */
    transform-origin: 0 0;
    z-index: 10;
}

/* Individual occupant badges - draggable */
/* Room content overlay - clipped to room bounds */
.room-content-overlay {
    z-index: 4;
    pointer-events: auto; /* Enable drag-drop on room overlay */
}

.room-content-overlay.drop-target {
    outline: 3px dashed #fff;
    outline-offset: -3px;
    background: rgba(255, 255, 255, 0.15);
}

.room-content-overlay .room-id-label {
    flex-shrink: 0;
    pointer-events: none;
}

.room-content-overlay .occupant-names {
    min-height: 0;
}

/* Individual occupant badge */
.occupant-badge {
    padding: 0 4px;
    color: #fff;
    font-size: 10px;
    border-radius: 2px;
    cursor: grab;
    pointer-events: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    user-select: none;
    transition: background 0.15s ease;
    position: relative;
    z-index: 10000;
}

.occupant-badge:hover {
    background: rgba(255, 255, 255, 0.2);
}

.occupant-badge.dragging {
    opacity: 0.3;
    cursor: grabbing;
}

.occupant-badge.dimmed {
    opacity: 0.08;
}

.occupant-badge.highlighted {
    background: rgba(76, 175, 80, 0.3);
}

.occupant-badge.highlighted-secondary {
    background: rgba(251, 188, 4, 0.25);
    opacity: 0.75;
}

.occupant-badge.moved {
    font-style: italic;
    border-left: 2px solid #ffab00;
    padding-left: 6px;
}

.occupant-badge.fixed {
    cursor: default;
    opacity: 0.7;
    font-style: italic;
}

/* Empty room placeholder */
.empty-placeholder {
    z-index: 4;
}

/* Desk logistics badges */
.desk-logistics-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    padding: 1px 4px;
    font-size: 9px;
    border-radius: 3px;
    pointer-events: auto;
    z-index: 10001;
    white-space: nowrap;
    font-weight: bold;
    line-height: 1.3;
}
.desk-logistics-badge.desk-add {
    background: rgba(33, 150, 243, 0.85);
    color: #fff;
}
.desk-logistics-badge.desk-remove {
    background: rgba(255, 152, 0, 0.85);
    color: #fff;
}

.reference-view {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-left: 2px solid #d0d0d0;
}

.reference-placeholder {
    text-align: center;
    color: #888;
}

.reference-placeholder p {
    margin-bottom: 16px;
}

#reference-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    transform-origin: top left;
}

.overlay-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    gap: 20px;
    border: 1px solid #d0d0d0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.overlay-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #666;
}

.overlay-controls input[type="range"] {
    width: 100px;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-icon:hover {
    background: #f5f5f5;
    border-color: #1a73e8;
    color: #1a73e8;
}

/* Loading */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: none;
}

.loading.visible {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
    position: fixed;
    padding: 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1000;
    display: none;
    max-width: 260px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.tooltip.visible {
    display: block;
}

/* Person card tooltip header with avatar */
.tooltip .tip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.tooltip .tip-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.tooltip .tip-identity {
    flex: 1;
    min-width: 0;
}

.tooltip .tip-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip .tip-title {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Details section with rows */
.tooltip .tip-details {
    font-size: 12px;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.tooltip .tip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.tooltip .tip-row span:last-child {
    color: #333;
    font-weight: 500;
}

/* Change indicator */
.tooltip .tip-change {
    margin-top: 8px;
    padding: 6px 8px;
    background: #fff3e0;
    border-radius: 4px;
    font-size: 11px;
    color: #e65100;
}

/* Drag hint */
.tooltip .tip-hint {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 10px;
    color: #888;
    text-align: center;
}

/* Legacy styles for room tooltip */
.tooltip .tip-id {
    font-weight: bold;
    color: #1a73e8;
}

.tooltip .tip-type {
    color: #34a853;
}

.tooltip .tip-occupants {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8rem;
    color: #555;
}

/* Room tooltip styles */
.tooltip .tip-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.tooltip .tip-room-id {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1a73e8;
}

.tooltip .tip-room-capacity {
    font-size: 0.85rem;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.tooltip .tip-room-type {
    font-size: 0.85rem;
    color: #34a853;
    margin-bottom: 8px;
}

.tooltip .tip-occupant-list {
    border-top: 1px solid #e0e0e0;
    padding-top: 8px;
}

.tooltip .tip-occupant-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    font-size: 0.85rem;
}

.tooltip .tip-occupant-name {
    font-weight: 500;
    color: #333;
}

.tooltip .tip-occupant-title {
    color: #666;
    font-size: 0.8rem;
}

.tooltip .tip-empty {
    color: #999;
    font-style: italic;
    font-size: 0.85rem;
}

.tooltip .tip-alias {
    color: #666;
    font-size: 0.8rem;
}

.tooltip .tip-detail {
    margin-top: 2px;
    font-size: 0.8rem;
    color: #444;
}

.tooltip .tip-room {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8rem;
    color: #1a73e8;
}

/* SVG Room Styles */
.room {
    cursor: pointer;
    transition: filter 0.15s ease;
    pointer-events: none; /* Let HTML overlays handle interactions */
}

.room:hover {
    filter: brightness(0.92);
    stroke-width: 1.5 !important;
}

.room.selected {
    stroke: #1a73e8 !important;
    stroke-width: 2 !important;
}

.room.drop-target {
    stroke: #34a853 !important;
    stroke-width: 2 !important;
    stroke-dasharray: 4,2;
    animation: pulse 0.5s infinite alternate;
}

.room.highlighted {
    stroke: #ea4335 !important;
    stroke-width: 3 !important;
    filter: brightness(1.1);
}

.room.highlighted-secondary {
    stroke: #fbbc04 !important;
    stroke-width: 2 !important;
    filter: brightness(1.05);
    opacity: 0.7;
}

.room.dimmed {
    opacity: 0.08;
}

@keyframes pulse {
    from { filter: brightness(1); }
    to { filter: brightness(0.9); }
}

.room-label {
    font-size: 10px;
    fill: #222;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: middle;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.room-label.room-number {
    fill: #222;
    font-weight: 600;
}

.room-label.room-occupant {
    fill: #444;
    font-weight: normal;
}

.room-header-bg {
    pointer-events: none;
}

.room-occupant-indicator {
    pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ==================== Admin Panel ==================== */

.admin-panel {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90%;
}

.admin-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    border-right: 1px solid #e0e0e0;
}

.admin-section:last-child {
    border-right: none;
    padding-right: 0;
}

.admin-section label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.admin-section select {
    padding: 4px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #f0f0f0;
    border-color: #1a73e8;
}

.btn-small.btn-danger {
    color: #d32f2f;
}

.btn-small.btn-danger:hover {
    background: #ffebee;
    border-color: #d32f2f;
}

.storage-status span {
    font-size: 11px;
    color: #666;
}

/* Room Editor */
.room-editor {
    background: #e8f4fd;
    border-radius: 4px;
    padding: 6px 12px !important;
}

#selected-room-label {
    font-weight: 600;
    color: #1a73e8;
    font-size: 12px;
}

#room-capacity-toggle {
    min-width: 42px;
    font-size: 11px;
    cursor: pointer;
}

/* Desk Logistics Toggle (active state) */
#desk-logistics-btn.active {
    background: #e3f2fd;
    border-color: #1a73e8;
    color: #1a73e8;
}

/* Desk Logistics Panel */
.desk-logistics-panel {
    position: absolute;
    bottom: 60px;
    right: 10px;
    width: 280px;
    max-height: 400px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
    z-index: 101;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.desk-logistics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}
.desk-logistics-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}
.btn-icon-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
}
.btn-icon-small:hover { background: #e0e0e0; }
.desk-logistics-summary {
    padding: 8px 12px;
    font-size: 12px;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
}
.desk-logistics-summary .desk-stat {
    font-weight: 600;
}
.desk-logistics-summary .desk-add-stat { color: #1565c0; }
.desk-logistics-summary .desk-remove-stat { color: #e65100; }
.desk-logistics-summary .desk-net-stat { color: #333; }
.desk-logistics-list {
    overflow-y: auto;
    max-height: 300px;
    padding: 4px 0;
}
.desk-logistics-list .desk-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding: 6px 12px 2px;
    text-transform: uppercase;
}
.desk-logistics-list .desk-room-item {
    font-size: 12px;
    padding: 3px 12px;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}
.desk-logistics-list .desk-room-item:hover {
    background: #f0f0f0;
}
.desk-logistics-list .desk-room-item .desk-delta {
    font-weight: 600;
}
.desk-logistics-list .desk-room-item .desk-delta.positive { color: #1565c0; }
.desk-logistics-list .desk-room-item .desk-delta.negative { color: #e65100; }

/* ==================== Context Menu ==================== */

.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    padding: 4px 0;
}

.context-menu-item {
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.context-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* ==================== Modal ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 16px;
    color: #333;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.deleted-shapes-list {
    max-height: 300px;
    overflow-y: auto;
}

.deleted-shape-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.deleted-shape-item:last-child {
    border-bottom: none;
}

.deleted-shape-item button {
    padding: 4px 8px;
    font-size: 11px;
}

/* ==================== Change Indicators ==================== */

.employee-card.changed {
    background: #fff8e1;
    border-left: 3px solid #ffc107;
}

.employee-card.changed .change-indicator {
    color: #f57c00;
    font-size: 12px;
    margin-left: 4px;
}

.employee-card.changed .employee-name {
    font-style: italic;
}

.change-tooltip {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

/* Change summary in header */
.change-summary {
    font-size: 11px;
    color: #f57c00;
    margin-left: 8px;
}

/* Selected room highlight */
rect.room.selected {
    stroke: #1a73e8 !important;
    stroke-width: 3px !important;
}

/* Hover state for assignable rooms */
rect.room.assign-target {
    stroke: #4caf50;
    stroke-width: 2px;
    stroke-dasharray: 4;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

.btn:hover {
    background: #f0f0f0;
}

.btn-primary {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

.btn-primary:hover {
    background: #1557b0;
}

/* Unsaved changes indicator */
.has-unsaved {
    border-color: #ea4335 !important;
    box-shadow: 0 0 3px rgba(234, 67, 53, 0.5);
}

#session-select.has-unsaved {
    background-color: #fce8e6;
}

#save-session-btn.has-unsaved {
    animation: pulse-unsaved 1.5s ease-in-out infinite;
}

@keyframes pulse-unsaved {
    0%, 100% { background-color: #ea4335; }
    50% { background-color: #f44336; }
}

/* Employee Tree Styles */
.employee-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 0.85rem;
}

.tree-node {
    margin-left: 0;
}

/* Indentation is controlled by nesting, not by level class */
.tree-children > .tree-node,
.tree-children > .tree-employee {
    margin-left: 20px;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
}

.tree-header:hover {
    background: #f0f0f0;
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #666;
    transition: transform 0.15s;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-checkbox {
    margin: 0;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.tree-label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-room {
    font-size: 0.7rem;
    color: #666;
    background: #e8e8e8;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 2px;
}

.tree-status {
    font-size: 0.8rem;
    margin-right: 2px;
}

.tree-count {
    font-size: 0.75rem;
    color: #888;
    margin-left: 4px;
}

.tree-spacer {
    flex: 1;
}

.tree-children {
    display: block;
}

.tree-children.collapsed {
    display: none;
}

/* Employee leaf nodes in tree */
.tree-employee {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    padding-left: 22px; /* Align with tree-header content (past toggle space) */
    cursor: default;
    border-radius: 4px;
    transition: all 0.15s;
}

.tree-employee:hover {
    background: #e8f0fe;
}

.tree-employee.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.tree-employee.selected {
    background: #c2e7ff;
}

.tree-employee.deselected {
    opacity: 0.4;
}

.tree-employee .emp-checkbox {
    margin: 0;
    cursor: pointer;
    pointer-events: auto;
}

.tree-employee .emp-name,
.tree-employee .emp-room,
.tree-employee .emp-status {
    pointer-events: none;
}

.tree-employee .emp-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-employee .emp-room {
    font-size: 0.7rem;
    padding: 1px 5px;
    background: #e8f0fe;
    border-radius: 3px;
    color: #1a73e8;
}

.tree-employee .emp-status {
    font-size: 0.8rem;
}

/* Status colors for tree employees */
/* Room type indicators removed for cleaner unified look */

/* Manager indicator */
.tree-employee.is-manager .emp-name {
    font-weight: 600;
}

/* Search match highlighting */
.tree-node.search-hidden,
.tree-employee.search-hidden,
.employee-card.search-hidden,
.employee-group.search-hidden {
    display: none;
}

.tree-node.search-match > .tree-header {
    background: #fef7e0;
}

.tree-employee.search-match,
.employee-card.search-match {
    background: #fef7e0;
}

/* Filtered out employees (tree selection) */
.occupant-badge.filtered-out {
    opacity: 0.3;
    filter: grayscale(70%);
}

/* View controls (tree/flat, all/selected) */
.view-controls {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    gap: 8px;
}

.view-toggle, .filter-toggle {
    display: flex;
    gap: 2px;
    background: #e0e0e0;
    border-radius: 4px;
    padding: 2px;
}

.view-btn, .filter-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.view-btn:hover, .filter-btn:hover {
    background: #d0d0d0;
}

.view-btn.active, .filter-btn.active {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Employee flat list */
.employee-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Grouping dropdown */
.group-select {
    padding: 4px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: white;
    font-size: 0.75rem;
    cursor: pointer;
}

.group-select:focus {
    outline: none;
    border-color: #1a73e8;
}

/* Group headers in flat list */
.employee-group {
    margin-bottom: 12px;
}

.employee-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
}

.employee-group-header:hover {
    background: #e8e8e8;
}

.employee-group-header .group-checkbox {
    margin: 0;
}

.employee-group-header .group-toggle {
    font-size: 0.7rem;
    color: #666;
    transition: transform 0.15s;
}

.employee-group-header .group-toggle.expanded {
    transform: rotate(90deg);
}

.employee-group-header .group-name {
    flex: 1;
}

.employee-group-header .group-count {
    font-size: 0.7rem;
    color: #666;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 10px;
}

.employee-group-items {
    padding-left: 8px;
}

.employee-group-items.collapsed {
    display: none;
}

/* Deselected card style */
.employee-card.deselected {
    opacity: 0.5;
}

.employee-card .emp-checkbox {
    margin: 0 4px 0 0;
}

/* Experimental features - hidden by default */
.experimental-feature {
    display: none !important;
}

body.experimental-mode .experimental-feature {
    display: flex !important;
}

/* Pool sections need block display when shown */
body.experimental-mode .pool-section.experimental-feature {
    display: block !important;
}

/* Icon-only buttons - smaller, no text */
.btn-icon-only {
    padding: 4px 8px;
    min-width: auto;
    font-size: 1rem;
}

/* Experimental mode toggle */
.experimental-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    background: transparent;
    border: 1px dashed transparent;
}

.experimental-toggle:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.experimental-toggle.active {
    color: #9c27b0;
    background: #f3e5f5;
    border-color: #9c27b0;
}

.experimental-toggle .toggle-icon {
    font-size: 0.9rem;
}

/* Compact stats row */
.stats-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: #f8f8f8;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.stats-compact .stat-item {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.stats-compact .stat-item span {
    font-weight: 600;
    min-width: 1.5em;
    text-align: center;
}

.stats-compact .stat-unassigned {
    color: #d32f2f;
}

.stats-compact .stat-unassigned span {
    color: #d32f2f;
}

/* Hide tooltips while dragging */
body.dragging-employee [title] {
    pointer-events: none;
}

body.dragging-employee [title]::after {
    display: none !important;
}

/* Suppress native browser tooltips during drag */
body.dragging-employee * {
    -webkit-user-select: none;
    user-select: none;
}

/* User info display in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    font-size: 13px;
    color: white;
}

.user-info #user-name {
    opacity: 0.9;
}
