/* Стили карты рассадки. Цвета, шрифт, скругления, плотность и тени — только через токены из css/theme.css
   (их меняет панель «Дизайн»): жёстких цветов интерфейса здесь нет. Исключение — рисунки мебели и плана (.furniture). */

body, html { margin: 0; padding: 0; overflow: hidden; font-family: var(--font); font-size: var(--font-size); color: var(--text); height: 100%; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
#map { width: 100vw; height: calc(100vh - 52px); margin-top: 52px; background: var(--canvas-bg); }

.leaflet-control-attribution { display: none !important; }
.leaflet-top.leaflet-left { top: 64px !important; }
.leaflet-bar { border: 1px solid var(--border) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow-sm) !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-bottom-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-2) !important; }

[hidden] { display: none !important; }

/* ---------- Общие элементы управления ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="datetime-local"], input[type="date"], input[type="time"], select, textarea {
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: 0 12px; min-height: var(--control-h); box-sizing: border-box; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { padding: 8px 12px; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
select { cursor: pointer; }

.btn-save, .btn-login, .btn-primary-small, body.edit-mode .hr-panel button, .m-btn {
    background: var(--color-primary); color: #fff; border: 1px solid var(--color-primary); border-radius: var(--radius);
    min-height: var(--control-h); padding: 0 16px; font-weight: 500; cursor: pointer; transition: background 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn-save:hover, .btn-login:hover, .btn-primary-small:hover, body.edit-mode .hr-panel button:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: #fff; }
.btn-cancel, .btn-small, .mode-toggle {
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius);
    min-height: var(--control-h); padding: 0 14px; font-weight: 500; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; white-space: nowrap;
}
.btn-cancel:hover, .btn-small:hover, .mode-toggle:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }
.btn-small { min-height: calc(var(--control-h) - 8px); padding: 0 10px; font-size: 0.93em; text-decoration: none; display: inline-flex; align-items: center; }
.btn-small.danger { color: var(--danger); }
.btn-small.danger:hover { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.btn-delete, .btn-office-delete {
    background: var(--surface); color: var(--danger); border: 1px solid var(--border-strong); border-radius: var(--radius);
    min-height: var(--control-h); padding: 0 14px; font-weight: 500; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-delete:hover, .btn-office-delete:hover { background: var(--danger-light); border-color: var(--danger); }
.link-button, .back-link, .m-back-link, .bell-all { background: none; border: none; color: var(--color-primary); cursor: pointer; padding: 0; text-decoration: none; font-size: inherit; }
.link-button:hover, .back-link:hover { text-decoration: underline; }
.btn-close { background: none; border: none; font-size: 20px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.btn-close:hover { color: var(--text); background: var(--surface-2); }
.check-row { display: flex !important; align-items: center; gap: 8px; font-weight: normal !important; font-size: inherit !important; color: var(--text) !important; }
.check-row.inline { align-self: end; font-size: 0.93em !important; color: var(--text-2) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); }
.muted { color: var(--text-muted); }

/* ---------- Шапка ---------- */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; width: 100vw; height: 52px; z-index: 1000;
    background: var(--header-bg) var(--header-image) center / cover no-repeat; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
    box-sizing: border-box; border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-logo { height: 26px; width: auto; object-fit: contain; display: block; }
.header-title { font-size: 1.07em; font-weight: 600; color: var(--header-text); white-space: nowrap; letter-spacing: -0.01em; }
.header-divider { width: 1px; height: 20px; background-color: var(--border); margin: 0 2px; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-header button, .hr-panel select { white-space: nowrap; }

.office-select { border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; padding: 0 28px 0 12px; }
.office-select:hover { border-color: var(--text-muted); }

.btn-office-edit, .btn-office-delete, .btn-office-add { display: none; }
body.edit-mode .btn-office-edit, body.edit-mode .btn-office-delete, body.edit-mode .btn-office-add { display: inline-flex; align-items: center; }
.btn-office-edit, .btn-office-delete, .btn-office-add { gap: 6px; justify-content: center; }
.btn-office-edit, .btn-office-add { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); min-height: var(--control-h); padding: 0 12px; cursor: pointer; font-weight: 500; }
.btn-office-edit:hover, .btn-office-add:hover { background: var(--surface-2); }

