/**
 * File: lumber_style.css
 * Verze a aktuální datum: 21-11-26 v_1.62 (krok 100: souhrn kroku 3 sdíleným .th-kit-sub, vlastní CSS souhrnu zrušené)
 */

/* --- Sekce a nadpisy --- */
.th-lumber-section {
    margin-bottom: 20px;
}

.th-lumber-heading {
    margin-bottom: 0;
}

.th-lumber-sub-heading {
    margin-top: 18px;
    margin-bottom: 8px;
}

/* --- Řádky seznamu kusů a prken skladu --- */
.th-lumber-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr) repeat(3, minmax(0, 1fr)) 36px;
    gap: 8px;
    align-items: center;
}

.th-lumber-grid-stock {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
}

.th-lumber-grid-head {
    margin: 8px 0 6px;
    font-size: 12px;
    color: #b3b3b3;
}

.th-lumber-grid-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.th-lumber-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.th-lumber-cell {
    margin: 0 !important;
    min-width: 0;
}

.th-lumber-cell input.th-lumber-input {
    padding: 0 6px;
}

.th-lumber-cell input.th-lumber-name {
    text-align: left !important;
    font-weight: normal !important;
    padding: 0 10px;
}

.th-lumber-cell input.th-input-bad {
    border-color: #ff5555 !important;
}

/* Ikonová tlačítka řádku Duplikovat a Odebrat (.th-lumber-actions, .th-lumber-del, .th-lumber-dup) jsou sdílená v shared/calc_theme.css */

.th-lumber-add {
    margin-top: 10px;
    padding: 8px 16px;
    border: 1px dashed rgba(249, 195, 67, 0.6);
    border-radius: var(--th-radius-pill);
    background: transparent;
    color: #f9c343;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.th-lumber-add:hover:not(:disabled),
.th-lumber-add:focus-visible {
    background: rgba(249, 195, 67, 0.08);
}

.th-lumber-add:disabled {
    opacity: 0.4;
    cursor: default;
}

.th-lumber-options {
    margin-bottom: 20px;
}

/* --- Nákupní seznam (přepínač) --- */
.th-lumber-shop-box {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--th-radius-lg);
    background: rgba(255, 255, 255, 0.03);
}

.th-lumber-check {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
}

.th-lumber-check .th-checkbox {
    flex: 0 0 auto;
    margin-top: 2px;
}

.th-lumber-check-title {
    display: block;
    color: #ececec;
    font-weight: bold;
}

.th-lumber-check-sub {
    display: block;
    color: #b3b3b3;
    font-size: 13px;
    margin-top: 2px;
}

.th-lumber-shop {
    margin-top: 16px;
}

.th-lumber-shop[hidden],
#th-lumber-fixed[hidden],
#th-lumber-vol[hidden],
.th-lumber-options[hidden],
.th-lumber-note[hidden],
.th-lumber-home-actions [hidden],
.th-lumber-mystock-btn[hidden],
#th-lumber-home-head[hidden],
#th-lumber-home-body[hidden],
#th-lumber-home-min[hidden],
#th-lumber-home-suggest[hidden] {
    display: none !important;
}

.th-lumber-modes {
    margin-bottom: 16px;
}

.th-lumber-pill-sub {
    display: block;
    font-size: 11px;
    font-weight: normal;
    opacity: 0.7;
}

.th-lumber-note {
    margin: 8px 0 0;
    color: #b3b3b3;
    font-size: 13px;
    line-height: 1.5;
    max-width: 860px;
}


/* --- Okamžitý výsledek v náhledu --- */
.th-lumber-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.th-lumber-live {
    text-align: center;
}

.th-lumber-live-label {
    color: #b3b3b3;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.th-lumber-big {
    color: #f9c343;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
    margin: 4px 0;
    white-space: nowrap;
}

.th-lumber-live-sub {
    color: #cccccc;
    font-size: 14px;
}

.th-lumber-live-sub strong {
    color: #ececec;
}

.th-lumber-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.th-lumber-chip {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--th-radius-md);
    background: rgba(0, 0, 0, 0.35);
    text-align: left;
}

.th-lumber-chip-label {
    display: block;
    color: #999;
    font-size: 11px;
}

.th-lumber-chip-value {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
}

.th-lumber-chip-hint {
    display: block;
    color: #b3b3b3;
    font-size: 12px;
    line-height: 1.35;
}

.th-lumber-draw svg {
    max-height: 320px !important;
}

/* Popisky ve výkresech (náhled a nářez) */
.th-lumber-svg-qty {
    fill: #f9c343;
    font: bold 14px Roboto, Arial, sans-serif;
}

.th-lumber-svg-label {
    fill: #cccccc;
    font: 12px Roboto, Arial, sans-serif;
}

.th-lumber-svg-part {
    fill: #ffffff;
    font: 11px Roboto, Arial, sans-serif;
}

/* --- Tlačítko Spočítat a admin odkaz --- */
.th-lumber-calc-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.th-lumber-calc-row .th-calc-btn {
    margin-bottom: 0 !important;
}

.th-lumber-admin-pdf {
    margin-top: 15px;
    text-align: center;
    color: #f9c343;
    font-size: 13px;
    font-weight: bold;
}

#pdf-btn-container.th-lumber-pdf-box {
    position: relative;
    margin-bottom: 20px;
}

.th-lumber-btn-sub {
    font-size: 11px;
    font-weight: normal;
}

.th-lumber-share-wrap {
    display: flex;
    gap: 10px;
}

.th-lumber-save-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-color: #f9c343;
    color: #f9c343;
}

.th-lumber-save-btn.th-lumber-save-locked {
    border-color: #555;
    color: #888;
    background: transparent;
}

.th-lumber-save-locked .th-pro-badge {
    margin-left: 0;
    filter: grayscale(100%);
    opacity: 0.7;
}

.th-lumber-save-ico {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.th-lumber-counter-img {
    width: 100%;
    height: 100%;
}

/* --- Výsledky --- */
.th-lumber-strip {
    margin-bottom: 20px;
}

.th-lumber-card {
    padding: 14px 12px;
    text-align: center;
}

.th-lumber-card .res-num {
    font-size: 20px !important;
}

.th-lumber-card-main .res-num {
    color: #f9c343;
    font-size: 26px !important;
}

.th-lumber-card-sub {
    margin-top: 4px;
    color: #999;
    font-size: 12px;
}

.th-lumber-block {
    margin-top: 22px;
}

.th-lumber-table td,
.th-lumber-table th {
    white-space: nowrap;
}

.th-lumber-buy {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}



.th-lumber-buy-sub {
    color: #b3b3b3;
    font-size: 14px;
}

.th-lumber-cutplan {
    margin: 8px 0 12px;
    overflow-x: auto;
}

.th-lumber-cutplan svg {
    display: block;
    width: 100%;
    min-width: 520px;
    height: auto;
}

.th-lumber-boards {
    margin: 0;
    padding-left: 20px;
    color: #cccccc;
    font-size: 14px;
    line-height: 1.6;
}

.th-lumber-boards strong {
    color: #ececec;
    font-size: 14px;
}

.th-lumber-muted {
    color: #999;
}

.th-lumber-receipt {
    margin-top: 22px;
}

.th-lumber-receipt-body {
    color: #cccccc;
    font-size: 14px;
    line-height: 1.6;
    max-width: 860px;
}

.th-lumber-receipt-body strong {
    color: #ececec;
    font-size: 14px;
}

/* --- E-mailové okno --- */


.th-lumber-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 0;
    background: transparent;
    color: #888;
    font-size: 20px;
    cursor: pointer;
}

.th-lumber-modal-desc {
    font-size: 14px;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 20px;
}

.th-lumber-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    margin-bottom: 15px;
    border-radius: var(--th-radius-pill);
    border: 1px solid #555;
    background: #252525;
    color: #fff;
    font-size: 16px;
    outline: none;
}

.th-lumber-usertype {
    gap: 10px;
    margin-bottom: 16px;
}

.th-lumber-usertype-opt {
    flex: 1;
    margin: 0;
    cursor: pointer;
}

.th-lumber-usertype-card {
    padding: 8px 12px;
    min-height: 45px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.th-lumber-usertype-ico {
    width: 22px;
    height: 22px;
    margin-right: 10px;
}

.th-lumber-usertype-text {
    font-size: 13px;
    font-weight: normal;
}

.th-lumber-modal-info {
    text-align: center;
    font-size: 12px;
    color: #b1b1b1;
    margin-bottom: 12px;
}

.th-lumber-modal-error {
    color: #ff5555;
    font-size: 13px;
    margin: 10px 0;
}

.th-lumber-modal-error[hidden],
#modal-content-form[hidden],
#modal-content-loading[hidden],
#modal-content-success[hidden] {
    display: none !important;
}

.th-lumber-modal-submit {
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: var(--th-radius-pill);
    background: #f9c343;
    color: #000;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.th-lumber-modal-count {
    margin-top: 15px;
    color: #f9c343;
    font-size: 14px;
    font-weight: bold;
}

.th-lumber-modal-closebtn {
    margin-top: 20px;
    padding: 10px 20px;
    border: 1px solid #555;
    border-radius: var(--th-radius-pill);
    background: transparent;
    color: #ccc;
    cursor: pointer;
}

.th-lumber-cover {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #f9c343;
    font-size: 18px;
}

/* --- Telefon (o mřížce seznamu kusů rozhoduje jen @container lumberrows, ne šířka okna) --- */
@media (max-width: 640px) {
    .th-lumber-big {
        font-size: 34px;
    }

    .th-lumber-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .th-lumber-modal-box {
        padding: 36px 18px 24px;
    }
}



