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

html {
    font-size: 1rem;
}

:root {
    --bg-primary: transparent;
    --bg-secondary: rgba(15, 20, 30, 0.65);
    --bg-card: rgba(26, 35, 50, 0.55);
    --bg-hover: rgba(37, 53, 69, 0.65);
    --bg-column: rgba(21, 29, 39, 0.6);
    --text-primary: #e4e8ec;
    --text-secondary: #8899a6;
    --accent: #00d68f;
    --accent-hover: #00b377;
    --accent-blue: #1da1f2;
    --accent-purple: #8b5cf6;
    --accent-red: #e0245e;
    --accent-yellow: #ffad1f;
    --accent-orange: #ff7a00;
    --border: rgba(42, 58, 74, 0.5);
    --shadow: rgba(0, 0, 0, 0.4);
    --column-measurement: #1da1f2;
    --column-estimate: #ff9500;
    --column-in-work: #00d68f;
    --column-deferred: #8b5cf6;
    --column-archive: #8899a6;
    --blur: 1.25rem;
    --glass-bg: rgba(15, 20, 30, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1040 25%, #0d1f3c 50%, #1a0a2e 75%, #0a1628 100%);
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(88, 101, 242, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(235, 69, 158, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(29, 161, 242, 0.1) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

body.has-bg {
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

body.has-bg::before {
    background: rgba(10, 14, 26, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: -1;
}

body.no-blur::before {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(10, 14, 26, 0.7);
}

body.no-blur .kanban-card,
body.no-blur .kanban-column,
body.no-blur .header,
body.no-blur .right-panel,
body.no-blur .modal,
body.no-blur .slide-panel,
body.no-blur .canvas-left,
body.no-blur .deleted-sidebar,
body.no-blur .search-filter,
body.no-blur .cal-toggles,
body.no-blur .cal-col,
body.no-blur .calendar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Glassmorphism header */
.header {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-bottom: 0.0625rem solid var(--glass-border);
    gap: 1rem;
    z-index: 100;
    position: relative;
}

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-card: #1e2a3a;
    --bg-hover: #253545;
    --bg-column: #151d27;
    --text-primary: #e4e8ec;
    --text-secondary: #8899a6;
    --accent: #00d68f;
    --accent-hover: #00b377;
    --accent-blue: #1da1f2;
    --accent-purple: #7856ff;
    --accent-red: #e0245e;
    --accent-yellow: #ffad1f;
    --accent-orange: #ff7a00;
    --border: #2a3a4a;
    --shadow: rgba(0, 0, 0, 0.4);
    --column-measurement: #1da1f2;
    --column-estimate: #ff9500;
    --column-in-work: #00d68f;
    --column-deferred: #8b5cf6;
    --column-archive: #8899a6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 0.0625rem solid var(--border);
    gap: 0.75rem;
    z-index: 100;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.375rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: var(--bg-hover);
}

.search-filter {
    flex: 1;
    max-width: 31.25rem;
    display: flex;
    align-items: center;
    background: rgba(26, 35, 50, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--glass-border);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-go {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    transition: color 0.2s;
}

.search-go:hover {
    color: var(--accent);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.users-btn {
    font-size: 1rem;
    padding: 0.375rem 0.625rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(0, 214, 143, 0.1);
    padding: 0.25rem 0.625rem;
    border-radius: 0.75rem;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.search-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--bg-hover);
}

/* Kanban Container */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.kanban-container {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Right Panel */
.right-panel {
    width: 37.5rem;
    min-width: 37.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-left: 0.0625rem solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.calendar {
    padding: 1rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-shrink: 0;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cal-nav {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    transition: background 0.2s;
}

.cal-nav:hover {
    background: var(--bg-hover);
}

.cal-month {
    font-size: 0.875rem;
    font-weight: 600;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.125rem;
    margin-bottom: 0.375rem;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.625rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.375rem 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.125rem;
}

.cal-day {
    text-align: center;
    padding: 0.375rem 0.125rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    min-height: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cal-day:hover {
    background: var(--bg-hover);
}

.cal-day.today {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.cal-day.other-month {
    color: var(--text-secondary);
    opacity: 0.4;
}

.cal-dots {
    display: flex;
    gap: 0.125rem;
    margin-top: 0.125rem;
    justify-content: center;
}

.cal-dot {
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: var(--accent-blue);
}

.cal-dot.green { background: var(--accent); }
.cal-dot.orange { background: var(--accent-orange); }
.cal-dot.red { background: var(--accent-red); }

.day-info {
    padding: 1rem;
    flex: 1;
}

.day-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
}

.day-objects {
    min-height: 9.375rem;
}

.day-objects-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    padding: 1.875rem 0;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
}

.day-object-item {
    padding: 0.625rem;
    background: rgba(26, 35, 50, 0.4);
    border-radius: 0.5rem;
    margin-bottom: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 0.1875rem solid var(--accent);
    backdrop-filter: blur(8px);
}

.day-object-item:hover {
    background: var(--bg-hover);
}

.day-object-item .obj-name {
    font-size: 0.75rem;
    font-weight: 500;
}

.day-object-item .obj-time {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.day-object-item .obj-addr {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
    opacity: 0.7;
}

/* ===== DUAL CALENDAR LAYOUT ===== */
.cal-toggles {
    display: flex;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(15, 20, 30, 0.3);
    justify-content: flex-end;
}

.cal-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    border: 0.0625rem solid var(--border);
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cal-toggle-btn.active {
    background: rgba(29, 161, 242, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.cal-toggle-btn:hover {
    background: var(--bg-hover);
}

.toggle-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    opacity: 0.4;
}

.cal-toggle-btn.active .toggle-dot {
    opacity: 1;
}

.toggle-dot.mount-dot { background: var(--accent-blue); }
.toggle-dot.zamer-dot { background: var(--accent-orange); }

.cal-row {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    width: 100%;
}

.cal-row-both .cal-col {
    flex: 1;
    width: 50%;
}

.cal-row-single .cal-col {
    flex: 1;
    width: 100%;
}

.right-panel-narrow {
    width: 18.75rem !important;
    min-width: 18.75rem !important;
}

.cal-col {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 0.0625rem solid var(--glass-border);
    min-height: 0;
}

.cal-col:last-child {
    border-right: none;
}

.cal-col.cal-hidden {
    display: none;
}

.cal-row-both .calendar {
    padding: 0.5rem 0.375rem;
}

.calendar-label {
    text-align: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    margin-bottom: 0.25rem;
}

.calendar-mount .calendar-label { color: var(--accent-blue); }
.calendar-zamer .calendar-label { color: var(--accent-orange); }

.calendar-zamer .cal-day:hover {
    background: rgba(255, 122, 0, 0.15);
}

.calendar-zamer .cal-day.has-planner {
    background: rgba(255, 122, 0, 0.08);
}

.calendar-zamer .cal-dot {
    background: var(--accent-orange);
}

/* Day info compact for dual layout */
.cal-col .day-info {
    padding: 0.5rem 0.375rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.cal-col .day-title {
    font-size: 0.625rem;
    margin-bottom: 0.375rem;
    text-align: center;
}

.cal-col .day-objects {
    min-height: 4rem;
    overflow-y: auto;
    flex: 1;
}

.cal-col .day-object-item {
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.25rem;
}

.cal-col .obj-name {
    font-size: 0.6875rem;
}

.cal-col .obj-time {
    font-size: 0.5625rem;
}

/* Zamer-specific day info */
.zamer-section-title {
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--accent-orange);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    letter-spacing: 0.0312rem;
}

.zamer-item {
    border-left-color: var(--accent-orange) !important;
}

.planner-mini-item {
    display: flex;
    gap: 0.375rem;
    align-items: baseline;
    padding: 0.1875rem 0;
    font-size: 0.5625rem;
}

.planner-mini-hour {
    color: var(--accent-orange);
    font-weight: 600;
    min-width: 2.5rem;
    font-variant-numeric: tabular-nums;
}

.planner-mini-text {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== DAILY PLANNER MODAL ===== */
.modal-planner {
    max-width: 28rem;
}

.modal-planner .modal-body {
    padding: 0;
    max-height: 65vh;
    overflow-y: auto;
}

.planner-body {
    padding: 0 !important;
}

.planner-grid {
    display: flex;
    flex-direction: column;
}

.planner-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    transition: background 0.15s;
}

.planner-row:hover {
    background: rgba(255, 122, 0, 0.05);
}

.planner-row.planner-now {
    background: rgba(0, 214, 143, 0.1);
    border-left: 0.125rem solid var(--accent);
}

.planner-hour {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-orange);
    min-width: 2.75rem;
    font-variant-numeric: tabular-nums;
    padding: 0.25rem 0;
}

.planner-input {
    flex: 1;
    background: transparent;
    border: 0.0625rem solid transparent;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.planner-input:focus {
    border-color: var(--accent-orange);
    background: rgba(255, 122, 0, 0.08);
}

.planner-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.planner-measurements {
    padding: 0.75rem 1rem;
    border-bottom: 0.125rem solid var(--glass-border);
    background: rgba(29, 161, 242, 0.05);
}

.planner-m-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-blue);
    text-transform: uppercase;
    margin-bottom: 0.375rem;
}

.planner-m-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.375rem 0.5rem;
    margin-bottom: 0.25rem;
    background: rgba(29, 161, 242, 0.1);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 0.125rem solid var(--accent-blue);
}

.planner-m-item:hover {
    background: rgba(29, 161, 242, 0.2);
}

.planner-m-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.planner-m-addr {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.kanban-column {
    flex: 1;
    min-width: 12.5rem;
    max-width: 17.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.125rem solid var(--border);
}

.kanban-column[data-status="measurement"] .column-header {
    border-bottom-color: var(--column-measurement);
}

.kanban-column[data-status="estimate"] .column-header {
    border-bottom-color: var(--column-estimate);
}

.kanban-column[data-status="in_work"] .column-header {
    border-bottom-color: var(--column-in-work);
}

.kanban-column[data-status="deferred"] .column-header {
    border-bottom-color: var(--column-deferred);
}

.kanban-column[data-status="archive"] .column-header {
    border-bottom-color: var(--column-archive);
}

.column-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
    color: var(--text-secondary);
}

.column-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    padding: 0.125rem 0.5rem;
    border-radius: 0.625rem;
}

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* Kanban Card */
.kanban-card {
    background: rgba(26, 35, 50, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.625rem;
    padding: 0.875rem;
    cursor: grab;
    transition: all 0.2s;
    border-left: 0.1875rem solid transparent;
    position: relative;
    user-select: none;
}

.kanban-card:hover {
    background: var(--bg-hover);
    transform: translateY(-0.0625rem);
    box-shadow: 0 0.25rem 0.75rem var(--shadow);
}

.kanban-card:active {
    cursor: grabbing;
    opacity: 0.8;
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
}

.kanban-card.drag-over {
    border-top: 0.1875rem solid var(--accent);
}

.column-cards.drag-over {
    background: rgba(0, 214, 143, 0.05);
}

/* Delete Zone */
.delete-zone {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5rem;
    z-index: 1000;
    transition: all 0.3s;
}
.delete-zone.active {
    display: flex;
}
.delete-zone-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 100%;
    border-top: 0.125rem dashed;
    transition: all 0.3s;
}
.delete-zone-archive {
    background: linear-gradient(transparent, rgba(139, 92, 246, 0.2));
    border-color: rgba(139, 92, 246, 0.5);
}
.delete-zone-archive .delete-zone-text { color: rgba(139, 92, 246, 0.6); font-size: 0.875rem; font-weight: 600; }
.delete-zone-archive .delete-zone-icon { font-size: 1.5rem; opacity: 0.5; }
.delete-zone-archive.hover {
    background: rgba(139, 92, 246, 0.4);
    height: 6.25rem;
}
.delete-zone-archive.hover .delete-zone-text { color: #b794f6; }
.delete-zone-archive.hover .delete-zone-icon { opacity: 1; }

.delete-zone-delete {
    background: linear-gradient(transparent, rgba(224, 36, 94, 0.2));
    border-color: rgba(224, 36, 94, 0.5);
}
.delete-zone-delete .delete-zone-text { color: rgba(224, 36, 94, 0.6); font-size: 0.875rem; font-weight: 600; }
.delete-zone-delete .delete-zone-icon { font-size: 1.5rem; opacity: 0.5; }
.delete-zone-delete.hover {
    background: rgba(224, 36, 94, 0.4);
    height: 6.25rem;
}
.delete-zone-delete.hover .delete-zone-text { color: #ff6b6b; }
.delete-zone-delete.hover .delete-zone-icon { opacity: 1; }

.delete-zone-icon {
    font-size: 1.75rem;
}

.delete-zone-text {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Floating Deleted Button */
.deleted-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--accent-red);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 0.25rem 1rem rgba(224, 36, 94, 0.4);
    z-index: 998;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deleted-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 0.375rem 1.5rem rgba(224, 36, 94, 0.5);
}

.deleted-fab .fab-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}

/* Deleted Sidebar */
.deleted-sidebar {
    position: fixed;
    top: 0;
    right: -21.875rem;
    width: 21.875rem;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 0.0625rem solid var(--glass-border);
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.deleted-sidebar.active {
    right: 0;
}

.deleted-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
}

.deleted-title {
    font-size: 1rem;
    font-weight: 600;
}

.deleted-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.deleted-item {
    background: rgba(26, 35, 50, 0.4);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 0.1875rem solid var(--accent-red);
    backdrop-filter: blur(8px);
}

.deleted-item-name {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.deleted-item-comment {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.deleted-item-date {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.deleted-item-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

/* Nomenclature Sidebar */
.nomenclature-sidebar {
    position: fixed;
    top: 0;
    right: -32.5rem;
    width: 32.5rem;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 0.0625rem solid var(--glass-border);
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.nomenclature-sidebar.active {
    right: 0;
}

.hamburger-menu {
    width: 17.5rem;
    right: auto;
    left: -17.5rem;
    border-left: none;
    border-right: 0.0625rem solid var(--glass-border);
    box-shadow: 0.25rem 0 1.25rem var(--shadow);
}

.hamburger-menu.active {
    right: auto;
    left: 0;
}

/* Профиль выезжает СЛЕВА (из главного меню), а не справа */
#profileSidebar {
    right: auto;
    left: -32.5rem;
    border-left: none;
    border-right: 0.0625rem solid var(--glass-border);
    box-shadow: 0.25rem 0 1.25rem var(--shadow);
}

#profileSidebar.active {
    right: auto;
    left: 0;
}

/* Nomenclature Tree */
.nom-folder {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.2s;
    margin-bottom: 0.25rem;
}

.nom-folder:hover {
    background: var(--bg-hover);
}

.nom-folder.drag-over {
    background: rgba(0, 214, 143, 0.15);
    border: 0.0625rem dashed var(--accent);
}

.nom-folder-icon {
    font-size: 1rem;
}

.nom-folder-name {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
}

.nom-folder-count {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.125rem 0.5rem;
    border-radius: 0.625rem;
}

.nom-folder-items {
    display: none;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.nom-folder.open + .nom-folder-items {
    display: block;
}

/* Menu items */
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 0.0625rem solid var(--glass-border);
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item-icon {
    font-size: 1.25rem;
    width: 1.75rem;
    text-align: center;
}

.menu-item-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Nomenclature Tree View */
.nom-tree {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    padding: 0.5rem 0;
}

.nom-tree-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.3125rem 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background 0.15s;
    white-space: nowrap;
}

.nom-tree-row:hover {
    background: var(--bg-hover);
}

.nom-tree-line {
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 0.75rem;
    min-width: fit-content;
    user-select: none;
}

.nom-tree-icon {
    font-size: 0.875rem;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.folder-row .nom-tree-icon {
    font-size: 1rem;
}

.nom-tree-name {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.folder-row .nom-tree-name {
    color: var(--accent);
    font-weight: 600;
}

.nom-tree-count {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-left: auto;
    padding: 0.0625rem 0.375rem;
    background: var(--bg-card);
    border-radius: 0.5rem;
}

.nom-tree-type {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    min-width: 4.5rem;
    text-align: right;
    flex-shrink: 0;
}

.nom-tree-price {
    font-size: 0.6875rem;
    color: var(--accent);
    font-weight: 600;
    margin-left: 0.5rem;
    min-width: 4rem;
    text-align: right;
    flex-shrink: 0;
}

.nom-tree-children {
    display: none;
    padding-left: 0.75rem;
    border-left: 0.0625rem solid rgba(136, 153, 166, 0.2);
    margin-left: 0.5rem;
}

.nom-tree-folder.open > .nom-tree-children {
    display: block;
}

.nom-tree-folder.drag-over > .folder-row {
    background: rgba(0, 214, 143, 0.15);
    outline: 0.0625rem dashed var(--accent);
    border-radius: 0.25rem;
}

.item-row {
    cursor: grab;
}

.item-row:active {
    cursor: grabbing;
    opacity: 0.6;
}

.nom-tree-row.selected {
    background: rgba(0, 214, 143, 0.15);
    outline: 0.0625rem solid var(--accent);
}

.nom-tree-row.shake-mode {
    animation: nomShake 0.4s ease-in-out infinite;
}

.nom-tree-row.shake-mode:hover {
    background: rgba(255, 59, 48, 0.15);
    outline: 0.0625rem solid #ff3b30;
}

@keyframes nomShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-0.125rem); }
    40% { transform: translateX(0.125rem); }
    60% { transform: translateX(-0.0625rem); }
    80% { transform: translateX(0.0625rem); }
}

.nom-drop-zone {
    height: 0.25rem;
    border-radius: 0.125rem;
    transition: all 0.2s;
}

.nom-drop-zone.drag-over {
    height: 1.875rem;
    background: rgba(0, 214, 143, 0.1);
    border: 0.0625rem dashed var(--accent);
    border-radius: 0.25rem;
    margin: 0.25rem 0;
}

.nom-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-card);
    border-radius: 0.5rem;
    margin-bottom: 0.375rem;
    cursor: grab;
    transition: all 0.2s;
    border: 0.0625rem solid transparent;
}

.nom-item:hover {
    background: var(--bg-hover);
    border-color: var(--glass-border);
}

.nom-item-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(0, 214, 143, 0.1);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.nom-item-info {
    flex: 1;
    min-width: 0;
}

.nom-item-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nom-item-meta {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.nom-item-price {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.kanban-card[data-status="measurement"] {
    border-left-color: var(--column-measurement);
}

.kanban-card[data-status="estimate"] {
    border-left-color: var(--column-estimate);
}

.kanban-card[data-status="in_work"] {
    border-left-color: var(--column-in-work);
}

.kanban-card[data-status="deferred"] {
    border-left-color: var(--column-deferred);
}

.kanban-card[data-status="archive"] {
    border-left-color: var(--column-archive);
}

.card-id {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-address {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.card-client {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.card-client-avatar {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: white;
    font-weight: 600;
}

.card-date {
    color: var(--text-secondary);
}

.card-price {
    font-weight: 600;
    color: var(--accent);
}

/* Slide Panel */
.slide-panel {
    position: fixed;
    top: 0;
    right: -56.25rem;
    width: 56.25rem;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 0.0625rem solid var(--glass-border);
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.slide-panel.active {
    right: 0;
}

.slide-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
}

.slide-panel-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.slide-panel-id {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.slide-panel-name {
    font-size: 1rem;
    font-weight: 600;
}

.slide-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slide-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.slide-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.slide-panel-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
}

.slide-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-radius: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.slide-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.slide-tab.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.slide-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Slide Panel Info */
.slide-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.slide-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.slide-info-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
}

.slide-info-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Slide Panel Sections */
.slide-section {
    margin-bottom: 1.5rem;
}

.slide-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.slide-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
}

.slide-ceiling-card {
    background: var(--bg-card);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 0.1875rem solid var(--accent);
}

.slide-ceiling-name {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.slide-ceiling-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.slide-estimate-table {
    width: 100%;
    border-collapse: collapse;
}

.slide-estimate-table th {
    text-align: left;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-bottom: 0.0625rem solid var(--border);
    text-transform: uppercase;
}

.slide-estimate-table td {
    font-size: 0.8125rem;
    padding: 0.5rem;
    border-bottom: 0.0625rem solid var(--border);
}

.slide-estimate-total {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-weight: 600;
    font-size: 0.875rem;
    border-top: 0.125rem solid var(--accent);
    margin-top: 0.5rem;
}

.slide-history-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 0.0625rem solid var(--border);
}

.slide-history-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent-blue);
    margin-top: 0.3125rem;
    flex-shrink: 0;
}

.slide-history-content {
    flex: 1;
}

.slide-history-text {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.slide-history-time {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 0.0625rem solid var(--border);
}

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

.btn-danger {
    background: rgba(255, 77, 77, 0.15);
    color: #ff4d4d;
    border: 1px solid rgba(255, 77, 77, 0.4);
}
.btn-danger:hover {
    background: #ff4d4d;
    color: #fff;
}

.btn-accent {
    background: var(--accent-purple);
    color: white;
}

.btn-accent:hover {
    background: #6a46e0;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
}

.btn-move-right {
    background: var(--accent-blue);
    color: white;
}

.btn-move-right:hover {
    background: #0d8bd9;
}

.btn-move-left {
    background: var(--accent-red);
    color: white;
}

.btn-move-left:hover {
    background: #c91f4e;
}

.btn-archive {
    background: var(--accent-yellow);
    color: var(--bg-primary);
}

.btn-archive:hover {
    background: #e69c00;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 1.25rem 3.75rem var(--shadow);
    z-index: 1000;
    width: 35rem;
    max-height: 90vh;
    overflow: hidden;
}

.modal-large {
    width: 56.25rem;
}


.modal.active {
    display: flex;
    flex-direction: column;
}

.modal.active.modal-canvas {
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.2);
}

.status-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Form */
.form-row {
    margin-bottom: 1rem;
}

.form-row.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.625rem 0.875rem;
    background: rgba(26, 35, 50, 0.4);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s;
    backdrop-filter: blur(8px);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 3.75rem;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* Detail Tabs */
.detail-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 0.0625rem solid var(--border);
    padding-bottom: 0.75rem;
}

.detail-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.detail-tab.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.detail-content {
    min-height: 18.75rem;
}

/* Canvas Layout - Full screen split */
.modal-canvas {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
    z-index: 1000;
}

/* Toolbar */
.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(26, 35, 50, 0.5);
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.toolbar-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toolbar-sep {
    width: 0.0625rem;
    height: 1.5rem;
    background: var(--border);
    flex-shrink: 0;
}

.toolbar-spacer {
    width: 14rem;
    min-width: 10rem;
    max-width: 22vw;
    flex-shrink: 0;
}

.toolbar-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Quick shapes toolbar */
.qs-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 35, 50, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.375rem;
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-text-stroke: 1.5px var(--accent);
}
.qs-btn:hover {
    background: rgba(0, 214, 143, 0.15);
    border-color: var(--accent);
}
.qs-btn.active {
    background: rgba(0, 214, 143, 0.2);
    border-color: var(--accent);
}
.qs-input {
    width: 5.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(26, 35, 50, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
}
.qs-input::placeholder {
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.qs-input:focus {
    border-color: var(--accent);
}

/* Ceiling Main Tabs */
.ceiling-main-tabs {
    display: flex;
    gap: 2px;
    padding: 0.125rem 0.25rem 0;
    background: rgba(15, 20, 30, 0.6);
    flex-shrink: 0;
}

.ceiling-tab {
    flex: none;
    padding: 0.45rem 0.75rem;
    background: rgba(26, 35, 50, 0.4);
    border: none;
    border-radius: 0.5rem 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 8rem;
}

.tab-close {
    font-size: 0.625rem;
    opacity: 0.4;
    cursor: pointer;
    padding: 0.125rem;
    border-radius: 0.25rem;
    transition: opacity 0.15s;
}

.tab-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

.ceiling-tab:hover {
    background: rgba(26, 35, 50, 0.7);
    color: var(--text-primary);
}

.ceiling-tab.active {
    background: rgba(26, 35, 50, 0.9);
    color: var(--accent);
    box-shadow: 0 -0.125rem 0 var(--accent) inset;
}

.ceiling-tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.ceiling-tab-panel.active {
    display: flex;
}

.materials-filters {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}
.mat-filter {
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}
.mat-filter.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.materials-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}
.mat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: grab;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.mat-item:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}
.mat-item.dragging {
    opacity: 0.5;
}
.mat-item-img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bg-card);
    flex-shrink: 0;
}
.mat-item-info {
    flex: 1;
    min-width: 0;
}
.mat-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mat-item-unit {
    font-size: 10px;
    color: var(--text-secondary);
}
.mat-item-price {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}
.mat-folder {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.mat-folder:hover {
    color: var(--accent-hover);
}
.mat-folder-count {
    font-size: 10px;
    color: var(--text-secondary);
}
/* Wall highlight colors */
.wall-shadow { filter: brightness(0.4); }
.wall-floating { filter: brightness(1.3) drop-shadow(0 0 6px rgba(255,255,200,0.5)); }
.wall-baguette { }

/* Materials popup */
.mat-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    min-width: 250px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.mat-popup-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.mat-popup-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}
.mat-popup-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

/* Materials Layout */
.materials-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.materials-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    overflow-y: auto;
}
.mat-module {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px;
}
.mat-module:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.materials-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}
.mat-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}
.mat-folder-header:hover { background: var(--bg-hover); }
.mat-folder-header .arrow { transition: transform 0.15s; font-size: 10px; }
.mat-folder-header.open .arrow { transform: rotate(90deg); }
.mat-folder-items { display: none; padding-left: 8px; }
.mat-folder-header.open + .mat-folder-items { display: block; }
.mat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: grab;
    border: 1px solid transparent;
    transition: all 0.15s;
    font-size: 11px;
}
.mat-item { margin-left: 8px; }
.mat-item:hover { background: var(--bg-hover); border-color: var(--border); }
.mat-item.dragging { opacity: 0.5; }
.mat-item-img { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; background: var(--bg-card); flex-shrink: 0; }
.mat-item-name { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mat-item-unit { font-size: 10px; color: var(--text-secondary); }
.mat-item-del {
    width: 18px; height: 18px; border-radius: 4px; background: rgba(220,80,80,0.85);
    color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
}
.mat-item-del:hover { background: rgba(220,80,80,1); }
/* Подпапки-группы внутри категории */
.mat-group-header {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; margin: 2px 0; border-radius: 5px;
    cursor: pointer; font-size: 11px; font-weight: 600; color: #9fb6cc;
    background: rgba(255,255,255,0.03);
}
.mat-group-header:hover { background: rgba(255,255,255,0.07); }
.mat-group-header .arrow { transition: transform 0.15s; font-size: 9px; }
.mat-group-header .arrow.open { transform: rotate(90deg); }
.mat-group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-group-count { font-size: 9px; color: var(--text-secondary); }
.mat-group-add {
    width: 16px; height: 16px; border-radius: 4px; background: rgba(79,195,247,0.25);
    color: #4fc3f7; font-size: 12px; line-height: 16px; text-align: center; cursor: pointer; flex-shrink: 0;
}
.mat-group-add:hover { background: rgba(79,195,247,0.5); }
.mat-group-items { padding-left: 4px; }
/* Пикер номенклатуры (админ) */
.mat-picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.mat-picker {
    width: min(560px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
    background: var(--bg-primary); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6); overflow: hidden;
}
.mat-picker-title { padding: 12px 14px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--border); }
.mat-picker-search {
    margin: 10px 14px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg-input); color: var(--text-primary); font-size: 12px;
}
.mat-picker-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.mat-picker-item {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.mat-picker-item:hover { background: var(--bg-hover); }
.mat-picker-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 14px; border-top: 1px solid var(--border);
}
.mat-picker-hint { font-size: 10px; color: var(--text-secondary); }
.mat-picker-close { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 12px; }
/* Materials popup */
.mat-popup-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
.mat-popup { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 280px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.mat-popup-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.mat-popup-btn { display: block; width: 100%; padding: 10px 12px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 12px; text-align: left; }
.mat-popup-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.curtain-popup { min-width: 300px; }
.curtain-form-row {
    display: grid;
    grid-template-columns: 1fr 8rem;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.curtain-form-row input,
.curtain-form-row select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.45rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    color: var(--text-primary);
    font-size: 0.75rem;
}
.curtain-form-actions { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.curtain-form-actions .mat-popup-btn { flex: 1; margin: 0; }

/* Addon Grid */
.addons-row {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.addons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
    padding: 0.625rem;
    align-content: start;
}

.addon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.25rem;
    background: var(--bg-card);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    gap: 0.25rem;
}

.addon-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-0.0625rem);
}

