/* POYA Public Dashboard */

:root {
    --bg: #f3f5f9;
    --card-bg: #fff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --green: #34c759;
    --red: #ff3b30;
    --blue: #007aff;
    --amber: #ff9500;
    --border: #e5e5e7;
    --surface: rgba(255, 255, 255, 0.82);
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
    --radius: 22px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(0, 122, 255, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(52, 199, 89, 0.10), transparent 24%),
        linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

.hero {
    max-width: 1180px;
    margin: 0 auto;
    padding: 3rem 1.5rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.hero-kicker {
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin-bottom: 0.65rem;
}

.hero-note {
    max-width: 42rem;
    color: var(--muted);
    font-size: 0.98rem;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 0.85rem;
}

.meta-card {
    min-width: 180px;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.meta-label {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    margin-bottom: 0.35rem;
}

.meta-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.toolbar {
    padding: 1.25rem;
    margin-bottom: 1.2rem;
}

.toolbar-row,
.toolbar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.toolbar-controls {
    margin-top: 1rem;
    justify-content: flex-start;
}

.toolbar-controls label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.range-presets {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 122, 255, 0.12);
    border-radius: 999px;
    padding: 0.5rem 0.95rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn-preset:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 122, 255, 0.28);
}

.btn-preset.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.toolbar input {
    width: 148px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 0.78rem 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 0.82rem 1.1rem;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 12px 24px rgba(0, 122, 255, 0.18);
}

.status-chip {
    border-radius: 999px;
    padding: 0.45rem 0.78rem;
    background: rgba(52, 199, 89, 0.12);
    color: #1f7a36;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-chip.loading {
    background: rgba(255, 149, 0, 0.12);
    color: #a85c00;
}

.range-label {
    margin-top: 0.9rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.error-banner {
    margin-top: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 59, 48, 0.08);
    color: #ad241b;
    font-size: 0.92rem;
}

.card-grid-3,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.metric-card {
    padding: 1.3rem;
}

.metric-label {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.metric-value {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--green);
    margin: 0.65rem 0 0.4rem;
    font-variant-numeric: tabular-nums;
}

.metric-caption {
    color: var(--muted);
    font-size: 0.8rem;
}

.metric-yoy {
    margin-top: 0.85rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.metric-yoy.up { color: var(--green); }
.metric-yoy.down { color: var(--red); }
.metric-yoy.flat { color: var(--blue); }
.metric-yoy.zero { color: var(--amber); }
.metric-yoy.muted { color: var(--muted); }

.section-card {
    padding: 1.3rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.section-head h2,
.section-head h3 {
    font-size: 1rem;
    font-weight: 700;
}

.section-head p {
    color: var(--muted);
    font-size: 0.78rem;
}

.table-rows {
    display: grid;
    gap: 0.65rem;
}

.row {
    display: grid;
    grid-template-columns: 72px 1fr 1fr 72px;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.row.compact {
    grid-template-columns: 72px 1fr;
}

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

.group-name {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.num {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.num.green { color: #1f7a36; }
.num.red { color: var(--red); }
.num.muted { color: var(--muted); }

.legend {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.76rem;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.blue { background: var(--blue); }
.dot.amber { background: var(--amber); }

.chart-card {
    padding: 1.3rem;
}

.chart-shell {
    position: relative;
    height: 360px;
}

.footer {
    text-align: center;
    padding: 0 1.5rem 2rem;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 980px) {
    .hero-meta,
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero {
        padding-top: 2rem;
    }

    .toolbar-controls {
        align-items: stretch;
    }

    .toolbar-controls label,
    .toolbar input,
    .btn-primary {
        width: 100%;
    }

    .card-grid-3 { grid-template-columns: 1fr; }

    .row,
    .row.compact {
        grid-template-columns: 64px 1fr 1fr 64px;
        font-size: 0.84rem;
    }

    .row.compact {
        grid-template-columns: 64px 1fr;
    }

    .chart-shell {
        height: 300px;
    }
}

@media (max-width: 520px) {
    .page,
    .hero,
    .footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero-meta {
        width: 100%;
        grid-template-columns: 1fr;
    }
}
