/* Фазы и план этажа: лента фаз, папки, таймлайн. */
.detail-item,
.timeline-content {
    background: var(--bg-surface);
    border: 0.09375rem solid var(--border);
    padding: var(--space-md);
}
.timeline-block {
    position: relative;
    margin-bottom: var(--space-2xl);
}
.timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    z-index: 1;
}
@media (min-width: 48em) {
    .timeline-marker { left: -2.5rem; }
    .timeline-content { padding: var(--space-lg); }
}
.timeline-time {
    font-family: var(--font-mono);
    /* №222 */
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--primary);
}
@media (min-width: 48em) {
    .timeline-time { font-size: var(--fs-2xl); }
}
.timeline-title {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}
.timeline-meta {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}
.timeline-track {
    --tl-dot-size: 0.75rem;
    --tl-gutter: 1rem;
    position: relative;
    padding-left: calc(var(--tl-dot-size) + var(--tl-gutter));
}
/* №246 + #1 Phase timeline: dash-dot centre-line (drafting axis), not a plain
   rule. Геометрия и штриховой background слиты из двух дублей (task-044);
   третье правило в @media ≥87.5em не тронуто. */
.timeline-track::before {
    content: "";
    position: absolute;
    left: calc(var(--tl-dot-size) / 2);
    top: 0;
    bottom: 0;
    width: 0.0938rem;
    background: repeating-linear-gradient(
        to bottom, var(--text-muted) 0 0.25rem, transparent 0.25rem 0.4375rem) !important;
    opacity: .7;
}
.tl-phase {
    position: relative;
    padding: var(--space-sm) var(--space-sm) var(--space-sm) 0;
    cursor: pointer;
    transition: background 0.15s;
}
.tl-phase.tl-active {
    background: var(--bg-elevated);
}
.tl-phase.tl-highlight {
    background: var(--bg-elevated);
}
.tl-dot {
    position: absolute;
    left: calc(-1 * (var(--tl-dot-size) + var(--tl-gutter)));
    top: 50%;
    transform: translateY(-50%);
    --dot-size: var(--tl-dot-size);
    z-index: 2;
    transition: all 0.2s;
}
.tl-dot[data-status="in_progress"] {
    --dot-size: 1rem;
    margin-left: calc((var(--tl-dot-size) - 1rem) / 2);
    box-shadow: 0 0 0 0.1875rem var(--accent);
}
.tl-phase.tl-done-segment::before {
    content: "";
    position: absolute;
    left: calc(-1 * (var(--tl-dot-size) / 2 + var(--tl-gutter)));
    top: 0;
    bottom: 0;
    width: 0.0938rem;
    background: var(--success);
    z-index: 1;
}
.tl-label {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0;
    line-height: 1.4;
}
.tl-pct {
    font-family: var(--font-mono);
    font-size: var(--micro-size);
    color: var(--micro-color);
    letter-spacing: 0;
    margin-top: 0.25rem;
}
.tl-tasks {
    padding: var(--space-sm) 0 var(--space-xs);
    padding-left: var(--space-md);
}
.tl-task {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 0.25rem 0;
    font-size: var(--fs-xs);
    line-height: 1.4;
}
.tl-task-name {
    flex: 1;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    color: var(--text-secondary);
}
.tl-task-pct {
    font-family: var(--font-mono);
    font-size: var(--micro-size);
    color: var(--text-muted);
    flex-shrink: 0;
}
.tl-phase.tl-active::after {
    content: "";
    position: absolute;
    inset: -0.0625rem;
    border: 0.09375rem solid var(--primary);
    pointer-events: none;
}
.tl-phase.tl-highlight::after {
    content: "";
    position: absolute;
    inset: -0.0625rem;
    border: 0.09375rem solid var(--accent);
    pointer-events: none;
}
.fp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.fp-toolbar .fp-select { flex: 1 1 10rem; min-width: 0; text-overflow: ellipsis; }
.fp-toolbar .btn { flex: none; white-space: nowrap; min-height: var(--tap-target); }
.fp-select {
    min-height: var(--tap-target);
    font-family: var(--font-mono);
    font-size: var(--micro-size);
    letter-spacing: 0;
    padding: 0.25rem var(--space-sm);
    background: var(--bg-surface);
    border: 0.09375rem solid var(--border);
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2378716c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.375rem center;
    padding-right: 1.25rem;
    /* Палец в перчатке: 22 px высоты не хватало на попадание. */
    min-height: var(--tap-target);
}
.fp-container {
    position: relative;
    border: 0.09375rem solid var(--border);
    /* №255 */
    max-height: 50vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-surface);
}
@media (min-width: 56.25em) {
    .fp-container { max-height: none; overflow: hidden; }
}
.fp-container img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}
.fp-empty {
    padding: var(--space-2xl) var(--space-md);
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    border: 0.09375rem dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
}
.fp-marker {
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 0.15625rem solid var(--white);
    transform: translate(-50%, -50%);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--micro-size);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    z-index: 2;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0.0625rem 0.25rem rgba(0,0,0,0.3);
}
.fp-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 3;
}
.fp-marker.fp-highlight {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 0 0.25rem var(--focus-ring);
    z-index: 3;
}
.fp-marker[data-pct="none"] { background: var(--text-muted); }
.fp-marker[data-pct="low"] { background: var(--secondary); }
.fp-marker[data-pct="mid"] { background: var(--accent); }
.fp-tooltip {
    position: absolute;
    background: var(--bg-surface);
    border: 0.09375rem solid var(--border);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--fs-xs);
    font-family: var(--font-mono);
    z-index: 10;
    min-width: 11.25rem;
    max-width: 17.5rem;
    display: none;
    box-shadow: 0 0.0625rem 0.25rem rgba(0,0,0,0.3);
}
.fp-tooltip-title {
    font-weight: 700;
    font-size: var(--fs-xs);
    margin-bottom: var(--space-xs);
}
.fp-tooltip-pct {
    color: var(--text-muted);
}
.fp-tooltip-phases {
    margin-top: var(--space-xs);
    font-size: var(--micro-size);
    color: var(--text-secondary);
}
@media (min-width: 87.5em) {
    /* №259 — one horizontal row, scrolled (not wrapped). The scrollbar styles
           below show this was the original intent; a later switch to flex-wrap:wrap
           is what made the connectors dangle/overlap at row breaks. Single row → the
           connector is continuous and first/last-child trimming actually works. */
    .timeline-track {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        padding-left: 0;
        padding-bottom: var(--space-md);
        gap: 0;
        align-items: flex-start;
    }
    .timeline-track::before {
        display: none; /* №260 */
    }
    .tl-phase {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 9.375rem;
        max-width: 12.5rem;
        text-align: center;
        padding: var(--space-sm);
        position: relative;
    }
    .tl-dot {
        position: static;
        left: auto;
        transform: none;
        margin-left: 0;
        margin-bottom: var(--space-xs);
        flex-shrink: 0;
    }
    /* №262 — connector behind the dots. Full width of each phase box, centred on
           the dot, self-contained per phase. On flex-wrap this breaks cleanly at row
           boundaries: no cross-row diagonal and no half-phase stub floating in empty
           space (the old `left:-50%` drew one to the left of every wrapped-row head,
           e.g. 07). Row ends are trimmed to the dot centre. */
    .tl-phase::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: calc(var(--space-sm) + var(--tl-dot-size) / 2);
        height: 0.0938rem;
        background: var(--border);
        z-index: 0;
    }
    .tl-phase:first-child::before,
    .tl-phase.tl-done-segment:first-child::before { left: 50%; }
    .tl-phase:last-child::before,
    .tl-phase.tl-done-segment:last-child::before { right: 50%; }
    /* Completed phase → horizontal green connector. Must reset the FULL
           geometry, not just background: the default vertical rule
           `.tl-phase.tl-done-segment::before` (0,2,1) outranks the horizontal
           `.tl-phase::before` reset (0,1,1), so top:0/bottom:0/left:-1.375rem
           leaked in and drew a stray vertical green line left of the done phase. */
    .tl-phase.tl-done-segment::before {
        left: 0;
        right: 0;
        top: calc(var(--space-sm) + var(--tl-dot-size) / 2);
        bottom: auto;
        width: auto;
        height: 0.0938rem;
        background: var(--success);
    }
    /* Keep the in-progress dot centred in its column. The negative margin-left
           on `.tl-dot[data-status="in_progress"]` is only meant for the vertical
           layout's absolutely-positioned dot; here it shoved the larger glowing dot
           off-centre so its ring overlapped the connector and the neighbour. */
    .tl-dot[data-status="in_progress"] { margin-left: 0; }
    .tl-content {
        text-align: center;
        width: 100%;
    }
    /* Task rows fill the phase column and left-align so wrapped sub-item
           text reads cleanly and never spills past the phase box. */
    .tl-tasks .tl-task { text-align: left; }
    .tl-tasks {
        border-left: none;
        border-top: 0.0625rem dashed var(--border);
        padding-left: 0;
        padding-top: var(--space-sm);
        margin-left: 0;
        text-align: left;
        width: 100%;
    }
    .tl-phase.tl-active::after,
    .tl-phase.tl-highlight::after {
        inset: -0.0625rem;
    }
    .timeline-track::-webkit-scrollbar {
        height: 0.375rem;
    }
    .timeline-track::-webkit-scrollbar-track {
        background: var(--bg-elevated);
        border-radius: 0.1875rem;
    }
    .timeline-track::-webkit-scrollbar-thumb {
        background: var(--text-muted);
        border-radius: 0.1875rem;
    }
    .timeline-track::-webkit-scrollbar-thumb:hover {
        background: var(--primary);
    }
}
.fp-marker.dragging {
    opacity: 0.7;
    cursor: grabbing;
    z-index: 10;
}
.fp-container.edit-mode { cursor: crosshair; }
.fp-zone-actions .btn { flex: 1 1 0; min-width: 0; }
.dt > .dt-in { flex: 1 1 auto; min-width: 0; width: 100%; padding-inline-end: var(--tap-target); font-variant-numeric: tabular-nums; }
.dt-pick::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