.th-lumber-check-title {
    cursor: pointer;
    margin: 0 !important;
}

/* Tlačítko Spočítat ve stejném řádku mřížky jako u ostatních kalkulaček (lícuje se spodkem náhledu) */
@media (min-width: 1024px) {
    #th-calc-app > .th-lumber-calc-row {
        grid-column: 1 / 2;
        grid-row: 7;
        align-self: end;
        width: 100%;
    }
}


/* Pole kalkulačky: stejný vzhled jako systémová pole (th-us-input), vlastní třída kvůli zápisu zlomků s pomlčkou (1-13/16) */
.th-input-group input.th-lumber-input {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: var(--th-radius-sm);
    color: #fff;
    height: 42px;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.th-input-group input.th-lumber-input:focus {
    border-color: #f9c343;
    box-shadow: 0 0 0 1px rgba(249, 195, 67, 0.5);
    outline: none;
}

.th-input-group input.th-lumber-input.th-input-bad {
    border-color: #ff5555;
}

/* Živý převod délky pod polem (palce: stopy a metry) */
.th-lumber-conv {
    margin-top: 3px;
    color: #b3b3b3;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
}

.th-lumber-cell .th-field-hint {
    font-size: 12px;
    line-height: 1.35;
}

/* Hlavní karta nákupu nahoře ve výsledcích */
.th-lumber-buy-card {
    margin: 10px 0 14px;
    padding: 16px 18px;
    border: 1px solid rgba(249, 195, 67, 0.45);
    border-radius: var(--th-radius-lg);
    background: rgba(249, 195, 67, 0.07);
}

.th-lumber-buy-card .th-lumber-buy li {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 4px;
}

.th-lumber-buy-meta {
    margin-top: 6px;
    color: #ececec;
    font-size: 15px;
    font-weight: bold;
}

.th-lumber-boards ul {
    margin: 2px 0 6px;
    padding-left: 18px;
}

/* Popisky polí v řadě lícují dole (Prořez / Zakrácení konců i při zalomení) */
.th-lumber-options > div > .th-label-row {
    min-height: 40px;
    align-items: flex-end;
}

.th-lumber-shop .th-option-cards {
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .th-lumber-buy-card .th-lumber-buy li {
        font-size: 18px;
    }
}

/* --- Počet kusů s tlačítky −/+ (systémové th-spin-btn) --- */
.th-lumber-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) repeat(3, minmax(0, 1fr)) 36px;
}

/* --- Nástroje: CSV, vzor, zkratky; rychlé zadání; náhled vložení --- */
.th-lumber-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.th-lumber-tool {
    margin-top: 0;
    font-size: 13px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.th-lumber-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.th-lumber-file:focus-visible + .th-lumber-tool,
.th-lumber-tool:focus-within {
    outline: 2px solid #f9c343;
}

.th-lumber-quick-box {
    margin-top: 16px;
}

.th-lumber-quick-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 6px;
}

.th-lumber-quick {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: var(--th-radius-sm);
    background: #0a0a0a;
    color: #fff;
    font: 15px/1.4 'Roboto', sans-serif;
    resize: vertical;
}

.th-lumber-quick:focus {
    border-color: #f9c343;
    outline: none;
}

.th-lumber-mic {
    flex: 0 0 48px;
    border: 1px solid #333;
    border-radius: var(--th-radius-sm);
    background: #0a0a0a;
    cursor: pointer;
}

.th-lumber-mic svg {
    width: 22px;
    height: 22px;
    fill: #f9c343;
}

.th-lumber-mic.is-on {
    border-color: #f9c343;
    background: rgba(249, 195, 67, 0.15);
}

.th-lumber-help {
    margin-top: 12px;
}

.th-lumber-import {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(249, 195, 67, 0.45);
    border-radius: var(--th-radius-lg);
    background: rgba(249, 195, 67, 0.06);
}

.th-lumber-import[hidden],
.th-lumber-sheet[hidden],
#th-lumber-import-msg[hidden] {
    display: none !important;
}

.th-lumber-import-title {
    margin: 0 0 8px;
    color: #ececec;
    font-weight: bold;
}

.th-lumber-import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.th-lumber-import-actions .th-lumber-add {
    margin-top: 0;
}

.th-lumber-import-main {
    padding: 8px 18px;
    border: 0;
    border-radius: var(--th-radius-pill);
    background: #f9c343;
    color: #000;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

#th-lumber-rows-section.is-drop {
    outline: 2px dashed #f9c343;
    outline-offset: 6px;
    border-radius: var(--th-radius-md);
}

.th-lumber-keys-box {
    max-width: 520px;
    text-align: left;
}

.th-lumber-keys-list {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    color: #cccccc;
    font-size: 14px;
    line-height: 2;
}

.th-lumber-keys-list kbd {
    margin-right: 6px;
}

/* --- Karta řádku (telefon) a spodní editor --- */
.th-lumber-rowcard {
    display: none;
}

.th-lumber-sheet {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.6);
}

.th-lumber-sheet-panel {
    width: 100%;
    max-height: 92vh;
    /* s klávesnicí nikdy vyšší než viditelná plocha (výšku editoru drží fitSheet) – horní pole nevyjedou nad okraj; editor neleží v kontejneru lumberrows, proto tady */
    max-height: min(92dvh, 100%);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #444;
    border-radius: var(--th-radius-lg) var(--th-radius-lg) 0 0;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.th-lumber-sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.th-lumber-sheet-head .th-lumber-modal-close {
    position: static;
}

.th-lumber-sheet .th-lumber-input {
    height: 50px;
    font-size: 18px;
}

.th-lumber-sheet-dims {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.th-lumber-sheet-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.th-lumber-sheet-actions > * {
    flex: 1;
    margin-top: 0;
    min-height: 44px;
}

html.th-lumber-sheet-open {
    overflow: hidden;
}

/* Klávesnice venku (lumber_input.js setTyping): editor nahoře přes celou viditelnou plochu */
.th-lumber-sheet.th-lumber-sheet-typing {
    align-items: flex-start;
}

.th-lumber-sheet.th-lumber-sheet-typing .th-lumber-sheet-panel {
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

@container lumberrows (max-width: 579px) {
    #th-lumber-rows .th-lumber-row {
        display: block;
        padding-bottom: 0;
        border-bottom: 0;
    }

    #th-lumber-rows .th-lumber-cell,
    #th-lumber-rows .th-lumber-del,
    #th-lumber-rows-section > .th-lumber-grid-head {
        display: none;
    }

    #th-lumber-rows .th-lumber-rowcard {
        display: block;
        width: 100%;
        min-height: 48px;
        padding: 12px 14px;
        border: 1px solid #333;
        border-radius: var(--th-radius-md);
        background: #0a0a0a;
        color: #ececec;
        font-size: 15px;
        font-weight: bold;
        text-align: left;
        cursor: pointer;
    }

    #th-lumber-rows .th-lumber-rowcard:focus-visible {
        border-color: #f9c343;
        outline: none;
    }

    .th-lumber-tools .th-lumber-keys-btn {
        display: none;
    }
}

/* Prkna skladu: tři rozměry a smazání (pravidlo výše pro díly má stejnou váhu, proto znovu) */
.th-lumber-grid.th-lumber-grid-stock {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
}

/* --- Kolo 4: akce řádku, ± u rozměrů, nabídka Vložit díly --- */
.th-lumber-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr) repeat(3, minmax(0, 1.15fr)) 76px;
}

.th-lumber-grid.th-lumber-grid-stock {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
}

.th-lumber-tools .th-lumber-tool {
    min-height: 40px;
    margin: 0;
    padding: 0 16px;
    font-size: 14px;
    justify-content: center;
}

.th-lumber-keys-link {
    margin-left: auto;
    padding: 2px 10px;
    border: 1px solid #333;
    border-radius: var(--th-radius-pill);
    background: transparent;
    color: #b3b3b3;
    font-size: 12px;
    cursor: pointer;
}

.th-lumber-keys-link:hover,
.th-lumber-keys-link:focus-visible {
    border-color: #f9c343;
    color: #f9c343;
}

.th-lumber-insert-box {
    max-width: 480px;
    text-align: left;
}

.th-lumber-insert-options {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.th-lumber-insert-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
    font-family: inherit;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: #0a0a0a;
    color: #ececec;
    font-size: 15px;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
}

.th-lumber-insert-opt[hidden] {
    display: none;
}

.th-lumber-insert-opt svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    fill: #f9c343;
}

.th-lumber-insert-opt:hover,
.th-lumber-insert-opt:focus-visible,
.th-lumber-insert-opt.is-on {
    border-color: #f9c343;
    outline: none;
}

.th-lumber-insert-opt.is-on {
    background: rgba(249, 195, 67, 0.12);
}

.th-lumber-insert-status {
    margin: 0 0 10px;
    color: #ececec;
    font-size: 14px;
}

.th-lumber-insert-status[hidden] {
    display: none;
}

.th-lumber-insert-label {
    display: block;
    margin-bottom: 6px;
}

.th-lumber-insert-box .th-lumber-quick {
    width: 100%;
}

.th-lumber-insert-box .th-lumber-import-main {
    margin-top: 8px;
    min-height: 44px;
}

.th-lumber-sheet-actions {
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .th-lumber-keys-link {
        display: none;
    }

    .th-lumber-tools .th-lumber-tool {
        flex: 1;
        min-height: 44px;
    }
}

@container lumberrows (max-width: 579px) {
    #th-lumber-rows .th-lumber-actions {
        display: none;
    }
}

/* --- Kolo 5: seznam podle šířky sloupce, ± u rozměrů, karty, editor, nákupní seznam nahoře --- */

