:root {
    --seat-occupied-opacity: 0.4;
    --panel-width: 480px;
    --panel-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.3);
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --card-w: 260px;
    --card-h: 180px;
    --card-spring: cubic-bezier(0.34, 1.25, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
}

#map-container {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#map-container svg {
    width: 100%;
    height: 100%;
}

/* ── Интерактивные места ── */

#office-svg .seat {
    transition: transform 0.2s ease-out, opacity 0.2s ease;
    cursor: pointer;
}

/* ── Панель контролов зума ── */

#zoom-controls {
    position: fixed;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

#zoom-controls button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: #333;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

#zoom-controls button:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

#zoom-controls button:active {
    background: #e4e4e4;
}

/* ── Якорный контейнер карточек ── */

#seat-cards-anchor {
    position: fixed;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 100;
}

#seat-cards-anchor.is-open {
    pointer-events: auto;
}

/* ── Карточка места ── */

.seat-card {
    position: absolute;
    width: 260px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 16px 18px;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    pointer-events: none;
    opacity: 0;
    transform: translate(-130px, -90px) scale(0.05);
    transition: transform 0.4s var(--card-spring), opacity 0.25s ease;
    will-change: transform, opacity;
    /* z-index и transition-delay задаются инлайново через JS */
}

.seat-card.is-open {
    opacity: 1;
    /* transform, pointer-events, z-index, transition-delay задаются инлайново через JS */
}

/* ── Внутренняя структура карточки ── */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-badges {
    display: flex;
    align-items: center;
    gap: 7px;
}

.card-seat-badge {
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    /* background и color задаются инлайново через JS (цвет карточки) */
}

.card-type-badge {
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.card-type-badge.is-fixed {
    background: #ECEEF2;
    color: #6B78A0;
}

.card-type-badge.is-flex {
    background: #ECEEF2;
    color: #9090A8;
}

.card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* background и color задаются инлайново через JS */
}

.card-name {
    font-size: 16px;
    font-weight: 500;
    color: #111111;
    line-height: 1.2;
    letter-spacing: -0.02em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-position {
    margin-top: 8px;
    font-size: 13px;
    color: #9090A0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 6px;
    overflow: hidden;
}

.card-dept-pill {
    padding: 3px 9px;
    background: #F5F5F7;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #555555;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta-sep {
    color: #D4D4DC;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.card-manager {
    font-size: 12px;
    color: #9090A0;
    flex-shrink: 0;
    white-space: nowrap;
}

.card-days {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.card-day-pill {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 400;
    background: #F5F5F7;
    color: #C0C0C8;
}

.card-day-pill.is-active {
    font-weight: 600;
    /* background и color задаются инлайново через JS (цвет аватара occupant) */
}

/* ── Пилюля свободного места ── */

.seat-free-tip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #444444;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#seat-cards-anchor.is-open .seat-free-tip {
    opacity: 1;
}

/* ── Overlay ── */

#panel-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

#panel-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Боковая панель ── */

#side-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: var(--panel-width);
    min-width: 360px;
    background: var(--panel-bg);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 9001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(calc(100% + 32px));
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#side-panel.is-open {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #F0F0F4;
    flex-shrink: 0;
}

.panel-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #111111;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-search {
    position: relative;
    width: 32px;
    height: 32px;
    transition: width 200ms ease;
}

.panel-search.is-expanded {
    width: 220px;
}

.panel-search-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #F0F0F4;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.panel-search-btn:hover {
    background: #E4E4EA;
    color: #111;
}

.panel-search-input-wrap {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    align-items: center;
    gap: 4px;
    padding: 0 8px 0 10px;
    background: #F7F8FA;
    border: 1px solid #E8E8EE;
    border-radius: 8px;
}

.panel-search-input-wrap.is-open {
    display: flex;
    width: 100%;
}

.panel-search-input {
    flex: 1;
    min-width: 0;
    height: 28px;
    border: none;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #111;
    outline: none;
}

.panel-search-input::placeholder {
    color: #9090A0;
}

.panel-search-collapse {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    color: #9090A0;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.panel-search-collapse:hover {
    background: #E8E8EE;
    color: #111;
}

.panel-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #F0F0F4;
    font-size: 18px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.panel-close:hover {
    background: #E4E4EA;
    color: #111;
}

.panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid #ECEEF2;
}

.panel-footer-counts {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    color: #9090A0;
}

/* ── Seat-группы ── */

.seat-group.is-hidden {
    display: none;
}

.panel-search-empty {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    min-height: 120px;
}

.panel-search-empty.is-visible {
    display: flex;
}

.panel-search-empty svg {
    color: #C0C0C8;
}

.panel-search-empty span {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #9090A0;
}

.seat-group {
    background: #FAFAFA;
    border: 1px solid #ECEEF2;
    border-radius: 16px;
    padding: 14px 16px;
    flex-shrink: 0;
}

.seat-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sg-seat-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    /* background и color задаются инлайново через JS (getSeatPalette) */
}

.sg-add-btn {
    padding: 4px 10px;
    border: 1px solid #E8E8EE;
    border-radius: 8px;
    background: #F7F8FA;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.sg-add-btn:hover {
    background: #ECEEF2;
    border-color: #D0D0DA;
}

.sg-occupants {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sg-free-badge {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #9090A0;
    padding: 4px 0;
}

/* ── Карточка occupant ── */

.occupant-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #ECEEF2;
    border-radius: 12px;
    padding: 14px;
}

.oc-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    color: #C0C0C8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.oc-remove-btn:hover {
    background: #FEE2E2;
    color: #E53E3E;
}

/* ── Вспомогательные ── */

.panel-empty {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #9090A0;
    text-align: center;
    padding: 32px 0;
}

/* ── Поля формы occupant ── */

.oc-row {
    margin-top: 10px;
}

.oc-row--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.oc-field {
    display: flex;
    flex-direction: column;
}

.oc-label {
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #9090A0;
    margin-bottom: 4px;
}

.oc-input {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #111111;
    background: #F7F8FA;
    border: 1px solid #E8E8EE;
    border-radius: 8px;
    padding: 7px 10px;
    outline: none;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.oc-input:focus {
    border-color: var(--oc-accent, #4A6CF7);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--oc-accent-shadow, #E8EEFF);
}

/* ── Segment-контрол статуса ── */

.oc-segment {
    display: flex;
    background: #F0F0F4;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.oc-seg-btn {
    flex: 1;
    padding: 5px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.oc-seg-btn.is-active {
    background: #ffffff;
    color: #111111;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

.oc-seg-btn:not(.is-active):hover {
    color: #555;
}

/* ── Пилюли дней посещения ── */

.oc-days {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.oc-day-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    background: #F5F5F7;
    color: #C0C0C8;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, font-weight 150ms ease;
}

.oc-day-btn.is-active {
    background: var(--oc-accent-shadow, #E8EEFF);
    color: var(--oc-accent, #4A6CF7);
    font-weight: 600;
}

.oc-day-btn:not(.is-active):hover {
    background: #ECEEF2;
    color: #888;
}

/* ── Toast ── */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1A1A2E;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    transition: opacity 200ms ease;
}

.toast.is-visible {
    opacity: 1;
}

