:root {
    --ink: #0d1b2a;
    --ocean: #1b263b;
    --mist: #e0e1dd;
    --accent: #00a6a6;
    --accent-2: #ff9f1c;
    --panel: #f7fafc;
    --ok: #2f9e44;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #8ecae6 0%, #f8f9fa 45%, #ffffff 100%);
    min-height: 100vh;
}

.shell {
    width: 95%;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.hero {
    background: linear-gradient(125deg, var(--ocean), #415a77);
    color: white;
    padding: 1.1rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(13, 27, 42, 0.2);
    animation: rise 500ms ease-out;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hero-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-title {
    flex: 1 1 200px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.hero p {
    margin: 0.2rem 0 0;
    opacity: 0.85;
    font-size: 0.8rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 0.42rem 0.8rem !important;
    font-size: 0.77rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

.hero-status {
    font-size: 0.77rem;
    opacity: 0.88;
    white-space: nowrap;
    padding: 0 0.25rem;
}

.hero-filters {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-filters .filter-field span {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hero-filters .filter-field select,
.hero-filters .filter-field input[type="date"] {
    font-size: 0.77rem;
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.13);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    min-width: 0;
}

.hero-filters .filter-field select option {
    background: #1b2a3b;
    color: white;
}

.controls {
    display: none;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

a.btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--accent-2);
}

.status {
    font-weight: 700;
    color: var(--ok);
}

.readiness-legend {
    margin: 1rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.8rem;
}

.legend-card {
    background: #fff;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    padding: 0.85rem;
}

.legend-card h2 {
    margin: 0 0 0.55rem;
    font-size: 1rem;
}

.legend-card ul {
    margin: 0;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.legend-card li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1.25;
}

.legend-progress-track {
    min-width: 96px;
    width: 180px;
    margin-top: 0;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
}

.metric-card {
    background: var(--panel);
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    padding: 0.8rem;
    animation: rise 500ms ease-out;
}

.metric-title {
    margin: 0;
    color: #415a77;
    font-size: 0.9rem;
}

.metric-value {
    margin: 0.25rem 0 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.gantt-wrapper {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #dbe7f3;
    border-radius: 14px;
    padding: 1rem;
}

.gantt .bar-wrapper.readiness-green .bar {
    fill: #2f9e44;
}

.gantt .bar-wrapper.readiness-yellow .bar {
    fill: #d4aa1f;
}

.gantt .bar-wrapper.readiness-red .bar {
    fill: #d94848;
}

.gantt .bar-wrapper.readiness-green .bar-progress {
    fill: #238636;
}

.gantt .bar-wrapper.readiness-yellow .bar-progress {
    fill: #ad8607;
}

.gantt .bar-wrapper.readiness-red .bar-progress {
    fill: #a51111;
}

.overlay-wrapper {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #dbe7f3;
    border-radius: 14px;
    padding: 1rem;
}

.timeline-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 68vh;
    scrollbar-color: rgba(65, 90, 119, 0.55) rgba(224, 232, 239, 0.8);
}

.timeline-scroll::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.timeline-scroll::-webkit-scrollbar-thumb {
    background: rgba(65, 90, 119, 0.55);
    border-radius: 999px;
}

.timeline-scroll::-webkit-scrollbar-track {
    background: rgba(224, 232, 239, 0.8);
    border-radius: 999px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.1rem;
}

.section-heading-compact {
    margin-bottom: 0.75rem;
}

.section-heading p {
    margin: 0.35rem 0 0;
    color: #526375;
}

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

.legend-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.legend-shift {
    background: rgba(0, 166, 166, 0.16);
    color: #0f6e6e;
}

.legend-job {
    background: rgba(27, 38, 59, 0.16);
    color: #203047;
}

.legend-downtime {
    background: rgba(255, 159, 28, 0.2);
    color: #9b5700;
}

.overlay-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.overlay-controls-inline {
    margin-bottom: 0;
    align-items: center;
    margin-left: auto;
    gap: 0.5rem;
}

.overlay-controls-inline .filter-field {
    min-width: 145px;
    gap: 0.2rem;
}

.overlay-controls-inline .filter-field span {
    font-size: 0.74rem;
}

.overlay-controls-inline .filter-field select,
.overlay-controls-inline .filter-field input {
    min-height: 34px;
    padding: 0.42rem 0.5rem;
    border-radius: 8px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 170px;
}

.filter-field span {
    font-size: 0.82rem;
    font-weight: 700;
    color: #415a77;
}

.filter-field select,
.filter-field input {
    min-height: 42px;
    border: 1px solid #c9d9e8;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.btn-ghost {
    background: #eff6fb;
    color: #203047;
}

#constraint-overlay {
    position: relative;
    min-width: 760px;
}

.dependency-svg-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.dependency-path {
    fill: none;
    stroke: rgba(27, 38, 59, 0.6);
    stroke-width: 2;
    stroke-linecap: round;
    cursor: pointer;
    pointer-events: stroke;
    transition: stroke 0.15s, stroke-width 0.15s;
}

.dependency-path:hover {
    stroke: #ef4444;
    stroke-width: 3;
}

/* ── Link-jobs mode ── */
.link-mode .timeline-row--job {
    cursor: crosshair !important;
}

.link-mode .timeline-row--job:hover .timeline-label,
.link-mode .timeline-row--job:hover .timeline-block.job {
    outline: 2px dashed #f59e0b;
    outline-offset: 2px;
}

.timeline-block.job--link-source {
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25) !important;
}

.btn-link-active {
    background: #f59e0b !important;
    color: #fff !important;
    border-color: #f59e0b !important;
}

.timeline-scale,
.timeline-row {
    display: grid;
    grid-template-columns: 44px 44px 56px 28px 28px 28px 480px minmax(580px, 1fr);
    gap: 0.45rem;
    align-items: center;
}

/* ── Lock checkbox column ── */
.timeline-lock {
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-lock--header {
    font-size: 0.62rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    height: 100%;
    background: #e5e7eb;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
}

.lock-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #e67700;
}

/* ── Pause checkbox column ── */
.timeline-pause {
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-pause--header {
    font-size: 0.62rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    height: 100%;
    background: #e5e7eb;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
}

.pause-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1971c2;
}

.timeline-row--paused {
    outline: 2px solid #1971c2;
    outline-offset: -2px;
    border-radius: 6px;
}

.timeline-row--locked {
    outline: 2px solid #e67700;
    outline-offset: -2px;
    border-radius: 6px;
}

/* ── Archive checkbox column ── */
.timeline-archive {
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-archive--header {
    font-size: 0.62rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    height: 100%;
    background: #e5e7eb;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
}

.archive-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #2f9e44;
}

.timeline-readiness {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.timeline-readiness--header {
    font-size: 0.62rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    justify-content: center;
    height: 100%;
    align-items: center;
    background: #e5e7eb;
    border: 1px solid #cfd4dc;
    border-radius: 6px;
}

.readiness-btn {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
    outline: none;
}

.readiness-btn:hover {
    transform: scale(1.25);
}

.readiness-btn--green  { background: #2f9e44; }
.readiness-btn--yellow { background: #d4aa1f; }
.readiness-btn--red    { background: #d94848; }

.readiness-btn--active {
    border-color: #0d1b2a;
    box-shadow: 0 0 0 2px rgba(13,27,42,0.25);
    transform: scale(1.18);
}

.timeline-npi {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #2c4a6e;
    background: #e8f0fb;
    border: 1px solid #b8cef5;
    border-radius: 6px;
    height: 22px;
    min-width: 0;
}

.timeline-npi--header {
    background: #e5e7eb;
    border-color: #cfd4dc;
    font-size: 0.65rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    height: 100%;
    gap: 0;
}

/* Purchasing column — same layout as NPI */
.timeline-purchasing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #1e3a5f;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    height: 22px;
    min-width: 0;
}

.timeline-purchasing--header {
    background: #e5e7eb;
    border-color: #cfd4dc;
    font-size: 0.65rem;
    font-weight: 600;
    color: #526375;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    height: 100%;
    gap: 0;
}

/* Read-only status dot */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(0,0,0,0.15);
}
.status-dot--green  { background: #2f9e44; }
.status-dot--yellow { background: #d4aa1f; }
.status-dot--red    { background: #d94848; }
.status-dot--grey   { background: #adb5bd; }

.timeline-group {
    margin-bottom: 0.55rem;
}

.timeline-row--header .timeline-label strong {
    font-size: 0.95rem;
    color: #1b263b;
}

.timeline-row--header .timeline-label {
    background: #e5e7eb;
    border-color: #cfd4dc;
}

.timeline-row--header .timeline-lane {
    border-color: #cfd4dc;
    background:
        linear-gradient(90deg, rgba(90, 102, 120, 0.2) 1px, transparent 1px) 0 0 / 12.5% 100%,
        linear-gradient(180deg, #eceff3, #dfe4ea);
}

.timeline-row--job {
    margin-top: 0;
    opacity: 1;
}

.timeline-label--job {
    padding: 0.16rem 0.5rem;
    background: #f2f6fb;
    border-radius: 8px;
}

.timeline-label--job .tl-erp {
    font-size: 0.68rem;
    font-weight: 600;
    color: #7c3aed;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.85;
}

.timeline-label--job .tl-order {
    font-size: 0.74rem;
    font-weight: 700;
    color: #2c4a6e;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-label--job .tl-qty {
    font-size: 0.68rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-label--job .tl-sep {
    color: #b0bec5;
    flex-shrink: 0;
    font-size: 0.72rem;
}

.timeline-label--job .tl-product {
    font-size: 0.7rem;
    color: #526375;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.timeline-lane--shifts {
    height: 22px;
}

.timeline-row--job .timeline-lane {
    height: 22px;
}

.timeline-scale {
    margin-bottom: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 30;
    background: #ffffff;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #dbe7f3;
}

.timeline-axis {
    position: relative;
    min-height: 44px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbfd, #eef4f8);
}

.timeline-axis-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px dashed rgba(65, 90, 119, 0.25);
}

.timeline-axis-tick span {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    font-size: 0.78rem;
    color: #415a77;
    white-space: nowrap;
    line-height: 1.35;
}

.timeline-axis-tick span em {
    font-style: normal;
    font-size: 0.68rem;
    color: #778da9;
}

.timeline-axis-tick--today span {
    color: #e85d3a;
    font-weight: 700;
}

.timeline-axis-tick--today span em {
    color: #e85d3a;
}

.timeline-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.46rem 0.6rem;
    border-radius: 10px;
    background: #f8fbfd;
    border: 1px solid #dbe7f3;
}

.timeline-label strong {
    font-size: 0.86rem;
}

.timeline-label span {
    margin-top: 0.12rem;
    font-size: 0.76rem;
    color: #526375;
}

/* Keep job labels on one horizontal line (order · product) */
.timeline-label.timeline-label--job {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.timeline-label.timeline-label--job span {
    margin-top: 0;
}

.timeline-row {
    margin-bottom: 0;
}

.timeline-lane {
    position: relative;
    height: 22px;
    border-radius: 4px;
    border: 1px solid #dbe7f3;
    background:
        linear-gradient(90deg, rgba(65, 90, 119, 0.08) 1px, transparent 1px) 0 0 / 12.5% 100%,
        linear-gradient(180deg, #fdfefe, #f5f9fc);
}

/* Today highlight band */
.timeline-lane::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--today-pct, -9999%);
    width: 2px;
    background: rgba(255, 90, 50, 0.7);
    pointer-events: none;
    z-index: 4;
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(255, 90, 50, 0.4);
}

/* Weekend / holiday day bands */
.day-band {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: 2px;
}

.day-band--weekend {
    background: rgba(100, 116, 139, 0.10);
}

.day-band--holiday {
    background: rgba(234, 179, 8, 0.15);
    border-left: 1px solid rgba(234, 179, 8, 0.4);
    border-right: 1px solid rgba(234, 179, 8, 0.4);
}

.timeline-block {
    position: absolute;
    border-radius: 10px;
    padding: 0;
    overflow: visible;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease;
    z-index: 1;
}

.timeline-block-label {
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    color: #1b263b;
    font-size: 0.68rem;
    font-weight: 600;
    pointer-events: none;
}

.timeline-block:hover,
.timeline-block:focus-visible,
.timeline-block.is-active {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(27, 38, 59, 0.14);
    outline: none;
}

.timeline-block.shift {
    background: rgba(0, 166, 166, 0.18);
    border: 1px solid rgba(0, 166, 166, 0.4);
    color: #0f6e6e;
    top: 2px;
    bottom: 2px;
    height: auto;
}

.timeline-block.downtime {
    background: rgba(255, 159, 28, 0.25);
    border: 1px solid rgba(255, 159, 28, 0.5);
    color: #8a4c00;
    top: 2px;
    bottom: 2px;
    height: auto;
}

.timeline-block.job {
    background: linear-gradient(135deg, rgba(27, 38, 59, 0.9), rgba(65, 90, 119, 0.88));
    border: 1px solid rgba(27, 38, 59, 0.7);
    color: #f8fbfd;
    top: 2px;
    bottom: 2px;
    height: auto;
}

.timeline-block.job.readiness-green {
    background: linear-gradient(135deg, #2f9e44, #238636);
    border-color: #238636;
}

.timeline-block.job.readiness-yellow {
    background: linear-gradient(135deg, #c9a227, #ad8607);
    border-color: #ad8607;
}

.timeline-block.job.readiness-red {
    background: linear-gradient(135deg, #c92a2a, #a51111);
    border-color: #a51111;
}

/* ── Blocked / not-ready placeholder row ── */
.timeline-row--blocked {
    opacity: 0.72;
}

.timeline-lane--blocked {
    border-style: dashed;
    border-color: #c9a0a0;
    background:
        linear-gradient(90deg, rgba(180, 60, 60, 0.06) 1px, transparent 1px) 0 0 / 12.5% 100%,
        linear-gradient(180deg, #fff5f5, #fdecea);
}

.timeline-block.job-blocked {
    top: 3px;
    bottom: 3px;
    height: auto;
    background: repeating-linear-gradient(
        -45deg,
        rgba(180, 60, 60, 0.10) 0px,
        rgba(180, 60, 60, 0.10) 6px,
        rgba(180, 60, 60, 0.04) 6px,
        rgba(180, 60, 60, 0.04) 12px
    );
    border: 1px dashed #c9a0a0;
    border-radius: 6px;
    cursor: pointer;
    color: #8b3333;
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
}

.timeline-block.job-blocked:hover {
    background: repeating-linear-gradient(
        -45deg,
        rgba(180, 60, 60, 0.18) 0px,
        rgba(180, 60, 60, 0.18) 6px,
        rgba(180, 60, 60, 0.08) 6px,
        rgba(180, 60, 60, 0.08) 12px
    );
    border-color: #a51111;
}

.timeline-block-label--inline {
    position: static;
    transform: none;
    display: block;
    padding: 0 0.5rem;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-npi--blocked {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #8b3333;
    background: #fdecea;
    border: 1px dashed #c9a0a0;
    border-radius: 6px;
    height: 22px;
    min-width: 0;
}

/* ── Job progress bar overlay ── */
.job-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.28);
    border-radius: 10px 0 0 10px;
    pointer-events: none;
    transition: width 80ms linear;
}

.job-progress-thumb {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.job-progress-thumb:hover {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.35);
}

.inline-job-edit-panel {
    margin: 0.3rem 0 0.6rem 0;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, #f0f6ff, #e8f2fc);
    border: 1px solid #93c5fd;
    border-radius: 10px;
    animation: rise 180ms ease-out;
    position: relative;
    z-index: 5;
}

.inline-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    font-size: 0.88rem;
    color: #1b263b;
}

.inline-panel-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: #526375;
    cursor: pointer;
    padding: 0 0.2rem;
    border-radius: 4px;
}

.inline-panel-close:hover {
    color: #c92a2a;
    background: rgba(201,42,42,0.08);
}

.inline-panel-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.7rem;
}

.inline-save-status {
    font-size: 0.8rem;
    color: #526375;
}

/* Keep the aside detail panel but hide it when unused */
.overlay-detail {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: linear-gradient(180deg, #fdfefe, #f6fafc);
}

.overlay-detail h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.overlay-detail p {
    margin: 0;
    color: #526375;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 0.85rem;
}

/* ── Editable job detail panel ── */
.detail-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.detail-edit-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
}

.detail-edit-row span {
    font-weight: 600;
    color: #415a77;
}

.detail-edit-row input,
.detail-edit-row select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #b8cef5;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #1b263b;
    background: #f4f8fe;
}

.detail-edit-row input:focus,
.detail-edit-row select:focus {
    outline: 2px solid #3b82f6;
    background: #fff;
}

/* Clickable job label */
.timeline-label--clickable {
    cursor: pointer;
}

.timeline-label--clickable:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.detail-card {
    padding: 0.75rem;
    border: 1px solid #dbe7f3;
    border-radius: 10px;
    background: #fff;
}

.detail-card strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.82rem;
    color: #415a77;
}

.detail-card span {
    color: var(--ink);
}

.overlay-editor {
    margin-top: 1rem;
    padding-top: 0.25rem;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.9rem;
}

/* Multi-select weekday list */
select[multiple]#shift-weekday {
    height: auto;
    min-height: 130px;
    border: 1px solid #c9d9e8;
    border-radius: 10px;
    padding: 0.3rem 0;
    background: #fff;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}

select[multiple]#shift-weekday option {
    padding: 0.42rem 0.75rem;
    border-radius: 0;
}

select[multiple]#shift-weekday option:checked {
    background: var(--accent);
    color: #fff;
}

.multi-hint {
    font-weight: 400;
    font-size: 0.72rem;
    color: #7a90a4;
    font-style: normal;
}

.editor-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: linear-gradient(180deg, #fdfefe, #f6fafc);
}

.editor-card h3 {
    margin: 0;
    font-size: 1rem;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.editor-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.inline-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.inline-list-empty {
    margin: 0;
    padding: 0.8rem;
    border: 1px dashed #c4d5e4;
    border-radius: 10px;
    color: #526375;
    background: #fff;
}

.inline-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: start;
    padding: 0.8rem;
    border: 1px solid #dbe7f3;
    border-radius: 10px;
    background: #fff;
}

.inline-item strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.inline-item span {
    color: #526375;
    font-size: 0.84rem;
}

.inline-item-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(13, 27, 42, 0.25);
}

.color-dot.green {
    background: #2f9e44;
}

.color-dot.yellow {
    background: #f0c419;
}

.color-dot.red {
    background: #e03131;
}

.points-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-weight: 700;
    background: #edf4fb;
    color: #274c77;
}

.progress-cell {
    font-weight: 700;
}

.progress-track {
    position: relative;
    width: 100%;
    min-width: 110px;
    height: 9px;
    border-radius: 999px;
    background: #e7eef5;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(90deg, #2a9d8f, #1f7d71);
}

.btn-small {
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
}

.overlay-empty {
    margin: 0;
    padding: 1rem;
    border: 1px dashed #b8cadb;
    border-radius: 12px;
    color: #526375;
    background: #f8fbfd;
}

@media (max-width: 800px) {
    .timeline-scale,
    .timeline-row {
        grid-template-columns: 44px 44px 56px 28px 28px 28px 160px minmax(560px, 1fr);
    }

    .section-heading {
        flex-direction: column;
    }

    .overlay-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-field {
        min-width: 100%;
    }

    .field-row {
        grid-template-columns: 1fr;
    }
}

.table-wrapper {
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #dbe7f3;
    border-radius: 14px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 0.65rem;
    border-bottom: 1px solid #eef3f7;
    text-align: left;
}

th {
    background: #f0f4f8;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable::after {
    content: '  ↕';
    color: #789;
    font-size: 0.78rem;
}

th.sortable.sorted-asc::after {
    content: '  ↑';
}

th.sortable.sorted-desc::after {
    content: '  ↓';
}

.table-input,
.table-select {
    width: 100%;
    min-width: 90px;
    border: 1px solid #c9d9e8;
    border-radius: 8px;
    padding: 0.35rem 0.45rem;
    font: inherit;
    background: #fff;
}

.table-select[data-field='readiness_color'].readiness-green {
    background: #e8f7ec;
    border-color: #7acb92;
    color: #1d6d34;
}

.table-select[data-field='readiness_color'].readiness-yellow {
    background: #fff7dc;
    border-color: #e5c56b;
    color: #7a5a00;
}

.table-select[data-field='readiness_color'].readiness-red {
    background: #fde9e9;
    border-color: #de8f8f;
    color: #8c1f1f;
}

.table-actions {
    white-space: nowrap;
}

tr.table-group-header td {
    background: #f0f4f8;
    padding: 6px 10px;
    border-top: 2px solid #c5d0dc;
    border-bottom: 1px solid #c5d0dc;
}

tr.table-group-header .group-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #344a5e;
}

tr.table-group-header .group-count {
    margin-left: 8px;
    font-size: 0.78rem;
    color: #7a90a4;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Drag to move and resize job bars ── */
.timeline-block.bar-dragging {
    cursor: grabbing !important;
    opacity: 0.82;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    z-index: 50;
    transition: none !important;
    transform: none !important;
}

.bar-drag-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(27, 38, 59, 0.92);
    color: #fff;
    font-size: 0.78rem;
    font-family: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.bar-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7px;
    cursor: ew-resize;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s;
    background: rgba(255, 255, 255, 0.4);
}

.bar-resize-handle--left {
    left: 0;
    border-radius: 10px 0 0 10px;
}

.bar-resize-handle--right {
    right: 0;
    border-radius: 0 10px 10px 0;
}

.timeline-block.job:hover .bar-resize-handle {
    opacity: 1;
}

/* ── In-progress job bar: slow glow blink ── */
@keyframes job-in-progress-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); opacity: 1; }
    50%       { box-shadow: 0 0 8px 3px rgba(255, 255, 255, 0.45); opacity: 0.78; }
}

