/* Design System & Variables */
:root {
    --zvyrazneny-pocet: #4ade80;   /* světlá zelená pro tmavý režim */
    --bg-main: #0b0f19;
    --bg-card: #162032;
    --bg-card-hover: #1e2b44;
    --border-color: #24324d;
    --border-color-hover: #3b4e75;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #10b981; /* Emerald */
    --primary-hover: #059669;
    --secondary: #3b82f6; /* Blue */
    --secondary-hover: #2563eb;
    --accent: #f97316; /* Warm Orange/Wood tone */
    --accent-hover: #ea580c;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --summary-gradient: linear-gradient(180deg, var(--bg-card) 0%, rgba(22, 32, 50, 0.5) 100%);
    --recap-gradient: linear-gradient(145deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.8) 100%);
}

/* Light Mode overrides */
body.light-mode {
    --zvyrazneny-pocet: #047857;   /* tmavá zelená, na bílém čitelná */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #3f4b5b;   /* bylo #475569, kontrast 4,2 */
    --text-muted: #5b6675;       /* bylo #94a3b8, kontrast 2,56 */

    --primary: #047857;          /* bylo #059669, na bílé jen 3,77 */
    --primary-hover: #065f46;
    --secondary: #2563eb;
    --secondary-hover: #1d4ed8;

    --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.15);

    /* Souhrnné karty (Souhrn kování, Shrnutí spotřebičů, Rekapitulace nabídky...)
       měly natvrdo tmavý gradient na pozadí - text nad ním se podle režimu měnil,
       pozadí ne. Kontrast 1,07: tmavý nadpis na tmavém pozadí i v bílém režimu. */
    --summary-gradient: linear-gradient(180deg, var(--bg-card) 0%, rgba(226, 232, 240, 0.6) 100%);
    --recap-gradient: linear-gradient(145deg, rgba(248, 250, 252, 0.7) 0%, rgba(226, 232, 240, 0.9) 100%);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
}

/* App Layout */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-section h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

body.light-mode .tab-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

.tab-btn.active {
    color: #ffffff !important;
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

/* Bento Cards Layout */
.tab-content {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

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

.grid-dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .grid-dashboard {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-color-hover);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* Beautiful Interactive Tables */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

body.light-mode th {
    background-color: rgba(0, 0, 0, 0.01);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

body.light-mode tr:hover td {
    background-color: rgba(0, 0, 0, 0.01);
}

/* Modern Form Controls */
input, select, textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    transition: all var(--transition-fast);
}

body.light-mode input, 
body.light-mode select, 
body.light-mode textarea {
    background: rgba(0, 0, 0, 0.02);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary) !important;
    border: 1px solid var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-color-hover);
    background: rgba(255, 255, 255, 0.03);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-icon-only {
    padding: 0.5rem;
    border-radius: 50%;
}

/* Switch UI */
.switch-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Live Summary Panel */
.summary-panel {
    background: var(--summary-gradient);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.95rem;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-total {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    color: var(--primary);
}

/* Custom Catalog Dropdown Item */
.catalog-select-wrapper {
    position: relative;
}

.catalog-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: none;
}

.catalog-search-results.active {
    display: block;
}

.catalog-item-option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.catalog-item-option:hover {
    background: var(--bg-card-hover);
}

.catalog-item-option .meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    margin-top: 0.2rem;
}

/* Helper Utility Classes */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.settings-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-grid label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.short {
    max-width: 90px !important;
    text-align: center;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.font-size-sm {
    font-size: 0.85rem !important;
}


/* --- Readability & Column Width Adjustments --- */
/* Refined compact table layout that gives perfect legibility to header text */
#laminaty table {
    width: 100% !important;
    table-layout: fixed !important; /* Force precise control over column widths */
    border-collapse: collapse !important;
}

#laminaty_boards_table th {
    white-space: normal !important; /* Allow header text to wrap */
    word-wrap: break-word !important;
    font-size: 0.72rem !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 0.5rem 0.15rem !important;
    vertical-align: bottom !important; /* Align headers to bottom for neat look */
}

#laminaty_boards_table td {
    padding: 0.4rem 0.15rem !important; /* Extremely small cell padding to maximize space */
    vertical-align: middle !important;
    font-size: 0.8rem !important;
}

/* General inputs inside laminates table - very compact padding and centered text */
#laminaty_boards_table td input {
    box-sizing: border-box !important;
    padding: 0.4rem 0.1rem !important; /* Zero side padding so numbers are fully visible */
    font-size: 0.82rem !important;
    border-radius: 4px !important;
    height: 32px !important;
    text-align: center !important;
    min-width: 0 !important; /* Force browser to allow inputs to shrink */
    width: 100% !important;
}

