/* ── Studio: Problems / Run / Kanban / Gantt / Device ── */
.side-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Кнопки действий доски используют стандартную чёрную заливку; цвет остаётся у иконки. */
.side-toolbar .board-action-dark {
    border: 1px solid var(--border);
    background: var(--bg-app);
}
.side-toolbar .board-action-dark:hover,
.side-toolbar .board-action-dark:focus-visible {
    border-color: var(--text-main);
    background: var(--bg-active);
}
.board-actualize-btn {
    color: #3b82f6;
    background: var(--bg-app);
    border: 1px solid var(--border);
}
.board-actualize-btn:hover,
.board-actualize-btn:focus-visible {
    color: #60a5fa;
    border-color: var(--text-main);
    background: var(--bg-active);
}
.side-toolbar .board-clear-btn { color: #ef4444; border-color: rgba(239, 68, 68, .55); }
.side-toolbar .board-clear-btn:hover,
.side-toolbar .board-clear-btn:focus-visible { color: #fecaca; background: rgba(127, 29, 29, .45); border-color: #ef4444; }
.side-toolbar.wrap { flex-wrap: wrap; }
.side-toolbar .board-action-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius-xs);
}
.side-toolbar .board-action-btn svg,
.side-toolbar .board-action-btn img {
    width: 16px;
    height: 16px;
    display: block;
    pointer-events: none;
}
.side-toolbar .board-action-btn svg { fill: currentColor; }
.side-toolbar .board-action-btn img { object-fit: contain; }
.side-toolbar .board-actualize-btn img { filter: brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1971%) hue-rotate(202deg) brightness(98%) contrast(96%); }
.side-toolbar #btnGoalEdit img { filter: brightness(0) saturate(100%) invert(53%) sepia(77%) saturate(464%) hue-rotate(91deg) brightness(93%) contrast(88%); }
.side-toolbar #btnKaizenAdd { color: #3b82f6; }
.side-toolbar #btnKaizenAdd:hover,
.side-toolbar #btnKaizenAdd:focus-visible { color: #60a5fa; }
.side-toolbar .board-action-add { color: #b7f7ce; background: #176b3e; }
.side-toolbar .board-action-add:hover { background: #238753; }
.side-hint { padding: 0 10px 8px; margin: 0; }
.side-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.side-panel[hidden] {
    display: none !important;
}
.devbook-consent-list { display: grid; gap: 8px; }
.devbook-consent-list label { display: flex; align-items: flex-start; gap: 7px; }
.devbook-research-button { display: inline-flex; align-items: center; gap: 7px; }
.devbook-research-button img { width: 16px; height: 16px; object-fit: contain; filter: saturate(1.2); }
.side-panel > .search-results,
.side-panel > .problems-list,
.side-panel > .kanban-board,
.side-panel > .gantt-chart,
.side-panel > .cal-grid,
.side-panel > .goals-strip,
.side-panel > .kaizen-list,
.side-panel > .device-list,
.side-panel > .mobile-actions,
.side-panel > .mobile-out,
.side-panel > .ui-tree,
.side-panel > .run-log,
.side-panel > .worktrace-body {
    overflow: auto;
}
#ganttPanel > .gantt-chart {
    overflow: hidden;
}
.problems-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    flex: 1;
    overflow: auto;
}
.problems-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
}
.problems-panel-head #btnProblemsFix { margin-left: auto; }
.problems-search {
    margin: 8px 10px 0;
    width: calc(100% - 20px);
    flex: 0 0 auto;
}
#problemsSidePanel {
    user-select: text;
    -webkit-user-select: text;
}
.prob-line {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    color: var(--text-main);
    background: rgba(127, 29, 29, .14);
    border: 1px solid rgba(248, 113, 113, .32);
    border-left: 3px solid #ef4444;
    border-radius: 4px;
    margin: 0 0 6px;
    padding: 7px 34px 7px 8px;
    cursor: pointer;
    font: inherit;
    user-select: text;
    -webkit-user-select: text;
}
.prob-dismiss {
    position: absolute;
    top: 5px;
    right: 6px;
    min-width: 20px;
    height: 20px;
    margin: 0;
    border: 0;
    border-radius: 3px;
    color: #fca5a5;
    background: transparent;
    cursor: pointer;
    font: 700 18px/18px var(--font-ui);
}
.prob-dismiss:hover,
.prob-dismiss:focus-visible { color: #fff; background: rgba(239, 68, 68, .45); }
.prob-line:hover { background: rgba(127, 29, 29, .28); }
.prob-line.is-fixed {
    border-left-color: #22c55e;
    border-color: rgba(74, 222, 128, .46);
    background: rgba(20, 83, 45, .24);
}
.prob-line.is-fixed:hover { background: rgba(20, 83, 45, .38); }
.prob-line.is-fixed strong { color: #86efac; }
.prob-line small { display: block; margin-top: 4px; color: #86efac; }
.prob-line.is-pending { border-left-color: #22c55e; border-color: rgba(74, 222, 128, .35); background: rgba(20, 83, 45, .18); }
.prob-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-left: 3px solid #ef4444;
    background: linear-gradient(135deg, rgba(239,68,68,0.12), transparent 70%);
    cursor: pointer;
    font-size: 11px;
}
.prob-item.sev-warning,
.prob-item.sev-warn {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.12), transparent 70%);
}
.prob-item.sev-info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent 70%);
}
.prob-item.active,
.prob-item:hover { border-color: var(--text-dim); }
.prob-item .sev {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: #f87171;
}
.prob-item.sev-warning .sev,
.prob-item.sev-warn .sev { color: #fbbf24; }
.prob-item .msg { color: var(--text-main); line-height: 1.35; }
.prob-item .loc {
    font-family: var(--font-code);
    font-size: 10px;
    color: var(--text-dim);
}
.prob-line { cursor: pointer; }
.prob-line:hover { background: rgba(255,255,255,0.04); }
.run-ops {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 10px;
    flex-shrink: 0;
}
.run-ops-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 2px 2px 4px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.run-ops-kicker {
    color: #8eea9b;
    font: 700 11px/1 var(--font-code);
    letter-spacing: .14em;
}
.run-ops-caption {
    color: var(--text-dim);
    font-size: 10px;
}
.run-device-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 0;
    flex-shrink: 0;
}
.run-device-serial {
    flex: 1;
    min-width: 0;
    font-size: 10px;
    font-family: Consolas, 'Cascadia Code', monospace;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.run-device-serial.ok { color: var(--text-main); }
.run-ops .btn {
    width: 100%;
    font-size: 11px;
    padding: 6px 8px;
}
.run-ops .run-ops-span {
    grid-column: 1 / -1;
}
.run-side-hint {
    padding: 0 10px 6px;
    flex-shrink: 0;
}
.np-progress-panel {
    margin-top: 10px;
}
.np-prog-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.np-prog-track .comp-prog-fill {
    transition: width 0.35s ease;
}
.np-create-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.np-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.run-ops .run-ops-device {
    border-color: rgba(90, 170, 255, 0.35);
}
/* Терминал в колонке Run — на всю оставшуюся высоту */
.side-panel.run-side {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}
.run-term {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    background: #000;
}
.run-term-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-app);
}
.term-activity {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    color: var(--text-dim);
}
.term-activity[data-state="run"] {
    color: #3dd68c;
}
.term-activity[data-state="run"]::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #3dd68c;
    box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.55);
    animation: term-pulse 1.1s ease-out infinite;
    vertical-align: middle;
}
.term-activity[data-state="wait"] {
    color: #e8a838;
}
.term-activity[data-state="wait"]::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #e8a838;
    vertical-align: middle;
}
.term-activity[data-state="idle"] {
    color: var(--text-dim);
    font-weight: 500;
}
@keyframes term-pulse {
    0% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(61, 214, 140, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0); }
}
.term-activity-bar {
    flex-shrink: 0;
    height: 3px;
    background: #1a2030;
    overflow: hidden;
}
/* высота всегда 3px — не [hidden], иначе xtermHost прыгает и fit дёргает экран */
.term-activity-bar.is-idle {
    opacity: 0;
    pointer-events: none;
}
.term-activity-bar.is-idle > i {
    animation: none;
    transform: none;
}
.term-activity-bar > i {
    display: block;
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, #3dd68c, #5b8def, #3dd68c);
    background-size: 200% 100%;
    animation: term-bar 1.2s linear infinite;
}
.term-activity-bar.is-wait > i {
    background: linear-gradient(90deg, #e8a838, #f0c14a, #e8a838);
    background-size: 200% 100%;
}
@keyframes term-bar {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}
.run-term-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.run-term .xterm-host {
    flex: 1;
    min-height: 0;
    padding: 4px 6px 22px;
}

/* Goals */
.goals-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
.goal-chip {
    padding: 8px;
    border: 1px solid var(--border);
    border-left: 3px solid #ff6bcb;
    background: linear-gradient(90deg, rgba(255, 107, 203, .24), transparent);
}
.goal-title { font-size: 12px; font-weight: 600; color: var(--text-main); }
.goal-description {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-dim);
    white-space: pre-line;
}
.goal-bar {
    margin-top: 6px;
    height: 7px;
    background: #1a2030;
    border: 1px solid var(--border);
    overflow: hidden;
}
.goal-bar > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #ff6bcb, #ff9cda);
    transition: width 0.35s ease;
}
.goal-meta { margin-top: 4px; font-size: 10px; color: var(--text-dim); }

