/* ============================================================
   EnergetickĂ˝ Audit â€” Design System v2
   ============================================================ */

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --border: #e2e8f0;
    --border-focus: #10b981; /* Emerald 500 */
    --text: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    --accent: #059669;       /* Emerald 600 */
    --accent-glow: rgba(5, 150, 105, 0.15);
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.1);
    --warning: #d97706;
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.08);
    --radius: 12px;          /* Softer corners like AquaCalc */
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --font: 'Inter', -apple-system, sans-serif;
    --bg-hover: #f1f5f9;
}

[data-theme="dark"] {
    --bg: #020617;           /* Deeper dark */
    --bg-card: #0f172a;      /* Slate 900 */
    --bg-card-hover: #1e293b;
    --bg-input: #020617;
    --border: #1e293b;
    --border-focus: #10b981;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #10b981;       /* Brighter emerald on dark */
    --accent-glow: rgba(16, 185, 129, 0.25);
    --success: #34d399;   
    --success-bg: rgba(5, 150, 105, 0.22);
    --danger: #f87171;    
    --danger-bg: rgba(220, 38, 38, 0.25);
    --warning: #fbbf24;   
    --info: #38bdf8;      
    --info-bg: rgba(14, 165, 233, 0.2);
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --bg-hover: #1e293b;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
}

.header-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.3));
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    margin-left: 3rem;
}

/* App Layout (Sidebar + Main) */
.app-layout {
    display: flex;
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 4rem;
    gap: 2rem;
    align-items: flex-start;
}

/* Sidebar Navigation */
.sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wizard-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step-btn:hover {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text);
}

.step-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: transparent;
    color: var(--accent);
    position: relative;
}

.step-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.step-btn.active .step-num {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
}

.step-btn.completed .step-num {
    background: #10b981;
    /* Green checkmark state ready */
    color: #fff;
}

.step-btn.step-dev {
    opacity: 0.55;
    filter: grayscale(1);
}

.step-btn.step-dev:hover {
    opacity: 0.85;
    filter: grayscale(0.2);
}

.step-btn.step-dev .step-title::after {
    content: " (v príprave)";
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
}

/* Banner pre sekcie vo vývoji */
.dev-banner {
    background: repeating-linear-gradient(
        45deg,
        rgba(217, 119, 6, 0.05),
        rgba(217, 119, 6, 0.05) 10px,
        rgba(217, 119, 6, 0.1) 10px,
        rgba(217, 119, 6, 0.1) 20px
    );
    border: 2px dashed var(--warning);
    color: var(--warning);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.dev-banner-icon {
    font-size: 2.5rem;
}

.dev-banner-text h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.dev-banner-text p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.expert-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Toggle Switch */
.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);
    transition: .4s;
    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(--accent);
}

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

