/**
 * Finishing overview — productieplanning per uitleverweek.
 * Mobile-first: stack op smal scherm, multi-column op desktop.
 */

:root {
    --fo-bg: #f8f7f5;
    --fo-bg-deep: #f3f1ed;
    --fo-card: #ffffff;
    --fo-border: #e7e5e4;
    --fo-border-strong: #d6d3d1;
    --fo-text: #1c1917;
    --fo-text-muted: #78716c;
    --fo-text-soft: #a8a29e;
    --fo-accent: #7c3aed;
    --fo-accent-soft: #ede9fe;
    --fo-week: #0e7490;
    --fo-week-soft: #cffafe;
    --fo-finish: #b45309;
    --fo-finish-soft: #fef3c7;
    --fo-radius: 10px;
    --fo-radius-lg: 14px;
    --fo-shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --fo-shadow: 0 2px 8px rgba(28,25,23,.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.finishing-page {
    background: linear-gradient(180deg, var(--fo-bg) 0%, var(--fo-bg-deep) 100%);
    color: var(--fo-text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* === HEADER === */

.fo-header {
    background: var(--fo-card);
    border-bottom: 1px solid var(--fo-border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    padding-top: calc(10px + env(safe-area-inset-top));
}

.fo-back {
    color: var(--fo-text-muted);
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .15s;
}

.fo-back:hover, .fo-back:focus-visible {
    background: var(--fo-bg);
    color: var(--fo-text);
}

.fo-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    min-width: 0;
}

.fo-refresh {
    background: transparent;
    border: 1px solid var(--fo-border-strong);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
    color: var(--fo-text-muted);
    transition: background .15s, color .15s;
}

.fo-refresh:hover { background: var(--fo-bg); color: var(--fo-text); }
.fo-refresh.is-spinning { animation: fo-spin 1s linear infinite; }

@keyframes fo-spin { to { transform: rotate(360deg); } }

/* === WEEK BAR === */

.fo-week-bar {
    background: var(--fo-card);
    border-bottom: 1px solid var(--fo-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 14px;
}

.fo-week-nav {
    background: transparent;
    border: 1px solid var(--fo-border-strong);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    color: var(--fo-text);
    line-height: 1;
}

.fo-week-nav:hover { background: var(--fo-bg); }
.fo-week-nav:disabled { opacity: .4; cursor: not-allowed; }

.fo-week-info {
    text-align: center;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fo-week-label {
    font-weight: 600;
    font-size: 15px;
}

.fo-week-sub {
    font-size: 12px;
    color: var(--fo-text-muted);
}

/* === CONTROLS === */

.fo-controls {
    background: var(--fo-card);
    border-bottom: 1px solid var(--fo-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
}

.fo-weeks-select {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--fo-text-muted);
}

.fo-weeks-select select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--fo-border-strong);
    border-radius: 8px;
    background: var(--fo-card);
    color: var(--fo-text);
    font-size: 14px;
    appearance: none;
}

.fo-search {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--fo-border-strong);
    border-radius: 8px;
    background: var(--fo-card);
    color: var(--fo-text);
    font-size: 14px;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.fo-search::placeholder { color: var(--fo-text-soft); }

.fo-search:focus {
    outline: none;
    border-color: var(--fo-accent);
    box-shadow: 0 0 0 3px var(--fo-accent-soft);
}

.fo-view-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: var(--fo-bg);
    padding: 4px;
    border-radius: 10px;
}

.fo-view-tab {
    border: 0;
    background: transparent;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--fo-text-muted);
    cursor: pointer;
    border-radius: 7px;
    transition: background .15s, color .15s;
    min-height: 36px;
}

.fo-view-tab:hover { color: var(--fo-text); }

.fo-view-tab.is-active {
    background: var(--fo-card);
    color: var(--fo-text);
    box-shadow: var(--fo-shadow-sm);
}

.fo-view-tab-desktop { display: none; }

/* === MAIN === */

.fo-main {
    padding: 14px;
    max-width: 1400px;
    margin: 0 auto;
}

.fo-summary {
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--fo-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.fo-summary strong {
    color: var(--fo-text);
    font-weight: 600;
}

.fo-loading, .fo-error, .fo-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--fo-text-muted);
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius);
}

.fo-error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.fo-content { display: flex; flex-direction: column; gap: 12px; }

/* === WEEK SECTIE === */

.fo-week-section {
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius-lg);
    overflow: hidden;
    box-shadow: var(--fo-shadow);
}