/* Kanban */
#kanbanPanel.side-panel {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
}
#kanbanPanel > .side-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-panel);
}
#kanbanPanel > .kanban-board,
#kanbanPanel > .goals-strip,
#kanbanPanel > .kaizen-list {
    overflow: visible;
}
.kanban-board {
    display: flex;
    gap: 6px;
    padding: 8px;
    /* Все колонки одной высоты: тянемся по самой высокой, чтобы пустая
       «В работе» была полноценной зоной приёма карточки. */
    align-items: stretch;
    min-height: 180px;
    overflow-x: auto;
    overflow-y: visible;
    isolation: isolate;
}
.kanban-col {
    flex: 1;
    min-width: 88px;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-top: 3px solid var(--c, #888);
}
.kanban-col-h {
    padding: 6px 8px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}
.kanban-add-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 6px;
    flex-shrink: 0;
}
.kanban-add-btn:hover { border-color: var(--text-dim); }
.kanban-cards {
    padding: 5px;
    /* Занимаем всю высоту колонки под заголовком: перетаскивание ловится
       по всей площади, а не в узкой полоске под шапкой. */
    flex: 1 1 auto;
    min-height: 90px;
}
.kanban-card {
    padding: 7px;
    margin-bottom: 5px;
    font-size: 11px;
    line-height: 1.3;
    border: 1px solid var(--border);
    border-left: 3px solid #5B8DEF;
    background: linear-gradient(145deg, #2a3344, #1c2230);
    color: var(--text-main);
    cursor: grab;
    /* Текст внутри карточки не выделяется: иначе Chromium начинает выделение
       вместо перетаскивания, и карточку нельзя утащить в соседнюю колонку. */
    user-select: none;
    -webkit-user-select: none;
    display: block;
    align-items: start;
    min-width: 0;
    box-sizing: border-box;
    position: relative;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.55; }
.kanban-col.drag-over,
.kanban-cards.drag-over {
    outline: 1px dashed #2ec4b6;
    background: rgba(46,196,182,0.06);
}
.kc-body {
    min-width: 0;
    overflow: hidden;
}
.kc-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.kc-description {
    margin-top: 4px;
    color: var(--text-main);
    font-size: 10px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}
.kc-meta {
    font-size: 10px;
    color: var(--text-dim, #94a3b8);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-card-tooltip {
    position: fixed;
    z-index: 1000;
    width: max-content;
    max-width: min(330px, calc(100vw - 20px));
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--text-main) 28%, var(--border));
    border-radius: 5px;
    background: #151b27;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .38);
    pointer-events: none;
}
.gantt-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 6px;
    position: relative;
}
.gantt-planned-end {
    position: absolute;
    top: 0;
    bottom: 0;
    box-sizing: border-box;
    background: #facc15;
    border: 1px solid #fde047;
    pointer-events: none;
    z-index: 2;
    box-shadow: inset 0 0 0 1px rgba(120, 82, 0, .24);
}
.gantt-planned-end.is-history { opacity: .72; }
.gantt-planned-end.is-current { opacity: 1; }
.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 6px 10px;
    color: var(--text-dim);
    font-size: 10px;
    border-bottom: 1px solid var(--border);
}
.gantt-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.gantt-legend-swatch { display: inline-block; width: 18px; height: 8px; border-radius: 2px; }
.gantt-legend-swatch.is-bar { background: #22c55e; }
.gantt-legend-swatch.is-plan { width: 8px; height: 12px; background: #facc15; border: 1px solid #fde047; }
.gantt-legend-swatch.is-early { height: 0; width: 18px; border-top: 2px dashed #facc15; position: relative; }
.gantt-legend-swatch.is-early::after { content: ''; position: absolute; right: -1px; top: -4px; width: 6px; height: 6px; border-radius: 50%; background: #facc15; }
.gantt-early-finish-link {
    position: absolute;
    top: 11px;
    height: 0;
    border-top: 2px dashed #facc15;
    z-index: 4;
    pointer-events: auto;
    cursor: help;
}
.gantt-early-finish-link::before,
.gantt-early-finish-link::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #facc15;
    box-shadow: 0 0 0 1px rgba(120, 82, 0, .35);
}
.gantt-early-finish-link::before { left: -3px; }
.gantt-early-finish-link::after { right: -3px; }
.gantt-bar.is-early-finish { box-shadow: 0 0 0 1px rgba(255,255,255,0.35), 0 0 0 3px rgba(34,197,94,.12); }

/* Kaizen */
.kaizen-list {
    padding: 8px 10px 12px;
    border-top: 1px solid var(--border);
}
.kaizen-item {
    padding: 7px 8px;
    margin-bottom: 5px;
    font-size: 11px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(34,197,94,0.1), rgba(59,130,246,0.06));
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.kaizen-item .kaizen-body { flex: 1; min-width: 0; }
.kaizen-item[draggable="true"] { cursor: grab; }
.kaizen-item--dragging { opacity: .55; }

/* Gantt — шкала на всю высоту панели, скролл по задачам и вправо по годам */
.gantt-toolbar .gantt-focus-btn {
    margin-left: auto;
    min-width: 32px;
    font-size: 16px;
    line-height: 1;
    padding: 2px 8px;
}
.gantt-toolbar .gantt-focus-btn.is-on {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255,255,255,0.08);
}
#ganttPanel.side-panel {
    --gantt-calendar-height: min(260px, 42vh);
    overflow: hidden;
}
#ganttPanel .gantt-chart {
    flex: 1 1 auto;
    min-height: 120px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#ganttPanel .cal-grid {
    flex: 0 1 var(--gantt-calendar-height);
    height: var(--gantt-calendar-height);
    min-height: 120px;
    max-height: calc(100% - 148px);
    overflow: auto;
    background: var(--bg-panel);
}
.gantt-calendar-resizer {
    position: relative;
    flex: 0 0 7px;
    height: 7px;
    cursor: row-resize;
    touch-action: none;
    background: var(--border);
    z-index: 4;
}
.gantt-calendar-resizer::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 12px;
    left: 12px;
    height: 1px;
    background: var(--text-dim);
    opacity: .55;
}
.gantt-calendar-resizer:hover,
.gantt-calendar-resizer:focus-visible,
body.gantt-calendar-resizing .gantt-calendar-resizer {
    background: #4d617e;
    outline: none;
}
body.gantt-calendar-resizing,
body.gantt-calendar-resizing * {
    cursor: row-resize !important;
    user-select: none !important;
}
.gantt-chart {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.gantt-scroll {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
    padding: 8px 0 8px;
}
.gantt-canvas { min-width: 100%; }
.gantt-ruler-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-panel);
}
.gantt-ruler-spacer {
    flex-shrink: 0;
    height: 36px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-panel);
}
.gantt-ruler-track {
    position: relative;
    height: 36px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.gantt-ruler-months,
.gantt-ruler-days {
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
}
.gantt-ruler-months {
    top: 0;
    height: 14px;
}
.gantt-ruler-days {
    top: 14px;
    height: 22px;
}
.gantt-month-cell {
    position: absolute;
    top: 0;
    height: 14px;
    box-sizing: border-box;
    border-left: 1px solid rgba(255,255,255,0.22);
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-day-cell {
    position: absolute;
    top: 0;
    height: 22px;
    box-sizing: border-box;
    border-left: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gantt-day-cell > i {
    font-style: normal;
    font-size: 9px;
    color: var(--text-dim);
    line-height: 1;
}
.gantt-day-cell.is-weekend {
    background: rgba(255, 80, 80, 0.08);
}
.gantt-day-cell.is-weekend > i { color: #c88; }
.gantt-day-cell.is-month-start {
    border-left-color: rgba(255,255,255,0.28);
}
.gantt-day-cell.is-month-start > i {
    color: var(--text-main);
    font-weight: 700;
}
.gantt-month {
    position: absolute;
    top: 0;
    font-size: 9px;
    color: var(--text-dim);
    white-space: nowrap;
    transform: translateX(-50%);
}
.gantt-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    opacity: 0.85;
    pointer-events: none;
    z-index: 1;
}
.gantt-label {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-panel);
    padding: 0 6px 0 8px;
    box-sizing: border-box;
    height: 24px;
    line-height: 24px;
    border-right: 1px solid var(--border);
}
.gantt-goal-marker {
    position: absolute;
    top: 5px;
    width: 12px;
    height: 12px;
    background: #ff6bcb;
    border: 0;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255,255,255,.3), 0 0 8px rgba(255,107,203,.65);
    z-index: 3;
}
.gantt-lane {
    position: relative;
    height: 24px;
    flex-shrink: 0;
    background-color: #141820;
    background-repeat: repeat;
    border: 1px solid var(--border);
    border-left: none;
}
.gantt-bar {
    position: absolute;
    top: 3px;
    height: 16px;
    border-radius: 2px;
    font-size: 9px;
    line-height: 16px;
    color: #fff;
    overflow: visible;
    cursor: default;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.2), 0 2px 6px rgba(0,0,0,0.35);
    user-select: none;
}
.gantt-bar > i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(255,255,255,0.28);
    border-radius: 2px 0 0 2px;
    pointer-events: none;
}
.gantt-bar > span {
    position: relative;
    z-index: 1;
    padding: 0 8px;
    font-weight: 700;
    pointer-events: none;
}