/* Column specific fixed widths summing up to only ~945px for maximum readability without scrolling */
#laminaty_boards_table th:nth-child(1), #laminaty_boards_table td:nth-child(1) { width: 70px !important; }  /* Materiál (DTD L, MDF) */
#laminaty_boards_table th:nth-child(2), #laminaty_boards_table td:nth-child(2) { width: 110px !important; } /* Dekor (W908, H3303) */
#laminaty_boards_table th:nth-child(3), #laminaty_boards_table td:nth-child(3) { width: 50px !important; }  /* Počet ks */
#laminaty_boards_table th:nth-child(4), #laminaty_boards_table td:nth-child(4) { width: 55px !important; }  /* Přesně */
#laminaty_boards_table th:nth-child(5), #laminaty_boards_table td:nth-child(5) { width: 55px !important; }  /* Odečet */
#laminaty_boards_table th:nth-child(6), #laminaty_boards_table td:nth-child(6) { width: 65px !important; }  /* Cena ks */
#laminaty_boards_table th:nth-child(7), #laminaty_boards_table td:nth-child(7) { width: 45px !important; }  /* Lesk */
#laminaty_boards_table th:nth-child(8), #laminaty_boards_table td:nth-child(8) { width: 65px !important; }  /* Druh hrany (ABS) */
#laminaty_boards_table th:nth-child(9), #laminaty_boards_table td:nth-child(9) { width: 110px !important; } /* Hranování dekor */
#laminaty_boards_table th:nth-child(10), #laminaty_boards_table td:nth-child(10) { width: 55px !important; }/* Hrana m */
#laminaty_boards_table th:nth-child(11), #laminaty_boards_table td:nth-child(11) { width: 55px !important; }/* Hrana cena */
#laminaty_boards_table th:nth-child(12), #laminaty_boards_table td:nth-child(12) { width: 55px !important; }/* Manip. */
#laminaty_boards_table th:nth-child(13), #laminaty_boards_table td:nth-child(13) { width: 85px !important; text-align: right !important; } /* Cena lamino */
#laminaty_boards_table th:nth-child(14), #laminaty_boards_table td:nth-child(14) { width: 85px !important; text-align: right !important; font-weight: 700 !important; color: var(--primary) !important; } /* Zákazník */
#laminaty_boards_table th:nth-child(15), #laminaty_boards_table td:nth-child(15) { width: 140px !important; text-align: center !important; } /* Smazat */

/* Align text inputs to left for better readability */
#laminaty_boards_table td:nth-child(1) input,
#laminaty_boards_table td:nth-child(2) input,
#laminaty_boards_table td:nth-child(8) input,
#laminaty_boards_table td:nth-child(9) input {
    text-align: left !important;
    padding-left: 0.3rem !important;
}

/* Make sure switch button is small and centered */
#laminaty_boards_table td:nth-child(7) .switch {
    transform: scale(0.8) !important;
    margin: 0 auto !important;
}

/* Autocomplete results dropdown styling */
/* Autocomplete results dropdown styling - wider than the cell, overlaying next columns */
.board-dropdown {
    min-width: 380px !important;
    max-width: 500px !important;
    width: max-content !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45) !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-card) !important;
    border-radius: 6px !important;
    z-index: 9999 !important; /* Stand above everything else */
}

.board-dropdown .decor-option:hover {
    background-color: var(--primary) !important;
    color: white !important;
}

body.light-mode td input, body.light-mode td select {
    border-color: rgba(0, 0, 0, 0.15) !important;
    background: #ffffff !important;
    color: #111111 !important;
}

/* ============================================================
   NABÍDKA PRO ZÁKAZNÍKA - vzhled listu CN-KL z Excelu
   ============================================================ */
.offer-view-switch {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.offer-view-switch .btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}
.offer-view-switch .btn.is-active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