.fo-week-header {
    background: var(--fo-week-soft);
    color: var(--fo-week);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--fo-border);
}

.fo-week-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fo-week-header-sub {
    font-size: 11px;
    font-weight: 500;
    opacity: .8;
}

.fo-week-totals {
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,.6);
    border-radius: 6px;
    padding: 3px 8px;
    white-space: nowrap;
}

.fo-week-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === AFWERKING SECTIE === */

.fo-finish-section {
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius);
    overflow: hidden;
    background: var(--fo-bg);
}

.fo-finish-header {
    background: var(--fo-finish-soft);
    color: var(--fo-finish);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.fo-finish-header-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.fo-finish-chevron {
    display: inline-block;
    transition: transform .15s;
    font-size: 10px;
    opacity: .7;
}

.fo-finish-section.is-collapsed .fo-finish-chevron { transform: rotate(-90deg); }
.fo-finish-section.is-collapsed .fo-finish-body { display: none; }

.fo-finish-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-finish-totals {
    background: rgba(255,255,255,.7);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    white-space: nowrap;
}

.fo-finish-body {
    background: var(--fo-card);
}

/* === BON RIJEN === */

.fo-bon-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fo-bon-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--fo-border);
    align-items: start;
}

.fo-bon-row:last-child { border-bottom: 0; }
.fo-bon-row:hover { background: var(--fo-bg); }

.fo-bon-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fo-bon-customer {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-bon-meta {
    font-size: 12px;
    color: var(--fo-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fo-bon-meta-sep::before { content: '•'; margin: 0 4px; opacity: .5; }

.fo-bon-finish-inline {
    font-size: 11px;
    color: var(--fo-finish);
    background: var(--fo-finish-soft);
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 500;
}

.fo-bon-day-pill {
    font-size: 11px;
    background: var(--fo-bg);
    border: 1px solid var(--fo-border);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--fo-text-muted);
}

.fo-bon-day-pill.is-today {
    background: var(--fo-week-soft);
    color: var(--fo-week);
    border-color: var(--fo-week);
}

.fo-bon-selcode {
    font-size: 11px;
    background: var(--fo-finish-soft);
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--fo-finish);
    font-weight: 600;
    white-space: nowrap;
}

.fo-bon-selcode strong { font-weight: 700; }

.fo-bon-card-selcode {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--fo-finish);
    background: var(--fo-finish-soft);
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 2px 8px;
    margin-right: 8px;
    font-family: ui-monospace, monospace;
}

/* === PLANNING BADGES (productie-status per bon) === */