.expert-fields {
    display: none;
    background: rgba(241, 245, 249, 0.8);
    /* Slate 100 with slight opacity */
    border-left: 3px solid var(--accent);
    padding: 1.5rem;
    margin-top: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

body.expert-mode-active .expert-fields {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Main Content Area */
main {
    flex: 1;
    min-width: 0;
    /* Prevents flex flex-blowouts */
}

.tab-content {
    display: none;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.card-desc {
    color: var(--text-dim);
    font-size: 0.83rem;
    margin-bottom: 1.5rem;
    font-family: monospace;
}

/* Form Sections */
.form-section {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}

.form-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.section-desc {
    color: var(--text-dim);
    font-size: 0.82rem;
    margin-bottom: 1rem;
}

/* Info box â€” formula explanations */
.info-box {
    background: var(--info-bg);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.7;
    font-family: monospace;
}

.info-box strong {
    color: var(--info);
    font-weight: 600;
}

/* Calculation Rollouts */
.calc-rollout {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    overflow: hidden;
}

.calc-rollout summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    outline: none;
    transition: background 0.2s ease;
    user-select: none;
}

.calc-rollout summary:hover {
    background: rgba(59, 130, 246, 0.1);
}

.calc-rollout summary::marker {
    color: var(--accent);
}

.rollout-content {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.rollout-content strong {
    color: var(--text);
}

.rollout-content em {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Tooltips */
.tooltip {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 0.2rem;
    line-height: 1.4;
    font-style: italic;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-wide {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Inputs */
input[type="text"],
input[type="number"],
select {
    font-family: var(--font);
    font-size: 0.88rem;
    padding: 0.55rem 0.7rem;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

input:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder {
    color: var(--text-dim);
}

/* Input with custom value pattern */
.input-with-custom {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-with-custom select {
    width: 100%;
}

.input-with-custom .custom-input {
    width: 100%;
}

.input-with-custom.compact {
    flex-direction: column;
}

.custom-input.hidden {
    display: none;
}

/* Construction table */
.construction-table,
.solar-table {
    margin-bottom: 0.75rem;
}

.ct-header,
.st-header {
    display: grid;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.ct-header {
    grid-template-columns: 2fr 1fr 1fr 1.5fr 36px;
}

.st-header {
    grid-template-columns: 2fr 1fr 1.5fr 0.8fr 36px;
}

.ct-row,
.solar-row {
    display: grid;
    gap: 0.5rem;
    padding: 0.4rem 0;
    align-items: start;
    border-bottom: 1px solid rgba(30, 41, 59, 0.3);
}

.ct-row {
    grid-template-columns: 2fr 1fr 1fr 1.5fr 36px;
}

.solar-row {
    grid-template-columns: 2fr 1fr 1.5fr 0.8fr 36px;
}

.ct-row:hover,
.solar-row:hover {
    background: rgba(59, 130, 246, 0.02);
}

/* Layers Table */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.layers-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    min-width: 600px;
}

.layers-table th {
    background: var(--bg-card-hover);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.layers-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.layers-table tr:hover {
    background: var(--bg-card-hover);
}

.layers-table input {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    padding: 0.4rem 0.5rem;
}

.layers-table input:hover,
.layers-table input:focus {
    background: var(--bg-card);
    border-color: var(--accent);
}

.layers-table .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: #1d4ed8;
    /* Blue 700 */
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-large {
    font-size: 1rem;
    padding: 0.9rem 2rem;
    width: 100%;
    margin-top: 1.5rem;
}

.btn-icon {
    font-family: var(--font);
    font-size: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* Results */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    animation: slideUp 0.4s ease-out;
    box-shadow: 0 8px 32px var(--success-bg);
}

.result-card.hidden {
    display: none;
}

.result-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verdict {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.verdict.pass {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.verdict.fail {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.result-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.result-table tr:hover td {
    background: rgba(59, 130, 246, 0.03);
}

.result-table .val {
    font-weight: 600;
    font-family: monospace;
    color: #93c5fd;
}

.result-table .unit {
    color: var(--text-dim);
    font-size: 0.78rem;
}

.result-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.result-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

/* Error */
.error-msg {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

/* Footer */
footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
}

/* Responsive - Breakpoints pre tablety a mobily */
@media (max-width: 1024px) {
    .app-layout, .header-inner {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 850px) {
    .app-layout {
        flex-direction: column;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 1.5rem;
    }
    
    .header-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Zmeníme vertikálny sidebar na horizontálny pre tablety/mobily */
    .sidebar {
        flex: none;
        width: 100%;
        position: static;
        margin-bottom: 2rem;
    }
    
    .wizard-steps {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .main-content {
        width: 100%;
    }
    
    .sidebar-footer {
        margin-top: 1rem;
    }
    
    .expert-fields {
        border-radius: var(--radius-sm);
        border-left: 3px solid var(--accent);
    }
}

@media (max-width: 640px) {
    .wizard-steps {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1.25rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
        overflow-x: auto;
    }
    
    .tab-btn {
        width: 100%;
        justify-content: center;
    }

    .ct-header,
    .ct-row,
    .st-header,
    .solar-row,
    .layer-row,
    .layers-header,
    .pt-header,
    .pt-row {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid var(--border);
    }
    
    /* Zabezpečenie resizovania inputov v tabuľkách pre mobily */
    .ct-row > *,
    .solar-row > *,
    .layer-row > * {
        width: 100%;
    }
    
    /* Vynútenie 100% max šírky pre celú stránku */
    body, html {
        overflow-x: hidden;
        width: 100vw;
    }
    
    main, .main-content, .card, .app-layout {
        max-width: 100vw !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }
    
    /* Oprava html <table> - layers table šírka a tabuľkový dizajn pre mobil */
    .table-responsive {
        border: none;
        background: transparent;
        overflow-x: hidden;
        width: 100%;
    }
    
    .layers-table {
        min-width: 0 !important;
        width: 100% !important;
        display: block;
    }
    
    .layers-table thead {
        display: none; /* Schováme hlavičku tabuľky na mobile */
    }
    
    .layers-table tbody, .layers-table tr, .layers-table td {
        display: block;
        width: 100%;
    }
    
    .layers-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 0.5rem;
        background: var(--bg-card);
    }
    
    .layers-table td {
        border-bottom: none;
        padding: 0.5rem 0;
    }
    
    .layers-table td input {
        width: 100%;
        margin-top: 0.2rem;
    }
    
    /* Modálne okná */
    .modal-box, .welcome-box {
        width: 100% !important;
        min-width: 0 !important;
        max-width: calc(100vw - 2rem) !important;
        margin: 1rem;
        box-sizing: border-box;
    }
}

/* Elaborát (Report) styling */
.elaborat {
    background: var(--bg-card);
    color: var(--text);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-family: 'Inter', serif;
    max-width: 900px;
    margin: 0 auto;
}

[data-theme="dark"] .elaborat {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.05);
}

.elaborat h2,
.elaborat h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.elaborat h4 {
    color: #2563eb;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.elaborat-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.elaborat-table th {
    background: var(--bg-card-hover);
    color: var(--text-muted);
    text-align: left;
    padding: 0.75rem;
    border: 1px solid var(--border);
    font-weight: 700;
}

.elaborat-table td {
    padding: 0.75rem;
    border: 1px solid var(--border);
}

.elaborat-table tr:nth-child(even) {
    background: var(--bg-input);
}

.elaborat-table td.pass {
    color: var(--success);
    font-weight: 700;
    text-transform: uppercase;
    background: var(--success-bg);
}

.elaborat-table td.fail {
    color: var(--danger);
    font-weight: 700;
    text-transform: uppercase;
    background: var(--danger-bg);
}
.report-section ul {
    list-style: none;
    margin-bottom: 1rem;
}

.report-section li {
    margin-bottom: 0.5rem;
}

.calc-step strong {
    color: var(--text);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.formula {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    color: #cbd5e1;
    display: block;
    margin-top: 0.4rem;
    white-space: pre-wrap;
    word-break: break-all;
    border-left: 2px solid var(--accent);
}

.sub-val {
    color: #94a3b8;
    font-size: 0.8rem;
    margin-left: 1rem;
    display: block;
    margin-top: 0.2rem;
}

/* Checkbox specific */
.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    background: var(--bg-input);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.checkbox-field label:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.checkbox-field input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Pipe Table (Kap 3) */
.pt-header,
.pt-row {
    display: grid;
    /* Name, DN, Length, Psi, Temp, Btn */
    grid-template-columns: 2fr 0.8fr 0.8fr 0.8fr 0.8fr 36px;
    gap: 0.5rem;
    padding: 0.4rem 0;
    align-items: center;
    border-bottom: 1px solid rgba(30, 41, 59, 0.3);
}

.pt-header {
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.4rem;
}

/* DHW Table (Kap 4) - Needs more columns */
.dhw-header,
.dhw-row {
    display: grid;
    /* Name, DN, Length, Psi, Amb, Wat, Circ, Btn */
    grid-template-columns: 2fr 0.6fr 0.7fr 0.7fr 0.7fr 0.7fr 0.5fr 36px;
    gap: 0.5rem;
    padding: 0.4rem 0;
    align-items: center;
    border-bottom: 1px solid rgba(30, 41, 59, 0.3);
}

.dhw-header {
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.4rem;
}

.read-only-input {
    background: rgba(30, 41, 59, 0.5) !important;
    color: var(--text-muted) !important;
    border-color: transparent !important;
    cursor: not-allowed;
}

/* Math Breakdown Component */
.math-breakdown {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.math-breakdown summary {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.5);
    transition: background 0.2s;
}

.math-breakdown summary:hover {
    background: rgba(241, 245, 249, 0.8);
}

.math-breakdown summary::marker {
    color: var(--accent);
}

.mb-content {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: #fff;
}

.mb-formula {
    margin-bottom: 0.4rem;
    color: var(--primary);
    font-weight: 600;
}

.mb-values {
    color: var(--text);
    margin-bottom: 0.4rem;
}

.mb-result {
    font-weight: 700;
    color: var(--accent);
    text-align: right;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}

.math-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.math-label {
    color: var(--text-dim);
}


/* Energy Certification (Chapter 9) */
.energy-class-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.ec-badge {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.ec-badge::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ec-label {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ec-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: block;
}

/* Energy Class Colors */
.ec-A0 {
    background: #22c55e;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

.ec-A1 {
    background: #84cc16;
    box-shadow: 0 0 30px rgba(132, 204, 22, 0.4);
}

.ec-B {
    background: #eab308;
    box-shadow: 0 0 30px rgba(234, 179, 8, 0.4);
}

.ec-C {
    background: #f97316;
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.4);
}

.ec-D {
    background: #ef4444;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.ec-E {
    background: #b91c1c;
    box-shadow: 0 0 30px rgba(185, 28, 28, 0.4);
}

.ec-F {
    background: #7f1d1d;
    box-shadow: 0 0 30px rgba(127, 29, 29, 0.4);
}

.ec-G {
    background: #450a0a;
    box-shadow: 0 0 30px rgba(69, 10, 10, 0.4);
}

.factors-table {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ft-header {
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.ft-row {
    display: contents;
    /* Use grid from parent */
}

.ft-row span,
.ft-row input {
    align-self: center;
}

/* Renovation measures checklist */
.measures-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.measure-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.measure-item:hover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.measure-item input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

.measure-item strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
}

/* Comparison table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.88rem;
}

.comparison-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.comparison-table .val {
    font-weight: 600;
    font-family: monospace;
}

.comparison-table .savings-row td {
    background: rgba(34, 197, 94, 0.08);
    font-weight: 600;
}

.savings-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.savings-negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ============================================================
   CHAPTER 9: ENERGY CERTIFICATE PRINT LAYOUT (A4)
   ============================================================ */

.certificate-wrapper {
    background: #525659;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    overflow-x: auto;
    border-radius: var(--radius);
    margin-top: 2rem;
}

.cert-page {
    width: 210mm;
    min-height: 297mm;
    background: white;
    color: black;
    padding: 15mm;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    font-family: 'Arial', sans-serif;
    position: relative;
    box-sizing: border-box;
}

/* Print Specific Rules */
@media print {
    body * {
        visibility: hidden;
    }

    #ch9-result,
    #ch9-result * {
        visibility: visible;
    }

    #ch9-result {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
    }

    .cert-page {
        margin: 0;
        box-shadow: none;
        page-break-after: always;
    }

    .certificate-wrapper {
        background: white;
        padding: 0;
        gap: 0;
        margin-top: 0;
    }

    @page {
        margin: 0;
        size: A4;
    }
}

.cert-header {
    text-align: center;
    border-bottom: 2px solid #000;
    margin-bottom: 5mm;
    padding-bottom: 2mm;
}

.cert-header h1 {
    font-size: 18pt;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
    color: black;
}

.cert-header h2 {
    font-size: 14pt;
    margin: 0;
    color: black;
}

.cert-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 5mm;
    font-size: 9pt;
    color: black;
}

.cert-table th,
.cert-table td {
    border: 1px solid #000;
    padding: 2mm;
    vertical-align: top;
}

.cert-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    text-align: left;
}

.cert-scale {
    margin: 5mm 0;
    position: relative;
    max-width: 120mm;
}

.cert-scale-row {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.cert-scale-label {
    width: 30mm;
    font-weight: bold;
    font-size: 10pt;
    color: black;
}

.cert-scale-bar {
    height: 7mm;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 2mm;
    color: white;
    font-weight: bold;
    font-size: 9pt;
    position: relative;
}

.bg-A0 {
    background-color: #008f39;
    width: 40%;
}

.bg-A1 {
    background-color: #22b14c;
    width: 45%;
}

.bg-B {
    background-color: #b5e61d;
    width: 50%;
    color: black;
}

.bg-C {
    background-color: #fff200;
    width: 55%;
    color: black;
}

.bg-D {
    background-color: #ffc90e;
    width: 60%;
    color: black;
}

.bg-E {
    background-color: #ff7f27;
    width: 65%;
}

.bg-F {
    background-color: #ed1c24;
    width: 70%;
}

.bg-G {
    background-color: #880015;
    width: 75%;
}

.cert-arrow {
    position: absolute;
    right: -35mm;
    top: 50%;
    transform: translateY(-50%);
    background: black;
    color: white;
    padding: 1.5mm 3mm;
    font-weight: bold;
    font-size: 10pt;
    z-index: 2;
}

.cert-arrow::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-style: solid;
    border-color: transparent black transparent transparent;
}

.cert-title {
    font-size: 12pt;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5mm;
    background: #e0e0e0;
    padding: 2mm;
    border: 1px solid #000;
}

/* ============================================================
   BODY DARK MODE — for dashboard / new-project views
   ============================================================ */



/* ============================================================
   DASHBOARD & PROJECT MANAGEMENT — Glassmorphism Premium Design
   ============================================================ */

/* ——— Dark gradient background for dashboard screens ———————— */
#view-dashboard,
#view-new-project {
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

/* Decorative background grid */
#view-dashboard::before,
#view-new-project::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* â”€â”€â”€ Glass utility â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.glass {
    background: var(--glass-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
}

/* â”€â”€â”€ Dashboard topbar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 32px rgba(0, 0, 0, 0.05);
}

.dash-topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2.5rem;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

/* â”€â”€â”€ Logo â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-logo {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
}

.dash-logo-img {
    height: 44px;
    width: 44px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: transform 0.3s ease;
}

.dash-logo-img:hover {
    transform: scale(1.05);
}

.dash-logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--success));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.dash-logo-sub {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 400;
    display: block;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* â”€â”€â”€ New project button (topbar) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-topbar .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 
        0 4px 15px rgba(5, 150, 105, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1);
    color: #fff;
    font-weight: 700;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    transition: all 0.25s ease;
    cursor: pointer;
}

.dash-topbar .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.35);
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

/* â”€â”€â”€ Hero section â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* ── Dashboard Enhancements ── */
.dash-hero {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 2.5rem 0.5rem;
}

.dash-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.dash-hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.dash-hero-banner {
    width: 100%;
    aspect-ratio: 4.5 / 1;
    min-height: 160px;
    max-height: 260px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.dash-hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s ease;
}

.dash-hero-banner:hover img {
    transform: scale(1.02);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 0rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 15px 35px var(--accent-glow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
}

/* Section Divider */
.dash-section-header {
    max-width: 1280px;
    margin: 1.5rem auto 1.5rem;
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.dash-section-header .dash-search-wrap {
    min-width: 320px;
}

/* End of Dashboard Enhancements */

/* â”€â”€â”€ Search bar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* Old search bar removed */

.dash-search-wrap {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.dash-search-wrap .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.5);
    font-size: 0.9rem;
    pointer-events: none;
}

#dash-search {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    font-family: var(--font);
    font-size: 0.88rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
}

#dash-search::placeholder { color: rgba(148, 163, 184, 0.45); }

#dash-search:focus {
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18), 0 0 24px rgba(139, 92, 246, 0.12);
    background: rgba(255, 255, 255, 0.09);
}

.dash-count {
    font-size: 0.82rem;
    color: rgba(100, 116, 139, 0.8);
    margin-left: auto;
    font-weight: 500;
}

/* â”€â”€â”€ Projects grid â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-content {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2.5rem 6rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* â”€â”€â”€ Project card â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99,102,241,0.06) 0%, transparent 60%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover {
    border-color: rgba(139, 92, 246, 0.45);
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1px rgba(139, 92, 246, 0.2),
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(99, 102, 241, 0.08);
    background: rgba(255, 255, 255, 0.08);
}

.project-card:hover::before { opacity: 1; }

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    position: relative;
}

.project-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.2));
    border: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.15);
}

.project-card-menu {
    opacity: 0;
    transition: all 0.15s;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(148, 163, 184, 0.6);
    cursor: pointer;
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-card:hover .project-card-menu { opacity: 1; }

.project-card-menu:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.3);
}

.project-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-address {
    font-size: 0.82rem;
    color: rgba(148, 163, 184, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-meta {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.project-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-type {
    background: rgba(99, 102, 241, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.badge-date {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(148, 163, 184, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-auditor {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* â”€â”€â”€ Empty state â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.dash-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 6rem 2rem;
}

.dash-empty-icon {
    font-size: 4.5rem;
    line-height: 1;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 0 24px rgba(99, 102, 241, 0.4));
}

.dash-empty h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
}

.dash-empty p {
    font-size: 0.9rem;
    max-width: 320px;
    margin: 0 auto 1.75rem;
    color: rgba(148, 163, 184, 0.7);
    line-height: 1.6;
}

.dash-empty .btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.3);
    padding: 0.75rem 2rem;
    font-size: 0.95rem;
}

.dash-empty .btn-primary:hover {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

/* â”€â”€â”€ New project form screen â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.new-project-screen {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 3rem 2rem 6rem;
}

.new-project-screen .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0;
    margin-bottom: 1.75rem;
    transition: color 0.15s;
    font-family: var(--font);
}

.new-project-screen .back-btn:hover {
    color: #a78bfa;
}

.new-project-screen h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #f8fafc, #cbd5e1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.new-project-screen .subtitle-text {
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.new-project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Override input styles inside new-project-card for theme sync */
.new-project-card input[type="text"],
.new-project-card input[type="number"],
.new-project-card select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
}

.new-project-card input[type="text"]::placeholder,
.new-project-card input[type="number"]::placeholder {
    color: var(--text-dim);
}

.new-project-card input:focus,
.new-project-card select:focus {
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: rgba(255, 255, 255, 0.09);
    outline: none;
}

.new-project-card select option {
    background: #1e1b4b;
    color: #f1f5f9;
}

.new-project-card label {
    color: rgba(148, 163, 184, 0.85);
    font-size: 0.8rem;
    font-weight: 500;
}

.form-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(99, 102, 241, 0.9);
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.new-project-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.new-project-actions .btn-primary {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.3), 0 4px 16px rgba(0,0,0,0.25);
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 10px;
}

.new-project-actions .btn-primary:hover {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.5), 0 8px 24px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.new-project-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(148, 163, 184, 0.8);
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
}

.new-project-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

/* â”€â”€â”€ Audit-mode header additions â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.header-project-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-left: 3rem;
    flex-wrap: wrap;
}

.header-project-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.header-project-name span {
    color: var(--text-dim);
    font-weight: 400;
}

.btn-save-project {
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--success);
    color: var(--success);
    background: var(--success-bg);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-save-project:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-back-dashboard {
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-back-dashboard:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* â”€â”€â”€ Toast notification â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(15, 18, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #f1f5f9;
    padding: 0.85rem 1.4rem;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font);
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.07);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { border-left: 4px solid #34d399; }
.toast.error   { border-left: 4px solid #f87171; }

/* ============================================================
   CHAPTER 1: MATERIAL PICKER & PRESETS
   ============================================================ */

/* ── Toolbar & Presets ── */
.layers-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

.layers-toolbar h3 {
    margin-bottom: 0;
}

.preset-dropdown-wrap {
    position: relative;
}

.btn-preset-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-preset-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.preset-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
}

.preset-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.preset-dropdown-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0.75rem 1rem 0.4rem;
    border-bottom: 1px solid var(--bg-hover);
    margin: 0;
}

.preset-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--bg-hover);
    cursor: pointer;
    transition: background 0.15s;
}

.preset-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.preset-item:hover {
    background: var(--bg-input);
}

.preset-item strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.1rem;
}

.preset-item span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Table button ── */
.btn-pick-mat {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-pick-mat:hover {
    background: rgba(37,99,235,0.1);
    border-color: var(--accent);
}

/* ── Material Picker Drawer (Right Side) ── */
#mat-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#mat-picker-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 480px;
    max-width: 90vw;
    background: var(--bg-card);
    box-shadow: -12px 0 48px rgba(0,0,0,0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

#mat-picker-drawer.open,
#mat-picker-overlay.open {
    opacity: 1;
    visibility: visible;
}

#mat-picker-drawer.open {
    transform: translateX(0);
}

/* Drawer Header */
.mpd-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.mpd-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.mpd-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mpd-close {
    background: var(--bg-input);
    border: 1px solid transparent;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mpd-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Search */
.mpd-search-wrap {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bg-hover);
    position: relative;
}

.mpd-search-icon {
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--text-dim);
    pointer-events: none;
}

#mpd-search {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-input);
}

/* Category Tabs */
.mpd-cats {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--bg-hover);
    scrollbar-width: none; /* Firefox */
}
.mpd-cats::-webkit-scrollbar { display: none; }

.mpc-tab {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--bg-input);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mpc-tab:hover {
    background: rgba(37,99,235,0.05);
    color: var(--text);
}

.mpc-tab.active {
    background: rgba(37,99,235,0.1);
    color: var(--accent);
    border-color: rgba(37,99,235,0.3);
}

/* Material Grid */
.mpd-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-hover);
    border-left: 1px solid var(--border);
}

.mat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.mat-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.08);
}

.mat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.mat-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.mat-cat {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--bg-input);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.mat-props {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
}

.mat-prop {
    display: flex;
    flex-direction: column;
}

.mat-prop .val {
    font-weight: 600;
    color: var(--accent);
}

.mat-prop .lbl {
    color: var(--text-dim);
    font-size: 0.65rem;
}

.mat-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
    font-size: 0.9rem;
}