.addon-card.active {
    border-color: var(--accent);
    background: rgba(0, 214, 143, 0.1);
}

.addon-icon {
    font-size: 1.375rem;
    color: var(--accent);
    line-height: 1;
}

.addon-name {
    font-size: 0.5625rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

/* Addon Detail Panel — below addon cards grid */
.addon-detail {
    padding: 0.5rem 0.625rem;
    border-top: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.4);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Addon History — bigger, with scroll */
.addon-history {
    border-top: 0.0625rem solid var(--glass-border);
    padding: 0.5rem 0.625rem;
    background: rgba(26, 35, 50, 0.5);
    max-height: 12rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.addon-history-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.addon-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.addon-history-empty {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    opacity: 0.5;
    padding: 0.25rem 0;
}

.addon-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    background: var(--bg-card);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    color: var(--text-primary);
}

.addon-history-item-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.addon-history-item-type {
    color: var(--accent);
    font-weight: 600;
}

.addon-history-item-params {
    color: var(--text-secondary);
    font-size: 0.625rem;
}

.addon-history-item-remove {
    background: none;
    border: none;
    color: var(--danger, #ff6b6b);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    transition: background 0.15s;
}

.addon-history-item-remove:hover {
    background: rgba(255, 107, 107, 0.15);
}

.addon-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
}

.addon-detail-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.addon-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.addon-field label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    min-width: 5rem;
}