.fo-badge {
    font-size: 11px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.fo-badge-ok {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.fo-badge-prod {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.fo-badge-warn {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* === FINISHING UITKLAP-PANEEL (per bon, WIS-werkzaamheden) === */

.fo-expand-btn {
    background: var(--fo-card);
    border: 1px solid var(--fo-border-strong);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    color: var(--fo-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.fo-expand-btn:hover { background: var(--fo-bg); color: var(--fo-text); }

.fo-expand-chevron { font-size: 9px; }

.fo-finishing-panel {
    list-style: none;
    margin: 8px 0 0;
    padding: 8px;
    background: var(--fo-bg);
    border: 1px solid var(--fo-border);
    border-radius: 8px;
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fo-fitem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: 6px;
    font-size: 12px;
}

.fo-fitem-pending { /* default */ }

.fo-fitem-running {
    border-color: #fbbf24;
    background: #fffbeb;
}

.fo-fitem-done {
    opacity: .7;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.fo-fitem-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fo-fitem-naam {
    font-weight: 600;
    color: var(--fo-text);
}

.fo-fitem-meta-row {
    font-size: 11px;
    color: var(--fo-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.fo-fitem-meta { white-space: nowrap; }

.fo-fitem-knelpunt {
    color: #b91c1c;
    font-weight: 700;
    cursor: help;
}

.fo-fitem-action {
    flex-shrink: 0;
}

.fo-fitem-btn {
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.fo-fitem-btn:disabled { opacity: .5; cursor: wait; }

.fo-fitem-btn-start {
    background: #16a34a;
    color: white;
    border-color: #15803d;
}

.fo-fitem-btn-start:hover:not(:disabled) { background: #15803d; }

.fo-fitem-btn-stop {
    background: #d97706;
    color: white;
    border-color: #b45309;
}

.fo-fitem-btn-stop:hover:not(:disabled) { background: #b45309; }

.fo-fitem-btn-reopen {
    background: transparent;
    color: var(--fo-text-muted);
    border-color: var(--fo-border-strong);
}

.fo-fitem-btn-reopen:hover:not(:disabled) {
    background: var(--fo-bg);
    color: var(--fo-text);
}

.fo-fitem-disabled {
    font-size: 11px;
    color: var(--fo-text-soft);
    font-style: italic;
}

.fo-day-source {
    font-size: 11px;
    color: var(--fo-text-muted);
    font-weight: 400;
    margin-left: 6px;
}

.fo-bon-card-deldate {
    font-size: 13px;
    font-weight: 600;
    color: var(--fo-text);
    background: var(--fo-bg);
    border-radius: 4px;
    padding: 2px 8px;
    margin-right: 8px;
    font-family: ui-monospace, monospace;
}

.fo-bon-card-av {
    font-weight: 600;
    color: var(--fo-text);
}

/* Mini bon-flow: pillen voor elke werkdag van DEZE bon, lijntje ertussen,
   huidige dag in de bon's hue-kleur. Maakt over-meerdere-dagen-spanning
   expliciet zichtbaar i.p.v. alleen via de border-left-kleur. */
.fo-bon-flow {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 6px 0 4px;
    flex-wrap: wrap;
}

.fo-bon-flow-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--fo-text-muted);
    background: var(--fo-bg);
    border: 1px solid var(--fo-border);
    border-radius: 10px;
    padding: 1px 8px;
    font-family: ui-monospace, monospace;
    white-space: nowrap;
}

.fo-bon-flow-pill.is-current {
    color: #fff;
    background: hsl(var(--bon-hue, 0), 65%, 45%);
    border-color: hsl(var(--bon-hue, 0), 65%, 35%);
}

.fo-bon-flow-sep {
    display: inline-block;
    width: 10px;
    height: 2px;
    background: hsl(var(--bon-hue, 0), 65%, 65%);
    margin: 0 1px;
}

/* === Bon-detail uitklap (View 1/2 + View 3) === */

.fo-bon-row, .fo-bon-card {
    cursor: pointer;
}

.fo-bon-card.is-expanded {
    background: var(--fo-bg);
    box-shadow: inset 0 0 0 1px var(--fo-border-strong);
}

/* Bon-kleur per AV-order: --bon-hue custom property wordt nog gezet en is
   nog steeds in gebruik door de bon-flow pillen + lijntjes (de mini-flow
   boven de WIS-timeline). De border-left op de cards zelf is weggehaald
   omdat het visueel druk was — de bon-flow pillen geven al voldoende
   kleur-binding tussen werkdagen. */

/* Pulse-animatie voor een AV-orderregel die op dit moment loopt
   (running InkoopLog). Vergelijkbaar met de WIS quickstart-feedback. */
@keyframes fo-running-pulse {
    0%, 100% { background: var(--fo-finish-soft); }
    50%      { background: #fde68a; }
}
.fo-detail-bew.is-running {
    animation: fo-running-pulse 1.6s ease-in-out infinite;
    border-left-width: 4px;
}

/* === COMPACT TIMELINE op bon-card (.fo-tl) === */

.fo-tl {
    position: relative;
    height: 44px;
    margin: 6px 0 10px;
}

.fo-tl-track {
    position: absolute;
    left: 4%;
    right: 4%;
    top: 22px;
    height: 2px;
    background: var(--fo-border);
    border-radius: 2px;
}

.fo-tl-dot {
    position: absolute;
    top: 23px;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid var(--fo-card);
    box-shadow: 0 0 0 1px var(--fo-border-strong);
    cursor: help;
}

.fo-tl-date {
    position: absolute;
    bottom: 100%;
    margin-bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    line-height: 1;
    font-weight: 500;
    color: var(--fo-text-muted);
    white-space: nowrap;
    pointer-events: none;
}

.fo-tl-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    line-height: 1;
    font-weight: 600;
    color: var(--fo-text-muted);
    white-space: nowrap;
    pointer-events: none;
}

.fo-tl-dot.is-highlight .fo-tl-label,
.fo-tl-dot.is-highlight .fo-tl-date {
    color: var(--fo-finish);
    font-weight: 700;
}

.fo-tl-ok        { background: #16a34a; box-shadow: 0 0 0 1px #15803d; }
.fo-tl-attention { background: #b91c1c; box-shadow: 0 0 0 1px #991b1b; }
.fo-tl-pending   { background: #94a3b8; box-shadow: 0 0 0 1px #64748b; }

.fo-tl-dot.is-highlight {
    width: 14px;
    height: 14px;
    top: 21px;
    background: var(--fo-finish);
    box-shadow: 0 0 0 2px var(--fo-finish-soft), 0 0 0 3px var(--fo-finish);
    z-index: 1;
}

.fo-tl-dot.is-highlight .fo-tl-label { top: 12px; }
.fo-tl-dot.is-highlight .fo-tl-date { margin-bottom: 5px; }

.fo-card-chevron {
    font-size: 10px;
    color: var(--fo-text-muted);
    margin-left: 4px;
}

.fo-bon-details {
    margin-top: 8px;
    padding: 8px;
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: default;
}

.fo-detail-meta {
    font-size: 12px;
    color: var(--fo-text-muted);
}

.fo-detail-meta-muted {
    font-size: 12px;
    color: var(--fo-text-soft);
    font-style: italic;
}

.fo-detail-meta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--fo-text-muted);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--fo-border);
}

.fo-detail-meta-row strong {
    color: var(--fo-text);
    font-weight: 600;
}

.fo-detail-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fo-detail-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--fo-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fo-detail-bew-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fo-detail-bew {
    display: grid;
    grid-template-columns: 70px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    background: var(--fo-bg);
    border: 1px solid var(--fo-border);
    border-radius: 5px;
    font-size: 12px;
}

.fo-detail-bew.is-highlight {
    background: #fef3c7;
    border-color: #fbbf24;
    font-weight: 600;
}

.fo-detail-bew-when {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--fo-text-muted);
}

.fo-detail-bew.is-highlight .fo-detail-bew-when { color: #b45309; }

.fo-detail-bew-naam { color: var(--fo-text); }

.fo-detail-bew-m2 {
    font-variant-numeric: tabular-nums;
    color: var(--fo-text);
}

.fo-detail-src {
    font-size: 9px;
    background: var(--fo-week-soft);
    color: var(--fo-week);
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.fo-detail-src-finish {
    background: var(--fo-finish-soft);
    color: var(--fo-finish);
}

.fo-detail-src-done {
    background: #dcfce7;
    color: #166534;
}

.fo-detail-src-warn {
    background: #fef2f2;
    color: #b91c1c;
    cursor: help;
}

.fo-detail-floor {
    background: var(--fo-bg);
    border: 1px solid var(--fo-border);
    padding: 2px 8px;
    border-radius: 5px;
    color: var(--fo-text);
    font-weight: 500;
}

.fo-detail-notes {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fo-detail-note {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    align-items: start;
    font-size: 12px;
    padding: 4px 8px;
    background: var(--fo-bg);
    border-radius: 5px;
}

.fo-detail-note-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--fo-text-muted);
    font-weight: 600;
    letter-spacing: .04em;
    padding-top: 2px;
}

.fo-detail-note-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--fo-text);
}

.fo-detail-bew.is-finishing {
    border-left: 3px solid var(--fo-finish);
    background: var(--fo-finish-soft);
}

.fo-detail-bew.is-finishing .fo-detail-bew-naam {
    color: var(--fo-finish);
    font-weight: 600;
}

.fo-detail-bew.is-finishing.is-highlight {
    background: #fde68a;
    border-color: var(--fo-finish);
    box-shadow: 0 0 0 2px var(--fo-finish);
}

.fo-detail-bew-werknemer {
    font-size: 11px;
    color: var(--fo-text-muted);
    text-align: right;
}

.fo-detail-bew-badges {
    display: flex;
    gap: 3px;
}

.fo-collapse-btn {
    background: transparent;
    border: 1px solid var(--fo-border-strong);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    color: var(--fo-text-muted);
    margin-left: 8px;
    font-weight: 500;
}

.fo-collapse-btn:hover {
    background: var(--fo-bg);
    color: var(--fo-text);
}

.fo-bon-m2 {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    color: var(--fo-text);
    text-align: right;
    align-self: center;
}

.fo-bon-m2-unit {
    font-size: 11px;
    color: var(--fo-text-muted);
    font-weight: 500;
    margin-left: 2px;
}

/* === DAG SECTIE (view 3) === */

.fo-day-section {
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius);
    overflow: hidden;
    background: var(--fo-card);
}

.fo-day-header {
    background: var(--fo-bg);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--fo-border);
}

.fo-day-header.is-today {
    background: var(--fo-week-soft);
    color: var(--fo-week);
}

.fo-day-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--fo-bg);
}

.fo-bon-card {
    padding: 12px 14px;
    background: var(--fo-card);
    border: 1px solid var(--fo-border);
    border-radius: var(--fo-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.fo-bon-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.fo-bon-card-customer {
    font-weight: 700;
    font-size: 15px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fo-bon-card-order {
    font-size: 13px;
    color: var(--fo-text-muted);
    font-family: ui-monospace, monospace;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fo-bon-card-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 4px 0 6px;
}

.fo-bon-card-finishes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.fo-finish-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    font-size: 17px;
    line-height: 1.25;
    border-top: 1px solid var(--fo-border);
}
.fo-finish-row:first-child { border-top: 0; }

.fo-finish-row.is-klaar .fo-finish-row-name {
    text-decoration: line-through;
    color: var(--fo-text-muted);
}

@keyframes fo-finish-row-pulse {
    0%, 100% { background: transparent; }
    50%      { background: var(--fo-finish-soft); }
}
.fo-finish-row.is-running {
    animation: fo-finish-row-pulse 1.6s ease-in-out infinite;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 6px;
}

.fo-finish-row-name {
    color: var(--fo-finish);
    font-weight: 600;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.fo-finish-row-m2 {
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    min-width: 72px;
    text-align: right;
    color: var(--fo-text-muted);
}

.fo-finish-row-action {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

/* Inline row-actie buttons: start / stop / heropen / handmatig klaar */
.fo-row-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--fo-border-strong);
    background: var(--fo-card);
    color: var(--fo-text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.fo-row-btn:hover:not(:disabled) {
    background: var(--fo-bg);
}

.fo-row-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.fo-row-btn-start {
    background: #16a34a;
    color: #fff;
    border-color: #15803d;
}
.fo-row-btn-start:hover:not(:disabled) {
    background: #15803d;
}

.fo-row-btn-stop {
    background: #b91c1c;
    color: #fff;
    border-color: #991b1b;
}
.fo-row-btn-stop:hover:not(:disabled) {
    background: #991b1b;
}

.fo-row-btn-reopen {
    background: var(--fo-card);
    color: var(--fo-text-muted);
}

.fo-row-btn-manual {
    background: var(--fo-card);
    color: var(--fo-text-muted);
    font-size: 16px;
}
.fo-row-btn-manual.is-klaar {
    background: #16a34a;
    color: #fff;
    border-color: #15803d;
}

/* === KLAAR → WEGSCHUIF-ANIMATIE ===
   JS zet eerst inline max-height op de huidige hoogte (transitie-startpunt),
   voegt dan .is-leaving toe: rij/card kleurt groen, schuift naar rechts weg
   en klapt dicht. Na LEAVE_MS (finishingOverviewClient) haalt de re-render
   het element echt uit de DOM. */
.fo-finish-row.is-leaving,
.fo-bon-card.is-leaving {
    transition:
        opacity .26s ease,
        transform .26s ease,
        background .2s ease,
        max-height .32s ease .08s,
        padding .32s ease .08s,
        margin .32s ease .08s,
        border-width .32s ease .08s;
    overflow: hidden;
    opacity: 0;
    transform: translateX(28px);
    background: #f0fdf4;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
    pointer-events: none;
}

/* === FOOTER === */

.fo-footer {
    text-align: center;
    padding: 16px;
    color: var(--fo-text-soft);
    font-size: 11px;
}

.fo-updated { font-style: italic; }

/* === RESPONSIVE === */

@media (min-width: 600px) {
    .fo-view-tab-mobile { display: none; }
    .fo-view-tab-desktop { display: inline; }
    .fo-controls {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
    .fo-weeks-select { flex: 0 0 auto; }
    .fo-view-switcher { flex: 1; max-width: 600px; }
    .fo-view-tab { font-size: 13px; }
}

@media (min-width: 900px) {
    .fo-title { font-size: 18px; }
    .fo-main { padding: 20px; }
    .fo-week-section .fo-week-body { padding: 12px; }
    .fo-bon-row {
        grid-template-columns: 1fr auto auto;
        align-items: center;
    }
    .fo-bon-meta { font-size: 13px; }
}

@media (min-width: 1100px) {
    /* Twee weken naast elkaar op desktop in view "week-afwerking-bonnen" */
    .fo-content.view-week-afwerking-bonnen,
    .fo-content.view-week-dag-bon-afwerking {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (min-width: 1400px) {
    .fo-content.view-week-afwerking-bonnen,
    .fo-content.view-week-dag-bon-afwerking {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
