* {
    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-warranty: #e0245e;
    --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;
    flex-wrap: wrap;
    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: 0.75rem 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-warranty: #e0245e;
    --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;
    flex-wrap: wrap;
    padding: 0.625rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 0.0625rem solid var(--border);
    gap: 0.5rem 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: rgba(15, 20, 30, 0.82);
    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;
    /* Месяц — первая строка, год — вторая, по центру между стрелками */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    text-align: center;
    line-height: 1.1;
}
.cal-month-name { white-space: nowrap; }
.cal-month-year { font-size: 0.78rem; font-weight: 500; opacity: 0.75; white-space: nowrap; }

.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: rgba(15, 20, 30, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-left: 0.0625rem solid var(--glass-border);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.deleted-sidebar.active {
    right: 0;
    /* Тень только у ОТКРЫТОЙ панели: у скрытых за краем (right: -21.875rem)
       она заливает чёрную полосу по правому краю всех экранов. */
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
}

.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);
    z-index: 1002;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.nomenclature-sidebar.active {
    right: 0;
    /* Тень только у ОТКРЫТОЙ панели (см. .deleted-sidebar) */
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
}

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

.hamburger-menu.active {
    right: auto;
    left: 0;
    box-shadow: 0.25rem 0 1.25rem var(--shadow);
}

/* Профиль выезжает СЛЕВА (из главного меню), а не справа */
#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;
}

/* Замок у позиций, загруженных из Мой Склад (удалять нельзя) */
.nom-ms-lock {
    font-size: 0.7rem;
    opacity: 0.6;
    cursor: help;
}

.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;
    /* Заголовок — до 2 строк, не обрезается в одну */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
}

.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: rgba(15, 20, 30, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-left: 0.0625rem solid var(--glass-border);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.slide-panel.active {
    right: 0;
    /* Тень только у ОТКРЫТОЙ панели (см. .deleted-sidebar) */
    box-shadow: -0.25rem 0 1.25rem var(--shadow);
}

.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;
}

/* Модалка договора открывается ПОВЕРХ карточки заказа (slide-panel z-index 1001)
   и на широких экранах встаёт РЯДОМ с карточкой, а не под ней. */
#contractModal {
    z-index: 1002;
}
@media (min-width: 1800px) {
    #contractModal {
        left: calc(50% - 28.125rem);
    }
}

/* Календарь выбора даты в договоре */
#contractDatePicker {
    display: none;
    position: fixed;
    z-index: 1060;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 0.5rem 2rem var(--shadow);
    width: 15.5rem;
}
.cdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cdp-title { font-weight: 700; font-size: 0.8125rem; }
.cdp-nav { background: var(--bg-hover); border: none; color: var(--text-primary); border-radius: 0.375rem; width: 1.75rem; height: 1.75rem; cursor: pointer; font-size: 1rem; line-height: 1; }
.cdp-nav:hover { background: var(--bg-card); }
.cdp-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.625rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.cdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.125rem; }
.cdp-day { background: none; border: none; color: var(--text-primary); border-radius: 0.375rem; height: 1.875rem; cursor: pointer; font-size: 0.75rem; }
.cdp-day:hover { background: var(--accent); color: #fff; }
.cdp-day.today { box-shadow: inset 0 0 0 0.0625rem var(--accent); }
.cdp-day.sel { background: var(--accent); color: #fff; font-weight: 700; }
.cdp-today { background: var(--bg-hover); border: none; color: var(--accent); border-radius: 0.375rem; padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.cdp-today:hover { background: var(--bg-card); }

.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: 100%;
    height: 100vh;
    max-height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
    z-index: 1000;
    /* Полноэкранный редактор: без backdrop-размытия и с непрозрачным фоном.
       Иначе на полупрозрачном стекле у края viewport образуется чёрная
       размытая полоса (~7мм), «уходящая в чёрный» по краю экрана. */
    background: #0b0f17;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* 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);
}

/* Дропдаун быстрых фигур (единый с мобильной версией) */
.qs-drop {
    position: relative;
    display: inline-flex;
}
.qs-drop .qs-current {
    display: inline-flex;
}
.qs-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.3rem);
    left: 0;
    flex-direction: column;
    gap: 0.25rem;
    background: #131a26;
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.6rem;
    padding: 0.35rem;
    z-index: 1300;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.55);
}
.qs-drop.open .qs-menu { display: flex; }