.addon-field input, .addon-field select {
    flex: 1;
}

.canvas-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* Left Data Panel */
.canvas-left {
    width: 22rem;
    min-width: 16rem;
    max-width: 30vw;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 0.0625rem solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.canvas-left-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.canvas-toolbar-h {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-wrap: wrap;
}

.toolbar-sep {
    width: 0.0625rem;
    height: 1.25rem;
    background: var(--border);
}

.toolbar-info {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.canvas-data-tabs {
    display: flex;
    border-bottom: 0.0625rem solid var(--glass-border);
}

.data-tab {
    flex: 1;
    padding: 0.625rem;
    background: none;
    border: none;
    border-bottom: 0.125rem solid transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
}

.data-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.data-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.data-tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.data-tab-content.active {
    display: flex;
}

/* Quick Shapes */
.quick-shapes {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-wrap: wrap;
}

.qs-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.qs-fields {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

/* Corner Row */
.corner-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.0625rem solid var(--glass-border);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.corner-row label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.corner-row input {
    width: 3.4375rem !important;
    font-size: 1rem !important;
    padding: 0.375rem 0.625rem !important;
}

.corner-row .btn {
    font-size: 0.875rem;
    padding: 0.375rem 1rem;
}

.corner-row .toolbar-info {
    font-size: 0.75rem;
}

/* Context Input */
.context-input-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    background: rgba(0, 214, 143, 0.08);
    border-bottom: 0.0625rem solid var(--glass-border);
}

.ci-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 1.5rem;
    flex-shrink: 0;
}

.ci-field {
    flex: 1;
    font-size: 1rem !important;
    font-weight: 600;
    padding: 0.375rem 0.625rem !important;
    min-width: 0;
}

.context-input-row .btn {
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 700;
    flex-shrink: 0;
}

.data-table-wrap {
    flex: 1;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    position: sticky;
    top: 0;
    background: rgba(26, 35, 50, 0.5);
    text-align: left;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.0312rem;
    border-bottom: 0.0625rem solid var(--glass-border);
}

.data-table td {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    border-bottom: 0.0625rem solid var(--border);
}

.data-table tr:hover {
    background: var(--bg-hover);
    cursor: pointer;
}

.data-table tr.selected-row {
    background: rgba(0, 214, 143, 0.15);
    border-left: 0.125rem solid var(--accent);
}

.data-table .editable {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.data-table .editable:hover {
    background: var(--bg-hover);
}

.data-table .editable:focus {
    outline: none;
    background: var(--bg-card);
    border: 0.0625rem solid var(--accent);
}

.size-card {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: rgba(26, 35, 50, 0.3);
    border-top: 0.0625rem solid var(--glass-border);
}

.quick-angles {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-wrap: wrap;
}

.btn-angle {
    min-width: 3rem;
    font-weight: 600;
}

.canvas-settings {
    padding: 0.625rem 0.75rem;
    border-top: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
    flex-shrink: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
}

.settings-row label {
    width: 4.375rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.hint {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    line-height: 1.4;
}

.input-sm {
    padding: 0.3125rem 0.5rem;
    background: rgba(26, 35, 50, 0.4);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.3125rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
    backdrop-filter: blur(8px);
}

.input-sm:focus {
    border-color: var(--accent);
}

/* Track shape menu */
.track-shape-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}
.track-shape-item:hover {
    background: rgba(0, 214, 143, 0.12);
}
.track-shape-item.active {
    background: rgba(0, 214, 143, 0.22);
    color: #00d68f;
}

/* Шаблоны расстановки (light profiles) */
#lightProfileMenu, #lightProfileWallMenu {
    position: fixed;
    z-index: 1007;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.5rem;
    box-shadow: 0 0.5rem 2rem rgba(0,0,0,0.5);
    min-width: 15rem;
    max-width: 22rem;
    max-height: 70vh;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}
.lp-menu-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.5rem 0.25rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    margin-bottom: 0.25rem;
}
.lp-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}
.lp-menu-item:hover {
    background: rgba(0, 214, 143, 0.12);
}
.lp-menu-item.lp-menu-add {
    color: #00d68f;
    font-weight: 600;
}
.lp-menu-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
}
.lp-del {
    margin-left: auto;
    color: var(--text-secondary);
    padding: 0 0.25rem;
}
.lp-del:hover { color: #ff4d4d; }
.lp-editor {
    padding: 0.25rem 0.5rem;
}
.lp-editor select[multiple] {
    height: auto;
}

/* Бейджи подборок в списке потолков */
.cli-variants {
    display: inline-flex;
    gap: 0.2rem;
    margin-left: 0.4rem;
}
.cli-variant {
    min-width: 1.1rem;
    height: 1.1rem;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 50%;
    background: rgba(0, 214, 143, 0.2);
    border: 0.0625rem solid #00d68f;
    color: #00d68f;
    font-size: 0.6rem;
    cursor: pointer;
    user-select: none;
}
.cli-variant:hover {
    background: #00d68f;
    color: #0f1419;
}

/* Right Canvas Panel */
.canvas-right-panel {
    width: 14rem;
    background: var(--glass-bg);
    border-left: 0.0625rem solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.ceiling-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 0.0625rem solid var(--glass-border);
}

.ceiling-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem;
}