/* A1: o kartách a mřížce rozhoduje šířka seznamu kusů, ne okna (pod 560 px karty a editor, širší seznam mřížka s klávesovými zkratkami) */
#th-lumber-rows-section {
    container-type: inline-size;
    container-name: lumberrows;
}

.th-lumber-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(110px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1.4fr) 72px;
    gap: 6px;
}

.th-lumber-grid.th-lumber-grid-stock {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
}

/* −/+ u Ks i rozměrů: systémové th-spinners (calc_theme.css). Vstup nechá tlačítkům místo jako systém:
   do 1024 px 34 px, nad 44 px; úzké pole (pod 160 px) systém zúží na 24 px. */
.th-lumber-cell .th-input-group {
    position: relative;
}

/* rezervu pro −/+ dává systém (calc_theme.css, třída th-stepper-input na poli) */

/* Karta řádku: tužka vpravo, neplatná hodnota zvýrazněná */
#th-lumber-rows .th-lumber-rowcard {
    position: relative;
    padding-right: 44px;
}

.th-lumber-rowcard-edit {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #f9c343;
    font-size: 18px;
    font-weight: normal;
}

#th-lumber-rows .th-lumber-rowcard.is-bad {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.08);
}

.th-lumber-rowcard-bad {
    color: #ff6b6b;
}

/* Smazáno · Vrátit ve sdíleném toastu */
#th-toast-msg.th-lumber-toast {
    z-index: 100001;
    display: flex;
    align-items: center;
    gap: 6px;
}

.th-lumber-undo {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--th-radius-pill);
    background: transparent;
    color: #f9c343;
    font-size: 15px;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}

/* A11: volba Načíst CSV je label se skrytým polem souboru uvnitř (bez stylů systémových labelů) */
/* sdílené .th-calc-wrapper label (display: block, 13 px) má vyšší váhu než samotná třída, proto i s .th-calc-wrapper */
.th-calc-wrapper label.th-lumber-insert-opt,
label.th-lumber-insert-opt {
    display: flex;
    font-size: 15px;
    position: relative;
    width: auto;
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
}

.th-lumber-insert-opt:focus-within {
    border-color: #f9c343;
    outline: 2px solid #f9c343;
    outline-offset: 1px;
}

/* B11: Vložit z Excelu / nadiktovat odlišené od Přidat řádek */
#th-lumber-insert-btn {
    border-style: dashed;
}

/* B2: dotykové plochy aspoň 44 px */
.th-lumber-sheet .th-lumber-modal-close,
.th-lumber-insert-box .th-lumber-modal-close,
.th-lumber-import-actions button {
    min-height: 44px;
}

.th-lumber-sheet .th-lumber-modal-close {
    min-width: 44px;
}

/* B2 + B4: editor dílu – výška podle viditelné části okna (klávesnice nezakryje Hotovo), tlačítka stejně vysoká */
.th-lumber-sheet {
    height: 100vh;
    height: 100dvh;
}

.th-lumber-sheet-panel {
    max-height: 92vh;
    max-height: 92dvh;
    max-width: 640px;
    margin: 0 auto;
}

.th-lumber-sheet-actions {
    position: sticky;
    z-index: 3; /* nad tlačítky − + polí (th-spin-btn z-index 2) při posunu panelu */
    bottom: calc(-16px - env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 10px -16px calc(-16px - env(safe-area-inset-bottom, 0px));
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #1a1a1a;
    border-top: 1px solid #333;
}

.th-lumber-sheet-actions > * {
    min-height: 48px;
    height: 100%;
    margin: 0;
    padding: 4px 6px;
    line-height: 1.15;
    white-space: normal;
}

@media (max-width: 420px) {
    .th-lumber-sheet-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Stáhnout CSV: systémový vedlejší odkaz pod PDF (th-pdf-preview-link, jako Ukázka PDF u šuplíků); tlačítko bez rámečku */
.th-lumber-csv-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

.th-lumber-csv-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Živý výsledek: KOUPIT 2× prkno … jako hlavní řádek */
.th-lumber-big.th-lumber-big-buy {
    font-size: 26px;
    line-height: 1.25;
}

@media (max-width: 640px) {
    .th-lumber-big.th-lumber-big-buy {
        font-size: 21px;
    }
}

/* --- Nářezové vzory na plátně a ve výsledcích (lumber_visuals.js patternsHtml): stejné rozřezy seskupené --- */
.th-lumber-draw-title {
    margin-bottom: 8px;
}

.th-lumber-pats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.th-lumber-pat-head {
    margin-bottom: 4px;
    color: #cccccc;
    font-size: 13px;
}

.th-lumber-pat-head strong {
    color: #f9c343;
}

.th-lumber-pat-dim {
    color: #b3b3b3;
}

/* Podřádek karty v pruhu hlavních čísel (Využití dřeva: zbytky a jejich cena) */
.th-workshop-summary-label.th-lumber-summary-sub {
    margin: 4px 0 0;
}

.th-lumber-pat-count {
    color: #f9c343;
    font-weight: bold;
}

.th-lumber-pat-boxes {
    margin-left: 4px;
    color: #f9c343;
    letter-spacing: 2px;
    word-break: break-all;
}

/* --- Nářez prken: dlaždice dílů v jemných odstínech, plné odznaky čísel, tlumený zbytek --- */
/* Odstíny typů dílů (teplé tóny k žluté CalcWoodu, ne duha); používá web, plátno i K pile (lumber_workshop.css) */
.th-lw-t1 { --lw-tone: rgba(249, 195, 67, 0.2); --lw-edge: rgba(249, 195, 67, 0.55); }
.th-lw-t2 { --lw-tone: rgba(214, 150, 84, 0.22); --lw-edge: rgba(214, 150, 84, 0.6); }
.th-lw-t3 { --lw-tone: rgba(168, 186, 112, 0.2); --lw-edge: rgba(168, 186, 112, 0.55); }
.th-lw-t4 { --lw-tone: rgba(132, 166, 196, 0.2); --lw-edge: rgba(132, 166, 196, 0.55); }
.th-lw-t5 { --lw-tone: rgba(196, 128, 112, 0.2); --lw-edge: rgba(196, 128, 112, 0.55); }
.th-lw-t6 { --lw-tone: rgba(190, 180, 160, 0.18); --lw-edge: rgba(190, 180, 160, 0.5); }

/* plný odznak čísla dílu */
.th-lumber-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: var(--th-radius-pill);
    background: #f9c343;
    color: #111111;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.th-lumber-badge-c {
    fill: #f9c343;
}

.th-lumber-badge-t {
    fill: #111111;
    font-weight: 800;
    font-family: Roboto, Arial, sans-serif;
}

/* šířka v % včetně rámečku, jinak je nejdelší prkno o 2 px širší než kontejner (vodorovný posuvník) */
.th-lumber-pat-board {
    box-sizing: border-box;
    min-width: 40px;
    padding: 3px;
    border: 1px solid #2f2f2f;
    border-radius: var(--th-radius-sm);
    background: #141414;
}

.th-lumber-pat-lane {
    position: relative;
    height: 30px;
}

.th-lumber-pat-lane + .th-lumber-pat-lane {
    margin-top: 3px;
}

.th-lumber-pat-part {
    position: absolute;
    top: 0;
    bottom: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0 5px;
    overflow: hidden;
    border: 1px solid var(--lw-edge, rgba(249, 195, 67, 0.55));
    border-radius: 6px;
    background: var(--lw-tone, rgba(249, 195, 67, 0.2));
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* zbytek: tlumená šrafa, slovo „zbytek …“ jen když se vejde */
.th-lumber-pat-rest {
    position: absolute;
    top: 0;
    bottom: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 6px, transparent 6px 12px);
    color: #8a8a8a;
    font-size: 12px;
    white-space: nowrap;
}

.th-lumber-pat-more {
    align-self: flex-start;
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #f9c343;
    font-size: 14px;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}

/* legenda: stejné odznaky a odstíny jako v nářezu, v mřížce */
.th-lumber-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 10px;
    margin: 10px 0 0;
    color: #cccccc;
    font-size: 13px;
}

.th-lumber-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid var(--lw-edge, #333);
    border-radius: var(--th-radius-sm);
    background: var(--lw-tone, transparent);
    color: #e0e0e0;
}

/* Bez nákupního seznamu: souhrn podle tlouštěk */
.th-lumber-thk {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.th-lumber-thk-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--th-radius-md);
    background: rgba(0, 0, 0, 0.35);
    text-align: left;
    font-size: 15px;
}

.th-lumber-thk-t {
    color: #f9c343;
    font-weight: bold;
}

.th-lumber-thk-pcs {
    color: #cccccc;
}

.th-lumber-thk-vol {
    color: #ffffff;
    font-weight: bold;
}

.th-lumber-thk-more {
    color: #b3b3b3;
    font-size: 13px;
    text-align: left;
}

/* Plátno na telefonu: sdílené pravidlo .th-is-mobile #th-svg-wrapper ruší horní odsazení (výkresy SVG mají okraj v sobě);
   textový obsah plátna dostane nahoře stejných 10 px jako systémové odsazení plátna po stranách */
.th-is-mobile #th-svg-wrapper .th-lumber-preview {
    padding-top: 10px;
}

/* Řádek KOUPIT se na úzkém plátně zalomí, nesmí přetéct */
.th-lumber-big.th-lumber-big-buy {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* --- Diktování: červené tlačítko „Poslouchám…“, ukazatel hlasitosti, živý text --- */
.th-lumber-insert-opt.is-listening {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.12);
    color: #ffffff;
    animation: th-lumber-mic-pulse 1.4s ease-in-out infinite;
}

.th-lumber-insert-opt.is-listening svg {
    fill: #ff4444;
}

