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

/* Style color variables */
:root {
    --color-bg: #f0f2f8;
    --color-header: #164767;
    --color-header-assembly: #114d31;
    --color-header-pcba: #164767;
    --color-header-module: #4d235f;
    --color-text: #222;
    --color-text-muted: #888;
    --color-error: #c0392b;
    --color-success: #1a7f4e;
}

body {
    font-family: system-ui, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

/* ── Header ── */
header {
    background: var(--color-header);
    color: #fff;
    padding: 1.25rem 2rem;
}

header h1 { font-size: 1.5rem; font-weight: 700; }

.header-sub {
    font-size: 0.85rem;
    color: #9ca8d4;
    margin-top: 0.2rem;
}

/* ── Main layout ── */
main {
    padding: 1rem;
    max-width: 1100px;
    margin: 0 auto;
}

#yield-data {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    align-items: start;
}

/* ── Product card ── */
.product-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    overflow: hidden;
}

.card-header {
    background: var(--color-header);
    color: #fff;
    padding: 0.65rem 1rem;
}

.card-header.product-group-assembly { background: var(--color-header-assembly); }
.card-header.product-group-pcba     { background: var(--color-header-pcba); }
.card-header.product-group-module   { background: var(--color-header-module); }

.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.product-meta {
    font-size: 0.78rem;
    color: #9ca8d4;
    margin-top: 0.2rem;
    display: block;
}

/* ── Period grid (4 columns) ── */
.period-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.period-cell {
    padding: 0.6rem 0.9rem;
    border-right: 1px solid #eef0f8;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.period-cell:last-child { border-right: none; }

.period-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #888;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #eef0f8;
}

/* ── Individual stat row ── */
.stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.78rem;
    color: #888;
    flex-shrink: 0;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.stat-value.yield.green { color: #1a7f4e; }
.stat-value.yield.red   { color: #c0392b; }

/* ── Empty / loading / error ── */
.no-data {
    font-size: 0.8rem;
    color: #bbb;
    margin-top: 0.25rem;
}

.loading, .error, .empty {
    padding: 3rem;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}
.error { color: #c0392b; }

/* ── Responsive ── */
@media (max-width: 700px) {
    #yield-data { grid-template-columns: 1fr; }
    main { padding: 0.5rem; }
}
}
