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

:root {
    --bg-1: #f5f6f2;
    --bg-2: #eceee7;
    --text-main: #172017;
    --text-muted: #566057;
    --surface: #fdfdfb;
    --surface-soft: #f4f7f1;
    --border: #d7ddd2;
    --accent: #2a7a51;
    --accent-soft: #d9efe1;
    --danger: #b04c41;
    --warning: #a37624;
}

body {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 15% 15%, rgba(42, 122, 81, 0.12), transparent 38%),
        radial-gradient(circle at 85% 0%, rgba(104, 132, 117, 0.1), transparent 40%),
        linear-gradient(150deg, var(--bg-1), var(--bg-2));
    min-height: 100vh;
    padding: 28px 16px 40px;
}

.app {
    width: min(1040px, 100%);
    margin: 0 auto;
}

.intro {
    margin-bottom: 22px;
    animation: liftIn 0.55s ease;
}

.kicker {
    margin-bottom: 10px;
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.intro h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(2rem, 6vw, 3rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.subtitle {
    max-width: 72ch;
    color: var(--text-muted);
    font-size: 0.97rem;
}

.status-strip {
    background: rgba(253, 253, 251, 0.82);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 26px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 7px rgba(42, 122, 81, 0.14);
    animation: breathe 2.4s ease-in-out infinite;
}

.status-strip strong {
    color: var(--text-main);
    font-weight: 700;
}

.parkings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.parking-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    position: relative;
    overflow: hidden;
    animation: liftIn 0.45s ease;
}

.parking-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 16px 0 0 16px;
    background: var(--accent);
}

.parking-card:hover {
    transform: translateY(-3px);
    border-color: #bbc8b9;
    box-shadow: 0 12px 20px rgba(23, 32, 23, 0.08);
}

.parking-card.full::before {
    background: var(--danger);
}

.parking-card.moderate::before {
    background: var(--warning);
}

.parking-card.available::before {
    background: var(--accent);
}

.parking-card.error::before {
    background: #727d72;
}

.parking-header {
    margin-bottom: 14px;
}

.parking-name {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.status-badge.available {
    background: var(--accent-soft);
    color: #1f5f3e;
}

.status-badge.moderate {
    background: #f4e9cc;
    color: #7a5514;
}

.status-badge.full {
    background: #f3ddd8;
    color: #83352e;
}

.status-badge.error {
    background: #e7ebe5;
    color: #405145;
}

.capacity-bar {
    margin: 16px 0;
}

.capacity-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.87rem;
    color: var(--text-muted);
}

.capacity-label strong {
    font-weight: 700;
    color: var(--text-main);
}

.progress-bar {
    width: 100%;
    height: 9px;
    background: #e8eee4;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.35s ease;
    border-radius: 999px;
}

.parking-card.full .progress-fill {
    background: var(--danger);
}

.parking-card.moderate .progress-fill {
    background: var(--warning);
}

.parking-card.available .progress-fill {
    background: var(--accent);
}

.parking-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0;
}

.stat-item {
    background: var(--surface-soft);
    border: 1px solid #e3e9df;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.stat-number {
    font-size: 1.45rem;
    font-weight: 700;
    color: #1f5f3e;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.parking-card.full .stat-number {
    color: var(--danger);
}

.parking-card.moderate .stat-number {
    color: var(--warning);
}

.parking-card.available .stat-number {
    color: var(--accent);
}

.parking-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e4eadf;
}

.parking-warning {
    display: block;
    margin-top: 8px;
    min-height: 1.4rem;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.parking-warning.active {
    border: 1px solid #eed8bd;
    background: #f8efe0;
    color: #755019;
    visibility: visible;
    opacity: 1;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    background: rgba(253, 253, 251, 0.8);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.error-message {
    grid-column: 1 / -1;
    background: #f6e8e5;
    color: #7f3028;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e6c8c2;
}

.history-panel {
    margin-top: 24px;
    background: rgba(253, 253, 251, 0.78);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    animation: liftIn 0.52s ease;
}

.history-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.history-head h2 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.35rem, 3.5vw, 1.8rem);
    font-weight: 700;
}

.history-head p {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.chart-card {
    border: 1px solid #dbe2d7;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(244, 248, 241, 0.95), rgba(252, 253, 250, 0.95));
    padding: 8px;
}

#historyChart {
    display: block;
    width: 100%;
    height: auto;
}

.history-legend {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.legend-item {
    border: 1px solid #d8dfd4;
    background: #fbfcf9;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-swatch {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-value {
    color: var(--text-main);
    font-weight: 700;
}

.history-note {
    margin-top: 12px;
    border-top: 1px solid #dfe6db;
    padding-top: 12px;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.comparison-panel {
    margin-top: 18px;
    background: rgba(253, 253, 251, 0.78);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    animation: liftIn 0.52s ease;
}

.comparison-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.comparison-head h2 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.2rem, 3.2vw, 1.6rem);
    font-weight: 700;
}

.comparison-head p {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.comparison-card {
    border: 1px solid #dde4d9;
    border-radius: 12px;
    background: #fbfcf9;
    padding: 12px;
}

.comparison-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.comparison-rows {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.comparison-row {
    border: 1px solid #e2e8df;
    border-radius: 10px;
    padding: 8px;
    background: #f7faf4;
}

.comparison-row strong {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.comparison-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.comparison-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.comparison-empty {
    color: var(--text-muted);
    font-size: 0.84rem;
}

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

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.18);
    }
}

.refreshing {
    opacity: 0.72;
}

@media (max-width: 768px) {
    body {
        padding-top: 18px;
    }

    .status-strip {
        border-radius: 16px;
    }

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

    .history-panel {
        padding: 14px;
    }

    .comparison-panel {
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .intro h1 {
        font-size: 1.9rem;
    }

    .parking-card {
        padding: 14px;
    }

    .parking-name {
        font-size: 1.35rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }
}