/* 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;
}
/* ---------- Материалы: 8 категорий-кнопок (2×4) + поиск + popup (ТОЛЬКО мобильный) ---------- */
.mat-cat-wrap {
    position: relative;
    margin-top: auto;             /* прижать блок к низу панели */
    display: none;                /* десктоп: материалы списком (mat-desktop-list) */
    flex-direction: column;
    gap: 0.4rem;
}
@media (max-width: 900px) {
    .mat-cat-wrap { display: flex; }
    .mat-desktop-list { display: none; }
}
/* Кнопка списка потолков — только для мобильного (на десктопе есть панель «Потолки») */
#btnCeilingList, #btnCeilingListOther { display: none; }
.mat-cat-popup {
    position: fixed;
    z-index: 1400;
    max-height: min(50vh, 22rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(15, 20, 30, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
    padding: 0.4rem;
}
.mat-cat-popup-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.3rem 0.4rem 0.45rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0.3rem;
}
.mat-cat-popup-empty {
    padding: 0.6rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
}
.mat-cat-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.78rem;
}
.mat-cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}
.mat-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.6rem 0.2rem;
    background: var(--bg-card);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    color: inherit;
    font: inherit;
}
.mat-cat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-0.0625rem);
}
.mat-cat-btn.active {
    border-color: var(--accent);
    background: rgba(0, 214, 143, 0.1);
}
.mat-cat-ico {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mat-cat-ico svg { width: 100%; height: 100%; display: block; }
.mat-cat-name {
    font-size: 0.56rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.15;
}
.mat-item-ico {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.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); }
/* Встроенный показ сметы (мобильное приложение/WebView без всплывающих окон) */
.calc-send-overlay { position: fixed; inset: 0; z-index: 4000; display: none; flex-direction: column; background: rgba(0,0,0,0.65); }
.calc-send-overlay.active { display: flex; }
.calc-send-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.6rem 0.75rem; background: #1a2332; border-bottom: 1px solid rgba(255,255,255,0.12); flex-shrink: 0; }
.calc-send-bar .calc-send-title { font-size: 0.85rem; font-weight: 600; color: #fff; margin-right: auto; }
.calc-send-bar button { border: none; border-radius: 0.5rem; padding: 0.5rem 0.9rem; font-size: 0.8rem; font-weight: 600; color: #fff; cursor: pointer; }
.calc-send-bar .cs-tg { background: #2AABEE; }
.calc-send-bar .cs-wa { background: #25D366; }
.calc-send-bar .cs-max { background: #ff6b6b; }
.calc-send-bar .cs-print { background: #555; }
.calc-send-bar .cs-close { background: rgba(255,255,255,0.15); }
.calc-send-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.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: 15.5rem;
    background: var(--glass-bg);
    border-left: 0.0625rem solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Мобильный выпадающий список потолков (под кнопкой ☰) */
.ceiling-dropdown {
    position: fixed;
    z-index: 1305;
    width: min(20rem, 90vw);
    max-height: 60vh;
    background: #131a26;
    border: 0.0625rem solid var(--glass-border);
    border-left: 0.0625rem solid var(--glass-border);
    border-radius: 0.6rem;
    box-shadow: 0 0.6rem 1.8rem rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
.ceiling-dropdown .ceiling-list-body {
    max-height: calc(60vh - 2.5rem);
    overflow-y: auto;
}

.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;
    /* Фиксированный слот: все площади в списке на одном уровне */
    min-width: 4.6rem;
    font-variant-numeric: tabular-nums;
}

.ceiling-list-item .cli-del-ph {
    cursor: default;
}

.ceiling-list-item .cli-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-red);
    font-size: 0.875rem;
    font-weight: 700;
    width: 1.375rem;
    height: 1.375rem;
    line-height: 1;
    padding: 0;
    border-radius: 0.375rem;
    opacity: 0.55;
    transition: background 0.15s, opacity 0.15s, transform 0.15s;
}

.ceiling-list-item:hover .cli-del {
    opacity: 1;
}

.ceiling-list-item .cli-del:hover {
    opacity: 1;
    background: var(--accent-red);
    color: #fff;
    transform: scale(1.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-bodyhtml { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
    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;
}

/* ВЕБ: рисование контура прямо на основном канвасе (оверлей, только десктоп) */
.web-draw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    z-index: 5;
}
.web-draw-ask {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(15, 20, 30, 0.94);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    z-index: 20;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.web-draw-ask-label { font-size: 0.85rem; color: var(--text-primary); font-weight: 600; }
/* ВЕБ: подтверждение перерисовки потолка (Да/Нет) */
.web-draw-confirm {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 9, 14, 0.55);
}
.web-draw-confirm .wdc-box {
    background: rgba(15, 20, 30, 0.97);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 22rem;
}
.web-draw-confirm .wdc-text { font-size: 0.9rem; color: var(--text-primary); font-weight: 600; }
.web-draw-confirm .wdc-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
@media (max-width: 900px) {
    .web-draw-canvas, .web-draw-ask, .web-draw-confirm { display: none !important; }
}

.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-item.diag-shown .diag-tree-icon {
    color: #00d68f;
}
.diag-tree-item.diag-shown {
    background: rgba(0,214,143,0.10);
}

.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 { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
.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 */
html { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
    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: 90rem) {
    .workspace-tabs .ws-tab {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }
    .header-user {
        gap: 0.35rem;
    }
    .user-name {
        max-width: 10rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 64rem) {
    .search-filter {
        max-width: none;
        flex: 1 1 100%;
        order: 10;
    }
    .header-cp-block {
        flex-wrap: wrap;
    }
    .header-cp-select {
        min-width: 8rem;
        max-width: 12rem;
    }
    .user-role {
        display: none;
    }
    .user-name {
        max-width: 7rem;
    }
}

@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-wrap: wrap;
    flex-shrink: 1;
    align-items: center;
}
.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); }
.header-cp-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    background: rgba(0, 214, 143, 0.12);
    border: 1px solid rgba(0, 214, 143, 0.35);
    border-radius: 0.5rem;
    color: #00d68f;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== 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-components-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 0;
}
.office-components-body .oc-search-wrap { position: relative; }
.office-components-body .oc-search-wrap input { width: 100%; }
.office-components-body .oc-suggest {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 2px);
    z-index: 50;
    max-height: 14rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #1a2332;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.office-components-body .oc-suggest-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.office-components-body .oc-suggest-item:last-child { border-bottom: none; }
.office-components-body .oc-suggest-item:hover { background: var(--bg-hover); }
.office-components-body .oc-suggest-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-components-body .oc-suggest-price { color: var(--accent); white-space: nowrap; font-weight: 600; }
.office-components-body .oc-list {
    flex: 1 1 auto;
    min-height: 4rem;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    overflow: hidden;
}
.office-components-body .oc-head,
.office-components-body .oc-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3.4rem 4.4rem 4.8rem 2.2rem;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.45rem;
}
.office-components-body .oc-head {
    background: #1a2332;
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.office-components-body .oc-rows {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.office-components-body .oc-row {
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.office-components-body .oc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-components-body .oc-head .num,
.office-components-body .oc-row .num { text-align: right; }
.office-components-body .oc-qty { width: 100%; min-width: 0; }
.office-components-body .oc-del { width: 100%; padding: 0.15rem 0.2rem; }
.office-components-body .oc-empty-row { color: var(--text-secondary); text-align: center; padding: 1rem 0.5rem; font-size: 0.78rem; }
.office-components-body .oc-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    flex-shrink: 0;
}
.office-components-body .oc-total { color: var(--accent); }
.office-components-body .oc-qty { width: 3.6rem; }
.office-components-body .oc-pickup { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; }
.office-components-body .oc-delivery { display: flex; flex-direction: column; gap: 0.35rem; }
.office-components-body .oc-send { width: 100%; }
.office-components-body .oc-hint { font-size: 0.66rem; color: var(--text-secondary); }
/* Длинный заголовок карточки — в 2 строки, не обрезается */
#officeComponentsCard .office-card-header { align-items: flex-start; }
#officeComponentsCard .office-card-title { white-space: normal; line-height: 1.1; font-size: 0.72rem; }

.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);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
}
/* Тень только у ОТКРЫТОГО drawer'а (см. .deleted-sidebar) */
.calc-drawer.open {
    transform: translateX(0);
    box-shadow: -0.5rem 0 2rem rgba(0, 0, 0, 0.4);
}
.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: var(--text-secondary); margin-bottom: 6px; }
#accountPanel .card-calc-table { font-size: 12px; line-height: 1.45; }
#accountPanel .card-calc-table th, #accountPanel .card-calc-table td { padding: 4px 8px; }
#accountPanel .card-calc-table th { color: var(--text-primary); border-bottom: 1px solid rgba(255,255,255,0.12); }
#accountPanel .card-calc-table td { border-bottom: 1px solid rgba(255,255,255,0.08); color: var(--text-primary); }
#accountPanel .card-calc-table tfoot td { border-top: 1px solid rgba(255,255,255,0.15); color: var(--text-primary); }
/* ===== СУПЕР-АДМИН: ПЛАТФОРМА ===== */
#superPanel {
    overflow-y: auto;
    justify-content: flex-start;
    align-items: stretch;
    flex: 1 1 100%;
}
#superPanel .super-plan {
    font-weight: 600;
}
#superPanel .acct-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(12px);
}
#superPanel .acct-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#superPanel .acct-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
#superPanel .acct-hero { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 10px 12px; }
#superPanel .acct-hero-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
#superPanel .acct-hero-val { font-size: 17px; font-weight: 700; color: var(--text-primary); }
#superPanel .acct-hero-val.inc { color: #00d68f; }
#superPanel .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);
}
#superPanel .input-sm option { background: #1a2332; color: var(--text-primary); }
#superPanel .super-company:hover { border-color: rgba(0,214,143,0.4); }
/* ===== БУХГАЛТЕРИЯ: ТЁМНЫЙ ДАШБОРД ===== */
#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; }