/* Календарь под Gantt */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-content: start;
    gap: 1px;
    padding: 8px;
}
.cal-title,
.cal-list {
    grid-column: 1 / -1;
}
.cal-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-bottom: 6px;
    color: var(--text-main);
    font-size: 11px;
    font-weight: 700;
}
.cal-title .kc-btn:last-child { width: auto; padding: 0 4px; font-size: 10px; }
.cal-dow {
    padding: 4px 2px;
    color: var(--text-dim);
    font-size: 9px;
    font-weight: 700;
    text-align: center;
}
.cal-day {
    position: relative;
    min-height: 29px;
    padding: 5px;
    border: 1px solid transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 11px;
}
.cal-day:hover { border-color: var(--text-dim); background: var(--bg-active); }
.cal-day.muted { cursor: default; }
.cal-day.is-weekend { background: rgba(239, 68, 68, .10); color: #e9b0b0; }
.cal-day.is-weekend:hover { background: rgba(239, 68, 68, .16); }
.cal-day.today { border-color: #5b8def; }
.cal-day.has-ev { box-shadow: inset 2px 0 0 var(--c, #3b82f6); }
.cal-day.has-gantt { background: rgba(59, 130, 246, .20); }
.cal-day.has-gantt:hover { background: rgba(59, 130, 246, .30); }
.cal-goal-dot { width: 7px; height: 7px; background: #ff6bcb; transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.cal-goal-item { cursor: pointer; }
.cal-goal-item:hover { background: var(--bg-active); }
.cal-process-markers,
.cal-milestone-markers { position: absolute; display: flex; gap: 2px; pointer-events: none; }
.cal-process-markers { left: 5px; bottom: 4px; }
.cal-milestone-markers { right: 4px; top: 4px; }
.cal-process-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--process-c, #3b82f6); box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.cal-process-counter { align-self: center; color: #bfdbfe; font-size: 8px; line-height: 1; letter-spacing: -.3px; }
.cal-milestone-dot { width: 6px; height: 6px; background: var(--milestone-c, #facc15); transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.cal-list { display: grid; gap: 4px; padding-top: 8px; }
.cal-item { position: relative; padding: 5px 28px 5px 7px; border-left: 3px solid var(--c, #e8a838); background: var(--bg-app); font-size: 10px; }
.cal-ops { position: absolute; top: 3px; right: 4px; display: flex; }

/* Gantt focus: центр = гант+календарь; справа Foma; снизу только приказ */
.gantt-focus-host {
    display: none;
    pointer-events: none;
}
body.gantt-focus .gantt-focus-host {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    /* fallback если JS не проставил inline; JS ставит top/left/right/bottom точно */
    top: var(--titlebar-height, 36px);
    left: var(--activity-width, 48px);
    right: var(--right-panel-width, 380px);
    bottom: calc(var(--bottom-panel-height, 200px) + var(--statusbar-height, 24px));
    width: auto !important;
    height: auto !important;
    z-index: 60 !important;
    overflow: hidden !important;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    pointer-events: auto !important;
    box-sizing: border-box !important;
}
body.gantt-focus #ganttPanel.side-panel {
    min-height: 0 !important;
    height: 100% !important;
}
body.gantt-focus #ganttPanel .gantt-chart { min-height: 120px; }
body.gantt-focus #ganttPanel .cal-grid { max-height: none; }
body.gantt-focus .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    border: none !important;
    overflow: hidden !important;
    flex-shrink: 0;
    visibility: hidden !important;
    pointer-events: none !important;
}
body.gantt-focus .sidebar-head,
body.gantt-focus .sidebar-resizer {
    display: none !important;
}
body.gantt-focus .sidebar-body {
    overflow: hidden;
    min-height: 0;
}
body.gantt-focus .editor-area {
    opacity: 0 !important;
    pointer-events: none !important;
    position: relative;
    z-index: 0;
}
body.gantt-focus #ganttPanel,
body.gantt-focus #ganttFocusHost > #ganttPanel {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--bg-panel) !important;
    border: none !important;
    pointer-events: auto !important;
    visibility: visible !important;
}
/* на случай [hidden] после переноса */
body.gantt-focus #ganttPanel[hidden] {
    display: flex !important;
}
body.gantt-focus .activity-bar,
body.gantt-focus #rightPanel,
body.gantt-focus #bottomPanel,
body.gantt-focus .status-bar,
body.gantt-focus .titlebar {
    position: relative;
    z-index: 70;
}
/* в fullscreen: нижняя панель — только приказ */
body.gantt-focus #bottomPanel .b-tab[data-btab="logcat"] {
    display: none !important;
}
body.gantt-focus #ganttPanel .gantt-toolbar {
    flex: 0 0 auto !important;
}
body.gantt-focus #ganttPanel .gantt-chart {
    /* В fullscreen высота календаря задаётся тем же resizer-ом, что и в
       обычном режиме. Процентный flex-basis не должен перетягивать это
       значение после ручного перемещения границы. */
    flex: 1 1 auto !important;
    min-height: 160px !important;
    overflow: hidden !important;
}
body.gantt-focus #ganttPanel .gantt-scroll {
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: 0 !important;
}
/* живой календарь под гантом */
body.gantt-focus #ganttPanel .cal-grid {
    flex: 0 1 var(--gantt-calendar-height, 260px) !important;
    height: var(--gantt-calendar-height, 260px) !important;
    max-height: none !important;
    min-height: 120px !important;
    overflow: auto !important;
    border-top: 2px solid var(--border);
}