@keyframes th-lumber-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(255, 68, 68, 0); }
}

.th-lumber-mic-meter {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 22px;
    margin-left: auto;
}

.th-lumber-mic-meter[hidden] {
    display: none;
}

.th-lumber-mic-meter i {
    display: block;
    width: 4px;
    height: 100%;
    border-radius: 2px;
    background: #ff4444;
    transform: scaleY(0.15);
    transform-origin: center;
    transition: transform 0.08s linear;
}

.th-lumber-dictation {
    min-height: 44px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: #0a0a0a;
    color: #ececec;
    font-size: 15px;
    line-height: 1.45;
}

.th-lumber-dictation[hidden] {
    display: none;
}

.th-lumber-dict-interim {
    color: #999999;
    font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
    .th-lumber-insert-opt.is-listening {
        animation: none;
    }

    .th-lumber-mic-meter i {
        transition: none;
    }
}

/* --- Kolo 6: Nadiktovat díly pod seznamem, čárové ikony v okně Vložit díly --- */
.th-lumber-insert-opt svg,
.th-lumber-dictate-btn svg,
.th-lumber-insert-type svg {
    fill: none;
    stroke: #f9c343;
}

.th-lumber-insert-opt.is-listening svg,
.th-lumber-dictate-btn.is-listening svg {
    fill: none;
    stroke: #ff4444;
}

/* Napsat větou jako 4. volba se stejnou ikonou (bez rámečku, nad polem) */
.th-lumber-insert-type {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
}

.th-lumber-insert-type svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

/* Nadiktovat díly: obrysové tlačítko stejné váhy jako Přidat díl a Vložit díly (plná žlutá je jen Spočítat) */
.th-lumber-tools .th-lumber-dictate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    cursor: pointer;
}

.th-lumber-tools .th-lumber-dictate-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke: #f9c343;
}

.th-lumber-tools .th-lumber-dictate-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.th-lumber-tools .th-lumber-dictate-btn.is-listening {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.15);
    color: #ffffff;
    animation: th-lumber-mic-pulse 1.4s ease-in-out infinite;
}

.th-lumber-tools .th-lumber-dictate-btn.is-listening svg {
    stroke: #ff4444;
}

.th-lumber-tools .th-lumber-dictate-btn .th-lumber-mic-meter {
    margin-left: 4px;
}

.th-lumber-tools .th-lumber-tool-minor {
    font-size: 13px;
}

.th-lumber-dict-inline-status,
#th-lumber-dictation-inline {
    margin-top: 10px;
}

/* Telefon: mikrofon první přes celou šířku, pod ním Přidat řádek a Vložit, všechna stejně vysoká */
@media (max-width: 767px) {
    .th-lumber-tools .th-lumber-dictate-btn {
        flex: 1 1 100%;
    }

    .th-lumber-tools .th-lumber-tool {
        min-height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .th-lumber-tools .th-lumber-dictate-btn.is-listening {
        animation: none;
    }
}

/* --- Kolo 7: v palcích širší délka (12′ 11 15/16″) a rozměry se zlomky, proto karty už pod 590 px seznamu --- */
#th-lumber-rows .th-lumber-rowcard {
    width: 100%;
    min-height: 48px;
    padding: 12px 44px 12px 14px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: #0a0a0a;
    color: #ececec;
    font-size: 15px;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
}

#th-lumber-rows-section[data-unit="in"] .th-lumber-grid:not(.th-lumber-grid-stock) {
    grid-template-columns: minmax(0, 1.3fr) minmax(110px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(150px, 1.5fr) 72px;
    gap: 6px;
}

@container lumberrows (max-width: 629px) {
    #th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-row {
        display: block;
        padding-bottom: 0;
        border-bottom: 0;
    }

    #th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-cell,
    #th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-del,
    #th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-actions,
    #th-lumber-rows-section[data-unit="in"] > .th-lumber-grid-head {
        display: none;
    }

    #th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-rowcard {
        display: block;
    }
}

/* --- Kolo 8: panel diktování pod seznamem kusů (upravitelné pole, Hotovo, Načíst díly, Smazat text) --- */
.th-lumber-dict-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: rgba(0, 0, 0, 0.35);
}

.th-lumber-dict-panel[hidden] {
    display: none;
}

.th-lumber-dict-text {
    width: 100%;
    box-sizing: border-box;
}

.th-lumber-dict-text[readonly] {
    border-color: #ff4444;
}

.th-lumber-dict-listening {
    margin: 0 0 8px;
    color: #ff6b6b;
    font-size: 14px;
    font-weight: bold;
}

.th-lumber-dict-listening[hidden] {
    display: none;
}

.th-lumber-dict-interim-line {
    min-height: 0;
    margin: 6px 0 0;
    padding: 6px 10px;
}

.th-lumber-dict-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.th-lumber-dict-actions > * {
    min-height: 48px;
    margin: 0;
}

.th-lumber-dict-actions .th-lumber-dictate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid #f9c343;
    border-radius: var(--th-radius-pill);
    background: #f9c343;
    color: #000000;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.th-lumber-dict-actions .th-lumber-dictate-btn svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: #000000;
}

.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening {
    border-color: #ff4444;
    background: #ff4444;
    color: #ffffff;
    animation: th-lumber-mic-pulse 1.4s ease-in-out infinite;
}

.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening svg {
    stroke: #ffffff;
}

.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening .th-lumber-mic-meter i {
    background: #ffffff;
}

@media (max-width: 767px) {
    .th-lumber-dict-actions > * {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .th-lumber-dict-actions .th-lumber-dictate-btn.is-listening {
        animation: none;
    }
}

/* --- Kolo 9: sklad navržený podle dílů --- */
.th-lumber-stock-hint {
    margin: 0 0 8px;
}

.th-lumber-stock-badge {
    grid-column: 1 / -1;
    margin-top: -4px;
    color: #b3b3b3;
    font-size: 12px;
}

.th-lumber-stock-wide {
    align-self: flex-start;
    margin-top: 4px;
    min-height: 44px;
}

#th-lumber-stock-again[hidden] {
    display: none;
}

/* --- Kolo 10: klidné diktování – žádný červený blok, rámeček ani pulzování; červená jen pro chybu --- */
.th-lumber-dict-text[readonly] {
    border-color: #333;
}

.th-lumber-dict-panel.is-touch [data-lumber-mic] {
    display: none;
}

/* mikrofon v panelu jako vedlejší tlačítko, při poslechu „Hotovo“ v systémové žluté s jemnými čárkami */
.th-lumber-dict-actions .th-lumber-dictate-btn,
.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening {
    border: 1px solid rgba(249, 195, 67, 0.6);
    background: transparent;
    color: #f9c343;
    animation: none;
    box-shadow: none;
}

.th-lumber-dict-actions .th-lumber-dictate-btn svg,
.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening svg {
    stroke: #f9c343;
}

.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening {
    border-color: #f9c343;
    background: rgba(249, 195, 67, 0.08);
}

.th-lumber-dict-actions .th-lumber-dictate-btn.is-listening .th-lumber-mic-meter i {
    background: #f9c343;
}

.th-lumber-mic-meter {
    height: 14px;
}

.th-lumber-mic-meter i {
    width: 3px;
    background: #f9c343;
}

/* rozpracovaná slova hned pod polem, šedě, bez rámečku */
.th-lumber-dict-interim-line {
    min-height: 0;
    margin: 4px 0 0;
    padding: 0 2px;
    border: 0;
    background: transparent;
    font-size: 14px;
}

/* stav jedním malým textem pod polem */
.th-lumber-dict-inline-status {
    margin: 6px 0 0;
    color: #b3b3b3;
    font-size: 13px;
}

/* záložní odkaz „Diktovat přes prohlížeč“ jen na dotykovém zařízení */
.th-lumber-dict-browser {
    display: none;
    min-height: 44px;
    margin-top: 2px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #b3b3b3;
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.th-lumber-dict-panel.is-touch .th-lumber-dict-browser {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.th-lumber-dict-browser.is-listening {
    color: #f9c343;
}

.th-lumber-dict-browser .th-lumber-mic-meter {
    display: none;
}

/* --- Kolo 11: plátno = náhled zadání, výsledek až po Spočítat (jako ostatní kalkulačky) --- */
.th-lumber-live-mini {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: #b3b3b3;
    font-size: 13px;
}

.th-lumber-live-mini strong {
    color: #ececec;
}

.th-lumber-inprev {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.th-lumber-inprev-label {
    margin-bottom: 4px;
    color: #cccccc;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.th-lumber-inprev-stack {
    min-width: 24px;
}

.th-lumber-inprev-board {
    position: relative;
    box-sizing: border-box;
    border: 1px solid rgba(249, 195, 67, 0.75);
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, rgba(249, 195, 67, 0.16) 0 18px, rgba(249, 195, 67, 0.1) 18px 20px);
}

.th-lumber-inprev-board.is-back {
    opacity: 0.45;
}

.th-lumber-inprev-more {
    color: #b3b3b3;
    font-size: 13px;
}

/* Výsledek: nákupní seznam jako klidná karta – jedno hlavní číslo (žlutý akcent) a tabulka */
.th-lumber-buy-card {
    padding: 14px 16px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: rgba(255, 255, 255, 0.02);
}

/* Systémový zámek PRO (thProNoteHtml) ve výsledcích: nákup nad hranicí dílů, úspora podélného řezání */
.th-lumber-pro-lock {
    margin: 10px 0 16px;
}

/* Stáhnout CSV pod pruhem „Vše v jednom PDF“ */
#th-dl-bar-slot .th-lumber-csv-link {
    display: flex;
    margin: 4px auto 0;
}

.th-lumber-buy-table td,
.th-lumber-buy-table th {
    white-space: nowrap;
}

/* Žlutá jen jako jeden akcent (hlavní číslo nákupu); záhlaví tabulky a vzory klidně */
.th-lumber-buy-table th {
    color: #b3b3b3 !important;
}

.th-lumber-pat-head strong {
    color: #ececec;
}


.th-lumber-pat-boxes {
    color: #b3b3b3;
}

/* tabulka nákupu se vejde i na 320 px: menší okraje buněk */
.th-lumber-buy-table th,
.th-lumber-buy-table td {
    padding: 8px 6px !important;
    font-size: 14px;
}

@media (max-width: 640px) {
    .th-lumber-buy-card {
        padding: 12px 10px;
    }
}

/* sdílená tabulka má min-width 400 px; nákupní tabulka má jen 3–4 krátké sloupce */
table.th-table-compare.th-lumber-buy-table {
    min-width: 0 !important;
}

/* --- Kolo 12: přepínač podélného řezání nad skladem, pruhy různých šířek v nářezu --- */
.th-lumber-rip-check {
    margin: 0 0 14px;
}

.th-lumber-pat-board.is-rip {
    display: flex;
    flex-direction: column;
}

.th-lumber-pat-board.is-rip .th-lumber-pat-lane {
    flex: 0 0 auto;
}

/* --- Kolo 13: náhled zadání jako výkres přes celou šířku plátna (1 jednotka SVG = 1 px) --- */
#th-svg-wrapper .th-lumber-pv {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
}