.mode-toggle { color: var(--color-primary); border-color: var(--color-primary); display: inline-flex; align-items: center; }
.mode-toggle:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }
body.edit-mode .mode-toggle { background: var(--color-primary); color: #fff; }

/* ---------- Поиск ---------- */
.search-panel { position: relative; width: 300px; }
body.edit-mode .search-panel { display: none !important; }
.search-input-wrapper { display: flex; align-items: center; position: relative; }
.search-panel input[type="text"] { width: 100%; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; display: none; flex-direction: column; z-index: 1001; border: 1px solid var(--border); padding: 4px;
}
.search-item { padding: 8px 10px; cursor: pointer; color: var(--text); border-radius: calc(var(--radius) - 2px); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.search-item:hover { background: var(--surface-2); }
.search-item small { color: var(--text-muted); }
.search-item.search-empty { color: var(--text-muted); cursor: default; }
.search-item.search-empty:hover { background: none; }
.search-item .desk-code-badge { font-size: 0.8em; background: var(--surface-2); color: var(--text-2); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ---------- Панели редактора ---------- */
.hr-panel, .editor-panel { display: none; }
body.edit-mode .hr-panel { display: flex; gap: var(--gap); align-items: center; }
body.edit-mode .hr-panel input[type="text"] { width: 150px; }
.hr-panel select { max-width: 150px; }
.hr-panel select { background: var(--surface); }

body.edit-mode .editor-panel, body.edit-mode .staff-panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
body.edit-mode .editor-panel { position: absolute; bottom: 20px; right: 20px; z-index: 1000; padding: 16px; flex-direction: column; gap: 12px; width: 290px; }
.editor-panel h4 { margin: 0 0 4px 0; font-size: 1em; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.editor-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.93em; color: var(--text-2); gap: 8px; }
.editor-row input[type="range"] { flex: 1; accent-color: var(--color-primary); }
.editor-row select, .editor-row input[type="text"] { flex: 1; min-width: 0; min-height: calc(var(--control-h) - 6px); padding: 0 8px; }
.number-input { width: 56px; min-height: calc(var(--control-h) - 6px) !important; padding: 0 4px !important; text-align: center; font-weight: 500; }
.btn-delete { margin-top: 4px; }

.staff-panel { display: none; }
body.edit-mode .staff-panel { display: flex; flex-direction: column; position: absolute; left: 10px; top: 215px; z-index: 1000; width: 260px; max-height: calc(100vh - 290px); font-size: 0.93em; color: var(--text-2); }
.staff-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.staff-head b { color: var(--text); font-size: 1.05em; font-weight: 600; }
.staff-count { flex: 1; font-size: 0.85em; color: var(--text-muted); }
.staff-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; overflow: hidden; min-height: 0; }
.staff-panel.collapsed .staff-body { display: none; }
.staff-body input[type="text"] { min-height: calc(var(--control-h) - 4px); }
.staff-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 60px; }
.staff-item { padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 6px; background: var(--surface); cursor: grab; }
.staff-item:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.staff-item.placed { cursor: pointer; opacity: 0.6; }
.staff-name { font-weight: 500; color: var(--text); }
.staff-sub, .staff-where { font-size: 0.85em; color: var(--text-muted); }
.staff-hint { margin: 0; font-size: 0.85em; color: var(--text-muted); }

/* ---------- Столы на карте ---------- */
.desk-marker { display: flex; align-items: center; justify-content: center; overflow: visible !important; }

.desk-wrapper {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background-color: var(--desk-occupied); border: 2px solid var(--desk-occupied-border); border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.22); box-sizing: border-box; user-select: none;
    cursor: pointer; transition: transform 0.1s, box-shadow 0.2s, border-color 0.2s;
    padding: 2px; overflow: hidden; text-decoration: none;
}
.desk-wrapper.free { background-color: var(--desk-free); border-color: var(--desk-free-border); color: #ffffff; }
.desk-wrapper.selected { outline: 3px solid #00d2ff; box-shadow: 0 0 15px rgba(0, 210, 255, 0.8); }
.desk-wrapper.searched-target { outline: 3px solid #e67e22; animation: pulseHighlight 1.5s infinite alternate; }
@keyframes pulseHighlight {
    0% { box-shadow: 0 0 5px #e67e22; }
    100% { box-shadow: 0 0 25px #e67e22; transform: scale(1.1); }
}
.desk-name-line { font-weight: 700; color: #222222; text-align: center; line-height: 1.1; white-space: nowrap; }
.desk-wrapper.free .desk-name-line { color: #ffffff; }

.custom-hover-tooltip {
    background: rgba(17, 24, 39, 0.94) !important; border: none !important; border-radius: var(--radius) !important; color: #ffffff !important;
    font-family: inherit !important; padding: 6px 10px !important; box-shadow: var(--shadow-md) !important; text-align: center !important; pointer-events: none !important;
}
.custom-hover-tooltip::before { border-top-color: rgba(17, 24, 39, 0.94) !important; }
.tooltip-place { font-size: 11px; font-weight: 600; color: #9ec5ff; margin-bottom: 2px; white-space: nowrap; }
.tooltip-emp-name { font-size: 11px; font-weight: 500; color: #ffffff; white-space: nowrap; }

.desk-wrapper.booking-desk { background-color: var(--desk-booking) !important; border-color: var(--desk-booking-border) !important; color: #ffffff !important; }
.desk-wrapper.booking-desk:hover { background-color: var(--desk-booking-border) !important; }

.app-footer {
    position: fixed; bottom: 10px; left: 15px; z-index: 1000; font-size: 11px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; pointer-events: none; user-select: none;
}
body.edit-mode .app-footer { display: none; }

/* ---------- Модальные окна ---------- */
.custom-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--overlay); z-index: 9999; justify-content: center; align-items: center; }
.custom-modal-card {
    background: var(--surface); padding: 24px; border-radius: var(--radius-lg); width: 360px; max-width: calc(100vw - 32px);
    border: 1px solid var(--border); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 10px; box-sizing: border-box;
}
.custom-modal-card h3 { margin: 0 0 6px 0; font-size: 1.15em; font-weight: 600; color: var(--text); }
.custom-modal-card input[type="text"], .custom-modal-card input[type="number"], .custom-modal-card input[type="file"], .custom-modal-card input[type="email"], .custom-modal-card input[type="password"] { width: 100%; }
.custom-modal-card label { font-size: 0.85em; color: var(--text-2); font-weight: 500; margin-top: 4px; display: block; }
.custom-modal-card form { display: flex; flex-direction: column; gap: 8px; }
.custom-modal-card form.users-new { flex-direction: row; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal-dialog-text { color: var(--text); line-height: 1.5; }
.logout-form { margin: 0; }
.custom-modal-card.wide { width: 680px; max-height: calc(100vh - 60px); overflow-y: auto; }
.settings-card { width: 780px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-head h3 { margin: 0 !important; }
.settings-panel { display: flex; flex-direction: column; gap: 8px; }
.settings-panel[hidden] { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid label { display: flex !important; flex-direction: column; gap: 4px; margin: 0 !important; }
.form-grid .wide-field { grid-column: 1 / -1; }
.form-grid input, .form-grid select { font-weight: normal; }
.warning { background: var(--warning-light); color: color-mix(in srgb, var(--warning) 75%, var(--text)); border: 1px solid var(--warning-border); border-radius: var(--radius); padding: 8px 12px; font-size: 0.93em; }

/* Вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 12px; color: var(--text-2); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 500; }

/* ---------- Таблицы, списки, формы в окнах и админке ---------- */
.users-table { width: 100%; border-collapse: collapse; color: var(--text); }
.users-table th { text-align: left; font-size: 0.85em; color: var(--text-muted); font-weight: 500; padding: 8px 8px; border-bottom: 1px solid var(--border); }
.users-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.users-table tbody tr:hover td { background: var(--surface-2); }
.users-table tr.disabled td { color: var(--text-muted); }
.users-table select { min-height: calc(var(--control-h) - 8px); padding: 0 8px; }
.users-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.users-table .muted { font-size: 0.93em; }
.users-new { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.users-new input { flex: 1; min-width: 120px; }
.users-hint { font-size: 0.93em; color: var(--text-2); margin: 0; line-height: 1.45; }
.secret-box { font-family: Consolas, monospace; background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius); user-select: all; word-break: break-all; }
.profile-edit td { background: var(--surface-2); }
.profile-edit .users-new { margin: 0; padding: 4px 0; border: none; }
.badge { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 16px; }
.library-list { max-height: 300px; overflow-y: auto; }
.library-preview { width: 48px; height: 32px; position: relative; }
.library-preview .furniture { position: absolute; inset: 0; }
.library-preview .rect-sample { position: absolute; inset: 4px 2px; background: var(--desk-occupied); border: 2px solid #333; border-radius: 4px; }
.library-subtitle { margin: 16px 0 6px; font-size: 0.93em; color: var(--text-muted); font-weight: 500; }

/* Дизайн и брендинг */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; margin: 6px 0 14px; }
.brand-color { display: flex !important; align-items: center; gap: 8px; font-size: 0.93em !important; font-weight: normal !important; color: var(--text) !important; margin: 0 !important; }
.brand-color input[type="color"] { width: 38px; height: 28px; padding: 2px; min-height: 0; border: 1px solid var(--border-strong); border-radius: calc(var(--radius) - 2px); background: var(--surface); cursor: pointer; }
.brand-color select { min-height: calc(var(--control-h) - 6px); padding: 0 8px; }
.brand-color:has(select) { flex-direction: column; align-items: flex-start; gap: 4px; }
.brand-color:has(select) select { width: 100%; }
.brand-group { margin: 14px 0 0; font-size: 0.85em; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.brand-presets { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.brand-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 500; }
.brand-swatch:hover { border-color: var(--color-primary); }
.brand-swatch i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); display: inline-block; }
.brand-files { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.brand-file { display: flex; align-items: center; gap: 8px; }
.brand-file-title { flex: 1; }
.brand-file-preview { max-height: 28px; max-width: 120px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 10px 10px; }
.brand-file-preview:not([src]), .brand-file-preview[src=""] { display: none; }
.brand-file-empty { color: var(--text-muted); }
.brand-file.has-file .brand-file-empty, .brand-file:not(.has-file) .brand-file-remove { display: none; }
.brand-file-pick { display: inline-flex; }
#brandCustomCss { width: 100%; box-sizing: border-box; font-family: Consolas, monospace; font-size: 0.93em; resize: vertical; }
.brand-actions { align-items: center; }
.brand-spacer { flex: 1; }
.brand-advanced { margin-top: 10px; }
.brand-advanced summary { cursor: pointer; color: var(--text-2); font-weight: 500; padding: 6px 0; }

/* ---------- Модели столов и мебель (img/furniture/*.svg встраиваются inline и красятся стилями) ---------- */
.furniture { position: absolute; inset: 0; pointer-events: none; }
.furniture svg, .furniture img { display: block; width: 100%; height: 100%; }
.furniture .surface { fill: #efe9df; stroke: #5f574e; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.furniture .seat { fill: #9aa3ad; stroke: #5f574e; stroke-width: 1; vector-effect: non-scaling-stroke; }
.furniture .detail { fill: #5f574e; }
.furniture .line { stroke: #5f574e; stroke-width: 1; vector-effect: non-scaling-stroke; }
.furniture .wall { fill: #4a4f57; }
.furniture .swing { fill: none; stroke: #8a8f97; stroke-width: 1.2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.furniture .leaf { fill: #6bab5a; }
.furniture .leaf-dark { fill: #4d8a3f; }
.furniture .zone { fill: color-mix(in srgb, var(--color-primary) 7%, transparent); stroke: none; vector-effect: non-scaling-stroke; }
/* пунктирная рамка зоны нужна только редактору: в просмотре на плане её нет */
body.edit-mode .furniture .zone { stroke: var(--color-primary); stroke-width: 1.5; stroke-dasharray: 6 4; }

.desk-wrapper.model { position: relative; background: none !important; border: none !important; box-shadow: none; padding: 0; overflow: visible; }
.desk-wrapper.model .surface { fill: var(--desk-occupied); }
.desk-wrapper.model.free .surface { fill: var(--desk-free); }
.desk-wrapper.model.booking-desk .surface { fill: var(--desk-booking); }
.desk-wrapper.model .desk-name-line { position: relative; color: #222222; text-shadow: 0 0 3px #ffffff, 0 0 2px #ffffff; }
.desk-wrapper.model.free .desk-name-line, .desk-wrapper.model.booking-desk .desk-name-line { color: #ffffff; text-shadow: 0 0 3px rgba(0,0,0,0.6); }
.desk-wrapper.model.selected { outline-offset: 2px; }
.desk-wrapper.model .furniture:has(img) + .desk-name-line { background: var(--desk-occupied); padding: 1px 4px; border-radius: 4px; text-shadow: none; }
.desk-wrapper.model.free .furniture:has(img) + .desk-name-line { background: var(--desk-free); }
.desk-wrapper.model.booking-desk .furniture:has(img) + .desk-name-line { background: var(--desk-booking); }

.map-object { position: relative; display: flex; align-items: center; justify-content: center; box-sizing: border-box; user-select: none; }
body.edit-mode .map-object { cursor: move; }
body.edit-mode .map-object:hover { outline: 1px dashed var(--color-primary); }
.map-object.selected { outline: 3px solid #00d2ff; box-shadow: 0 0 15px rgba(0, 210, 255, 0.6); }
.object-label { position: relative; font-weight: 600; color: #1f2937; text-align: center; line-height: 1.1; text-shadow: 0 0 3px #ffffff, 0 0 2px #ffffff; white-space: nowrap; }

/* ---------- Меню пользователя и колокольчик ---------- */
.admin-menu { position: relative; }
.admin-menu summary, .bell summary {
    list-style: none; cursor: pointer; min-height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    color: var(--text); background: var(--surface); white-space: nowrap; user-select: none; display: inline-flex; align-items: center; box-sizing: border-box; font-weight: 500;
}
.admin-menu summary:hover, .bell summary:hover { background: var(--surface-2); }
.admin-menu summary::-webkit-details-marker, .bell summary::-webkit-details-marker { display: none; }
.admin-menu[open] summary, .bell[open] summary { border-color: var(--color-primary); }
.admin-menu-list, .bell-list {
    position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); z-index: 1002;
}
.admin-menu-list { min-width: 250px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.admin-menu-user { color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 0.93em; }
.admin-menu-list button, .admin-menu-list .menu-link {
    display: block; box-sizing: border-box; background: none; border: none; color: var(--text); text-align: left; font-weight: normal;
    padding: 8px 10px; border-radius: calc(var(--radius) - 2px); width: 100%; cursor: pointer; text-decoration: none; font-family: inherit; min-height: 0;
}
.admin-menu-list button:hover, .admin-menu-list .menu-link:hover { background: var(--surface-2); color: var(--text); }
.admin-menu-list .btn-logout { color: var(--danger); }
.bell { position: relative; }
.bell summary { padding: 0 10px; position: relative; }
.bell summary .badge { position: absolute; top: -6px; right: -6px; }
.bell-list { width: 360px; max-height: 440px; overflow-y: auto; display: flex; flex-direction: column; }
.bell-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 500; }
.bell-items { display: flex; flex-direction: column; }
.bell-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 10px 14px; cursor: pointer; font-family: inherit; color: var(--text-2); }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { color: var(--text); background: var(--color-primary-light); }
.bell-item.unread .bell-item-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary); margin-right: 6px; vertical-align: middle; }
.bell-item-title { font-weight: 500; }
.bell-item-body { font-size: 0.93em; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bell-item-time { font-size: 0.85em; color: var(--text-muted); margin-top: 2px; }
.bell-empty { padding: 16px 14px; color: var(--text-muted); }
.bell-all { display: block; padding: 12px 14px; text-align: center; }
/* На небольших экранах в режиме редактирования прячем название — оно есть во вкладке */
@media (max-width: 1800px) { body.edit-mode .header-title, body.edit-mode .header-divider { display: none; } }

/* ---------- Страница администрирования ---------- */
body.admin-page { overflow-y: auto; overflow-x: hidden; background: var(--bg); height: 100vh; } /* html имеет overflow:hidden (карта), поэтому админка прокручивается сама */
.admin-page .app-header { position: sticky; }
.admin-layout { display: flex; gap: 24px; max-width: 1240px; margin: 24px auto; padding: 0 20px; align-items: flex-start; }
.admin-nav { flex: 0 0 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.admin-nav a { padding: 9px 12px; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-weight: 500; }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a.active { background: var(--color-primary-light); color: var(--color-primary); }
.admin-content { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 32px; }
.admin-section { display: flex; flex-direction: column; gap: 12px; }
.admin-section[hidden] { display: none; }
.admin-section h2 { margin: 0 0 4px; font-size: 1.35em; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.admin-section label { font-size: 0.93em; color: var(--text-2); font-weight: 500; }
.admin-section > input[type="text"] { width: 100%; }
.admin-section .library-list { max-height: none; }
.admin-section .modal-actions { justify-content: flex-start; }
.admin-section-head { display: flex; align-items: center; }
.admin-section-head .btn-small { margin-left: 6px; }
.admin-section code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 0.93em; }
.journal-table tr.unread td { background: var(--color-primary-light); }
@media (max-width: 800px) { .admin-layout { flex-direction: column; } .admin-nav { position: static; flex: none; width: 100%; box-sizing: border-box; } .admin-content { padding: 20px 16px; } }

/* ---------- Бронирование ---------- */
.desk-wrapper.booked { background-color: var(--desk-booked) !important; border-color: color-mix(in srgb, var(--desk-booked) 75%, black) !important; color: #fff !important; }
.desk-wrapper.booked-mine { background-color: var(--desk-mine) !important; border-color: color-mix(in srgb, var(--desk-mine) 75%, black) !important; color: #fff !important; }
.desk-wrapper.booked .desk-name-line, .desk-wrapper.booked-mine .desk-name-line { color: #fff; }
.desk-wrapper.model.booked .surface { fill: var(--desk-booked); }
.desk-wrapper.model.booked-mine .surface { fill: var(--desk-mine); }
.desk-wrapper.model.booked .desk-name-line, .desk-wrapper.model.booked-mine .desk-name-line { color: #fff; text-shadow: 0 0 3px rgba(0,0,0,0.6); }
.desk-wrapper.clickable, .map-object.clickable { cursor: pointer; }
.desk-wrapper.clickable:hover { filter: brightness(1.08); }
.map-object.bookable { outline: 3px solid var(--desk-booking); outline-offset: -3px; }
.map-object.booked { outline: 3px solid var(--desk-booked); outline-offset: -3px; }
.map-object.booked-mine { outline: 3px solid var(--desk-mine); outline-offset: -3px; }
.booking-at { display: flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.booking-at input { min-height: calc(var(--control-h) - 6px); padding: 0 8px; }
.booking-card { width: 440px; max-width: calc(100vw - 32px); }
.booking-date { padding: 0 12px; }
.booking-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.booking-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.booking-row.mine { border-color: color-mix(in srgb, var(--desk-mine) 45%, var(--surface)); background: color-mix(in srgb, var(--desk-mine) 7%, var(--surface)); }
.booking-row.external { opacity: 0.8; font-style: italic; }
.booking-time { font-weight: 600; white-space: nowrap; }
.booking-who { flex: 1; min-width: 0; }
.booking-free { color: var(--success); padding: 6px 0; }
.booking-times { display: flex; gap: 12px; }
.booking-times label { display: flex !important; align-items: center; gap: 6px; color: var(--text) !important; margin: 0 !important; font-weight: normal !important; }

/* Ручки поворота и размера у выделенного элемента */
.object-marker { display: flex; align-items: center; justify-content: center; overflow: visible !important; }
.desk-wrapper.selected, .map-object.selected { overflow: visible; }
.desk-wrapper.transforming, .map-object.transforming { transition: none !important; }
.handle { position: absolute; width: 12px; height: 12px; box-sizing: border-box; background: #fff; border: 2px solid #00a0d2; z-index: 5; touch-action: none; pointer-events: auto; }
.rotate-handle { top: -28px; left: 50%; margin-left: -6px; border-radius: 50%; cursor: grab; }
.rotate-handle::after { content: ""; position: absolute; left: 3px; top: 10px; width: 2px; height: 16px; background: #00a0d2; }
.rotate-handle:active { cursor: grabbing; }
.resize-handle { right: -7px; bottom: -7px; border-radius: 2px; cursor: nwse-resize; }
/* во время растягивания элемент больше своего маркера — не даём flex-контейнеру его сжать */
.desk-marker > .desk-wrapper, .object-marker > .map-object { flex-shrink: 0; }

/* ---------- Отзывы и ошибки (режим пилота) ---------- */
#feedbackText { width: 100%; box-sizing: border-box; padding: 8px 12px; font: inherit; resize: vertical; }
.feedback-file { display: block; font-size: 0.93em; color: var(--text-2); margin: 8px 0; }
.feedback-card { border: 1px solid var(--border); border-left: 3px solid var(--color-primary); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; background: var(--surface); }
.feedback-card.status-work { border-left-color: var(--warning); }
.feedback-card.status-done { border-left-color: var(--success); opacity: 0.8; }
.feedback-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.feedback-text { white-space: pre-wrap; margin: 8px 0; color: var(--text); }
.feedback-shot { max-width: 320px; max-height: 200px; border: 1px solid var(--border); border-radius: var(--radius); display: block; margin-bottom: 8px; }
.feedback-context { font-size: 0.93em; color: var(--text-2); }
.feedback-errors { white-space: pre-wrap; margin: 4px 0 0; font-size: 0.85em; color: var(--danger); }
.srv-cert { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 6px; }
.srv-cert.warn { border-color: var(--warning-border); background: var(--warning-light); }
.srv-cert.bad { border-color: var(--danger); background: var(--danger-light); }
.wc-text { width: 100%; box-sizing: border-box; font-family: Consolas, monospace; font-size: 0.93em; padding: 10px 12px; white-space: pre; }
.wc-steps { color: var(--text); padding-left: 20px; line-height: 1.5; }
.selfcheck-row { padding: 2px 0; }
.selfcheck-row.ok::before { content: "✓ "; color: var(--success); }
.selfcheck-row.bad { color: var(--danger); font-weight: 500; }
.selfcheck-row.bad::before { content: "✗ "; }

/* Ссылка на мобильный список мест — только на узких экранах */
.m-back-link { display: none; font-weight: 500; white-space: nowrap; }
@media (max-width: 700px) { .m-back-link { display: inline-block; } }

/* Коды мест: пример разбора */
.cr-preview { margin: 8px 0; }
.cr-parts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.cr-part { display: inline-flex; flex-direction: column; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cr-part.used { border-color: var(--color-primary); background: var(--color-primary-light); }
.cr-part i { font-size: 0.85em; color: var(--text-muted); font-style: normal; }

/* Отметка «я пришёл» */
.checkin-bar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--color-primary); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); max-width: calc(100vw - 24px); }
.checkin-bar[hidden] { display: none; }
.checkin-warn { font-size: 0.93em; color: var(--warning); margin-top: 2px; }

/* Роли и права */
.role-form { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.role-form[hidden] { display: none; }
.perm-group h5 { margin: 14px 0 4px; font-size: 0.93em; color: var(--text-2); font-weight: 600; }
.perm-row { align-items: flex-start; padding: 3px 0; }
.perm-row .muted { font-size: 0.93em; font-weight: normal; }
.perm-tag { font-size: 0.85em; color: var(--color-primary); font-weight: normal; }
.role-offices { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 10px 24px; }
.role-offices[hidden] { display: none; }
.role-perms { font-size: 0.93em; color: var(--text-2); max-width: 360px; }
.role-form > label { display: block; font-weight: 500; }
.role-form > label input[type="text"] { display: block; width: 100%; max-width: 420px; margin-top: 4px; }
.role-form > label.check-row { display: flex; font-weight: normal; }

/* Загрузка сотрудников из CSV */
.import-box { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 8px; }
.import-summary { margin: 10px 0 4px; }
.import-done { margin: 10px 0; padding: 10px 14px; background: var(--success-light); border: 1px solid color-mix(in srgb, var(--success) 30%, var(--surface)); border-radius: var(--radius); }
.import-error { color: var(--danger); }
.import-warn { font-size: 0.93em; color: var(--warning); }
.import-table tr.import-error td { background: var(--danger-light); }
.import-table tr.import-skip td { color: var(--text-muted); }
.import-table td { vertical-align: top; }

/* Каталог (AD) */
.dir-warn { margin: 8px 0; padding: 10px 14px; background: var(--warning-light); border: 1px solid var(--warning-border); border-radius: var(--radius); }
.dir-warn[hidden] { display: none; }

/* Календари переговорных */
.cal-ref { width: 100%; min-width: 180px; }

.icon { display: block; }
.booking-at .muted { font-size: 0.93em; }

/* Статистика */
.stats-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stats-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 6px 0; }
.stat-tile { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface); }
.stat-value { font-size: 1.9em; font-weight: 600; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; }
.stat-value small { font-size: 0.45em; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.stat-label { color: var(--text-2); margin-top: 2px; }
.stat-hint { color: var(--text-muted); font-size: 0.85em; margin-top: 2px; }
.stat-tile.warn .stat-value { color: var(--warning); }
.stats-chart { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--surface); }
.stats-chart svg { display: block; width: 100%; height: 190px; }
.stats-chart .bar { fill: var(--color-primary); }
.stats-chart .bar:hover { opacity: 0.75; }
.stats-chart .bar-no { fill: var(--warning); }
.stats-chart text { fill: var(--text-muted); font-size: 11px; }
.stats-chart .grid { stroke: var(--border); stroke-width: 1; }
.stats-empty { color: var(--text-muted); padding: 24px 0; text-align: center; }
.stats-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 8px 24px; }
.stats-cols .users-table td { padding: 8px; }
.stats-cols .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats-bar-cell { width: 34%; }
.stats-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.stats-bar i { display: block; height: 100%; background: var(--color-primary); border-radius: 3px; }

/* Панель «Свободные места» */
.free-panel { position: fixed; top: 64px; right: 12px; bottom: 12px; width: 340px; z-index: 1000; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.free-panel[hidden] { display: none; }
.free-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.free-head b { font-size: 1.07em; font-weight: 600; }
.free-filters { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.free-times { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.free-times input, .free-filters > input { flex: 1; min-width: 0; }
.free-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: calc(var(--control-h) - 6px); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; }
.chip:hover { background: var(--surface-2); }
.chip.active { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.free-info { padding: 8px 14px; color: var(--text-2); }
.free-list { list-style: none; margin: 0; padding: 0 10px 10px; overflow-y: auto; flex: 1; }
.free-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 6px; background: var(--surface); }
.free-item:hover { border-color: var(--color-primary); }
.free-item.busy { opacity: 0.7; }
.free-item.mine { border-color: var(--desk-mine); }
.free-main { flex: 1; min-width: 0; cursor: pointer; }
.free-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-sub { color: var(--text-muted); font-size: 0.93em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.free-badge { font-size: 0.85em; padding: 2px 10px; border-radius: 999px; background: var(--danger-light); color: var(--danger); white-space: nowrap; }
.free-empty { color: var(--text-muted); text-align: center; padding: 20px 0; }
#btnFreePlaces.active { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
@media (max-width: 700px) { .free-panel { display: none !important; } #btnFreePlaces { display: none; } }

/* Шапка в режиме просмотра: на средних экранах сжимаем второстепенное, чтобы части не наезжали друг на друга */
#btnFreePlaces { display: inline-flex; align-items: center; gap: 6px; }
.header-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.search-panel { width: clamp(150px, 16vw, 300px); }
@media (max-width: 1620px) { #btnFreePlaces .txt, .booking-at > .muted { display: none; } }
@media (max-width: 1280px) { .header-title { max-width: 120px; } }

/* Лицензия */
.license-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; background: var(--surface); }
.license-mode { display: inline-block; font-weight: 600; padding: 3px 12px; border-radius: 999px; background: var(--surface-2); margin-bottom: 8px; }
.license-mode.ok { background: var(--success-light); color: var(--success); }
.license-mode.warn { background: var(--warning-light); color: var(--warning); }
.license-banner { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--warning-light); border: 1px solid var(--warning-border); color: var(--text); }
.license-banner.bad { background: var(--danger-light); border-color: var(--danger); }
.license-banner a { color: var(--color-primary); font-weight: 500; margin-left: 6px; }
#licenseText { width: 100%; box-sizing: border-box; font-family: Consolas, monospace; font-size: 0.93em; }

.audit-fail td { color: var(--danger); }

.sso-button { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; background: var(--surface); }
.sso-button:hover { background: var(--surface-2); border-color: var(--text-muted); }