/* ======================================================
   БАЗЫ ДАННЫХ (dbPanel) + КОНТАКТЫ ЗАКАЗА + КОМИССИЯ
   ====================================================== */

/* Пикеры контактов в модалке заказа */
.oc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.oc-label { flex: 0 0 72px; font-size: 12px; color: var(--text-secondary); }
.oc-select { flex: 1; min-width: 0; background: var(--bg-input, #141b26); color: var(--text-primary); border: 1px solid var(--glass-border); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.oc-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.oc-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 12px; cursor: pointer; background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid transparent; user-select: none; }
.oc-chip.active { background: rgba(0,214,143,0.18); color: #00d68f; border-color: rgba(0,214,143,0.4); }

/* Панель Базы данных */
.db-count { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 20px; background: rgba(0,214,143,0.15); color: #00d68f; font-size: 11px; }
.db-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.03); margin-bottom: 6px; cursor: pointer; transition: background 0.15s; }
.db-row:hover { background: rgba(0,214,143,0.08); }
.db-name { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; min-width: 120px; }
.db-phone { font-size: 12px; color: var(--text-secondary); }
/* Телефон в базах данных — кликабельный (звонок) */
.db-phone-link { color: var(--accent); text-decoration: none; cursor: pointer; }
.db-phone-link:hover { text-decoration: underline; }
.db-metric { font-size: 12px; color: var(--text-secondary); background: rgba(255,255,255,0.05); padding: 3px 9px; border-radius: 20px; }
.db-table-row { cursor: pointer; }
.db-table-row:hover td { background: rgba(0,214,143,0.06); }
.db-stat-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; color: var(--text-primary); }
.db-order { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.03); margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.db-order:hover { background: rgba(0,214,143,0.08); }
.db-order-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.db-order-status { font-size: 11px; }

/* Тумблер комиссии в калькуляции */
.calc-commission-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); cursor: pointer; margin-left: auto; }
.calc-commission-toggle input { accent-color: var(--accent); }