#offer_doc {
    background: #ffffff;
    color: #000000;
    font-family: Calibri, Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.35;
    width: 210mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 12mm 14mm;
    box-sizing: border-box;
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
    border-radius: 2px;
}
#offer_doc .o-logo {
    margin-bottom: 6mm;
}
#offer_doc .o-title {
    border: 1px solid #000;
    padding: 2px 6px;
    margin-bottom: 2mm;
}
#offer_doc .o-title-input {
    font-size: 14pt;
    font-weight: bold;
    text-align: center;
}
#offer_doc .o-date {
    text-align: right;
    font-size: 8pt;
    margin-bottom: 4mm;
}
#offer_doc .o-date-input {
    width: 26mm;
    text-align: right;
}
#offer_doc input.offer-spec {
    border: none;
    border-bottom: 1px dotted #bbb;
    background: transparent;
    color: #000;
    font: inherit;
    padding: 0 2px;
    width: 100%;
    box-sizing: border-box;
}
#offer_doc input.offer-spec:focus {
    outline: none;
    border-bottom-color: #10b981;
    background: rgba(16, 185, 129, 0.06);
}
#offer_doc input.offer-spec::placeholder {
    color: #c9c9c9;
}
#offer_doc .o-spec-head {
    text-decoration: underline;
    font-weight: 600;
    margin: 3mm 0 1mm;
}
#offer_doc .o-spec-grid {
    display: grid;
    grid-template-columns: 30mm 1fr 24mm 1fr 12mm 1fr;
    column-gap: 3mm;
    row-gap: 1mm;
    align-items: end;
}
#offer_doc .o-spec-grid label {
    white-space: nowrap;
}

#offer_doc .o-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6mm;
}
#offer_doc .o-table th {
    font-size: 8pt;
    font-weight: normal;
    text-align: right;
    padding-bottom: 1mm;
}
#offer_doc .o-table td {
    padding: 0.6mm 0;
    vertical-align: bottom;
}
#offer_doc .o-name { text-align: left; }
#offer_doc .o-brand,
#offer_doc .o-model { text-align: left; padding-left: 3mm; white-space: nowrap; }
#offer_doc .o-qty { text-align: right; width: 16mm; white-space: nowrap; }
#offer_doc .o-price { text-align: right; width: 26mm; white-space: nowrap; }
#offer_doc .o-bold td,
#offer_doc tr.o-bold { font-weight: bold; }
#offer_doc .o-section {
    text-decoration: underline;
    font-weight: 600;
    padding-top: 2mm;
}
#offer_doc .o-subtotal .o-price {
    font-weight: bold;
    border-top: 1px solid #000;
    padding-top: 0.8mm;
}
#offer_doc .o-gap td { height: 4mm; }

#offer_doc .o-total-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8mm;
}
#offer_doc .o-total-table td {
    padding: 0.8mm 2mm;
}
#offer_doc .o-signature {
    vertical-align: bottom;
    width: 60%;
}
#offer_doc .o-total-label {
    font-weight: bold;
    text-align: left;
    border: 1px solid #000;
    border-right: none;
    white-space: nowrap;
}
#offer_doc .o-total-value {
    font-weight: bold;
    text-align: right;
    border: 1px solid #000;
    border-left: none;
    width: 26mm;
    white-space: nowrap;
}
#offer_doc .o-total-final {
    background: #00ff00;
}