.th-lumber-pv-name {
    fill: #ececec;
    font: 600 14px Roboto, Arial, sans-serif;
}

.th-lumber-pv-thick {
    fill: #b3b3b3;
    font: 12px Roboto, Arial, sans-serif;
}

.th-lumber-pv-board {
    fill: rgba(249, 195, 67, 0.16);
    stroke: #f9c343;
    stroke-width: 1.5;
}

.th-lumber-pv-grain {
    fill: none;
    stroke: rgba(249, 195, 67, 0.35);
    stroke-width: 1;
}

.th-lumber-pv-qty {
    fill: #f9c343;
    font: 800 20px Roboto, Arial, sans-serif;
}

.th-lumber-pv-dim {
    fill: none;
    stroke: #8a8a8a;
    stroke-width: 1;
}

.th-lumber-pv-dimtext {
    fill: #cccccc;
    font: 12px Roboto, Arial, sans-serif;
}

.th-lumber-pv-more {
    fill: #b3b3b3;
    font: 13px Roboto, Arial, sans-serif;
}

/* panel Díly k načtení: křížek Zavřít */
.th-lumber-dict-panel {
    position: relative;
}

.th-lumber-dict-panel .th-lumber-dict-close {
    top: 2px;
    right: 2px;
    min-width: 44px;
    min-height: 44px;
}

/* --- Kolo 14: po Spočítat jediný žlutý akcent = hlavní číslo nákupu --- */
#th-result-output .th-lumber-card-main .res-num {
    color: #ffffff;
}

#th-result-output .th-lumber-table th {
    color: #b3b3b3 !important;
}

#th-result-output .th-lumber-table .th-td-bold-yellow {
    color: #ececec !important;
}

/* --- Kolo 16: −/+ i u prken skladu; v úzkém panelu (telefon) řádek skladu na dva řádky: tloušťka | šířka / délka | smazat --- */
#th-lumber-fixed {
    container-type: inline-size;
    container-name: lumberstock;
}

@container lumberstock (max-width: 460px) {
    #th-lumber-fixed .th-lumber-grid.th-lumber-grid-stock {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
        row-gap: 6px;
    }

    #th-lumber-fixed .th-lumber-grid-stock > :nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    #th-lumber-fixed .th-lumber-grid-stock > :nth-child(2) {
        grid-column: 2 / 4;
        grid-row: 1;
    }

    #th-lumber-fixed .th-lumber-grid-stock > :nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    #th-lumber-fixed .th-lumber-grid-stock > :nth-child(4) {
        grid-column: 3;
        grid-row: 2;
    }

    #th-lumber-fixed .th-lumber-grid-stock > :nth-child(5) {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(4) {
        display: none;
    }

    #th-lumber-fixed #th-lumber-stock .th-lumber-row {
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
}

/* --- Kolo 17 --- */
/* Sklad prodává pod cenou ve stejném sloupci */
.th-lumber-basis-row {
    margin-top: 10px;
}

/* mezera pod nabídkou levnější varianty */
.th-lumber-alt-offer {
    margin-bottom: 16px;
}

/* sbalený podrobný rozpis prken */
.th-lumber-detail {
    margin: 10px 0;
}

/* diktování na počítači: při poslechu jen Hotovo */
.th-lumber-dict-panel.is-listening #th-lumber-dict-go,
.th-lumber-dict-panel.is-listening #th-lumber-dict-clear {
    display: none;
}

/* --- Kolo 18: Můj sklad --- */
.th-lumber-stock-source {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 0 0 10px;
}

.th-lumber-stock-source[hidden],
.th-lumber-mystock-save[hidden] {
    display: none;
}

.th-lumber-mystock-pick[hidden] {
    display: none;
}

/* výběr sady přes celou šířku jako ostatní systémové výběry (druh dřeva) */
.th-lumber-mystock-pick {
    flex: 1 1 100%;
    margin-top: 4px;
}

.th-lumber-mystock-pick select {
    width: 100%;
}

.th-lumber-mystock-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.th-lumber-mystock-list {
    margin: 4px 0 10px;
    padding-left: 18px;
    color: #ececec;
    font-size: 15px;
    line-height: 1.7;
}

.th-lumber-mystock-missing {
    margin: 6px 0 12px;
}

.th-lumber-mystock-save {
    margin: 10px 0 16px;
}


#th-lumber-stock-head[hidden],
#th-lumber-add-stock[hidden] {
    display: none;
}

/* --- Tlačítka pod nákupním seznamem: Zkopírovat, Do skladu, K pile (okna v lumber_workshop.css) --- */
.th-lumber-work-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.th-lumber-work-actions .th-lumber-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin: 0;
}


/* --- UX: tři kroky, akordeon Pokročilé, cena a Sklad prodává ve 2 sloupcích --- */
#th-lumber-step3 {
    margin-top: 8px;
}

.th-lumber-opt-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.th-lumber-adv {
    margin-top: 16px;
}

.th-lumber-adv[hidden] {
    display: none;
}

.th-lumber-adv .th-accordion-content .th-lumber-options {
    padding-top: 12px;
}

.th-lumber-price-grid {
    margin-top: 16px;
}

/* --- UX: věta o nákupu v pruhu hlavních čísel, odkazy prázdných dlaždic, rozpis sbalený --- */
.th-lumber-summary-buy {
    margin: 0 0 14px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.th-lumber-summary-buy strong {
    color: #f9c343;
}

.th-lumber-summary-more {
    display: block;
    color: #9a9a9a;
    font-size: 13px;
    font-weight: normal;
}

.th-lumber-summary-go {
    display: block;
    margin: 4px auto 0;
    min-height: 32px;
}

.th-lumber-rows-detail {
    margin-top: 18px;
}

.th-lumber-strip-small {
    margin: 12px 0;
}

.th-lumber-strip-small .th-lumber-card .res-num,
.th-lumber-strip-small .th-lumber-card-main .res-num {
    font-size: 16px !important;
}

.th-lumber-free-hint {
    color: #f0a040;
}

.th-lumber-cuts-block .th-lumber-heading {
    margin-top: 0;
}

/* jen jeden sloupec detailu (řezivo na objem, zámek): přes celou šířku */
.th-result-details.th-lumber-details-one {
    display: block;
}

@media (max-width: 640px) {
    .th-lumber-summary-buy {
        font-size: 16px;
    }
}

/* --- UX: velké číslo objemu na plátně (jediné žluté), karty skladu, ztišený nákupní blok PRO --- */
.th-lumber-live-big {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.th-lumber-live-label {
    color: #b3b3b3;
    font-size: 13px;
}

.th-lumber-live-num {
    color: #f9c343;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
}

.th-lumber-live-sub {
    color: #9a9a9a;
    font-size: 13px;
}

.th-lumber-stock-len {
    margin: 8px 0 12px;
    align-items: end !important;
}

.th-lumber-stock-len .th-lumber-note {
    margin: 0 0 10px;
}

.th-lumber-stock-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0 8px 8px 0;
    padding: 0 14px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: #0a0a0a;
    color: #ececec;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.th-lumber-stock-card:hover,
.th-lumber-stock-card:focus-visible {
    border-color: #f9c343;
}

.th-lumber-stock-card-edit {
    color: #f9c343;
}

#th-lumber-stock-head[hidden] {
    display: none;
}


/* Seznam kusů na počítači: ± jen u řádku s fokusem (systémová varianta .th-stepper-focus-rows), uvolněné místo dostane Název */
@media (min-width: 1025px) {
    #th-lumber-rows .th-lumber-grid,
    #th-lumber-rows-section > .th-lumber-grid-head {
        grid-template-columns: minmax(0, 2.6fr) minmax(0, 0.8fr) repeat(3, minmax(0, 1fr)) 36px;
    }
}

