:root {
    --fp-primary: #2e5d3a;
    --fp-primary-dark: #234a2d;
    --fp-bg: #f6f7f5;
    --fp-surface: #ffffff;
    --fp-text: #1f2421;
    --fp-muted: #5f6b63;
    --fp-border: #d5dbd6;
    --fp-danger: #b3261e;
    --fp-danger-bg: #fdecea;
    --fp-success: #1e6b34;
    --fp-success-bg: #e6f4ea;
}

html, body {
    font-family: Roboto, "Segoe UI", Arial, sans-serif;
}

h1:focus {
    outline: none;
}

/* --- /Account puslapiai (statiniai, be MudBlazor) --- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--fp-bg);
    color: var(--fp-text);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: 8px;
    padding: 28px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.auth-brand {
    color: var(--fp-primary);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0 0 20px;
}

.auth-card .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.auth-card label {
    font-size: 0.9rem;
    color: var(--fp-muted);
}

.auth-card input[type=text],
.auth-card input[type=email],
.auth-card input[type=password],
.auth-card input:not([type]) {
    font: inherit;
    font-size: 1rem;
    padding: 12px;
    border: 1px solid var(--fp-border);
    border-radius: 6px;
    background: #fff;
}

.auth-card input:focus {
    outline: 2px solid var(--fp-primary);
    outline-offset: -1px;
}

.auth-card .check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--fp-text);
}

.auth-card .check input {
    width: 18px;
    height: 18px;
}

.btn-primary {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    padding: 12px;
    border: 0;
    border-radius: 6px;
    background: var(--fp-primary);
    color: #fff;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--fp-primary-dark);
}

.auth-hint {
    margin: 20px 0 0;
    font-size: 0.875rem;
    color: var(--fp-muted);
}

.auth-card a {
    color: var(--fp-primary);
}

.alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-danger {
    background: var(--fp-danger-bg);
    color: var(--fp-danger);
}

.alert-success {
    background: var(--fp-success-bg);
    color: var(--fp-success);
}

.validation-message {
    color: var(--fp-danger);
    font-size: 0.85rem;
}

.auth-card input.invalid {
    border-color: var(--fp-danger);
}

/* --- Blazor klaidų juosta --- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.6rem 1.25rem;
    background: #ffe8a1;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    z-index: 2000;
}

#blazor-error-ui .reload {
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    padding: 1rem;
    background: var(--fp-danger);
    color: #fff;
}

.blazor-error-boundary::after {
    content: "Įvyko klaida.";
}

/* --- Planų grafikai (SVG) --- */

.chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.chart {
    width: 100%;
    min-width: 720px;
    height: auto;
    display: block;
    font-family: Roboto, "Segoe UI", Arial, sans-serif;
}

.chart .grid {
    stroke: #d5dbd6;
    stroke-width: 1;
}

.chart .axis-label,
.chart .row-sub {
    font-size: 11px;
    fill: #5f6b63;
}

.chart .row-label {
    font-size: 12px;
    font-weight: 500;
    fill: #1f2421;
}

.chart .row-bg {
    fill: #f1f3f0;
}

.chart .bar {
    fill-opacity: 0.85;
    stroke: #fff;
    stroke-width: 0.5;
}

.chart .bar-label {
    font-size: 11px;
    fill: #fff;
    pointer-events: none;
}

.chart .bin-run-label {
    font-size: 11px;
    fill: #1f2421;
    pointer-events: none;
}

.chart .lane-bg {
    fill: #f7f8f6;
}

.chart .lane-label {
    font-size: 9px;
    fill: #8a948d;
}

.chart .lane-bar {
    fill-opacity: 0.9;
}

.chart .lane-bar-label {
    font-size: 10px;
    fill: #fff;
    pointer-events: none;
}

.chart .bin-empty-label {
    font-size: 10px;
    fill: #5f6b63;
    pointer-events: none;
}

.chart .bar-sub {
    font-size: 10px;
    fill: #fff;
    fill-opacity: 0.9;
    pointer-events: none;
}

.chart .cleaning {
    fill: #bdbdbd;
    fill-opacity: 0.6;
}

.chart .now-marker {
    pointer-events: none;
}

.chart .now {
    stroke: #f9a825;
    stroke-width: 3;
}

.chart .past {
    fill: #757575;
    fill-opacity: 0.08;
}

/* Visa simuliacija: kas po plano pabaigos (BUSINESS_RULES §4 „Apkrova – ir tai, kas netelpa“). */
.chart .after-plan {
    fill: #d32f2f;
    fill-opacity: 0.06;
    pointer-events: none;
}

.chart .plan-end {
    stroke: #d32f2f;
    stroke-width: 2;
    stroke-dasharray: 6 4;
    pointer-events: none;
}

