/* TxPlanningBoard (r082 T37): stili della lavagna. Solo token di app.css (chiaro e scuro); l'animazione di 180 ms si spegne con prefers-reduced-motion. */

.tx-pb {
    /* Colori delle famiglie e tratteggio del setup dai token di app.css (p011 T7): lo scuro arriva dal blocco unico
       :root[data-theme="dark"], quindi qui nessuna variante di tema. */
    --fam-0: var(--info);
    --fam-1: var(--accent);
    --fam-2: var(--warning);
    --fam-3: color-mix(in srgb, var(--info) 50%, var(--danger));
    --fam-text: var(--on-accent);
    --pb-hatch: color-mix(in srgb, var(--on-accent) 38%, transparent);
    --pb-hatch-2: color-mix(in srgb, var(--ink) 28%, transparent);
}

.tx-pb-x-bar {
    position: relative;
    display: flex;
    height: 100%;
    min-height: 18px;
    overflow: hidden;
    border-radius: var(--radius-control);
    background: var(--fam-0);
    color: var(--fam-text);
    font-size: var(--text-xs);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tx-pb-x-bar.fam-1 { background: var(--fam-1); }
.tx-pb-x-bar.fam-2 { background: var(--fam-2); }
.tx-pb-x-bar.fam-3 { background: var(--fam-3); }

/* Setup: trama diagonale sopra il colore della famiglia, mai solo colore (anche il titolo/aria lo dice). */
.tx-pb-x-setup {
    flex: none;
    height: 100%;
    background-image: repeating-linear-gradient(135deg, var(--pb-hatch) 0 3px, var(--pb-hatch-2) 3px 6px);
    border-right: 1px solid var(--pb-hatch);
}

.tx-pb-x-run {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 var(--space-1);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    align-self: center;
}

.tx-pb-x-bar.is-selected {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.tx-pb-x-res {
    font-variant-numeric: tabular-nums;
}

/* Scheduler: baseline e anteprima come appuntamenti in sola lettura con la classe data da OnItemRender. */

.tx-pb-x-baseline {
    height: 4px;
    margin-top: auto;
    border-radius: var(--radius-control);
    background: var(--text-muted);
    opacity: 0.6;
}


.tx-pb-host {
    height: 640px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    overflow: hidden;
}

.tx-pb-viewport {
    position: relative;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
}

.tx-pb-viewport:focus {
    outline: none;
}

.tx-pb-canvas {
    position: relative;
}

.tx-pb-axis {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    height: var(--pb-axis);
    border-bottom: 1px solid var(--border);
    background: var(--grid-header);
}

.tx-pb-corner {
    position: sticky;
    left: 0;
    z-index: 5;
    flex: none;
    width: var(--pb-label);
    padding: var(--space-2) var(--space-3);
    border-right: 1px solid var(--border);
    background: var(--grid-header);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
}

.tx-pb-ticks {
    position: relative;
    flex: none;
    height: 100%;
    overflow: hidden;
}

.tx-pb-day,
.tx-pb-hour {
    position: absolute;
    left: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tx-pb-day {
    top: 0;
    height: 24px;
    padding: 4px var(--space-2);
    border-left: 1px solid var(--border);
    color: var(--text);
    font-size: var(--text-xs);
    font-weight: 600;
    overflow: hidden;
}

.tx-pb-hour {
    top: 26px;
    padding-left: 3px;
    border-left: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: 10px;
}

.tx-pb-body {
    position: relative;
    display: flex;
}

.tx-pb-labels {
    position: sticky;
    left: 0;
    z-index: 3;
    flex: none;
    width: var(--pb-label);
    height: 100%;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.tx-pb-label {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    height: var(--pb-row);
    padding: 0 var(--space-3);
    border-bottom: 1px solid var(--border-soft);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

.tx-pb-label-text {
    overflow: hidden;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tx-pb-label-flag {
    margin-left: auto;
    color: var(--danger);
    font-size: var(--text-md);
}

.tx-pb.is-dragging .tx-pb-label.is-blocked {
    opacity: 0.55;
}

.tx-pb-label.is-target {
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--accent);
}

.tx-pb-label.is-target.is-blocked {
    background: var(--danger-soft);
    box-shadow: inset 3px 0 0 var(--danger);
}

.tx-pb-time {
    position: relative;
    flex: none;
    height: 100%;
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
    background-size: calc(var(--pb-hour) * 24) 100%, 100% var(--pb-row);
}

.tx-pb-past {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--surface-2);
    opacity: 0.6;
}

.tx-pb-layer {
    position: absolute;
    inset: 0;
}

.tx-pb-bar,
.tx-pb-ghost,
.tx-pb-baseline,
.tx-pb-toast {
    position: absolute;
    left: 0;
    top: 0;
}

.tx-pb-bar {
    z-index: 2;
    height: calc(var(--pb-row) - 12px);
    min-height: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: transform 180ms ease, width 180ms ease;
}

.tx-pb-bar:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.tx-pb-bar.is-dragged {
    opacity: 0.45;
}

.tx-pb-baseline {
    z-index: 1;
    height: 4px;
    margin: 0;
}

.tx-pb-ghost {
    z-index: 6;
    display: flex;
    height: calc(var(--pb-row) - 12px);
    border-radius: var(--radius-control);
    outline: 2px dashed var(--accent);
    background: color-mix(in srgb, var(--accent) 28%, transparent);
    pointer-events: none;
}

.tx-pb-ghost .tx-pb-setup {
    height: 100%;
    background-image: repeating-linear-gradient(135deg, var(--pb-hatch-2) 0 3px, transparent 3px 6px);
}

.tx-pb-ghost.is-blocked {
    outline-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 22%, transparent);
}

.tx-pb-ghost.is-pending {
    opacity: 0.7;
}

.tx-pb-ghost-hint {
    position: absolute;
    left: 0;
    bottom: calc(100% + 4px);
    padding: 2px var(--space-2);
    border-radius: var(--radius-control);
    background: var(--text);
    color: var(--surface);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.tx-pb-ghost.is-blocked .tx-pb-ghost-hint {
    background: var(--danger);
    color: var(--surface);
}

.tx-pb-toast {
    z-index: 7;
    max-width: 22rem;
    margin-top: 2px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--danger);
    border-radius: var(--radius-control);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: var(--text-sm);
    box-shadow: var(--elevation-overlay);
}

.tx-pb-links {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    overflow: visible;
    pointer-events: none;
}

.tx-pb-links path.tx-pb-link {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
}

.tx-pb-links marker path {
    fill: var(--accent);
}

.tx-pb-now {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 4;
    width: 2px;
    background: var(--danger);
    pointer-events: none;
}

.tx-pb-now-tick {
    position: absolute;
    left: 0;
    bottom: 2px;
    z-index: 1;
    padding: 1px 4px;
    border-radius: var(--radius-control);
    background: var(--danger);
    color: var(--surface);
    font-size: 10px;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .tx-pb-bar {
        transition: none;
    }
}

.tx-pb-status {
    margin-left: var(--space-1);
    padding: 0 var(--space-1);
    border: 1px solid currentColor;
    border-radius: var(--radius-control);
    font-size: var(--text-xs);
    white-space: nowrap;
}