.ceiling-list-empty {
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 1rem;
    text-align: center;
}

.ceiling-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background 0.15s;
    border: 0.0625rem solid transparent;
}

.ceiling-list-item:hover {
    background: var(--bg-hover);
}

.ceiling-list-item.active {
    background: rgba(0, 214, 143, 0.12);
    border-color: rgba(0, 214, 143, 0.3);
    color: var(--accent);
}

.cli-num {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

.ceiling-list-item.active .cli-num {
    background: rgba(0,214,143,0.2);
    color: var(--accent);
}

.ceiling-list-item .cli-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ceiling-list-item .cli-area {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    flex: 0 0 auto;
}

.ceiling-list-item .cli-del {
    display: none;
    cursor: pointer;
    color: var(--accent-red);
    font-size: 0.75rem;
    padding: 0.125rem;
    border-radius: 0.25rem;
}

.ceiling-list-item:hover .cli-del {
    display: inline-block;
    opacity: 0.6;
}

.ceiling-list-item .cli-del:hover {
    opacity: 1;
    background: rgba(224, 36, 94, 0.15);
}

.materials-summary {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 12;
    width: min(20rem, calc(100% - 1.5rem));
    /* Резервируем снизу под квадратики-сноски ниш, иначе панель сметы
       перекрывает «+»/корзину на канвасе и клики по ним не доходят. */
    max-height: min(26rem, calc(100% - 13rem));
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 0.75rem;
    background: rgba(12, 16, 22, 0.72);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.28);
    backdrop-filter: blur(14px);
    display: none;
    flex-direction: column;
}