/* Telefon: krok 2 kratší – cena a Sklad prodává vedle sebe, rada k Mému skladu jen na počítači */
@media (max-width: 640px) {
    .th-opti-grid-2.th-lumber-price-grid,
    .th-opti-grid-2.th-lumber-options {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .th-lumber-mystock-save .th-lumber-note {
        display: none;
    }
}

.th-lumber-stock-hint[hidden] {
    display: none;
}

/* Telefon: souhrn 2 × 2 (ne 4 pod sebou), souhrn akordeonu pod nadpisem */
@media (max-width: 420px) {
    .th-lumber-summary .th-workshop-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .th-lumber-adv .th-title-with-badge {
        flex-wrap: wrap;
    }
}

/* --- UX kratší cesta ke Spočítat --- */
/* nástroje pod seznamem v jedné řadě, stejná výška; na telefonu ikona + krátký text */
.th-lumber-tools {
    flex-wrap: nowrap;
}

.th-lumber-tools .th-lumber-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
}

.th-lumber-tools .th-lumber-tool svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke: #f9c343;
}

.th-lumber-tool-short {
    display: none;
}

@media (max-width: 767px) {
    .th-lumber-tools .th-lumber-tool {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 8px;
    }

    .th-lumber-tool-long {
        display: none;
    }

    .th-lumber-tool-short {
        display: inline;
    }
}

/* karty dílů (telefon): nejvýš 6, pak Zobrazit všechny díly */
#th-lumber-rows-all {
    display: none;
}

@container lumberrows (max-width: 579px) {
    #th-lumber-rows .th-lumber-row-extra {
        display: none;
    }

    #th-lumber-rows-all:not([hidden]) {
        display: block;
        margin: 8px 0 0;
    }
}

/* Délka prken na skladě v jedné řadě s popiskem, navržená prkna jako jeden řádek */
.th-lumber-stock-len {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 8px;
}

.th-lumber-stock-len > div {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.th-lumber-stock-len .th-label-row {
    flex: 1 1 auto;
    margin: 0;
}

.th-lumber-stock-len .th-input-group {
    flex: 0 0 140px;
}

.th-lumber-stock-sum {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #333;
    border-radius: var(--th-radius-md);
    background: #0a0a0a;
    color: #ececec;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.th-lumber-stock-sum:hover,
.th-lumber-stock-sum:focus-visible {
    border-color: #f9c343;
}

#th-lumber-stock-wrap {
    margin-top: 10px;
}

#th-lumber-stock-wrap[hidden] {
    display: none;
}

/* krok 3 jako jeden řádek se souhrnem */
#th-lumber-step3 .th-lumber-opt {
    margin: 0;
}

#th-lumber-opt-body .th-lumber-price-grid {
    margin-top: 12px;
}

#th-lumber-opt-body .th-lumber-options {
    margin-top: 12px;
}

#th-lumber-adv .th-lumber-rip-check {
    margin: 12px 0 4px;
}

/* telefon: plátno nejvýš ~35 % okna (systémové minimum 400 px tady neplatí, velké číslo zůstane na první obrazovce) */
#th-calc-app.th-is-mobile #th-svg-wrapper.th-svg-wrapper-tall {
    min-height: 0 !important;
}


/* Telefon: kratší cesta ke Spočítat (rámeček kroku 2 tenčí, karty režimu bez podtitulu, krok 3 jako jeden řádek) */
@media (max-width: 640px) {
    .th-lumber-shop-box {
        padding: 10px;
    }

    .th-lumber-shop-box .th-lumber-pill-sub {
        display: none;
    }

    #th-lumber-step3 .th-lumber-opt {
        padding: 0 !important;
    }

    #th-lumber-step3 .th-lumber-opt > .th-accordion-header {
        padding: 10px 12px;
    }

    .th-lumber-section {
        margin-bottom: 6px;
    }
}

@media (max-width: 640px) {
    #th-lumber-step3 .th-lumber-opt > .th-accordion-header {
        min-height: 44px;
        font-size: 13px;
    }}

/* --- UX kontrola 2: souhrn akordeonu jako tichý řádek pod nadpisem, chyba oranžově, ukázkový díl, odemknout --- */
.th-lumber-adv .th-title-with-badge {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.th-lumber-demo-note {
    margin: 0 0 6px;
    color: #f0a040;
}

.th-lumber-demo-note[hidden] {
    display: none;
}

/* poznámka u ukázkového dílu v řádku nadpisu kroku 1 (nepřidá výšku) */
#th-lumber-rows-section .th-lumber-demo-note {
    margin: 0 0 0 8px;
    font-size: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

@media (max-width: 640px) {
    #th-lumber-step3 .th-lumber-opt > .th-accordion-header {
        padding: 6px 12px;
    }
}

/* Telefon: kompaktní přehled dílů v plátně (lumber_visuals.js compactPreviewSvg) */
.th-lumber-pv-cname {
    fill: #ececec;
    font: 600 12px Roboto, Arial, sans-serif;
}

#th-lumber-quality[hidden],
#th-lumber-waste-box[hidden] {
    display: none;
}

#th-lumber-quality-sub {
    margin: 6px 0 0;
}

/* krok 3: podnadpisy uvnitř bloku Volitelně (systémové th-sec-subtitle, menší mezery) */
.th-lumber-opt-sub {
    margin: 14px 0 6px;
}

#th-lumber-opt-body > .th-lumber-opt-sub:first-child {
    margin-top: 10px;
}

#th-lumber-adv-item {
    margin-top: 6px;
}

/* zapamatovaná cena: tichý řádek pod polem */
.th-lumber-price-memo {
    margin: 4px 0 0;
    color: #8a8a8a;
    font-size: 12px;
}

.th-lumber-price-memo[hidden] {
    display: none;
}

/* --- Profily řeziva: okno s hledáním a skupinami (systémové th-modal), tlačítko u dílu --- */
/* Okno výběru (rozvržení, hledání, skupiny) = sdílené .th-picker-* v shared/calc_theme.css */
.th-lumber-prof-item {
    margin: 0;
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
}

/* Editor dílu na telefonu: řádek Profil jako pole (vzhled th-lumber-input), vpravo živý průřez a šipka */
.th-lumber-sheet-profrow {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    margin: 10px 0 4px;
    padding: 0 12px 0 14px;
    box-sizing: border-box;
    border: 1px solid #333;
    border-radius: 8px;
    background: #0a0a0a;
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.th-lumber-sheet-profrow:hover,
.th-lumber-sheet-profrow:focus-visible {
    border-color: rgba(249, 195, 67, 0.6);
    outline: none;
}

.th-lumber-sheet-profrow-lab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.th-lumber-sheet-profrow-lab svg {
    width: 20px;
    height: 20px;
    color: #b3b3b3;
}

.th-lumber-sheet-profrow-val {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    color: #f9c343;
    font-size: 17px;
}

.th-lumber-sheet-profrow-val.is-empty {
    color: #b3b3b3;
    font-weight: 400;
}

.th-lumber-sheet-profrow-chev {
    flex: none;
    width: 20px;
    height: 20px;
    color: #b3b3b3;
}

.th-lumber-prof-note {
    margin: 2px 0 0;
    font-size: 12px;
}

.th-lumber-prof-more {
    margin-top: 16px;
}

/* --- Krok 2 a pole nastavení podle šuplíků (12-11-26) --- */
/* Tlačítko Profil (.th-lumber-prof-btn) je sdílená komponenta v shared/calc_theme.css (i Formát desky ve Skříňce a šuplících) */

/* Seznam dílů (mřížka): Název | Ks | Profil | Tloušťka | Šířka | Délka | kopie + koš; hlavička má stejné sloupce */
#th-lumber-rows-section[data-unit] .th-lumber-grid:not(.th-lumber-grid-stock),
#th-lumber-rows-section[data-unit] > .th-lumber-grid-head {
    grid-template-columns: minmax(0, 1.1fr) minmax(62px, 0.7fr) 92px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 76px;
    gap: 6px;
}

#th-lumber-rows-section[data-unit="in"] .th-lumber-grid:not(.th-lumber-grid-stock),
#th-lumber-rows-section[data-unit="in"] > .th-lumber-grid-head {
    grid-template-columns: minmax(0, 0.9fr) minmax(62px, 0.7fr) 44px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.7fr) 76px;
}

#th-lumber-rows-section[data-unit="in"] #th-lumber-rows .th-lumber-prof-txt {
    display: none;
}

#th-lumber-rows .th-lumber-actions {
    display: flex;
}

/* užší seznam na počítači: Profil jen s ikonou, ať zbyde místo na čísla */
@container lumberrows (max-width: 679px) {
    #th-lumber-rows-section[data-unit] .th-lumber-grid:not(.th-lumber-grid-stock),
    #th-lumber-rows-section[data-unit] > .th-lumber-grid-head {
        grid-template-columns: minmax(0, 1.1fr) minmax(62px, 0.7fr) 44px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 76px;
    }

    #th-lumber-rows-section[data-unit="in"] .th-lumber-grid:not(.th-lumber-grid-stock),
    #th-lumber-rows-section[data-unit="in"] > .th-lumber-grid-head {
        grid-template-columns: minmax(0, 0.9fr) minmax(62px, 0.7fr) 44px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.7fr) 76px;
    }

    #th-lumber-rows .th-lumber-prof-txt {
        display: none;
    }
}

/* Řezivo k nákupu (počítač): Profil | Tloušťka | Šířka | Délka | koš */
#th-lumber-fixed .th-lumber-grid.th-lumber-grid-stock {
    grid-template-columns: 92px repeat(3, minmax(0, 1fr)) 36px;
    gap: 6px;
}

#th-lumber-stock .th-lumber-row {
    margin-bottom: 6px;
}

.th-lumber-stock-hint {
    margin: 4px 0 0;
}