.timeline-block.job.job-in-progress {
    animation: job-in-progress-pulse 2s ease-in-out infinite;
}

/* ── Status badge in job label column ── */
.tl-status {
    font-size: 0.42rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 1px 3px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1.4;
}

.tl-status--pending     { background: #94a3b8; color: #ffffff; }
.tl-status--planned     { background: #dbeafe; color: #1d4ed8; }
.tl-status--in_progress { background: #dcfce7; color: #15803d; }
.tl-status--paused      { background: #fef3c7; color: #92400e; }
.tl-status--done        { background: #f3f4f6; color: #6b7280; }

/* ── Drag-to-reorder rows ── */
.row-grip-handle {
    display: inline-block;
    width: 12px;
    flex-shrink: 0;
    cursor: grab;
    color: rgba(90, 105, 125, 0.5);
    font-size: 0.75rem;
    line-height: 1;
    user-select: none;
    margin-right: 4px;
    background-image: radial-gradient(circle, currentColor 1.5px, transparent 1.5px);
    background-size: 4px 4px;
    background-repeat: repeat;
    height: 12px;
    border-radius: 2px;
}

.row-grip-handle:hover {
    color: rgba(27, 38, 59, 0.75);
}

.timeline-row--job.row-dragging {
    opacity: 0.38;
}

.timeline-row--job.drag-over-above {
    box-shadow: 0 -2px 0 0 var(--accent);
}

.timeline-row--job.drag-over-below {
    box-shadow: 0 2px 0 0 var(--accent);
}

/* ── New Job modal ── */
.new-job-dialog {
    border: none;
    border-radius: 16px;
    padding: 0;
    width: min(560px, 95vw);
    box-shadow: 0 24px 64px rgba(13, 27, 42, 0.28);
    animation: rise 200ms ease-out;
}

.new-job-dialog::backdrop {
    background: rgba(13, 27, 42, 0.45);
    backdrop-filter: blur(2px);
}

.new-job-dialog form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.new-job-dialog h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--ocean);
}

.new-job-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

.new-job-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #415a77;
}

.new-job-grid label em {
    color: #d94848;
    font-style: normal;
}

.new-job-grid input,
.new-job-grid select {
    border: 1px solid #c9d9e8;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    font: inherit;
    font-size: 0.85rem;
    background: #fff;
    color: var(--ink);
}

.new-job-grid input:focus,
.new-job-grid select:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}

.new-job-footer {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: flex-end;
    border-top: 1px solid #dbe7f3;
    padding-top: 1rem;
}

.new-job-footer #new-job-status {
    flex: 1;
    font-size: 0.8rem;
    color: #d94848;
}