.materials-summary.visible {
    display: flex;
}

.materials-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    font-weight: 600;
}

.materials-summary-total {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 400;
}

.ms-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}
.ms-nav-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.14);
    color: var(--text-primary);
    border-radius: 0.3rem;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1;
    font-size: 0.65rem;
    cursor: pointer;
    padding: 0;
    flex: none;
}
.ms-nav-btn:hover {
    border-color: #00d68f;
    color: #00d68f;
}
#msNavLabel {
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.materials-summary-footer {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.materials-summary-footer .btn {
    flex: 1;
    font-size: 0.72rem;
}

.materials-summary-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
}

.materials-summary-body::-webkit-scrollbar {
    width: 0.3rem;
}

.materials-summary-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 1rem;
}

.materials-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.3rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.materials-summary-section {
    margin: 0.4rem -0.5rem 0;
    padding: 0.45rem 0.5rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4fc3f7;
    background: rgba(79,195,247,0.08);
    border-top: 1px solid rgba(79,195,247,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.materials-summary-section:first-child { margin-top: 0.2rem; }
.materials-summary-sub {
    margin-top: 0.3rem;
    padding: 0.3rem 0.3rem 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: #9fb6cc;
}

.materials-summary-row strong {
    color: var(--accent);
    white-space: nowrap;
    font-size: 0.8rem;
}

.materials-summary-empty {
    padding: 0.65rem 0.25rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-align: center;
}

.ceiling-list-footer {
    padding: 0.5rem 0.75rem;
    border-top: 0.0625rem solid var(--glass-border);
}

.canvas-header {
    display: none;
}

.qs-bar {
    display: none;
}

.qs-actions {
    display: none;
}

.canvas-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tab-toolbar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: rgba(26, 35, 50, 0.3);
    border-bottom: 0.0625rem solid var(--glass-border);
    flex-shrink: 0;
    width: 100%;
    overflow: visible;
    position: relative;
    z-index: 30;
}

.btn-active {
    background: var(--accent) !important;
    color: var(--bg-primary) !important;
}

.canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#ceilingCanvas {
    display: block;
}

.diag-tree-wrap {
    padding: 0.25rem 0;
    max-height: none;
    overflow-y: auto;
    flex: 1;
}

.diag-folder {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 0.25rem;
    user-select: none;
}

.diag-folder:hover {
    background: var(--bg-hover);
}

.diag-folder-arrow {
    font-size: 0.5rem;
    color: var(--text-secondary);
    transition: transform 0.15s;
    width: 0.75rem;
    text-align: center;
}

.diag-folder.open .diag-folder-arrow {
    transform: rotate(90deg);
}

.diag-folder-name {
    flex: 1;
}

.diag-folder-count {
    font-size: 0.625rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    padding: 0.0625rem 0.375rem;
    border-radius: 0.5rem;
}

.diag-folder-children {
    display: none;
    padding-left: 1rem;
}

.diag-folder.open + .diag-folder-children {
    display: block;
}

.diag-tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    transition: background 0.15s;
}

.diag-tree-item:hover {
    background: var(--bg-hover);
}

.diag-tree-item.selected-row {
    background: rgba(0,214,143,0.12);
}

.diag-tree-icon {
    color: var(--text-secondary);
    font-size: 0.625rem;
    width: 0.875rem;
    text-align: center;
}

.diag-tree-item.diag-measured .diag-tree-icon {
    color: #00d68f;
}

.diag-tree-item.diag-key .diag-tree-icon {
    color: #ffad1f;
}

.diag-tree-name {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 1.875rem;
}

.diag-tree-item.diag-measured .diag-tree-name {
    color: #00d68f;
    font-weight: 600;
}

.diag-tree-len {
    color: var(--text-secondary);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* Addons tab: diagonal visibility tree (styled like materials list) */
.addon-diag-folder {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.2rem;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
    border-radius: 0.25rem;
}
.addon-diag-folder:hover { background: var(--bg-hover); }
.addon-diag-folder .arrow {
    font-size: 0.5rem;
    color: var(--text-secondary);
    transition: transform 0.15s;
    width: 0.6rem;
    text-align: center;
}
.addon-diag-folder.open .arrow { transform: rotate(90deg); }
.addon-diag-folder .name { margin-right: auto; }
.addon-diag-folder .count {
    font-size: 0.6rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 0.5rem;
}
.addon-diag-folder-items { display: none; padding-left: 0.4rem; }
.addon-diag-folder.open + .addon-diag-folder-items { display: block; }
.addon-diag-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.2rem 0.3rem;
    border-radius: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-primary);
}
.addon-diag-item:hover { background: var(--bg-hover); }
.addon-diag-item input[type="checkbox"] { accent-color: var(--accent); margin: 0; }
.addon-diag-item .name { font-weight: 500; }
.addon-diag-item .len { margin-left: auto; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.addon-diag-empty {
    padding: 0.65rem 0.25rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-align: center;
}

/* Addons tab: diagonal dropdown on the toolbar */
.diag-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
}
.diag-dropdown-list {
    position: fixed;
    top: auto;
    min-width: 14rem;
    max-width: 20rem;
    max-height: 0;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 0.6rem;
    background: rgba(12, 16, 22, 0.94);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.4);
    backdrop-filter: blur(14px);
    padding: 0.35rem 0.5rem;
    z-index: 2000;
    transition: max-height 0.2s ease;
    visibility: hidden;
    margin: 0;
}
.diag-dropdown-list.open {
    max-height: 22rem;
    visibility: visible;
}
.diag-dropdown-list::-webkit-scrollbar {
    width: 0.3rem;
}
.diag-dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 1rem;
}

.canvas-footer-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(26, 35, 50, 0.3);
    border-top: 0.0625rem solid var(--glass-border);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0.375rem;
    height: 0.375rem;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 0.1875rem;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== NICHE DETAIL PANEL ===== */
.niche-detail-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.niche-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.niche-detail-body {
    padding: 12px;
    flex: 1;
}

.niche-detail-body .form-group {
    margin-bottom: 10px;
}