/* Calendar */
.cal-title,
.kaizen-list .cal-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    padding: 8px 10px 12px;
}
.cal-grid .cal-title {
    grid-column: 1 / -1;
}
.cal-dow {
    text-align: center;
    color: transparent;
    color: var(--text-dim);
    padding: 2px 0;
}
.cal-day {
    min-height: 32px;
    padding: 3px;
    font-size: 9px;
    border: 1px solid var(--border);
    background: #151a24;
    color: var(--text-dim);
    position: relative;
}
.cal-day.muted { opacity: 0.35; }
.cal-day.today {
    border-color: #f59e0b;
    box-shadow: inset 0 0 0 1px rgba(245,158,11,0.5);
}
.cal-day.has-ev {
    background: linear-gradient(145deg, color-mix(in srgb, var(--c, #3b82f6) 45%, #151a24), #151a24);
    color: #f1f5f9;
}
.cal-day.has-gantt {
    background: rgba(59, 130, 246, .20);
    box-shadow: inset 0 -2px 0 #3b82f6;
}
.cal-day.has-gantt:hover { background: rgba(59, 130, 246, .30); }

/* Окно задач дня */
.cal-day-window { width: min(560px, 92vw); }
/* список дня ниже форм StudioPrompt — иначе «Изменить» открывается под оверлеем */
.cal-day-modal.modal-overlay {
    z-index: 1100;
}
#workspaceFormModal.modal-overlay,
#workspacePromptModal.modal-overlay,
#workspaceConfirmModal.modal-overlay,
#confirmModal.modal-overlay {
    z-index: 10050;
}
.cal-day-section {
    margin: 10px 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}
.cal-day-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    background: #141820;
}
.cal-day-badge {
    flex: none;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    color: #fff;
    border-radius: 3px;
    foma-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-day-main { flex: 1; min-width: 0; }
.cal-day-name { color: var(--text-main); font-size: 12px; word-break: break-word; }
.cal-day-ops {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.cal-day-ops .btn { min-width: 72px; }

.cal-list {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.cal-item {
    padding: 6px 8px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--c, #E8A838);
    background: linear-gradient(90deg, color-mix(in srgb, var(--c, #E8A838) 20%, transparent), transparent);
    color: var(--text-main);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}
.cal-item .cal-ops { margin-left: auto; display: inline-flex; gap: 2px; }
.cal-day[data-date] { cursor: pointer; }
.cal-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Ход работы (операционка) ── */
.worktrace-panel .worktrace-body {
    overflow: auto;
    padding: 8px 10px 16px;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
}
.worktrace-hint { display: none !important; }
.wt-block {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border, #2a3140);
}
.wt-block:last-child { border-bottom: none; }
.wt-block h3 {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
}
.wt-route {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}
.wt-count {
    font-weight: 600;
    color: #E8A838;
    margin-left: 4px;
}
.wt-people, .wt-models, .wt-exec, .wt-feed {
    list-style: none;
    margin: 0;
    padding: 0;
}
.wt-person {
    display: grid;
    grid-template-columns: 12px minmax(52px, 0.65fr) minmax(64px, 0.9fr) 1.45fr;
    gap: 6px;
    align-items: baseline;
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #334155) 50%, transparent);
}
.wt-person.wt-busy-row {
    grid-template-columns: 12px auto 1fr;
}
.wt-person.wt-busy-row .wt-task {
    white-space: normal;
    color: #fca5a5;
}
.wt-model {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--border, #334155) 40%, transparent);
}
.wt-lamp { font-size: 10px; line-height: 1; }
.wt-person.is-free .wt-lamp { color: #22c55e; }
.wt-person.is-busy .wt-lamp { color: #ef4444; }
.wt-person.is-down .wt-lamp { color: #64748b; }
.wt-pn { font-weight: 600; color: var(--text-main, #e2e8f0); }
.wt-pr { color: var(--text-muted, #94a3b8); font-size: 11px; }
.wt-pt, .wt-mw {
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wt-person.is-busy .wt-pt { color: #fca5a5; }
.wt-mn {
    font-family: var(--font-code, Consolas, monospace);
    font-size: 11px;
    color: #38BDF8;
}
.wt-kpi {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}
.wt-kpi-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.wt-sub {
    margin: 10px 0 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.wt-kpi-i {
    background: color-mix(in srgb, #000 25%, transparent);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
}
.wt-kpi-i b {
    display: block;
    font-size: 14px;
    color: var(--text-main, #fff);
    font-variant-numeric: tabular-nums;
}
.wt-kpi-i span {
    font-size: 9px;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.wt-sprint { margin: 0 0 6px; }
.wt-exec li, .wt-feed-item {
    padding: 3px 0;
    font-size: 12px;
    line-height: 1.35;
}
.wt-feed-item {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 8px;
}
.wt-ft {
    color: var(--text-muted, #64748b);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.wt-fx { word-break: break-word; }
.wt-err { color: #E85D4C; }
.side-panel > .worktrace-body {
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.wt-director {
    flex: 1 1 auto;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    border-bottom: none !important;
    margin-bottom: 0 !important;
}
.wt-director .wt-feed {
    flex: 1 1 auto;
    min-height: 160px;
    foma-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}
.wt-approve-block { flex-shrink: 0; }
.wt-apr-hint { margin: 0 0 8px; }
.wt-apr-badge, .st-pending-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #E8A838;
    vertical-align: middle;
}
.wt-apr-result, .st-pending-result {
    border-left: 3px solid #E8A838;
    padding-left: 8px;
}
.st-card.is-waiting .st-live,
.st-live.is-waiting { color: #E8A838; }
.st-live-line.is-waiting { color: #E8A838; }
.wt-apr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--border, #334155) 60%, transparent);
}
.wt-apr-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.wt-apr-btns .foma-btn-yes,
.wt-apr-btns .foma-btn-no,
.st-pending-actions .btn {
    pointer-events: auto !important;
    position: relative;
    z-index: 3;
    cursor: pointer;
}

/* ── Студия ── */
.workspace-panel .workspace-body {
    overflow: auto;
    padding: 8px 10px 16px;
    flex: 1;
    min-height: 0;
}
.st-block { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border, #2a3140); }
.st-block h3 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
}
.st-block-pending {
    min-height: 140px;
}
.st-pending-list {
    foma-height: min(42vh, 420px);
    overflow: auto;
    padding-right: 4px;
}
.st-power { color: color-mix(in srgb, var(--st, #5B8DEF) 70%, #e2e8f0); }
.st-chain { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.45; }
.st-count { color: #E8A838; margin-left: 4px; }
.st-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.st-card {
    border: 1px solid var(--border, #334155);
    border-left: 3px solid var(--st, #5B8DEF);
    border-radius: 6px;
    padding: 10px;
    background: color-mix(in srgb, var(--st, #5B8DEF) 8%, transparent);
}
.st-card-top { display: flex; gap: 10px; align-items: flex-start; }
.st-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--st, #5B8DEF);
    background: #1e293b;
}
.st-avatar.is-fallback {
    background: linear-gradient(135deg, var(--st, #5B8DEF), #1e293b);
}
.st-id h4 { margin: 0 0 2px; font-size: 14px; }
.st-title { margin: 0; font-size: 12px; color: var(--st, #5B8DEF); }
.st-reports { margin: 2px 0 0; font-size: 11px; color: var(--text-muted, #94a3b8); }
.st-zone { margin: 8px 0 6px; font-size: 12px; line-height: 1.35; }
.st-stacks { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.st-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border, #334155);
}
.st-meta { margin: 2px 0; font-size: 11px; color: var(--text-muted, #94a3b8); }
.st-live {
    margin-left: 4px;
    font-size: 14px;
    line-height: 1;
    color: #22c55e; /* свободен — зелёный по умолчанию */
    text-shadow: 0 0 6px color-mix(in srgb, currentColor 55%, transparent);
}
.st-rank {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    min-width: 0;
    text-align: center;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid color-mix(in srgb, var(--st, #5B8DEF) 50%, transparent);
    color: var(--st, #5B8DEF);
    white-space: nowrap;
}
.st-live.is-idle { color: #22c55e; }
.st-live.is-working {
    color: #ef4444; /* занят — красный */
    animation: st-pulse 1.2s ease-in-out infinite;
}
.st-live.is-unavailable,
.st-live.is-error {
    color: #0a0a0a; /* недоступен — чёрный */
    text-shadow: 0 0 0 transparent;
    filter: drop-shadow(0 0 1px #666);
}
.st-live.is-owner { color: #D4AF37; }
.st-live-line {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}
.st-live-line.is-idle { color: #4ade80; }
.st-live-line.is-working { color: #f87171; }
.st-live-line.is-unavailable,
.st-live-line.is-error { color: #94a3b8; }
.st-live-line.is-owner { color: #D4AF37; }
.st-card.is-working {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #ef4444 40%, transparent);
}
.st-card.is-unavailable {
    opacity: 0.72;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 35%, transparent);
}
.st-card.st-owner {
    border-left-width: 4px;
    background: color-mix(in srgb, #D4AF37 12%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #D4AF37 35%, transparent);
}
.st-avatar-owner {
    border-color: #D4AF37 !important;
    width: 64px;
    height: 64px;
}
.st-badge-owner {
    color: #D4AF37 !important;
}
@keyframes st-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
.st-badge {
    margin: 6px 0 0;
    font-size: 10px;
    color: #A78BFA;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.st-pending {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px dashed color-mix(in srgb, var(--border, #334155) 60%, transparent);
}
.st-pending-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.side-panel > .workspace-body { overflow: auto; }