/* ── Top navigation bar ──────────────────────────────────────────────────── */
.app-nav {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}

.app-nav-brand {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 0.5rem 0.3rem 0;
    margin-right: 0.35rem;
    user-select: none;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.app-nav-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    line-height: 1;
    font-family: inherit;
    white-space: nowrap;
}

.app-nav-link:hover {
    background: rgba(255,255,255,0.13);
    color: #fff;
}

.app-nav-link--active {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.app-nav-spacer { flex: 1; min-width: 0.5rem; }

.app-nav-util { opacity: 0.65; }
.app-nav-util:hover { opacity: 1; }

.app-nav-lang-form {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0.25rem;
}
.app-nav-lang-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.app-nav-lang-select {
    appearance: auto;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.88);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.22rem 0.35rem;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1.3;
    font-family: inherit;
    max-width: 9.5rem;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.app-nav-lang-select:hover,
.app-nav-lang-select:focus-visible {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.6);
    outline: none;
}
.app-nav-lang-select option {
    background: #fff;
    color: #1b263b;
}
.app-nav-lang-submit {
    border: 1px solid rgba(255,255,255,0.35);
    background: transparent;
    color: #fff;
    border-radius: 5px;
    padding: 0.22rem 0.4rem;
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}

/* ── Dropdown groups ─────────────────────────────────────────────────────── */
.app-nav-group {
    position: relative;
}