.niche-detail-body label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.niche-preview-wrap {
    margin-top: 12px;
    text-align: center;
}

.niche-preview-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

#nichePreviewCanvas {
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    width: 100%;
    max-width: 200px;
}

/* Niche on canvas wall */
.niche-wall-marker {
    position: absolute;
    background: rgba(100, 180, 255, 0.3);
    border: 1px solid rgba(100, 180, 255, 0.6);
    border-radius: 3px;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 75rem) {
    .kanban-column {
        min-width: 15rem;
    }
}

@media (max-width: 56.25rem) {
    .kanban-container {
        flex-direction: column;
    }
    .kanban-column {
        max-width: 100%;
        min-height: 12.5rem;
    }
    .right-panel {
        width: 100%;
        min-width: 100%;
    }
    .cal-row {
        flex-direction: column;
    }
    .cal-col {
        border-right: none;
        border-bottom: 0.0625rem solid var(--glass-border);
    }
}

/* Скрытие canvas и списка потолков на вкладке Калькуляция */
.modal-canvas.estimate-mode .canvas-center { display: none !important; }
.modal-canvas.estimate-mode .canvas-right-panel { display: none !important; }

/* ===== WORKSPACE TABS ===== */
.workspace-tabs {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.ws-tab {
    padding: 0.4rem 0.9rem;
    background: rgba(26, 35, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ws-tab:hover { background: rgba(26, 35, 50, 0.8); color: var(--text-primary); }
.ws-tab.active {
    background: rgba(0, 214, 143, 0.15);
    color: var(--accent);
    border-color: rgba(0, 214, 143, 0.4);
    box-shadow: 0 0 0.5rem rgba(0, 214, 143, 0.15);
}

/* ===== WORKSPACE TRANSITIONS ===== */
.kanban-container,
.right-panel,
.office-panel {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.kanban-container.hidden-ws,
.right-panel.hidden-ws,
.office-panel.hidden-ws {
    display: none !important;
}
.kanban-container.visible-ws,
.right-panel.visible-ws,
.office-panel.visible-ws {
    opacity: 1;
    transform: translateX(0);
}

/* Header counterparty block */
.header-cp-block {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.header-cp-select {
    padding: 0.35rem 0.6rem;
    background: rgba(26, 35, 50, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
    min-width: 12rem;
    max-width: 18rem;
    cursor: pointer;
}
.header-cp-select:focus { border-color: var(--accent); }
.header-cp-select option { background: #1a2332; color: var(--text-primary); }

/* ===== OFFICE PANEL ===== */
.office-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    min-width: 0;
    min-height: 0;
}

.office-layout {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: auto;
}

#officeDebtCard,
#officeCatalogCard,
#officeChatCard,
#officeOrdersCard {
    position: absolute;
}

.office-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Edit mode styles */
.office-layout.editing .office-card-header {
    cursor: grab;
    user-select: none;
}
.office-layout.editing .office-card-header:active {
    cursor: grabbing;
}

.office-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Cards always absolutely positioned via JS */

/* Resize handle visual feedback */
.office-resize-handle:hover {
    background: var(--accent) !important;
    opacity: 0.5;
}

/* Resize edges — thin invisible zones on all sides */
.office-card .resize-edge {
    display: none;
    position: absolute;
    z-index: 10;
}
.office-card .resize-edge::after {
    content: '';
    position: absolute;
    background: transparent;
    transition: background 0.15s;
}
.office-card .resize-edge:hover::after {
    background: rgba(0, 214, 143, 0.4);
}

/* Right edge */
.resize-edge-right { top: 8px; right: 0; width: 6px; bottom: 8px; cursor: ew-resize; }
.resize-edge-right::after { top: 0; right: 0; width: 4px; height: 100%; }

/* Bottom edge */
.resize-edge-bottom { bottom: 0; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.resize-edge-bottom::after { bottom: 0; left: 0; width: 100%; height: 4px; }

/* Left edge */
.resize-edge-left { top: 8px; left: 0; width: 6px; bottom: 8px; cursor: ew-resize; }
.resize-edge-left::after { top: 0; left: 0; width: 4px; height: 100%; }

/* Top edge */
.resize-edge-top { top: 0; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.resize-edge-top::after { top: 0; left: 0; width: 100%; height: 4px; }

/* Bottom-right corner */
.resize-handle {
    display: none;
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    z-index: 11;
}
.resize-handle::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    opacity: 0.4;
}
.resize-handle:hover::after {
    border-color: var(--accent);
    opacity: 1;
}

/* Bottom-left corner */
.resize-handle-bl {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 16px;
    height: 16px;
    cursor: nesw-resize;
    z-index: 11;
}
.resize-handle-bl::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-left: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    opacity: 0.4;
}
.resize-handle-bl:hover::after {
    border-color: var(--accent);
    opacity: 1;
}

/* Show all handles in editing mode */
.office-layout.editing .office-card .resize-edge,
.office-layout.editing .office-card .resize-handle,
.office-layout.editing .office-card .resize-handle-bl {
    display: block;
}
.office-layout.editing .office-card {
    outline: 1px dashed transparent;
    transition: outline-color 0.2s;
}
.office-layout.editing .office-card:hover {
    outline-color: rgba(0, 214, 143, 0.3);
}

/* Archive panel */
.archive-list { display: flex; flex-direction: column; gap: 4px; }
.archive-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--glass-border);
    cursor: pointer; transition: background 0.15s;
}
.archive-item:hover { background: var(--bg-hover); }
.archive-item-id { font-size: 12px; color: var(--accent); font-weight: 700; min-width: 40px; }
.archive-item-info { flex: 1; min-width: 0; }
.archive-item-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-item-meta { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-item-date { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }

/* Layout edit mode toggle button */
.btn-layout-edit {
    display: none;
}
.btn-layout-edit.active {
    background: var(--accent-red);
    color: #fff;
}

.office-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.office-card-icon { font-size: 1.1rem; }
.office-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.office-card-badge {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 0.5rem;
}

.office-card-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.office-empty {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem 0.5rem;
    opacity: 0.6;
}

/* Debt table */
.office-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.office-table th {
    text-align: left;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--glass-border);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.office-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.office-row-clickable { cursor: pointer; }
.office-row-clickable:hover { background: var(--bg-hover); }
.office-debt { color: #ff6b6b; font-weight: 600; }
.office-overpay { color: #00d68f; font-weight: 600; }
.office-ok { color: var(--text-secondary); }

/* Catalog */
.office-search-input {
    margin-left: auto;
    padding: 0.3rem 0.6rem;
    background: rgba(26, 35, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.7rem;
    outline: none;
    width: 9rem;
}
.office-search-input:focus { border-color: var(--accent); }

/* Orders table */
.office-orders-scroll {
    overflow-y: auto;
    padding: 0 !important;
}
.office-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}
.office-orders-table th {
    position: sticky;
    top: 0;
    background: rgba(26, 35, 50, 0.8);
    text-align: left;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--glass-border);
    z-index: 1;
}
.office-orders-table th.num { text-align: right; }
.office-orders-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: top;
}
.office-orders-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.office-orders-table tr:hover { background: var(--bg-hover); }
.office-orders-order-header {
    background: rgba(0, 214, 143, 0.06);
    cursor: pointer;
    transition: background 0.15s;
}
.office-orders-order-header:hover { background: rgba(0, 214, 143, 0.12); }
.office-orders-order-header td {
    font-weight: 600;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--glass-border);
}
.office-orders-order-num { color: var(--accent); }
.office-orders-order-date { color: var(--text-secondary); }
.office-orders-order-total { color: var(--text-primary); font-weight: 700; }
.office-orders-pos td {
    padding: 0.3rem 0.6rem 0.3rem 1.5rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
}
.office-orders-pos:hover { background: rgba(255,255,255,0.02); }
.office-orders-pos td:first-child { color: var(--text-primary); }
.office-orders-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* AI Chat */
.office-card-chat { grid-row: span 1; }
.office-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.office-chat-msg {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.45;
    white-space: pre-line;
}
.office-chat-msg.user {
    align-self: flex-end;
    background: rgba(0, 214, 143, 0.15);
    color: var(--text-primary);
    border-bottom-right-radius: 0.2rem;
}
.office-chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-bottom-left-radius: 0.2rem;
}
.office-chat-input-row {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.office-chat-input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    background: rgba(26, 35, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
}
.office-chat-input:focus { border-color: var(--accent); }
.office-chat-input-row .btn {
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== OFFICE TOP BAR — counterparty selector ===== */
.office-top-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}
.office-top-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.office-cp-select {
    flex: 1;
    padding: 0.45rem 0.75rem;
    background: rgba(26, 35, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}
.office-cp-select:focus { border-color: var(--accent); }
.office-cp-select option { background: #1a2332; color: var(--text-primary); }

/* Debt detail card */
.office-debt-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 0.5rem;
    gap: 0.4rem;
}
.office-debt-client {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.office-debt-amount {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}
.office-debt-status {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.office-debt-hint {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 0.4rem;
}

/* ===== COUNTERPARTY MANAGER OVERLAY ===== */
.cp-manager-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cp-manager {
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    width: 28rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.cp-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.cp-manager-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.cp-search-row,
.cp-add-row {
    display: flex;
    gap: 0.4rem;
}
.cp-search-input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    background: rgba(26, 35, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    outline: none;
}
.cp-search-input:focus { border-color: var(--accent); }
.cp-search-results {
    max-height: 10rem;
    overflow-y: auto;
}
.cp-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}
.cp-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.cp-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
}
.cp-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cp-item-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}
.cp-ms-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.3rem;
    font-weight: 600;
}
.cp-ms-badge.ok { background: rgba(0, 214, 143, 0.15); color: #00d68f; }
.cp-ms-badge.warn { background: rgba(255, 173, 31, 0.15); color: #ffad1f; }
.cp-item-actions {
    display: flex;
    gap: 0.3rem;
}

/* ===== КАЛЬКУЛЯЦИЯ (5 блоков) ===== */
.modal-canvas.estimate-mode .canvas-left {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    border-right: none;
}
#ctabEstimate.active {
    padding: 0.75rem;
    overflow-y: auto;
}
.calc-empty {
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}
.calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 0.75rem;
    align-items: start;
}
.calc-card {
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.calc-card.calc-full {
    grid-column: 1 / -1;
}
.calc-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.3);
}
.calc-num {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.calc-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.calc-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-left: auto;
    text-align: right;
}
.calc-visual {
    position: relative;
    padding: 0.5rem;
}
.calc-visual canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
    background: #131a24;
}
.calc-visual-meta {
    position: absolute;
    right: 0.9rem;
    bottom: 0.9rem;
    display: flex;
    gap: 0.5rem;
    font-size: 0.65rem;
    color: #cfe3ff;
    background: rgba(12, 16, 22, 0.7);
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    pointer-events: none;
}
.calc-table {
    flex: 1;
    overflow-y: auto;
    max-height: 26rem;
    padding: 0.25rem 0;
}
.calc-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.75rem;
    font-size: 0.7rem;
    border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.04);
}
.calc-row:hover { background: rgba(255, 255, 255, 0.03); }
.calc-row-head {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(23, 31, 42, 0.98);
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.08);
}
.calc-row.calc-disabled { opacity: 0.45; }
.calc-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.calc-row-head .calc-name { color: var(--text-secondary); }
.calc-qty { width: 6.5rem; text-align: right; color: var(--text-secondary); }
.calc-price { width: 6rem; text-align: right; color: var(--text-secondary); }
.calc-sum { width: 6.5rem; text-align: right; color: var(--text-primary); font-weight: 600; }
.calc-sec {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.75rem 0.15rem;
}
.calc-total {
    padding: 0.5rem 0.75rem;
    border-top: 0.0625rem solid var(--glass-border);
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: right;
    background: rgba(26, 35, 50, 0.3);
}
.calc-total b { color: var(--accent); font-size: 0.9rem; }
.calc-total-sub { font-size: 0.62rem; color: var(--text-secondary); margin-left: 0.4rem; }
.calc-brk {
    display: block;
    font-size: 0.58rem;
    color: var(--text-secondary);
    white-space: normal;
}
.calc-bundle-mark { color: #ffd166; margin-right: 0.25rem; }
.calc-toggle {
    width: 1rem;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.calc-toggle input { accent-color: var(--accent); }

/* меню «Связки» */
#calcBundleMenu {
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.5rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
    min-width: 15rem;
    max-width: 24rem;
    max-height: 70vh;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}
.lp-menu-sub {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.25rem 0.25rem;
    margin-top: 0.25rem;
    border-top: 0.0625rem solid var(--glass-border);
}
.calc-editor label { display: block; }
.calc-editor .input-sm { margin-bottom: 0.25rem; }
.calc-bundle-items { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.25rem; }
.calc-bundle-row { display: flex; gap: 0.25rem; align-items: center; }
.calc-bundle-row .input-sm { padding: 0.25rem 0.4rem; }
.calc-topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    padding: 0.4rem 0.6rem;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.6rem;
}
.calc-topbar-label { font-size: 0.7rem; color: var(--text-secondary); }
.calc-topbar select { width: auto; }
.calc-topbar-hint { margin-left: auto; font-size: 0.62rem; color: var(--text-secondary); }