/* ======================================================
   БАЗЫ ДАННЫХ: два модуля рядом (клиенты + контакты)
   ====================================================== */
#dbPanel { padding: 0; }
.db-workspace {
    display: grid;
    grid-template-columns: minmax(360px, 5fr) minmax(420px, 7fr);
    gap: 14px;
    align-items: start;
    justify-content: start;
    padding: 18px;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}
.db-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    min-width: 0;
}
.db-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.db-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.db-card-body { max-height: calc(100vh - 230px); overflow-y: auto; }
/* Внутренние вкладки секций — обычный flex, не absolute (в отличие от .workspace-tabs шапки) */
.db-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.db-tabs .ws-tab { padding: 0.3rem 0.7rem; font-size: 0.7rem; background: rgba(26,35,50,0.6); }

/* ===== QS-DROP: выпадающее меню быстрых форм (базовый чертёж) =====
   Десктоп (>900px): 4 фигуры показаны ПОДРЯД (как раньше в вебе), без выпадашки.
   Мобильный (≤900px): сворачивается в кнопку qsCurrent → дропдаун (mobile.css). */
.qs-drop {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.qs-drop .qs-btn.qs-current {
    display: none; /* на десктопе кнопка-«текущая фигура» не нужна — фигуры видны сразу */
}
.qs-drop .qs-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    position: static;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: 0;
}
.qs-drop.open .qs-menu {
    display: flex;
}
.qs-drop.open .qs-btn.qs-current {
    background: var(--accent);
    color: #0b0f17;
}
.qs-drop .qs-menu .qs-btn {
    width: 2.6rem;
    height: 2.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}
.qs-drop .qs-menu .qs-btn.btn-active {
    background: rgba(0, 214, 143, 0.18);
}

/* ===== Мобильная кнопка DEL (аналог клавиши Delete) =====
   Плавает поверх канваса снизу по центру; видна только когда
   на чертеже что-то выделено (класс .show вешает canvas.js). */
#mobileDelBtn {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%);
    z-index: 1300;
    padding: 0.7rem 1.4rem;
    border-radius: 0.9rem;
    border: 0.0625rem solid var(--accent-red);
    background: rgba(224, 36, 94, 0.92);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.45);
}
#mobileDelBtn.show {
    display: block;
}
#mobileDelBtn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Мобильные плавающие кнопки (кубики) — видны ТОЛЬКО на мобильном (см. mobile.css) */
.canvas-mats-fab,
.canvas-razmetka-fab {
    display: none;
}

/* Меню переходов статусов — только на мобильном (см. mobile.css) */
.slide-next-menu {
    display: none;
}

/* Кнопка удаления — только мобильная (см. mobile.css), на вебе скрыта */
#mobileDelBtn {
    display: none;
}