.chart .plan-end-label {
    fill: #d32f2f;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
}

.chart .now-pill {
    fill: #f9a825;
}

.chart .now-label {
    fill: #212121;
    font-size: 11px;
    font-weight: 600;
}

/* Partijų ir darbų būsena pagal laiką (vyksta / baigta). */
.time-running {
    box-shadow: inset 0 0 0 2px #f9a825;
    background-color: rgba(249, 168, 37, 0.08) !important;
}

.time-done {
    opacity: 0.6;
}

.swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.cleaning-swatch {
    background: #bdbdbd;
}

/* --- Pamainų tinklelis --- */

.shift-grid {
    border-collapse: collapse;
    font-size: 0.85rem;
}

.shift-grid th {
    padding: 4px 6px;
    font-weight: 500;
    white-space: nowrap;
}

.shift-grid .shift-no {
    color: #5f6b63;
    font-weight: 400;
    font-size: 0.75rem;
}

.shift-grid .line-name {
    text-align: left;
}

.shift-grid td {
    width: 26px;
    height: 30px;
    text-align: center;
    border: 1px solid #fff;
    cursor: pointer;
    user-select: none;
}

.shift-grid td.on {
    background: #c8e6c9;
}

.shift-grid td.off {
    background: #bdbdbd;
    color: #424242;
    font-weight: 700;
}

.shift-grid td.sched-off {
    background: repeating-linear-gradient(45deg, #e0e0e0, #e0e0e0 4px, #eeeeee 4px, #eeeeee 8px);
}

.shift-grid td.extra {
    background: #66bb6a;
    color: #fff;
    font-weight: 700;
}

.shift-grid td.partial {
    background: #e8f5e9;
    color: #5f6b63;
}

.reversed-row td {
    opacity: 0.55;
    text-decoration: line-through;
}

/* --- Pamainos užduotis --- */

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 4px 0 8px;
}

.task-table th,
.task-table td {
    border-bottom: 1px solid #d5dbd6;
    padding: 5px 8px;
    text-align: left;
    vertical-align: top;
}

.task-table th {
    font-weight: 500;
    color: #5f6b63;
}

.task-table .num {
    text-align: right;
    white-space: nowrap;
}

.line-block {
    margin: 8px 0 12px;
}

.shift-task .muted {
    color: #5f6b63;
}

.signature {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 32px;
}

/* Pamainų ataskaita: nuokrypio spalvos ir blokai, kurie nelaužomi per puslapius. */
.gap-behind {
    color: #c62828;
}

.gap-ahead {
    color: #2e7d32;
}

.shift-block {
    break-inside: avoid;
}

.total-row td {
    border-top: 1px solid #bbb;
}

@media print {
    .mud-appbar,
    .mud-drawer,
    .mud-snackbar-provider,
    .no-print,
    #blazor-error-ui,
    #components-reconnect-modal {
        display: none !important;
    }

    .mud-main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .mud-container {
        max-width: none !important;
        padding: 0 !important;
    }

    body {
        background: #fff !important;
    }

    .task-table {
        font-size: 10pt;
    }

    .line-block,
    .task-table tr {
        break-inside: avoid;
    }
}

/* --- Plano koregavimas tempiant --- */