/* ===== КАЛЬКУЛЯЦИЯ: 3 колонки + боковая панель общих смет ===== */
.calc-grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr) minmax(0, 7fr);
}
.calc-card.calc-full { grid-column: auto; }
.calc-topbar {
    flex-wrap: wrap;
    gap: 0.4rem;
}
.calc-topbar-right {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
}
.calc-topbar select { max-width: 12rem; }
.calc-visual { padding: 0.3rem; }
.calc-visual canvas { border-radius: 0.4rem; }
.calc-visual-meta { right: 0.6rem; bottom: 0.6rem; font-size: 0.58rem; }
.calc-table { max-height: 24rem; }
#calcVariantSelect { max-width: 8.5rem; font-size: 0.65rem; }

/* Боковая панель общих смет */
.calc-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(30rem, 92vw);
    z-index: 1006;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 0.0625rem solid var(--glass-border);
    box-shadow: -0.5rem 0 2rem rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
}
.calc-drawer.open { transform: translateX(0); }
.calc-drawer-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 0.0625rem solid var(--glass-border);
    background: rgba(26, 35, 50, 0.4);
}
.calc-drawer-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.calc-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.calc-drawer-body .calc-table { max-height: none; flex: 1; }

/* Дописывание сметы: редактор строк + кнопки */
.calc-card-actions {
    padding: 0.25rem 0.75rem 0.4rem;
    display: flex;
    justify-content: flex-end;
}
.calc-custom-editor {
    display: none;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-top: 0.0625rem dashed var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}
.calc-custom-editor .input-sm { flex: 1; min-width: 5rem; }
.calc-custom-num { width: 3.5rem; flex: 0 0 auto !important; }
.calc-custom-unit { width: 3.5rem; flex: 0 0 auto !important; }
.calc-del {
    margin-left: 0.4rem;
    color: #ff5b5b;
    cursor: pointer;
    font-size: 0.72rem;
    opacity: 0.85;
}
.calc-del:hover { opacity: 1; }

/* Пикер номенклатуры (выбор/замена позиции) */
.nom-picker {
    z-index: 1010;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.6rem;
    padding: 0.4rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
    min-width: 16rem;
    max-width: 24rem;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}
.nom-picker-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.15rem 0.3rem 0.35rem;
}
.nom-picker-search {
    width: 100%;
    margin-bottom: 0.3rem;
}
.nom-picker-list {
    overflow-y: auto;
    max-height: 40vh;
}
.nom-picker-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border-radius: 0.35rem;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--text-primary);
}
.nom-picker-item:hover { background: rgba(255, 255, 255, 0.06); }
.np-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-price { color: var(--text-secondary); white-space: nowrap; }
.nom-picker-empty { padding: 0.5rem; font-size: 0.7rem; color: var(--text-secondary); }

/* Метка «позиция по умолчанию» у группы в материалах */
.mat-group-def-tag {
    display: block;
    font-size: 0.62rem;
    color: var(--accent);
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 10rem;
}
.calc-custom-name-wrap {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex: 1;
    min-width: 6rem;
}
.calc-custom-name-wrap .input-sm { margin-bottom: 0; }
.calc-head-btns {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}
.calc-head-btns .btn { padding: 0.2rem 0.5rem; font-size: 0.62rem; }
.calc-card-head .calc-sub { margin-left: 0.5rem; }
.calc-menu-label {
    display: block;
    font-size: 0.62rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}