/* Řezivo k nákupu (telefon, upravovaný řádek): Tloušťka | Šířka | Délka, pod nimi Vybrat profil a koš */
@container lumberstock (max-width: 559px) {
    #th-lumber-fixed .th-lumber-grid.th-lumber-grid-stock {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas: "t w l" "p p d";
        row-gap: 6px;
    }

    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-cell-t { grid-area: t; }
    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-cell-w { grid-area: w; }
    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-cell-l { grid-area: l; }
    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-cell-prof { grid-area: p; }

    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-actions {
        grid-area: d;
        justify-self: end;
    }

    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-stock-badge {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    #th-lumber-fixed .th-lumber-grid-stock .th-lumber-del {
        width: 44px;
    }

    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head {
        grid-template-areas: "t w l";
    }

    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(1),
    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(5) {
        display: none;
    }

    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(2) { grid-area: t; display: block; }
    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(3) { grid-area: w; }
    #th-lumber-fixed .th-lumber-grid-stock.th-lumber-grid-head > :nth-child(4) { grid-area: l; display: block; }

    #th-lumber-fixed .th-lumber-prof-txt {
        display: none;
    }

    #th-lumber-fixed .th-lumber-prof-txt-long {
        display: inline;
    }
}

/* Moje řezivo: Upravit / Smazat / Uložit / Zrušit = systémové th-share-btn (jako Uložit projekt), jen rozestupy */
.th-lumber-mystock-save {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.th-lumber-mystock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* telefon: zalomená tlačítka stejně široká, ne zubatě pod sebou */
@media (max-width: 767px) {
    .th-lumber-mystock-btn {
        flex: 1 1 auto;
    }
}

/* Pole nastavení (odpad, prořez, zakrácení, hrana, přídavek): systémové −/+ po stranách jako šuplíky */
.th-lumber-num-group {
    position: relative;
}

/* rezervu pro −/+ dává systém (th-stepper-input) */

/* --- Výsledky podle schodů (12-11-26): rozpis nesbalený, karty v systémové mřížce, systémové mezery mezi bloky --- */
#th-result-output .th-lumber-rows-detail {
    margin-top: 25px;
}

#th-result-output .th-lumber-rows-detail .th-lumber-block {
    margin-top: 0;
}

#th-result-output .th-lumber-strip-small {
    margin: 12px 0 20px;
}

#th-result-output .th-lumber-strip-small:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#th-result-output > .th-lumber-detail,
#th-result-output > details.th-knowledge-more {
    margin: 25px 0 0;
}

/* Zkopírovat / Nákup / K pile: jedna řada stejné výšky; v úzkém sloupci Zkopírovat přes celou šířku, pod ním dvě vedle sebe */
.th-lumber-shop-result {
    container-type: inline-size;
    container-name: lumbershop;
}

.th-lumber-work-actions {
    display: grid;
    grid-template-columns: auto auto auto;
    justify-content: start;
    align-items: stretch;
    gap: 8px;
}

.th-lumber-work-actions .th-lumber-add {
    justify-content: center;
    white-space: nowrap;
}

/* Úzký sloupec (telefon, dlouhé jazyky): každé tlačítko na vlastním řádku přes celou šířku, text se smí zalomit */
@container lumbershop (max-width: 519px) {
    .th-lumber-work-actions {
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
    }

    .th-lumber-work-actions .th-lumber-add {
        min-width: 0;
        padding: 8px 16px;
        white-space: normal;
        text-align: center;
    }
}

#th-result-output .th-result-details-left > .th-lumber-block:first-child,
#th-result-output .th-result-details-right > .th-lumber-block:first-child {
    margin-top: 0;
}

#th-result-output .th-result-details-left > .th-lumber-block:first-child > .th-lumber-heading,
#th-result-output .th-result-details-right > .th-lumber-block:first-child > .th-lumber-heading {
    margin-top: 0;
}