/* Сохранённый комментарий в «Проекте» — сообщение с рамкой (как в чате) */
.project-comment-bubble {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.project-comment-bubble-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}
.project-comment-bubble-text {
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

/* ===== ШАБЛОН ФОТО «До / После» (модуль-капсула) ===== */
.pf-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.pf-module {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    aspect-ratio: 8 / 3;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    box-sizing: border-box;
}
/* Пунктир — только у пустых половинок; заполненная половинка — сплошная.
   Центральный разделитель — всегда пунктир. */
.pf-half {
    flex: 1;
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed rgba(128, 145, 168, 0.55);
    box-sizing: border-box;
}
.pf-half.left {
    border-right: none;
    border-top-left-radius: 0.75rem;
    border-bottom-left-radius: 0.75rem;
}
.pf-half.right {
    border-left: none;
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}
.pf-half.filled {
    border-style: solid;
    border-color: rgba(128, 145, 168, 0.85);
}
.pf-half.pf-empty {
    cursor: pointer;
    transition: background 0.15s;
}
.pf-half.pf-empty:hover { background: rgba(0, 214, 143, 0.06); }
.pf-divider {
    width: 0;
    border-left: 2px dashed rgba(128, 145, 168, 0.55);
    flex-shrink: 0;
}
/* Одинокая половинка (режим «Только фото после» / не хватает второй) */
.pf-module-single .pf-half {
    border: 2px dashed rgba(128, 145, 168, 0.55);
    border-radius: 0.75rem;
}
.pf-module-single .pf-half.filled {
    border-style: solid;
    border-color: rgba(128, 145, 168, 0.85);
}
.pf-half-label {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 2px 10px;
    border-radius: 12px;
    z-index: 2;
    pointer-events: none;
    text-transform: uppercase;
    white-space: nowrap;
}
.pf-half-label.do { color: #4da3ff; background: rgba(6, 10, 16, 0.72); }
.pf-half-label.posle { color: #00d68f; background: rgba(6, 10, 16, 0.72); }
.pf-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pf-plus {
    font-size: 30px;
    font-weight: 300;
    color: rgba(128, 145, 168, 0.8);
    line-height: 1;
}
.pf-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.pf-add-more {
    margin-top: 10px;
}

/* ===== ПОРТФОЛИО ===== */
.portfolio-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 16, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}
.portfolio-panel {
    width: min(1200px, 100%);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.portfolio-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
}
.portfolio-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.portfolio-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.portfolio-search {
    width: min(280px, 100%);
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}
.portfolio-search:focus { border-color: var(--accent); }
.portfolio-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}
.portfolio-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 40px 10px;
    line-height: 1.7;
}
.portfolio-empty-sm {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 12px;
}
.portfolio-card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    cursor: pointer;
    z-index: 1;
    transition: border-color 0.15s, transform 0.15s, z-index 0s;
}
.portfolio-card:hover {
    border-color: var(--accent);
    z-index: 20;
}
.portfolio-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(90deg, rgba(0, 214, 143, 0.12), rgba(0, 0, 0, 0));
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0.75rem 0.75rem 0 0;
}
.portfolio-card-icon { font-size: 20px; }
.portfolio-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portfolio-card-addr {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Сетка портфолио: по 3 карточки в ряд */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    align-items: start;
}
/* Компактные «эскизы» в списке портфолио — маленькие, по клику увеличиваются */
.portfolio-sketches {
    padding: 10px 12px;
}
.portfolio-sketches .pf-module {
    width: 100%;
    aspect-ratio: 7 / 2;
}
/* Разворот при наведении: если фото несколько — показываем поверх карточек ниже */
.portfolio-hover-panel {
    position: absolute;
    top: calc(100% - 4px);
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.portfolio-card:hover .portfolio-hover-panel {
    display: flex;
}
.portfolio-hover-panel .pf-module {
    width: 100%;
    aspect-ratio: 7 / 2;
}
/* Подсветка модуля при наведении (фото можно выбрать и увеличить кликом) */
.portfolio-sketches .pf-module:hover,
.portfolio-hover-panel .pf-module:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 214, 143, 0.25);
}
.portfolio-sketches .pf-module:hover .pf-half,
.portfolio-hover-panel .pf-module:hover .pf-half {
    border-color: var(--accent);
}
.portfolio-sketches .pf-module:hover .pf-half.filled,
.portfolio-hover-panel .pf-module:hover .pf-half.filled {
    border-color: var(--accent);
}
/* Наведение на шапку адреса — подсвечиваются ВСЕ фото заказа */
.portfolio-card-head:hover + .portfolio-sketches .pf-module,
.portfolio-card-head:hover ~ .portfolio-hover-panel .pf-module {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 214, 143, 0.25);
}
.portfolio-card-head:hover + .portfolio-sketches .pf-half,
.portfolio-card-head:hover ~ .portfolio-hover-panel .pf-half {
    border-color: var(--accent);
}

/* ===== ГАЛЕРЕЯ (портфолио) ===== */
.portfolio-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    align-items: start;
}
.portfolio-gallery-photo {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0.75rem;
    cursor: zoom-in;
    border: 1px solid var(--glass-border);
    transition: border-color 0.15s, transform 0.15s;
    display: block;
}
.portfolio-gallery-photo:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

/* ===== ЛАЙТБОКС (просмотр фото в галерее) ===== */
.portfolio-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 9, 0.92);
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    box-sizing: border-box;
}
.portfolio-lightbox img {
    max-width: calc(100% - 140px);
    max-height: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}