/* Карточки калькуляции в карточке заказа */
.card-calc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.card-calc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
}
.card-calc-head:hover { background: rgba(255,255,255,0.03); }
.card-calc-body {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}
/* Мелкая таблица в карточке заказа (калькуляция) */
.card-calc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    line-height: 1.2;
}
.card-calc-table th, .card-calc-table td {
    padding: 2px 5px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: left;
    white-space: nowrap;
}
.card-calc-table th {
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.card-calc-table td:nth-child(2),
.card-calc-table td:nth-child(3),
.card-calc-table td:nth-child(4),
.card-calc-table th:nth-child(2),
.card-calc-table th:nth-child(3),
.card-calc-table th:nth-child(4) {
    text-align: right;
}
.card-calc-table td:nth-child(1) {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-calc-table tr.sec td {
    color: var(--accent);
    font-weight: 700;
    background: rgba(255,255,255,0.02);
}
.card-calc-table tfoot td {
    font-weight: 700;
    border-top: 1px solid var(--accent);
}
/* Статистика (расход/доход) в калькуляции */
.calc-stats { margin-top: 0.75rem; }
.calc-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
    padding: 0.75rem;
}
.calc-stat {
    background: rgba(255,255,255,0.03);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    text-align: center;
}
.calc-stat-label { font-size: 0.62rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.3rem; }
.calc-stat-val { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.calc-stat-val.inc { color: #00d68f; }
.calc-stat-val.exp { color: #ff5b6b; }
.calc-stat-pct { font-size: 0.7rem; color: var(--text-secondary); font-weight: 600; }
/* ===== БУХГАЛТЕРИЯ И УЧЁТ ===== */
.acct-layout { display: flex; flex-direction: column; gap: 14px; }
.acct-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.acct-card-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 10px;
}
.acct-badge { font-size: 11px; color: var(--text-secondary); margin-left: auto; }
.acct-sub { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.acct-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.acct-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.acct-stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.acct-stat-val { font-size: 18px; font-weight: 700; }
.acct-stat-val.inc { color: #00d68f; }
.acct-stat-val.exp { color: #ff5b6b; }
.acct-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
}
.acct-row span:first-child { flex: 1; }
.acct-eff-row { display: flex; align-items: center; gap: 10px; font-size: 12px; padding: 5px 0; }
.acct-eff-row span:first-child { width: 110px; }
.acct-eff-bar { flex: 1; height: 12px; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; }
.acct-eff-bar div { height: 100%; background: var(--accent); border-radius: 6px; }
/* Причины удаления заказа */
.delete-reason-list { display: flex; flex-direction: column; gap: 6px; }
.delete-reason { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 4px 0; }
.delete-reason input { accent-color: var(--accent); }
/* Общая смета в карточке заказа */
.card-calc-total {
    display: flex; align-items: center; gap: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.card-calc-total b { color: var(--accent); font-size: 14px; }
/* Прокрутка бухгалтерии */
#accountPanel {
    overflow-y: auto;
    justify-content: flex-start;
    align-items: stretch;
    flex: 1 1 100%;
}
#accountPanel .acct-layout {
    flex: 1 1 100%;
    justify-content: flex-start;
    align-items: stretch;
    min-height: 0;
    overflow: visible;
    padding: 18px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.acct-layout .acct-card { width: 100%; box-sizing: border-box; flex: 0 0 auto; }
/* ===== БУХГАЛТЕРИЯ: СОВРЕМЕННЫЙ ДАШБОРД ===== */
#accountPanel .acct-dash {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    padding: 18px;
    align-items: start;
    height: 100%;
}
#accountPanel .acct-side { display: flex; flex-direction: column; gap: 16px; }
#accountPanel .acct-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#accountPanel .acct-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(16,24,40,0.06);
}
#accountPanel .acct-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#accountPanel .acct-title { font-size: 14px; font-weight: 700; color: #1f2937; }
.acct-period {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 8px; margin-bottom: 12px;
}
.acct-period .input-sm {
    background: #fff; border: 1px solid #d1d5db; border-radius: 8px;
    padding: 5px 8px; font-size: 12px; color: #374151;
}
.acct-period-label { font-size: 12px; color: #6b7280; margin-left: auto; font-weight: 600; }
.acct-hero-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.acct-hero {
    background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 10px;
    padding: 10px 12px;
}
.acct-hero-label { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.acct-hero-val { font-size: 17px; font-weight: 700; color: #1f2937; }
.acct-hero-val.inc { color: #10b981; }
.acct-hero-val.exp { color: #ef4444; }
.acct-hero-val.warn { color: #f59e0b; }
#acctChart { width: 100%; height: auto; background: #fff; border-radius: 10px; }
.acct-add-row { display: flex; gap: 6px; margin-top: 6px; }
.acct-add-row .input-sm { background: #fff; border: 1px solid #d1d5db; border-radius: 8px; padding: 5px 8px; font-size: 12px; color: #374151; }
#accountPanel .acct-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid #f3f4f6;
    font-size: 12px; color: #374151;
}
.acct-eff-bar { flex: 1; height: 10px; background: #f3f4f6; border-radius: 6px; overflow: hidden; }
.acct-eff-bar div { height: 100%; border-radius: 6px; background: var(--eff, var(--accent)); }
#accountPanel .acct-sub { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 6px; }
#accountPanel .card-calc-table th { color: #6b7280; border-bottom: 1px solid #e5e7eb; }
#accountPanel .card-calc-table td { border-bottom: 1px solid #f3f4f6; color: #374151; }
#accountPanel .card-calc-table tfoot td { border-top: 1px solid #e5e7eb; color: #1f2937; }
/* ===== БУХГАЛТЕРИЯ: ТЁМНЫЙ ДАШБОРД ===== */
#accountPanel .acct-dash {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    padding: 18px;
    align-items: start;
    height: 100%;
}
#accountPanel .acct-side { display: flex; flex-direction: column; gap: 16px; }
#accountPanel .acct-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#accountPanel .acct-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(12px);
}
#accountPanel .acct-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#accountPanel .acct-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.acct-period {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    background: rgba(26,35,50,0.5); border: 1px solid var(--glass-border); border-radius: 10px;
    padding: 8px; margin-bottom: 12px;
}
.acct-period .input-sm {
    background: rgba(26,35,50,0.6); border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 8px; font-size: 12px; color: var(--text-primary);
}
.acct-period .input-sm option { background: #1a2332; color: var(--text-primary); }
.acct-period-label { font-size: 12px; color: var(--text-secondary); margin-left: auto; font-weight: 600; }
.acct-hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.acct-hero { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 10px 12px; }
.acct-hero-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.acct-hero-val { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.acct-hero-val.inc { color: #00d68f; }
.acct-hero-val.exp { color: #ff5b6b; }
.acct-hero-val.warn { color: #ffad1f; }
#acctChart { width: 100%; height: auto; background: #0f1419; border-radius: 10px; }
.acct-add-row { display: flex; gap: 6px; margin-top: 6px; }
.acct-add-row .input-sm { background: rgba(26,35,50,0.6); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px; color: var(--text-primary); }
#accountPanel .acct-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: var(--text-primary); }
.acct-eff-bar { flex: 1; height: 10px; background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden; }
.acct-eff-bar div { height: 100%; border-radius: 6px; background: var(--eff, var(--accent)); }
#accountPanel .acct-sub { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.acct-data-note {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.acct-nosalary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 6px 0 10px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    user-select: none;
}
.acct-nosalary input {
    accent-color: var(--accent);
}
/* Визуал потолка — стабильный, по центру, не размытый */
.calc-visual canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 380px;
    height: auto;
    image-rendering: auto;
}
/* ===== КАЛЬКУЛЯЦИЯ: НОВЫЙ ЛЕЙАУТ (2 колонки + общие модули) ===== */
.calc-layout {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.calc-col-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.calc-col-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.calc-layout-wide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
    margin-top: 12px;
}
.calc-layout-wide .calc-total-client,
.calc-layout-wide .calc-total-purchase { min-width: 0; }
.calc-layout-wide .calc-stats { grid-column: 1 / -1; }
/* Визуал потолка — по центру, не касаясь границ */
.calc-visual { padding: 8px; }
.calc-visual canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 330px;
    height: auto;
    border-radius: 8px;
    background: #0f1419;
}
/* Статистика — компактная, ширина визуала */
.calc-stats .calc-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
}
.calc-stats .calc-stat { padding: 8px 10px; }
.calc-stats .calc-stat-val { font-size: 15px; }
/* ===== КАЛЬКУЛЯЦИЯ: 3 КОЛОНКИ (визуал | работы | закуп) ===== */
.calc-layout3 {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.calc-col-vis, .calc-col-works, .calc-col-purchase {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
/* Визуал потолка — по центру, не касаясь границ */
.calc-visual { padding: 8px; }
.calc-visual canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    background: #0f1419;
}
/* Статистика — компактная (индивидуальная и общая) */
.calc-stats .calc-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
}
.calc-stats .calc-stat { padding: 8px 10px; }
.calc-stats .calc-stat-val { font-size: 15px; }
/* Общие сметы — в колонках работ/закупа */
.calc-total-client, .calc-total-purchase { min-width: 0; }
.calc-total-client .calc-table, .calc-total-purchase .calc-table { max-height: 20rem; }
