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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.subtitle {
    color: #718096;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.55;
}

.top-nav {
    margin-bottom: 20px;
}

.top-nav a {
    color: #2b6cb0;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.top-nav a:hover {
    text-decoration: underline;
}

.home-container {
    max-width: 920px;
}

.calc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 28px;
}

.calc-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
    padding: 22px;
    color: inherit;
    text-decoration: none;
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.calc-card:hover {
    transform: translateY(-2px);
    border-color: #90cdf4;
    box-shadow: 0 10px 26px rgba(49,130,206,0.14);
}

.calc-card__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    background: #ebf8ff;
    border-radius: 14px;
    font-size: 28px;
}

.calc-card__content {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.calc-card__title {
    color: #1a202c;
    font-size: 18px;
    font-weight: 700;
}

.calc-card__description {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

.calc-card__meta {
    color: #718096;
    font-size: 12px;
    line-height: 1.45;
}

.calc-card__arrow {
    color: #3182ce;
    font-size: 26px;
    font-weight: 700;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.form-row {
    width: 100%;
}

.form-row--settings {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.form-row--actions {
    display: flex;
    justify-content: flex-start;
}

.search-group {
    width: 100%;
}

.autocomplete-wrapper {
    position: relative;
}

.search-group label,
.range-group label,
.options-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66,153,225,0.15);
}

.range-group {
    display: flex;
    gap: 12px;
    flex: 0 1 360px;
    min-width: 260px;
}

.range-group label {
    flex: 1;
}

.options-group {
    flex: 1 1 360px;
    min-width: 280px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px !important;
    cursor: pointer;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: #4299e1;
}

.hint {
    color: #718096;
    font-size: 12px;
    line-height: 1.4;
}

button {
    padding: 10px 28px;
    background: #4299e1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    height: 42px;
}

button:hover:not(:disabled) {
    background: #3182ce;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.suggestions.active {
    display: block;
}

.suggestions li {
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    border-bottom: 1px solid #f7fafc;
}

.suggestions li:hover {
    background: #ebf8ff;
}

.suggestions li .country {
    color: #a0aec0;
    font-size: 12px;
    margin-left: 8px;
}

.selected-station {
    margin-top: 8px;
    padding: 8px 12px;
    background: #ebf8ff;
    border-radius: 8px;
    font-size: 14px;
    color: #2b6cb0;
    display: none;
}

.selected-station.active {
    display: block;
}

.station-map-card {
    margin-top: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.station-map-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.station-map-title {
    color: #2d3748;
    font-size: 14px;
    font-weight: 700;
}

.station-map-hint {
    margin-top: 3px;
    color: #718096;
    font-size: 12px;
    line-height: 1.35;
}

.station-map-status {
    flex: 0 0 auto;
    max-width: 220px;
    padding: 5px 9px;
    color: #2b6cb0;
    background: #ebf8ff;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.25;
    text-align: right;
}

.station-map {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 420px;
    background: #e2e8f0;
}

.station-map .leaflet-control-attribution {
    font-size: 10px;
}

.popular-stations {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: #718096;
    font-size: 13px;
    line-height: 1.4;
}

.station-chip {
    height: auto;
    padding: 6px 12px;
    background: #edf2f7;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 13px;
}

.station-chip:hover:not(:disabled) {
    background: #e6fffa;
    color: #2c7a7b;
    border-color: #81e6d9;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #718096;
    font-size: 15px;
}

.error {
    padding: 14px;
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 8px;
    color: #c53030;
    margin-bottom: 16px;
    font-size: 14px;
}

.warnings {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fbd38d;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #7b341e;
}

.warnings li {
    margin-left: 1.2em;
    margin-bottom: 4px;
}

.warnings li:last-child {
    margin-bottom: 0;
}

.chart-card {
    background: #fafcff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
}

#results-chart {
    display: block;
    width: 100%;
    height: auto;
    max-width: 1000px;
}

.hidden {
    display: none;
}

.results-container {
    margin-top: 8px;
}

#results-title {
    font-size: 20px;
    margin-bottom: 8px;
}

.data-info {
    margin-bottom: 16px;
    color: #718096;
    font-size: 13px;
    line-height: 1.5;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th:first-child, td:first-child,
th:nth-child(4), td:nth-child(4) {
    text-align: left;
}

tbody tr:hover {
    background: #f7fafc;
}

.result-row-skipped {
    background: #fffaf0;
    color: #975a16;
}

.result-row-skipped td {
    border-bottom-color: #fbd38d;
}

.result-skip-message {
    text-align: left;
    font-weight: 600;
    white-space: normal;
}

.result-row-skipped:hover {
    background: #feebc8;
}

.averages {
    margin-top: 16px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.averages span {
    font-weight: 600;
    color: #2b6cb0;
}

.grape-varieties {
    margin-top: 18px;
    padding: 18px;
    background: linear-gradient(135deg, #fffaf0 0%, #fff5f5 100%);
    border: 1px solid #fbd38d;
    border-radius: 10px;
}

.grape-varieties__header {
    margin-bottom: 14px;
}

.grape-varieties__header h3 {
    margin-bottom: 5px;
    color: #2d3748;
    font-size: 18px;
}

.grape-varieties__header p,
.grape-varieties__footnote {
    color: #744210;
    font-size: 13px;
    line-height: 1.45;
}

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

.grape-variety-card {
    padding: 14px;
    background: #ffffff;
    border: 1px solid #f6ad55;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(221, 107, 32, 0.08);
}

.grape-variety-card--nearest {
    border-color: #cbd5e0;
}

.grape-variety-card__top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.grape-variety-card__top strong {
    color: #1a202c;
    font-size: 15px;
}

.grape-variety-card__top span {
    flex: 0 0 auto;
    padding: 3px 8px;
    color: #975a16;
    background: #feebc8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.grape-variety-card__range {
    margin-bottom: 6px;
    color: #2b6cb0;
    font-size: 13px;
    font-weight: 700;
}

.grape-variety-card__note {
    color: #4a5568;
    font-size: 13px;
    line-height: 1.4;
}

.grape-varieties__footnote {
    margin-top: 12px;
}

@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 20px;
    }

    .form-row--settings {
        flex-direction: column;
    }

    .range-group {
        flex-direction: column;
        min-width: 100%;
    }

    .options-group {
        min-width: 100%;
    }

    button {
        width: 100%;
    }

    .station-chip {
        width: auto;
    }

    .calc-card {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 18px;
    }

    .calc-card__arrow {
        display: none;
    }

    th, td {
        padding: 9px 10px;
        font-size: 13px;
    }
}