.portfolio-lb-nav {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.portfolio-lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.portfolio-lightbox .slide-close {
    position: absolute;
    top: 16px;
    right: 18px;
}

/* ===== ГАЛОЧКИ-ФИЛЬТРЫ портфолио ===== */
.portfolio-filters {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-left: auto;
}
.pf-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}
.pf-check input {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
/* Увеличенное «До / После» */
.portfolio-detail-panel {
    width: min(1100px, 100%);
}
.portfolio-detail-overlay { z-index: 2100; }
.portfolio-detail-head {
    text-align: center;
    margin-bottom: 14px;
}
.portfolio-detail-modules {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.portfolio-detail-modules .pf-module {
    aspect-ratio: 16 / 5;
    border-width: 3px;
}

/* ===== ДОГОВОРЫ: модалка + бейджи ===== */
.contract-type-tab { border: 1px solid var(--glass-border) !important; }
.contract-type-tab.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}
#contractModal .modal-body { max-height: 70vh; overflow-y: auto; }
.card-contract-badge {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; padding: 1px 5px; border-radius: 5px;
    background: rgba(0,214,143,.12); color: var(--accent);
}
.card-contract-badge.warn { background: rgba(255,107,107,.14); color: #ff6b6b; }
.card-mounters {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
    font-size: 10px; color: var(--text-secondary);
}
.card-mounters span { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 4px; padding: 1px 5px; }

/* ===== СТРОИТЕЛЬ ПОТОЛКА (построение через рисование/дальномер) =====
   Полноэкранный модальный редактор; на десктопе — центр канваса. */
.mbuilder-modal {
    position: fixed;
    /* Полноэкранный редактор: непрозрачный фон как у основного канваса,
       чтобы панели/модули не просвечивали обложку приложения. */
    background: #0b0f17;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.mbuilder-modal .mb-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--canvas-bg, #0e1420);
    touch-action: none;
    display: block;
}
/* Верхний модуль: площадь/углы/периметр — на всю ширину до крестика */
.mbuilder-modal .mb-top {
    position: absolute;
    top: 0.75rem; left: 0.75rem; right: 3.4rem;
    display: flex; align-items: center; justify-content: space-around;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.85rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 20;
}
.mbuilder-modal .mb-top-close {
    position: absolute;
    top: 0.55rem; right: 0.55rem;
    z-index: 21;
    width: 2.2rem; height: 2.2rem;
}
.mbuilder-modal .mb-title { font-size: 0.95rem; font-weight: 600; flex: 0 0 auto; }
/* Метрики: 3 колонки (Площадь / Углы / Периметр) — заголовки + белые цифры */
.mbuilder-modal .mb-metric {
    display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
    min-width: 0; flex: 1 1 0;
}
.mbuilder-modal .mb-metric-label {
    font-size: 0.68rem; color: var(--text-secondary); letter-spacing: 0.02em;
    white-space: nowrap;
}
.mbuilder-modal .mb-metric-value {
    font-size: 0.92rem; font-weight: 700; color: var(--text-primary);
    white-space: nowrap;
}
/* Строка ввода стороны: компактная, по центру сверху под метриками */
.mbuilder-modal .mb-side-row {
    position: absolute;
    bottom: 4.2rem; left: 50%;
    transform: translateX(-50%);
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--glass-bg);
    border-radius: 2rem;
    padding: 0.4rem 0.8rem; border: 0.0625rem solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 45;
    max-width: 92%;
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.35);
    transition: bottom 0.15s;
}
/* Кнопка «Готово» для ВЕБА (в построителе). На мобильном скрыта — там #mbKeypadDone.
   Ставим в правый нижний угол, чтобы не перекрывать центрированные панели/меню. */
.mbuilder-modal .mb-done-web {
    display: none;
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 60;
    min-width: 8rem;
    justify-content: center;
}
@media (min-width: 901px) {
    .mbuilder-modal .mb-done-web { display: inline-flex; }
}
.mbuilder-modal .mb-back-draw {
    flex: 0 0 auto;
    min-width: 2.4rem;
    min-height: 2.4rem;
    padding: 0.4rem 0.55rem;
    border-radius: 1.3rem;
    font-size: 1.05rem;
}
/* Кнопка «назад» при замкнутом контуре / настройке углов — СНИЗУ СЛЕВА, чтобы
   не перекрывать чертёж и углы сверху (раньше стояла top:3.6rem и закрывала угол). */