/* Print Styling */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-size: 11pt !important;
    }

    /* tiskne se vždy dokument pro zákazníka, nikdy interní skladba ceny */
    .offer-view-switch,
    #offer_breakdown {
        display: none !important;
    }
    #offer_doc {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        box-shadow: none !important;
        font-size: 10pt !important;
    }
    #offer_doc input.offer-spec {
        border-bottom: none !important;
        background: transparent !important;
    }
    #offer_doc input.offer-spec::placeholder {
        color: transparent !important;
    }
    #offer_doc .o-total-final {
        background: #00ff00 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    @page {
        size: A4 portrait;
        margin: 12mm 14mm;
    }
    
    .app-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .tabs-nav, .header-actions, .btn, table:not(.table-offer) th:last-child, table:not(.table-offer) td:last-child {
        display: none !important;
    }
    
    .tab-content {
        display: none !important;
    }
    
    #nabidka {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        width: 100% !important;
    }
    
    /* Force all details categories to expand fully during print */
    details.category-details {
        display: block !important;
    }
    details.category-details > * {
        display: block !important;
    }
    details.category-details > summary {
        display: block !important;
        font-weight: bold !important;
        margin-bottom: 0.5rem !important;
    }
    
    .grid-offer {
        display: block !important;
        width: 100% !important;
    }

    .grid-offer > div:first-child {
        width: 100% !important;
        max-width: 100% !important;
    }

    .grid-offer > div:last-child {
        display: none !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .card-title {
        display: none !important;
    }
    
    .table-wrapper {
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    table, th, td {
        border-color: #ccc !important;
        color: black !important;
    }
    
    th {
        background: #f0f0f0 !important;
        font-weight: bold !important;
    }
}

/* Beautiful spacious column widths for Worktops & Backsplashes table */
#laminaty_worktops_table {
    table-layout: fixed !important;
    width: 100% !important;
}
#laminaty_worktops_table th:nth-child(1), #laminaty_worktops_table td:nth-child(1) { width: 220px !important; } /* Popis */
#laminaty_worktops_table th:nth-child(2), #laminaty_worktops_table td:nth-child(2) { width: 110px !important; } /* Dekor */
#laminaty_worktops_table th:nth-child(3), #laminaty_worktops_table td:nth-child(3) { width: 80px !important; }  /* Délka/Mn. */
#laminaty_worktops_table th:nth-child(4), #laminaty_worktops_table td:nth-child(4) { width: 80px !important; }  /* Cena/m */
#laminaty_worktops_table th:nth-child(5), #laminaty_worktops_table td:nth-child(5) { width: 60px !important; }  /* Spoje */
#laminaty_worktops_table th:nth-child(6), #laminaty_worktops_table td:nth-child(6) { width: 60px !important; }  /* Řezy */
#laminaty_worktops_table th:nth-child(7), #laminaty_worktops_table td:nth-child(7) { width: 60px !important; }  /* Hrana */
#laminaty_worktops_table th:nth-child(8), #laminaty_worktops_table td:nth-child(8) { width: 85px !important; }  /* Rabat koef. */
#laminaty_worktops_table th:nth-child(9), #laminaty_worktops_table td:nth-child(9) { width: 100px !important; text-align: right !important; } /* Zákazník */
#laminaty_worktops_table th:nth-child(10), #laminaty_worktops_table td:nth-child(10) { width: 140px !important; text-align: center !important; } /* Akce */

#laminaty_worktops_table td:nth-child(1) input,
#laminaty_worktops_table td:nth-child(2) input {
    text-align: left !important;
    padding-left: 0.5rem !important;
}


/* Compact table and input styles for Worktops table to match Laminates table */
#laminaty_worktops_table th {
    white-space: normal !important;
    word-wrap: break-word !important;
    font-size: 0.72rem !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 0.5rem 0.15rem !important;
    vertical-align: bottom !important;
}

#laminaty_worktops_table td {
    padding: 0.4rem 0.15rem !important;
    vertical-align: middle !important;
    font-size: 0.8rem !important;
}

#laminaty_worktops_table td input {
    box-sizing: border-box !important;
    padding: 0.4rem 0.1rem !important;
    font-size: 0.82rem !important;
    border-radius: 4px !important;
    height: 32px !important;
    text-align: center !important;
    min-width: 0 !important;
}

/* Unified styling for active/inactive checkboxes in Laminates and Worktops */
.toggle-board-active, .toggle-board-price-active {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    transform: none !important;
    margin: 0 !important;
    accent-color: var(--primary, #007bff) !important;
}


/* ==========================================================================
   CUSTOM SUPPLEMENTARY INPUTS STYLE OVERRIDES
   Ensures clean, borderless table cell styling in both light & dark modes
   ========================================================================== */
.backing-name-input,
.backing-price-base-input,
.backing-markup-input,
.doors-supp-name-input,
.doors-supp-price-base-input,
.doors-supp-markup-input,
.worktops-supp-name-input,
.worktops-supp-price-base-input,
.worktops-supp-markup-input,
.offer-labor-name-input,
.offer-labor-cost-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.35rem 0.6rem !important;
    font-size: 0.88rem !important;
    height: auto !important;
    width: 100% !important;
    border-radius: 0 !important;
    color: var(--text-primary) !important;
}

/* Visual feedback on focus/hover in Light and Dark Modes */
.backing-name-input:focus,
.backing-price-base-input:focus,
.backing-markup-input:focus,
.doors-supp-name-input:focus,
.doors-supp-price-base-input:focus,
.doors-supp-markup-input:focus,
.worktops-supp-name-input:focus,
.worktops-supp-price-base-input:focus,
.worktops-supp-markup-input:focus,
.offer-labor-name-input:focus,
.offer-labor-cost-input:focus {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px !important;
    outline: none !important;
}