@media (max-width: 640px) {
    #th-result-output .th-lumber-strip-small {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #th-result-output .th-lumber-strip-small > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}


/* --- Textura dřeva v plátně a v nářezu (12-11-26): barva podle dřeviny, jemná léta, tenké šedé kóty --- */
.th-lumber-wood-neutral { --wood-a: #e2c99c; --wood-b: #d3b481; --wood-c: #c7a571; --wood-line: rgba(122, 82, 36, 0.22); --wood-edge: #a8834f; --wood-text: #2b1d0e; }
.th-lumber-wood-light { --wood-a: #ecd7aa; --wood-b: #dfc28c; --wood-c: #d2b379; --wood-line: rgba(140, 96, 40, 0.2); --wood-edge: #b8925a; --wood-text: #2b1d0e; }
.th-lumber-wood-mid { --wood-a: #d4a26c; --wood-b: #c08a53; --wood-c: #ad7643; --wood-line: rgba(84, 46, 16, 0.26); --wood-edge: #8f5f33; --wood-text: #24150a; }
.th-lumber-wood-dark { --wood-a: #8e6340; --wood-b: #77512f; --wood-c: #634226; --wood-line: rgba(28, 14, 4, 0.34); --wood-edge: #4a311c; --wood-text: #ffffff; }

.th-lumber-pv .th-lw-s1 { stop-color: var(--wood-a); }
.th-lumber-pv .th-lw-s2 { stop-color: var(--wood-b); }
.th-lumber-pv .th-lw-s3 { stop-color: var(--wood-c); }

.th-lumber-pv .th-lumber-pv-board {
    fill: url(#thlw-grad);
    stroke: var(--wood-edge);
    stroke-width: 1;
}

.th-lumber-pv .th-lumber-pv-grain {
    stroke: var(--wood-line);
    stroke-width: 0.8;
}

.th-lumber-pv .th-lumber-pv-dim {
    stroke: #7a7a7a;
    stroke-width: 0.75;
}

.th-lumber-pv .th-lumber-pv-dimtext {
    fill: #b8b8b8;
    font: 12px Roboto, Arial, sans-serif;
}

/* nářez: dlaždice jako kus dřeva (přechod + tenká léta), plné žluté odznaky čísel zůstávají */
.th-lumber-pats .th-lumber-pat-part {
    border-color: var(--wood-edge);
    background:
        repeating-linear-gradient(180deg, transparent 0 7px, var(--wood-line) 7px 8px, transparent 8px 13px),
        linear-gradient(180deg, var(--wood-a) 0%, var(--wood-b) 45%, var(--wood-a) 70%, var(--wood-c) 100%);
    color: var(--wood-text);
}

/* Plátno: stoh dalších kusů za prknem, odznak čísel řádků (i „1–5“), menší šedé kóty */
.th-lumber-pv .th-lumber-pv-back {
    opacity: 0.55;
}

.th-lumber-pv-badge {
    fill: #f9c343;
}

.th-lumber-pv-badge-t {
    fill: #111111;
    font: 700 11px Roboto, Arial, sans-serif;
}

.th-lumber-pv .th-lumber-pv-dimtext {
    fill: #a8a8a8;
    font: 11px Roboto, Arial, sans-serif;
}

.th-lumber-pv .th-lumber-pv-thick {
    fill: #a8a8a8;
    font: 12px Roboto, Arial, sans-serif;
}

/* Plátno: prkno v šikmém pohledu s tloušťkou – bok a čelo tmavší, jemný obrys a stín mezi vrstvami stohu, suky */
.th-lumber-wood-neutral { --wood-side: #a9864f; --wood-end: #bf9c66; --wood-knot: #8a6332; }
.th-lumber-wood-light { --wood-side: #b4925c; --wood-end: #c9a870; --wood-knot: #946a36; }
.th-lumber-wood-mid { --wood-side: #8d5d31; --wood-end: #a06d3e; --wood-knot: #6b4220; }
.th-lumber-wood-dark { --wood-side: #4f341e; --wood-end: #5e3f25; --wood-knot: #4a2f19; }

.th-lumber-pv-layer {
    filter: drop-shadow(0 -1px 1.5px rgba(0, 0, 0, 0.45));
}

.th-lumber-pv .th-lumber-pv-layer .th-lumber-pv-board {
    stroke: var(--wood-edge);
    stroke-width: 1;
    stroke-linejoin: round;
}

.th-lumber-pv-side {
    fill: var(--wood-side);
    stroke: var(--wood-edge);
    stroke-width: 1;
}

.th-lumber-pv-end {
    fill: var(--wood-end);
    stroke: var(--wood-edge);
    stroke-width: 1;
    stroke-linejoin: round;
}

.th-lumber-pv-endring {
    fill: none;
    stroke: var(--wood-line);
    stroke-width: 0.8;
}

.th-lumber-pv-knot {
    fill: var(--wood-knot);
    opacity: 0.7;
}

.th-lumber-pv-knotring {
    fill: none;
    stroke: var(--wood-knot);
    stroke-width: 0.7;
    opacity: 0.45;
}

.th-lumber-wood-dark .th-lumber-pv-knot {
    opacity: 0.35;
}

.th-lumber-wood-dark .th-lumber-pv-knotring {
    opacity: 0.2;
}


/* Řádky s posuvníkem pod Délkou: pole zarovnaná nahoru (posuvník jen prodlouží buňku Délky, nic neposkočí) */
#th-lumber-rows .th-lumber-row,
#th-lumber-stock .th-lumber-row {
    align-items: start;
}

/* Plátno: každé prkno stohu čitelné samo – tmavší obrys 1 px a kontaktní stín pod vrstvou, léta jen jemná */
.th-lumber-wood-neutral { --wood-outline: #7a5a2e; }
.th-lumber-wood-light { --wood-outline: #85622f; }
.th-lumber-wood-mid { --wood-outline: #5e3a17; }
.th-lumber-wood-dark { --wood-outline: #2b1a0c; }

.th-lumber-pv-layer {
    filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55));
}

.th-lumber-pv .th-lumber-pv-layer .th-lumber-pv-board,
.th-lumber-pv .th-lumber-pv-side,
.th-lumber-pv .th-lumber-pv-end {
    stroke: var(--wood-outline);
    stroke-width: 1;
}

.th-lumber-pv .th-lumber-pv-grain {
    stroke-width: 0.6;
    stroke-opacity: 0.75;
}

/* Plátno: kóty jako schody (stairs_visuals.js drawDimH / drawDimV) – žlutá, pomocné čáry čárkované, šipky, text 13 px tučně se stínem */
.th-lumber-pv .th-lumber-pv-ext {
    stroke: #f9c343;
    stroke-width: 1;
    stroke-dasharray: 4 4;
    opacity: 0.8;
}

.th-lumber-pv .th-lumber-pv-dimline {
    stroke: #f9c343;
    stroke-width: 2;
}

.th-lumber-pv .th-lumber-pv-dimtext {
    fill: #f9c343;
    font: bold 13px sans-serif;
    text-shadow: 0 1px 3px #111, 0 -1px 3px #111, 1px 0 3px #111, -1px 0 3px #111;
}

/* stoh nad 10 kusů: značka přerušení */
.th-lumber-pv-break {
    fill: none;
    stroke: #ececec;
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* Kóty ve tvaru schodů, ale tlumené – kreslí se přes texturu dřeva (výjimka schválená Tomem 12-11-26) */
.th-lumber-pv .th-lumber-pv-ext {
    opacity: 0.4;
}

.th-lumber-pv .th-lumber-pv-dimline {
    stroke-width: 1;
    stroke-opacity: 0.6;
}

.th-lumber-pv .th-lumber-pv-dimtext {
    fill-opacity: 0.85;
    font: 600 12px sans-serif;
}

/* kóta šířky v rovině horní plochy: pokosené hroty (vlastní polygon), stejně tlumené jako šipky ostatních kót */
.th-lumber-pv .th-lumber-pv-arrow {
    fill: #f9c343;
    fill-opacity: 0.6;
}

/* Řezivo k nákupu: tlumená poznámka pod řádkem, ze kterého nejde nic nařezat, a věty o chybějícím řezivu s tlačítkem Přidat */
#th-lumber-fixed .th-lumber-grid-stock > .th-lumber-stock-unused {
    grid-column: 1 / -1;
    margin: 0;
}

#th-lumber-fixed .th-lumber-grid-stock > .th-lumber-stock-unused[hidden],
.th-lumber-stock-missing[hidden] {
    display: none;
}

@container lumberstock (max-width: 559px) {
    #th-lumber-fixed .th-lumber-grid-stock > .th-lumber-stock-unused {
        grid-column: 1 / -1;
        grid-row: 3;
    }
}

.th-lumber-stock-missing {
    margin: 6px 0 0;
}

.th-lumber-stock-gap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 4px 0;
}

.th-lumber-stock-gap .th-lumber-add {
    margin-top: 0;
}

/* Nářez: zbytek prkna čitelně jako „část prkna, která zbude“ – obrys prkna, výraznější šrafa,
   text na úrovni sekundárního textu (#b3b3b3 na nejsvětlejším pruhu šrafy #2a2a2a = kontrast 6,8 : 1) */
.th-lumber-pat-board {
    border-color: rgba(255, 255, 255, 0.22);
}

.th-lumber-pat-rest {
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0 6px, transparent 6px 12px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    color: #b3b3b3;
}

/* Nákupní seznam bez dílů, které se nevejdou (17-11-26): nesmí vypadat jako hotový */
.th-lumber-incomplete {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid rgba(240, 90, 80, .55);
    border-radius: var(--th-radius-md, 8px);
    background: rgba(240, 90, 80, .1);
    color: #f3f0e8;
    font-weight: 700;
    line-height: 1.45;
}

/* --- Dřevo v3: zbytky doma (Ks | Tloušťka | Šířka | Délka | koš), nejmenší užitečný zbytek, výsledky ze zbytků --- */
.th-lumber-home {
    margin-top: 25px;
}

#th-lumber-fixed .th-lumber-grid.th-lumber-grid-home {
    grid-template-columns: minmax(0, 0.8fr) repeat(3, minmax(0, 1fr)) 36px;
    gap: 6px;
    align-items: start; /* posuvník pod Délkou: pole v řádku zarovnaná nahoru */
}

#th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head {
    align-items: end;
}

#th-lumber-home-rows .th-lumber-row {
    margin-bottom: 6px;
}

.th-lumber-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 6px 0 14px;
}

.th-lumber-home-min {
    margin-top: 4px;
}

@container lumberstock (max-width: 559px) {
    #th-lumber-fixed .th-lumber-grid.th-lumber-grid-home {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas: "t w l" "q q d";
        row-gap: 6px;
    }

    #th-lumber-fixed .th-lumber-grid-home > .th-lumber-cell-t { grid-area: t; }
    #th-lumber-fixed .th-lumber-grid-home > .th-lumber-cell-w { grid-area: w; }
    #th-lumber-fixed .th-lumber-grid-home > .th-lumber-cell-l { grid-area: l; }
    #th-lumber-fixed .th-lumber-grid-home > .th-lumber-cell-qty { grid-area: q; max-width: 160px; }

    #th-lumber-fixed .th-lumber-grid-home > .th-lumber-actions {
        grid-area: d;
        justify-self: end;
    }

    /* telefon: popisky Tloušťka | Šířka | Délka nad poli zůstávají, Ks má pole s −/+ pod nimi */
    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head {
        grid-template-areas: "t w l";
    }

    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head > :nth-child(1),
    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head > :nth-child(5) {
        display: none;
    }

    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head > :nth-child(2) { grid-area: t; }
    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head > :nth-child(3) { grid-area: w; }
    #th-lumber-fixed .th-lumber-grid-home.th-lumber-grid-head > :nth-child(4) { grid-area: l; }
}

.th-lumber-summary-home {
    margin: -8px 0 14px;
    color: #b3b3b3;
    font-size: 14px;
    text-align: center;
}

.th-lumber-home-use {
    margin-bottom: 14px;
}

.th-lumber-home-use-title {
    margin: 0 0 6px;
    color: #ececec;
    font-weight: 600;
}

.th-lumber-offcuts {
    margin-top: 18px;
}

.th-lumber-offcut-list {
    margin: 4px 0 10px;
    padding-left: 18px;
    color: #ececec;
    font-size: 15px;
    line-height: 1.7;
}

.th-lumber-pat-rest.is-waste {
    background: rgba(0, 0, 0, 0.22);
}

/* Stažení pod pruhem PDF: CSV · Excel · Štítky v jednom řádku na střed (systémové .th-quiet-actions) */
.th-lumber-dl-row {
    justify-content: center;
    margin: 6px 0 0;
}

/* Nabídka uložených zbytků, které se hodí (tónovaný rámeček jako rada, ne varování) */
.th-lumber-home-suggest {
    margin: 4px 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(249, 195, 67, 0.35);
    border-radius: var(--th-radius-md, 12px);
    background: rgba(249, 195, 67, 0.06);
}

.th-lumber-home-suggest .th-lumber-note {
    margin: 0 0 8px;
    color: #ececec;
}

.th-lumber-summary-home .th-lumber-suggest-btn {
    min-height: 0;
    color: #f9c343;
}

/* Poznámka ke zbytku (Moje zbytky): tlumeně pod rozměrem, ve výsledku i v nářezu */
.th-lumber-home-note {
    display: block;
    color: #b3b3b3;
    font-size: 13px;
}

.th-lumber-home-rownote {
    grid-column: 1 / -1;
    margin: -2px 0 4px;
}

.th-lumber-pat-note {
    color: #b3b3b3;
    font-size: 13px;
    font-weight: 400;
}

/* Plátno jako hromada dřeva (20-11-26, window.thLumberPile): řady dozadu a spodní vrstvy postupně tmavší, měkký stín hromady na podložce */
.th-lumber-pv-layer.is-s1 { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55)) brightness(0.9); }
.th-lumber-pv-layer.is-s2 { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55)) brightness(0.8); }
.th-lumber-pv-layer.is-s3 { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55)) brightness(0.72); }
.th-lumber-pv-layer.is-s4 { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55)) brightness(0.64); }
.th-lumber-pv-layer.is-s5 { filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.55)) brightness(0.57); }

.th-lumber-pv-shadow {
    fill: rgba(0, 0, 0, 0.6);
    filter: blur(4px);
}

.th-lumber-pv-all {
    justify-content: center;
    margin-top: var(--th-space-2, 8px);
}

/* Hromada na telefonu: výšku hlídá počet rozměrů (3 / Zobrazit všechny díly), ne společné max. 40vh – jinak se zmenší i šířka dřeva */
.th-is-mobile #th-svg-wrapper svg.th-lumber-pv-pile {
    max-height: none !important;
}

/* Seznam dílů v2 (20-11-26, $lumber_rows_v2_enabled): Název dostane místo – Profil jen ikona (popisek v title), čísla užší
   (4 číslice se vejdou i tak), písmo beze změny ze stupnice; karty pod 580 px beze změny.
   21-11-26 (Tom): mm i palce stejné šířky sloupců, Název o ~15 % užší ve prospěch Ks a rozměrů */
@container lumberrows (min-width: 580px) {
    #th-lumber-rows-section.th-lumber-rows-v2[data-unit] .th-lumber-grid:not(.th-lumber-grid-stock),
    #th-lumber-rows-section.th-lumber-rows-v2[data-unit] > .th-lumber-grid-head {
        grid-template-columns: minmax(0, 1.75fr) minmax(62px, 0.65fr) 44px minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.15fr) 76px;
    }

    #th-lumber-rows-section.th-lumber-rows-v2 #th-lumber-rows .th-lumber-prof-txt {
        display: none;
    }
}