.mbuilder-modal .mb-back-corner {
    position: absolute;
    bottom: 4.6rem; left: 0.75rem; top: auto;
    z-index: 20;
    min-width: 2.6rem;
    min-height: 2.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 1.5rem;
    font-size: 1.15rem;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.35);
}
.mbuilder-modal .mb-side-row .mb-side-name { font-size: 1.1rem; font-weight: 700; color: var(--accent); min-width: 1.9rem; text-align: center; }
.mbuilder-modal .mb-side-input {
    flex: 1; font-size: 1.25rem; font-weight: 700; text-align: center;
    background: transparent; border: none; color: var(--text-primary);
    outline: none; min-height: 2.1rem; min-width: 4rem; max-width: 8rem;
    caret-color: var(--accent);
}
.mbuilder-modal .mb-angle-custom { caret-color: var(--accent); }
.mbuilder-modal .mb-side-unit { font-size: 0.85rem; color: var(--text-secondary); }
/* Кнопка «Вернуться» к рисованию (внутри нижней панели) */
.mbuilder-modal .mb-back-edit {
    display: none;
}
/* Нижний модуль: кнопки по центру — центрировать/назад·рисовать/очистить/фигуры/сохранить */
.mbuilder-modal .mb-drawbar {
    position: absolute;
    bottom: 0.75rem; left: 50%;
    transform: translateX(-50%);
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 2rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 20;
    flex-wrap: nowrap;
    max-width: 94%;
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.35);
}
.mbuilder-modal .mb-draw-btn {
    flex: 0 0 auto;
    min-width: 2.6rem;
    padding: 0.5rem 0.6rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 1.5rem;
}
.mbuilder-modal .mb-save-btn { min-width: 2.8rem; }
.mbuilder-modal .mb-angles-done-btn {
    flex: 0 0 auto;
    min-width: 6rem;
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
}
.mbuilder-modal .mb-angles-done-btn.mb-disabled {
    opacity: 0.4;
    pointer-events: none;
}
/* СВОЯ цифровая клавиатура (не системная) */
.mbuilder-modal .mb-keypad {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(15, 20, 30, 0.98);
    border-top: 0.0625rem solid var(--glass-border);
    border-radius: 1rem 1rem 0 0;
    padding: 0.2rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 40;
}
.mbuilder-modal .mb-keypad-handle {
    width: 3rem; height: 0.3rem;
    background: rgba(255,255,255,0.35);
    border-radius: 1rem;
    margin: 0.35rem auto 0.5rem;
    cursor: pointer;
}
.mbuilder-modal .mb-keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}
.mbuilder-modal .mb-key {
    background: var(--bg-card, #1a2332);
    border: 0.0625rem solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 0.6rem 0;
    border-radius: 0.6rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.mbuilder-modal .mb-key:active { background: var(--bg-secondary, #243044); }
.mbuilder-modal .mb-key-empty { visibility: hidden; }
.mbuilder-modal .mb-key-del { color: #ff9500; }
.mbuilder-modal .mb-key-comma { color: var(--accent, #00d68f); }
.mbuilder-modal .mb-key-ok { color: var(--accent, #00d68f); font-weight: 700; }
.mbuilder-modal .mb-key-done {
    grid-column: span 2;
    color: var(--accent, #00d68f);
    font-weight: 700;
    font-size: 0.8rem;
    background: rgba(0, 214, 143, 0.12);
}
.mbuilder-modal .mb-key-done.mb-disabled {
    color: var(--text-secondary, #8b98ad);
    background: transparent;
    opacity: 0.45;
    pointer-events: none;
}
/* ===== СВОЯ ЦИФРОВАЯ КЛАВИАТУРА основного чертежа ===== */
.cv-keypad {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(15, 20, 30, 0.98);
    border-top: 0.0625rem solid var(--glass-border);
    border-radius: 1rem 1rem 0 0;
    padding: 0.2rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 1400;
}
.cv-keypad-handle {
    width: 3rem; height: 0.3rem;
    background: rgba(255,255,255,0.35);
    border-radius: 1rem;
    margin: 0.35rem auto 0.5rem;
    cursor: pointer;
}
.cv-keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}
.cv-key {
    background: var(--bg-card, #1a2332);
    border: 0.0625rem solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 0.6rem 0;
    border-radius: 0.6rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.cv-key:active { background: var(--bg-secondary, #243044); }
.cv-key-empty { visibility: hidden; }
.cv-key-del { color: #ff9500; }
.cv-key-comma { color: var(--accent, #00d68f); }
.cv-key-ok { color: var(--accent, #00d68f); font-weight: 700; }
.cv-key-apply {
    color: var(--accent, #00d68f);
    font-weight: 700;
    background: rgba(0, 214, 143, 0.12);
}
/* При открытой клавиатуре строка ввода поднимается НАД ней (список/чертёж не трогаем) */
.modal-canvas.cv-kb-open .context-input-row {
    position: fixed;
    left: 0; right: 0;
    z-index: 1401;
    background: rgba(15, 20, 30, 0.98);
    border-top: 0.0625rem solid var(--glass-border);
    box-shadow: 0 -0.5rem 1.5rem rgba(0,0,0,0.35);
    transition: bottom 0.15s;
}
.mbuilder-modal .mb-qs-wrap { position: relative; display: inline-flex; }
.mbuilder-modal .mb-qs-btn { position: relative; }
.mbuilder-modal .mb-qs-menu {
    position: absolute;
    bottom: calc(100% + 0.4rem);
    left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: row; gap: 0.25rem;
    background: var(--bg-card);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.4rem;
    z-index: 30;
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.3);
    white-space: nowrap;
}
.mbuilder-modal .mb-qs-item {
    background: transparent; border: none; color: var(--text-primary);
    font-size: 0.85rem; text-align: left; padding: 0.4rem 0.5rem;
    border-radius: 0.5rem; cursor: pointer; white-space: nowrap;
}
.mbuilder-modal .mb-qs-item:hover { background: var(--bg-secondary); }
.mbuilder-modal .mb-qs-item.active { color: var(--accent); font-weight: 600; }
/* Кнопка дальномера: плавающая, подключение поверх окон, зелёная при подключении */
.mbuilder-modal .mb-rf-fab {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.4rem 0.5rem;
    flex: 0 0 auto;
}
.mbuilder-modal .mb-rf-fab svg { display: block; }
.mbuilder-modal .mb-rf-fab.mb-rf-connected {
    border-color: var(--accent, #00d68f);
    color: var(--accent, #00d68f);
    background: rgba(0, 214, 143, 0.12);
}
/* ===== Панели ввода (появляются после замыкания) ===== */
.mbuilder-modal .mb-panels {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 0.75rem; gap: 0.5rem;
    pointer-events: none;
    z-index: 42;
    overflow-y: auto;
}
.mbuilder-modal .mb-panels > * { pointer-events: auto; }
/* Сообщение «Потолок построен» — выше нижней панели кнопок */
.mbuilder-modal .mb-built {
    position: fixed;
    top: 5.4rem; left: 50%;
    transform: translateX(-50%);
    width: auto; max-width: 92%;
    z-index: 50;
    margin-bottom: 0;
    text-align: center;
}
/* Статус дальномера — выше нижней панели кнопок. pointer-events:none, чтобы
   надпись «замер…» НЕ перехватывала тапы по клавиатуре; кликабельны только кнопки. */
.mbuilder-modal #mbRfStatus { margin-bottom: 8rem; pointer-events: none; }
.mbuilder-modal #mbRfStatus button,
.mbuilder-modal #mbRfStatus [data-rfdev],
.mbuilder-modal #mbRfStatus a { pointer-events: auto; }
.mbuilder-modal .mb-contour { width: 100%; justify-content: center; }
.mbuilder-modal .mb-info { font-size: 0.8rem; color: var(--text-secondary); }
.mbuilder-modal .mb-angle-panel {
    background: var(--glass-bg);
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.85rem; padding: 0.5rem 0.75rem;
    width: 100%;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
/* Вопрос об углах: две кнопки РЯДОМ, одного цвета, крупные, панель в самом низу */
.mbuilder-modal .mb-angle-q {
    border-radius: 1.2rem;
    padding: 0.6rem 0.6rem;
}
.mbuilder-modal .mb-actions-q {
    display: flex; flex-direction: row; gap: 0.6rem; width: 100%;
    flex-wrap: nowrap;
}
.mbuilder-modal .mb-qbtn {
    flex: 1 1 0;
    padding: 0.7rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mbuilder-modal .mb-angle-panel .mb-info { display: block; }
.mbuilder-modal .mb-hint { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45; text-align: center; }
.mbuilder-modal .mb-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.mbuilder-modal .mb-result {
    background: var(--glass-bg); border-radius: 0.85rem; padding: 0.75rem;
    border: 0.0625rem solid var(--glass-border);
    display: flex; flex-direction: column; gap: 0.4rem;
    width: 100%;
}
.mbuilder-modal .mb-angle-row {
    display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0;
    border-bottom: 0.0625rem solid var(--border); flex-wrap: wrap; justify-content: center;
}
.mbuilder-modal .mb-angle-input {
    width: 4.5rem; padding: 0.4rem; background: var(--bg-secondary);
    border: 0.0625rem solid var(--border); border-radius: 0.375rem;
    color: var(--text-primary); font-size: 0.85rem;
}

/* ===== Отправка в работу (меню) ===== */
.nom-picker.ord-picker { width: min(380px, 94vw); overflow: hidden; }
/* Фиксированные блоки меню не сжимаются — прокручивается только номенклатура */
.nom-picker.ord-picker > * { flex-shrink: 0; }
.ord-ceil {
    border: 0.0625rem solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.55rem;
    margin-bottom: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
}
.ord-ceil-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; }
.ord-ceil-fabric { color: var(--text-secondary); font-size: 0.72rem; text-align: right; }
.ord-ceil-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.ord-ceil-row .ord-harpoon { flex: 1; min-width: 0; }
.ord-spec { font-size: 0.75rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.25rem; }
.ord-done-badge { color: var(--accent); font-weight: 700; font-size: 0.72rem; margin-left: 0.4rem; }
.ord-done-badge.warn { color: #ffb74d; }
/* Список позиций в меню отправки: своя прокрутка, кнопки «Отправить/Отмена» всегда видны */
.nom-picker.ord-picker .ord-pos-list { flex: 1 1 auto; min-height: 4.5rem; overflow-y: auto; border: 0.0625rem solid var(--glass-border); border-radius: 0.5rem; padding: 0.25rem; }
/* Список потолков в меню отправки — ограничен по высоте со своей прокруткой */
.nom-picker.ord-picker .ord-ceil-list { max-height: 8.5rem; overflow-y: auto; }
.ord-pos { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.35rem; border-radius: 0.35rem; font-size: 0.76rem; cursor: pointer; }
.ord-pos:hover { background: rgba(255,255,255,0.05); }
.ord-pos-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-pos-qty { color: var(--text-secondary); white-space: nowrap; font-size: 0.72rem; }
.ord-pos-ordered { opacity: 0.55; }
.ord-pos-empty { padding: 0.5rem; font-size: 0.75rem; color: var(--text-secondary); text-align: center; }
/* Отметка «заказано» в смете закупа */
.calc-row.calc-ordered .calc-name { opacity: 0.75; }
.calc-ord-mark { color: var(--accent); font-size: 0.68rem; font-weight: 700; margin-left: 0.35rem; white-space: nowrap; }

/* ===== ПОДПИСКА: бейдж в шапке + баннер ===== */
.sub-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    cursor: pointer;
    white-space: nowrap;
}
.sub-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
    border-bottom: 1px solid rgba(239, 68, 68, 0.35);
}