body.light-mode .backing-name-input:focus,
body.light-mode .backing-price-base-input:focus,
body.light-mode .backing-markup-input:focus,
body.light-mode .doors-supp-name-input:focus,
body.light-mode .doors-supp-price-base-input:focus,
body.light-mode .doors-supp-markup-input:focus,
body.light-mode .worktops-supp-name-input:focus,
body.light-mode .worktops-supp-price-base-input:focus,
body.light-mode .worktops-supp-markup-input:focus,
body.light-mode .offer-labor-name-input:focus,
body.light-mode .offer-labor-cost-input:focus {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #111111 !important;
}

.backing-name-input:hover,
.backing-price-base-input:hover,
.backing-markup-input:hover,
.doors-supp-name-input:hover,
.doors-supp-price-base-input:hover,
.doors-supp-markup-input:hover,
.worktops-supp-name-input:hover,
.worktops-supp-price-base-input:hover,
.worktops-supp-markup-input:hover,
.offer-labor-name-input:hover,
.offer-labor-cost-input:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 4px !important;
}

body.light-mode .backing-name-input:hover,
body.light-mode .backing-price-base-input:hover,
body.light-mode .backing-markup-input:hover,
body.light-mode .doors-supp-name-input:hover,
body.light-mode .doors-supp-price-base-input:hover,
body.light-mode .doors-supp-markup-input:hover,
body.light-mode .worktops-supp-name-input:hover,
body.light-mode .worktops-supp-price-base-input:hover,
body.light-mode .worktops-supp-markup-input:hover,
body.light-mode .offer-labor-name-input:hover,
body.light-mode .offer-labor-cost-input:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}


/* Specific override to fix table-layout and prevent overlapping columns in Souhrn/recap tables */
.table-wrapper table {
    table-layout: auto !important;
    min-width: 750px !important;
    width: 100% !important;
}

/* Responsive Offer & Summary Grid */
.grid-offer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .grid-offer {
        grid-template-columns: 1fr;
    }
}

/* Exempt the final offer table from the 750px minimum width constraint */
.table-wrapper table.table-offer, .table-offer {
    table-layout: fixed !important;
    min-width: 0 !important;
    width: 100% !important;
}

/* ---------------------------------------------------------------
   Šipky u číselných polí pryč. Kolečkem myši nebo omylem se přes ně
   dal přepsat počet kusů uprostřed naceňování.
   --------------------------------------------------------------- */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ===============================================================
   BÍLÝ MÓD - čitelnost obsahu

   Prvky uvnitř tabulek dostávaly tmavé pozadí ze specifičtějších
   pravidel (např. #spotrebice_tab_body table td select), takže
   v bílém módu zbyl tmavý text na tmavém pozadí - kontrast 1,09.
   Tenhle blok je schválně poslední v souboru.
   =============================================================== */
body.light-mode table td input,
body.light-mode table td select,
body.light-mode table td textarea,
body.light-mode #spotrebice_tab_body table td input,
body.light-mode #spotrebice_tab_body table td select {
    background: #ffffff !important;
    color: #14161a !important;
    border-color: #cbd5e1 !important;
    opacity: 1 !important;
}

/* Zelená čísla byla světlá (kontrast 1,24). Na bílém potřebují tmavší odstín. */
body.light-mode td.numeric,
body.light-mode .numeric,
body.light-mode .price-highlight,
body.light-mode .total-value {
    color: #047857 !important;
}

/* Hlavičky tabulek byly na 2,77. */
body.light-mode th {
    color: #1e293b !important;
    background: #eef1f5 !important;
}

/* Součtové a zvýrazněné buňky */
body.light-mode td {
    color: #14161a;
}
body.light-mode tr td strong,
body.light-mode tr td b {
    color: #0f172a !important;
}

/* Barvy zapsané natvrdo v inline stylech pro tmavé pozadí.
   Na bílém jsou nečitelné (světlá zelená #4ade80 má kontrast 1,5). */
body.light-mode [style*="#4ade80"],
body.light-mode [style*="#f3f4f6"],
body.light-mode [style*="#e5e7eb"] {
    color: #14161a !important;
}
body.light-mode td[style*="#4ade80"],
body.light-mode span[style*="#4ade80"] {
    color: #047857 !important;
}

/* Nadpisy karet dědily barvu z tmavého režimu (kontrast 1,1 na bílé). */
body.light-mode .card-title,
body.light-mode .card-title * {
    color: var(--text-primary) !important;
}

/* Kořen problému: body v bílém režimu drželo text z tmavého (#f3f4f6),
   takže všechno, co barvu dědí (nadpisy karet, popisky), bylo skoro bílé
   na bílé. Ostatní opravy výše řešily jen následky. */
body.light-mode {
    color: #0f172a !important;
}