.app-nav-caret {
    font-size: 0.6rem;
    opacity: 0.7;
    display: inline-block;
    transition: transform 0.15s;
    line-height: 1;
}

.app-nav-group.is-open .app-nav-caret {
    transform: rotate(180deg);
}

.app-nav-group__menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 195px;
    background: #fff;
    border: 1px solid #dde5ef;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(13,27,42,0.22);
    padding: 0.35rem;
    z-index: 500;
}

.app-nav-group.is-open .app-nav-group__menu {
    display: block;
}

.app-nav-menu-item {
    display: block;
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.1s;
    white-space: nowrap;
}

.app-nav-menu-item:hover,
.app-nav-menu-item.is-active {
    background: #f0f6ff;
    color: #1d4ed8;
}

.app-nav-menu-divider {
    height: 1px;
    background: #e8eef5;
    margin: 0.3rem 0.4rem;
}

.app-nav-menu-section-label {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    padding: .35rem .75rem .1rem;
    pointer-events: none;
    user-select: none;
}

/* ── Nav action buttons group (gantt-specific) ───────────────────────────── */
.app-nav-actions-group {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    border-left: 1px solid rgba(255,255,255,0.18);
    padding-left: 0.5rem;
    margin-left: 0.2rem;
}

.app-nav-status {
    font-size: 0.72rem;
    font-weight: 700;
    color: #4ade80;
    padding: 0 0.3rem;
    white-space: nowrap;
}
