:root {
    /* Color Palette */
    --bg-main: #f4f5f7;
    --bg-panel: #ffffff;
    --glass-border: #e0e3ea;

    --text-primary: #1a1d23;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Primary accent — used sparingly (≤15%) */
    --accent-red: #be1e2d;
    --accent-red-hover: #a31825;
    --accent-red-bg: #fdf2f3;   /* very pale tint for backgrounds */

    /* Neutral accent for secondary elements */
    --accent-slate: #374151;
    --accent-blue: #062ef9;

    /* Semantic colours */
    --accent-green: #059669;
    --accent-green-bg: #ecfdf5;
    --warn-red: #dc2626;
    --warn-red-bg: #fef2f2;

    /* Shadows */
    --shadow-card: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem 1.5rem;
    line-height: 1.6;
}

/* ===== HEADER ===== */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.25rem;
}

.logo-icon svg { width: 38px; height: 38px; }

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-red);          /* title in red — deliberate accent */
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* ===== LAYOUT ===== */
.app-container { max-width: 1300px; margin: 0 auto; }

.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    align-items: start;
}

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

/* ===== PANEL BASE ===== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.6s ease-out backwards;
}

.panel:nth-child(2) { animation-delay: 0.15s; }

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.panel-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

/* ===== FORM ===== */
.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.mode-selector {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
}

label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 7px;
    background: var(--bg-main);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}

input[type="number"]:focus {
    outline: none;
    border-color: #94a3b8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

/* ===== RADIO CARDS ===== */
.radio-group { display: flex; gap: 0.75rem; }

.radio-card { flex: 1; cursor: pointer; position: relative; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }

.card-content {
    display: block;
    padding: 0.7rem 1rem;
    text-align: center;
    border-radius: 7px;
    border: 1.5px solid var(--glass-border);
    background: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.radio-card:hover .card-content {
    border-color: #94a3b8;
    background: #fff;
    color: var(--text-primary);
}

.radio-card input:checked + .card-content {
    background: var(--accent-red);      /* primary red — just the toggle */
    color: #fff;
    border-color: var(--accent-red-hover);
    box-shadow: 0 2px 8px rgba(190, 30, 45, 0.25);
}

/* ===== ADVANCED TOGGLE ===== */
.text-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    margin-top: 1.25rem;
    padding: 0.4rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    width: 100%;
    text-align: center;
    border-radius: 6px;
    transition: var(--transition);
}
.text-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.hidden-advanced { display: none; }

/* ===== RESULTS PANEL ===== */
.results-panel {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* ===== HIGHLIGHT CARDS ===== */
.highlights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.highlight-card {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--bg-panel);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.highlight-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

/* Coloured left-border accent strip */
.highlight-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 12px 0 0 12px;
}

.primary-gradient::before   { background: var(--accent-red); }
.secondary-gradient::before { background: var(--accent-blue); }
.green-gradient::before     { background: var(--accent-green); }

.icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.primary-gradient   .icon-circle { background: var(--accent-red-bg);   color: var(--accent-red); }
.secondary-gradient .icon-circle { background: #eef1ff;                 color: var(--accent-blue); }
.green-gradient     .icon-circle { background: var(--accent-green-bg);  color: var(--accent-green); }

.highlight-info { flex: 1; }

.highlight-info h3 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.primary-gradient   .highlight-info h3 { color: var(--accent-red); }
.secondary-gradient .highlight-info h3 { color: var(--accent-blue); }
.green-gradient     .highlight-info h3 { color: var(--accent-green); }

.highlight-info .value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
}

.highlight-info .unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: block;
}

/* ===== BREAKDOWN CARD ===== */
.breakdown-container {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
}

/* ===== COMPARISON BARS ===== */
.comparison-bars { margin-bottom: 1.5rem; }

.bar-group { margin-bottom: 1.25rem; }

.bar-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.bar-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.bar-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.bar-track {
    height: 10px;
    background: var(--bg-main);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.boiler-color { background: #94a3b8; }
.hp-color     { background: var(--accent-red); }   /* single deliberate red usage */

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border-top: 1px solid var(--glass-border);
    padding-top: 1.25rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 0.5rem;
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

/* Remove right border on even items, remove bottom border on last row */
.stat-box:nth-child(2n) { border-right: none; }
.stat-box:nth-last-child(-n+2) { border-bottom: none; }

.stat-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.green-text { color: var(--accent-green); }
.red-text   { color: var(--warn-red); }

/* ===== ANIMATIONS ===== */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

.value-update { animation: pulseValue 0.35s ease-out; }

@keyframes pulseValue {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.04); }
    100% { transform: scale(1); }
}