.board {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.board-lane {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.board-lane-title {
    width: 110px;
    flex-shrink: 0;
    font-weight: 500;
    padding-top: 10px;
}

.board-zone {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 58px;
    padding: 6px;
    border-radius: 6px;
    background: #f1f3f0;
    border: 1px dashed #d5dbd6;
}

.board-card {
    background: #fff;
    border: 1px solid #d5dbd6;
    border-left: 5px solid #9e9e9e;
    border-radius: 4px;
    padding: 5px 8px;
    min-width: 190px;
    max-width: 280px;
    cursor: grab;
    font-size: 0.8rem;
    line-height: 1.3;
}

.board-card-title {
    font-weight: 500;
}

.board-card-sub {
    color: #5f6b63;
}

.board-card-problem {
    color: #c62828;
    font-weight: 500;
}

.help-list li {
    margin-bottom: 6px;
}

/* Juostų tempimas laike (Koregavimas). */
.chart [data-drag] {
    cursor: ew-resize;
    touch-action: none;
}

.chart [data-drag].dragging .bar {
    fill-opacity: 0.6;
    stroke: #222;
    stroke-width: 1.5;
}

.chart .drag-hint {
    font-size: 11px;
    font-weight: 600;
    fill: #222;
    pointer-events: none;
}

.chart .manual-start {
    fill: #222;
    pointer-events: none;
}

.chart [data-drag].dragging .bar-sub {
    display: none;
}

.chart [data-drag].dragging .drag-hint {
    fill: #fff;
}

/* Partijos tempimas į kitą aruodą (Aruodai). */
.chart [data-bin-drag] {
    cursor: ns-resize;
    touch-action: none;
}

.chart [data-bin-drag].dragging .lane-bar {
    fill-opacity: 0.6;
    stroke: #222;
    stroke-width: 1.5;
}

.chart .bin-row-zone {
    fill: transparent;
}

.chart .bin-row-zone.bin-drop {
    fill: #1565c0;
    fill-opacity: 0.12;
    stroke: #1565c0;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.chart .manual-bin {
    fill: #222;
    pointer-events: none;
}

/* Linijų grafikas: perėjimas po darbo ir nedarbo laikas. */
.chart .changeover {
    fill: #fbc02d;
    stroke: #f57f17;
    stroke-width: 0.5;
}

.chart .changeover-label {
    fill: #212121;
    font-size: 10px;
    font-weight: 600;
}

.chart .offtime {
    fill: #9e9e9e;
    fill-opacity: 0.22;
}

.chart .off-label {
    fill: #616161;
    font-size: 9px;
    font-style: italic;
}

/* Pamainų lentelė: komandos žmonių skaičius pamainoje. */
.shift-grid .crew-cell {
    padding: 0;
    background: #fffde7;
}

.shift-grid .crew-cell.crew-set {
    background: #fff59d;
}

.shift-grid .crew-input {
    width: 100%;
    min-width: 30px;
    border: none;
    background: transparent;
    text-align: center;
    font: inherit;
    font-weight: 600;
}

/* Spausdinamas planas: vieta faktui ranka ir parašams. */
.task-sub {
    font-size: 0.8em;
    color: #616161;
}

.fact-cell {
    min-width: 70px;
    border-bottom: 1px solid #9e9e9e;
}

.print-signature {
    display: flex;
    gap: 48px;
    margin-top: 28px;
    font-size: 10pt;
}

/* Darbuotojų grafikas */
.roster-grid {
    border-collapse: collapse;
    font-size: 0.8rem;
}

.roster-grid th {
    padding: 2px 3px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.roster-grid th .dow {
    color: #5f6b63;
    font-weight: 400;
    font-size: 0.7rem;
}

.roster-grid .name {
    text-align: left;
    white-space: nowrap;
    padding-right: 8px;
}

.roster-grid .team {
    color: #5f6b63;
    padding-right: 6px;
}

.roster-grid td {
    border: 1px solid #e0e0e0;
    padding: 0;
    text-align: center;
}

.roster-grid .weekend {
    background-color: #f2f2f2;
}

.roster-input {
    width: 30px;
    height: 26px;
    border: none;
    background: transparent;
    text-align: center;
    font: inherit;
    text-transform: uppercase;
}

.roster-grid td.work { background: #fff59d; }
.roster-grid td.work.partial { background: #fffde7; }
.roster-grid td.work.night { background: #ffcc80; }
.roster-grid td.work.other-team { background: #b3e5fc; }
.roster-grid td.rest { background: #eeeeee; color: #757575; }
.roster-grid td.sick { background: #ef9a9a; }
.roster-grid td.absent { background: #ce93d8; }
.roster-grid td.bad { background: #e53935; color: #fff; }

.roster-grid tr.summary td {
    background: #fafafa;
    color: #37474f;
    font-weight: 500;
    height: 22px;
}

.roster-grid td.cell {
    width: 30px;
    min-width: 30px;
    height: 26px;
    font-weight: 500;
    user-select: none;
}

.roster-grid tr.group td { background: #e3f2fd; font-weight: 600; font-size: 0.8rem; padding-top: 4px; }
.roster-grid td.cell.editable { cursor: cell; }
.roster-grid td.cell.editable:hover { outline: 2px solid #1565c0; outline-offset: -2px; }
.roster-grid .today { box-shadow: inset 2px 0 0 #1565c0, inset -2px 0 0 #1565c0; }

.roster-grid thead tr.summary th {
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    padding: 2px;
    font-size: 0.75rem;
}

.crew-count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 4px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
}

.crew-count.ok { background: #c8e6c9; color: #1b5e20; }
.crew-count.low { background: #ffcdd2; color: #b71c1c; }
.crew-count.high { background: #bbdefb; color: #0d47a1; }
.crew-count.neutral { background: #eeeeee; color: #37474f; }

.roster-brush {
    min-width: 38px;
    height: 30px;
    border: 1px solid #bdbdbd;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    background: #fff;
}

.roster-brush.work { background: #fff59d; }
.roster-brush.work.night { background: #ffcc80; }
.roster-brush.work.partial { background: #fffde7; }
.roster-brush.rest { background: #eeeeee; }
.roster-brush.sick { background: #ef9a9a; }
.roster-brush.absent { background: #ce93d8; }
.roster-brush.selected { outline: 3px solid #1565c0; outline-offset: 1px; }

.roster-name {
    cursor: pointer;
    color: #1565c0;
    text-decoration: none;
}

.roster-name:hover { text-decoration: underline; }

.pattern-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.pattern-preview .cell {
    width: 34px;
    height: 34px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1.1;
}

.pattern-preview .cell .d { font-size: 0.65rem; color: #5f6b63; }
.pattern-preview .cell.work { background: #fff59d; }
.pattern-preview .cell.work.night { background: #ffcc80; }
.pattern-preview .cell.work.partial { background: #fffde7; }
.pattern-preview .cell.rest { background: #eeeeee; }
.pattern-preview .cell.sick { background: #ef9a9a; }
.pattern-preview .cell.absent { background: #ce93d8; }

/* Datos / laiko pasirinkimas rodomas visas: MudBlazor picker'io iškylančiam langui uždeda „relative width“,
   o jo JS tada riboja max-width įvesties laukelio pločiu – kalendorius ir laikrodis nukerpami.
   Ribojamas vidinis popieriaus elementas (.mud-picker-popover-paper), ne pats .mud-popover. */
.mud-picker-popover-paper {
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
}

/* Tas pats ribojimas uždedamas ir viršutinei juostai (pasirinkta data / laikas) – kitaip laikas nukerpamas. */
.mud-picker-popover-paper .mud-picker-toolbar {
    max-width: none !important;
}

/* Pamainos perdavimo forma: punktas, atsakymas, komentaras. */
.handover-table {
    width: 100%;
    border-collapse: collapse;
}

.handover-table td {
    padding: 2px 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    vertical-align: middle;
}

.handover-table .handover-label {
    width: 45%;
}

.handover-table .handover-value {
    width: 20%;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .handover-table tr {
        display: flex;
        flex-direction: column;
        padding: 6px 0;
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    .handover-table td {
        border: none;
        width: auto !important;
    }
}

/* Fasavimo užduoties lapas (forma 75PR13-01): spalvos kaip popierinėje formoje. */
.task-sheet {
    background: #fff;
    color: #000;
    padding: 12px;
    font-size: 13px;
}

.task-sheet .ts-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.task-sheet .ts-title {
    font-size: 15px;
    margin: 14px 0 6px;
}

.task-sheet .ts-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.task-sheet .ts-table th,
.task-sheet .ts-table td {
    border: 1px solid #000;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}

.task-sheet .ts-table th {
    font-weight: 700;
    font-size: 12px;
}

.task-sheet .ts-hl { background: #ffd966; }
.task-sheet .ts-label { background: #bdd7ee; }
.task-sheet .ts-fill { background: #fff2a8; }

.task-sheet .ts-notes {
    min-width: 220px;
    color: #c00000;
    font-weight: 700;
    white-space: pre-line;
}

.task-sheet .ts-side {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    width: 28px;
}

.task-sheet .ts-status { min-width: 90px; }
.task-sheet .ts-status.ts-done { background: #33cc33; }
.task-sheet .ts-status.ts-progress { background: #ffc000; }
.task-sheet .ts-status-text { font-size: 15px; }

.task-sheet .ts-input {
    width: 100%;
    min-width: 60px;
    font: inherit;
    padding: 2px 4px;
    border: 1px solid #888;
    background: #fff;
}

.task-sheet .ts-small {
    font-size: 11px;
    color: #555;
}

/* Pildomas langelis kaip Excel'yje: be rėmelio, užpildo langelį; aktyvus – žalias rėmelis. */
.task-sheet .ts-fill .ts-input { border: 1px solid transparent; background: transparent; min-width: 50px; }
.task-sheet .ts-fill .ts-input:focus { outline: none; border: 2px solid #217346; background: #fff; }
.task-sheet .ts-input.ts-num { text-align: right; }

@media print {
    @page { size: A4 landscape; margin: 8mm; }

    .task-sheet { padding: 0; }
    .task-sheet .ts-input { border: none !important; }

    .task-sheet .ts-hl,
    .task-sheet .ts-label,
    .task-sheet .ts-fill,
    .task-sheet .ts-status {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.task-sheet .ts-remarks {
    text-align: left !important;
    min-width: 220px;
    font-size: 12px;
}

/* Technologinė kortelė (forma 75PR13-05.1): Excel tinklelis, pildomi langeliai – geltoni, įvedama tiesiai langelyje. */
.tech-card {
    background: #fff;
    color: #000;
    padding: 8px;
    font-size: 12px;
}

.tech-card .tc-head,
.tech-card .tc-foot {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
}

.tech-card .tc-head td { padding: 2px 6px; }
.tech-card .tc-big { font-size: 15px; }
.tech-card .tc-small { font-size: 11px; color: #555; }

.tech-card .tc-scroll { overflow-x: auto; }

.tech-card .tc {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 8px;
}

.tech-card .tc th,
.tech-card .tc td,
.tech-card .tc-foot td {
    border: 1px solid #000;
    padding: 1px 4px;
    text-align: center;
    vertical-align: middle;
    height: 22px;
}

.tech-card .tc th { font-weight: 700; font-size: 11px; }
.tech-card .tc .tc-name { text-align: left; }
.tech-card .tc-note { color: #c00000; font-weight: 700; font-size: 10px; white-space: normal; }
.tech-card .tc-section td { background: #ddebf7; }
.tech-card .tc-sum td { font-weight: 700; background: #f2f2f2; }
.tech-card .tc-calc { color: #555; font-style: italic; }
.tech-card .tc-fill { background: #fff2a8; padding: 0 !important; }
.tech-card .tc-foot .tc-lbl { text-align: left; font-weight: 700; background: #f2f2f2; }
.tech-card .tc-check-head { min-width: 22px; font-weight: 400; }
.tech-card .tc-check { min-width: 22px; font-weight: 700; color: #006100; }
.tech-card .tc-check.tc-on { background: #c6efce; }
.tech-card .tc-click { cursor: pointer; }
.tech-card .tc-click:hover { background: #e2efda; }

/* Langelis kaip Excel'yje: be rėmelio, užpildo visą langelį; aktyvus – mėlynas rėmelis. */
.tech-card .tc-in {
    width: 100%;
    min-width: 42px;
    height: 22px;
    font: inherit;
    padding: 0 4px;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
}

.tech-card .tc-in.tc-num { text-align: right; }
.tech-card .tc-in:focus { outline: none; border: 2px solid #217346; background: #fff; }

@media print {
    .tech-card { padding: 0; font-size: 10px; }
    .tech-card .tc-scroll { overflow: visible; }
    .tech-card .tc-in { border: none; }

    .tech-card .tc-section td,
    .tech-card .tc-sum td,
    .tech-card .tc-check.tc-on {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Spausdinama gamybos užduotis: 1 lapas – Oracle užduotis, 2–3 – kortelės smulkiems užmetimams; visi A4 gulsčiai
   (vienas @page – kitaip naršyklė maišo orientaciją ir prideda tuščią pirmą lapą). Kiekvienas lapas sumažinamas, kad tilptų
   į vieną puslapį (js/print-fit.js), todėl stiliai galioja ne tik spausdinant – lapas matuojamas ekrane, paslėptas. */
.tc-print { display: none; color: #000; background: #fff; }
.print-fit.print-measure { display: block; position: absolute; left: -20000px; top: 0; visibility: hidden; }
.tc-print .tcp-oracle { font-size: 9px; }
.tc-print .tcp-card { padding: 0; font-size: 10px; }

.tc-print .tcp-plain { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.tc-print .tcp-plain td { padding: 1px 4px; vertical-align: top; }
.tc-print .tcp-info td:first-child { width: 150px; }
.tc-print .tcp-center { text-align: center; }
.tc-print .tcp-right { text-align: right; }
.tc-print .tcp-title { font-size: 14px; font-weight: 700; }

.tc-print .tcp-grid { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.tc-print .tcp-grid th { border: 1px solid #000; padding: 2px 4px; font-weight: 400; }
.tc-print .tcp-grid td { padding: 0 4px; vertical-align: top; }
.tc-print .tcp-num { text-align: right; white-space: nowrap; }
.tc-print .tcp-total td { border-top: 1px solid #000; }
.tc-print .tcp-sign td { padding-top: 10px; }
.tc-print .tcp-line { border-top: 1px solid #000; width: 200px; text-align: center; }
.tc-print .tcp-blank { display: inline-block; width: 140px; border-bottom: 1px solid #000; }
.tc-print .tcp-supply { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-bottom: 4px; }
.tc-print .tcp-supply-title { font-size: 26px; font-weight: 700; }
.tc-print .tcp-supply-note { font-size: 11px; font-weight: 700; text-align: right; }
.tc-print .tcp-supply-box { width: 48px; height: 48px; border: 2px solid #000; }

@media print {
    .tc-print { display: block; }
    .tc-print section { break-after: page; break-inside: avoid; }
    .tc-print section:last-child { break-after: auto; }
}

/* Lentelė, redaguojama kaip Excel'is (Parametrai → Žaliavos): langelis = įvesties laukas, išsaugoma palikus langelį. */
.grid-edit {
    width: 100%;
    border-collapse: collapse;
    background: var(--mud-palette-surface);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.grid-edit th,
.grid-edit td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 0;
    height: 30px;
    vertical-align: middle;
}

.grid-edit th { padding: 4px 6px; text-align: left; font-weight: 600; background: var(--mud-palette-background-gray); }
.grid-edit td:not(:has(.ge-in)) { padding: 0 6px; }
.grid-edit tr.ge-inactive { opacity: 0.5; }
.grid-edit .ge-note { color: var(--mud-palette-error); }

.grid-edit .ge-in {
    width: 100%;
    height: 30px;
    font: inherit;
    color: inherit;
    padding: 0 6px;
    border: 2px solid transparent;
    background: transparent;
}

.grid-edit .ge-in.ge-num { text-align: right; }
.grid-edit .ge-in:hover { background: var(--mud-palette-action-default-hover); }
.grid-edit .ge-in:focus { outline: none; border-color: #217346; background: var(--mud-palette-surface); }

.tech-card .tc-dev { background: #fce4d6; color: #9c0006; }
.tech-card .tc-in::placeholder { color: #a6a6a6; }

@media print {
    .tech-card .tc-in::placeholder { color: transparent; }
    .tech-card .tc-dev { background: none; color: inherit; }
}

/* Pajėgumai (Excel tipo lentelės ir modelio laiko juosta) */
.cap-scroll { overflow-x: auto; }
.cap-table { border-collapse: collapse; font-size: 0.82rem; }
.cap-table th, .cap-table td { border: 1px solid var(--mud-palette-lines-default); padding: 2px 4px; white-space: nowrap; }
.cap-table th { background: var(--mud-palette-background-gray); font-weight: 500; text-align: center; }
.cap-table td.calc, .cap-table th.calc { background: #f1f8e9; text-align: right; }
.cap-table tr.sub th { font-size: 0.72rem; }
.cap-table tr.bigbags td { background: #fff8e1; }
.cap-table td.warn { color: #c62828; font-weight: 600; }
.cap-table tr.cap-total td { background: var(--mud-palette-background-gray); }
.cap-input { width: 72px; border: 1px solid transparent; background: transparent; font: inherit; padding: 2px 3px; text-align: right; }
.cap-input.wide { width: 140px; text-align: left; }
.cap-input.date { width: 190px; text-align: left; border-color: var(--mud-palette-lines-default); }
.cap-input:hover { border-color: var(--mud-palette-lines-default); }
.cap-input:focus { outline: 2px solid var(--mud-palette-primary); background: #fff; }
.cap-label { font-size: 0.85rem; display: inline-flex; align-items: center; gap: 4px; }
.cap-label .cap-input { border-color: var(--mud-palette-lines-default); }
.cap-label.master { background: #e3f2fd; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.cap-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.cap-timeline { font-size: 0.78rem; }
.cap-lane { display: flex; align-items: center; height: 26px; }
.cap-lane-name { width: 110px; flex: none; font-weight: 500; }
.cap-lane-bar { position: relative; flex: 1; height: 20px; background: var(--mud-palette-background-gray); }
.cap-axis .cap-lane-bar { background: none; height: 18px; }
.cap-tick { position: absolute; top: 0; border-left: 1px solid var(--mud-palette-lines-default); padding-left: 3px; color: var(--mud-palette-text-secondary); white-space: nowrap; }
.cap-seg { position: absolute; top: 0; bottom: 0; }
.cap-seg.changeover, .cap-seg-sample.changeover { background: #757575; }
.cap-seg.waiting, .cap-seg-sample.waiting { background: repeating-linear-gradient(45deg, #e57373 0 4px, transparent 4px 8px); }
.cap-legend { display: flex; gap: 16px; margin-top: 6px; color: var(--mud-palette-text-secondary); }
.cap-seg-sample { display: inline-block; width: 18px; height: 10px; margin-right: 4px; vertical-align: middle; }

/* Produktų apskaita pagal partiją */
.pa-table th.num, .pa-table td.num { text-align: right; white-space: nowrap; }
.pa-table td.hold { color: #c62828; font-weight: 600; }
.pa-table td.neg { color: #c62828; }

/* „Pamainos“ – žmonės prie linijų (BUSINESS_RULES §6 „Žmonės prie linijų“). */
.shift-grid.line-crew td {
    width: auto;
    min-width: 84px;
    padding: 0 6px;
    white-space: nowrap;
    cursor: pointer;
}

.shift-grid.line-crew td.shared {
    background: #eeeeee;
}

.shift-grid.line-crew td.day-line {
    font-weight: 700;
    outline: 2px solid #2e7d32;
    outline-offset: -2px;
}

.shift-grid .crew-card-line {
    color: #5f6b63;
    font-weight: 400;
}

.shift-grid .crew-person {
    cursor: pointer;
}

/* Aruodų lenta (BUSINESS_RULES §13): darbui ir TV. */
.bb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.bb-card {
    background: #fff;
    border: 2px solid #cfd8dc;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 300px;
}

.bb-card.bb-clickable { cursor: pointer; }
.bb-card.bb-clickable:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
.bb-card.bb-filled { border-color: #1565c0; }
/* Tuščias aruodas – visa kortelė spalvota, kad matytųsi iš toli (vartotojas 2026-11-01; švelnesni tonai, tamsus tekstas):
   nevalytas – raudona, švarus – žalia. */
.bb-card.bb-dirty { border-color: #e53935; background: #ef9a9a; }
.bb-card.bb-clean { border-color: #43a047; background: #a5d6a7; }
.bb-card.bb-dirty, .bb-card.bb-dirty .bb-code, .bb-card.bb-dirty .bb-batch, .bb-card.bb-dirty .bb-was,
.bb-card.bb-dirty .bb-state, .bb-card.bb-dirty .bb-empty-label { color: #7f0000; }
.bb-card.bb-clean, .bb-card.bb-clean .bb-code, .bb-card.bb-clean .bb-state, .bb-card.bb-clean .bb-empty-label { color: #1b5e20; }
/* Bake po „TUŠČIAS“ – „VALYTAS“ / „NEVALYTAS“ (vartotojas 2026-11-01). */
.bb-empty-label { flex-direction: column; gap: 0.3em; text-align: center; }
.bb-clean-label { font-size: 1.15em; font-weight: 800; }
.bb-card.bb-dirty .bb-tank, .bb-card.bb-clean .bb-tank { background: rgba(255, 255, 255, 0.35); border-color: rgba(0, 0, 0, 0.25); }

.bb-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.bb-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.bb-code { color: #78909c; font-size: 0.85rem; }
/* Pavadinimo laukas – fiksuoto aukščio (visose kortelėse vienodas); ilgesniam – mažesnis šriftas, netilpus – „…“. */
.bb-product {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    height: 4rem;
    flex: none;
    overflow: hidden;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.bb-product.bb-long { font-size: 0.95rem; -webkit-line-clamp: 4; }
.bb-product.bb-xlong { font-size: 0.8rem; -webkit-line-clamp: 5; }
/* Partijos nr. – visas, be žodžio „Partija“ (vartotojas 2026-11-01); ilgesniam – mažesnis šriftas, kad nenusikirstų. */
.bb-batch { font-weight: 700; font-size: 1.3rem; color: #263238; height: 1.35em; line-height: 1.35em; flex: none; white-space: nowrap; overflow: hidden; }
.bb-batch.bb-batch-long { font-size: 1.05rem; }
.bb-batch.bb-batch-xlong { font-size: 0.85rem; }
.bb-was { color: #8d6e63; }

.bb-tank {
    position: relative;
    flex: 1;
    min-height: 120px;
    border: 3px solid #90a4ae;
    border-top: none;
    border-radius: 0 0 16px 16px;
    background: #eceff1;
    overflow: hidden;
}

.bb-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.85;
}

.bb-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
}

.bb-pct { flex-direction: column; line-height: 1.1; }
.bb-tonnes { font-size: 0.65em; font-weight: 700; }
.bb-pct.bb-pct-dark { color: #263238; text-shadow: none; }

.bb-empty-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #90a4ae;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.bb-state { font-size: 0.85rem; color: #455a64; }
.bb-state.bb-warn { color: #e65100; font-weight: 700; }
.bb-state.bb-ok { color: #2e7d32; font-weight: 700; }

/* TV: visas ekranas – kortelės per visą aukštį, bakas užima likusią vietą; pavadinimas ir partija – didžiausi. */
.tv-shell {
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: #263238;
    padding: 14px 18px;
    overflow: hidden;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: #eceff1;
    margin-bottom: 10px;
}

.tv-title { font-size: 2rem; font-weight: 700; }
.tv-clock { font-size: 2rem; font-variant-numeric: tabular-nums; }
.tv-message { color: #eceff1; font-size: 1.6rem; padding: 40px; }

.bb-grid.bb-tv {
    flex: 1;
    min-height: 0;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: 1fr;
    gap: 14px;
}

.bb-tv .bb-card { min-height: 0; padding: 14px 16px; gap: 10px; }
.bb-tv .bb-num { font-size: 3.2rem; }
.bb-tv .bb-code { font-size: 1.1rem; }
.bb-tv .bb-product { font-size: 2.1rem; height: 7.7rem; }
.bb-tv .bb-product.bb-long { font-size: 1.6rem; }
.bb-tv .bb-product.bb-xlong { font-size: 1.3rem; }
.bb-tv .bb-batch { font-size: 2.4rem; }
.bb-tv .bb-batch.bb-batch-long { font-size: 1.9rem; }
.bb-tv .bb-batch.bb-batch-xlong { font-size: 1.5rem; }
.bb-tv .bb-tank { min-height: 0; border-width: 4px; }
.bb-tv .bb-pct { font-size: 3.4rem; }
.bb-tv .bb-empty-label { font-size: 1.6rem; }
.bb-tv .bb-state { font-size: 1.2rem; }
/* Lygio davikliai (BUSINESS_RULES §13): iš kur %, „PILAMA“, neatsako / prieštarauja lentai. */
.bb-sensor { font-size: 0.75rem; color: #607d8b; }
.bb-sensor.bb-sensor-stale { color: #e65100; font-weight: 700; }
.bb-sensor.bb-sensor-mismatch { color: #b71c1c; font-weight: 700; }
.bb-card.bb-dirty .bb-sensor, .bb-card.bb-clean .bb-sensor { color: inherit; }
.bb-filling {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 10px;
    background: #1565c0;
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
.bb-tv .bb-sensor { font-size: 1rem; }
.bb-tv .bb-filling { font-size: 1.2rem; }

/* Technologinio aprašymo (Word) peržiūra – docx-preview puslapiai slenkamame lange. */
.docx-view { max-height: 75vh; overflow: auto; background: #f0f0f0; border-radius: 4px; }
.docx-view .docx-wrapper { padding: 16px; background: #f0f0f0; }
.docx-view .docx-wrapper > section.docx { box-shadow: 0 0 6px rgba(0, 0, 0, 0.25); margin-bottom: 16px; }

/* Paspaudžiama lentelės eilutė (redaguojama dialoge). */
.cursor-pointer { cursor: pointer; }

/* Sandėlio vienetų etiketės su QR (BUSINESS_RULES §19): ekrane – kortelės, spausdinant – po vieną 100×60 mm puslapyje. */
.stock-labels { display: flex; flex-wrap: wrap; gap: 12px; }
.stock-label {
    width: 100mm; height: 60mm; box-sizing: border-box; padding: 3mm; background: #fff; color: #000;
    border: 1px dashed #bbb; display: flex; gap: 3mm; align-items: center; overflow: hidden; font-family: Arial, sans-serif;
    /* Etiketė visada juoda ant balto – ir kai telefono naršyklė puslapį tamsina pati. */
    color-scheme: only light; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stock-label .sl-qr { width: 40mm; height: 40mm; flex: 0 0 40mm; }
.stock-label .sl-qr img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.stock-label .sl-text { flex: 1; min-width: 0; line-height: 1.15; }
.stock-label .sl-code { font-size: 20pt; font-weight: 700; letter-spacing: 1px; }
.stock-label .sl-material { font-size: 13pt; font-weight: 700; }
.stock-label .sl-name { font-size: 9pt; max-height: 3.5em; overflow: hidden; }
.stock-label .sl-qty { font-size: 16pt; font-weight: 700; margin-top: 1mm; }
.stock-label .sl-meta { font-size: 7pt; color: #333; }

@page stock-label { size: 100mm 60mm; margin: 0; }

@media print {
    .stock-labels { display: block; }
    .stock-label { page: stock-label; border: none; break-after: page; }
    .stock-label:last-child { break-after: auto; }
}

/* Vieneto kortelė telefone (/q/P000123). */
.unit-card .uc-qty { font-size: 2rem; font-weight: 700; }
.qr-scanner .qr-view { width: 100%; max-width: 480px; min-height: 240px; background: #000; border-radius: 6px; overflow: hidden; }
.qr-scanner .qr-view video { width: 100% !important; height: auto !important; }

/* Tik spausdinant (pvz. didmaišio etiketė išleidimo lange – BUSINESS_RULES §19). */
/* Eilė partijoje (fasavimo planas): darbo numeris apskritime. */
.order-no {
    display: inline-block; min-width: 1.5em; height: 1.5em; line-height: 1.5em; padding: 0 .3em; border-radius: 1em; text-align: center;
    font-weight: 700; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text);
}

.order-step { margin-top: 2px; white-space: nowrap; }

.print-only { display: none; }
@media print {
    .print-only { display: block; }

    /* Etiketė iš puslapio su kitu turiniu (pvz. fasavimo planas, atidarytas langas): spausdinama tik ji – slepiama viskas,
       kas nėra etiketė, jos vidus ar jos tėviniai elementai. */
    body:has(.label-print) *:not(.label-print):not(.label-print *):not(:has(.label-print)) { display: none !important; }
}
