
:root {
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --border: #e3e9f2;
    --text: #172033;
    --muted: #6b778c;
    --primary: #2563eb;
    --primary-soft: #eaf2ff;
    --teal: #0f9f8f;
    --teal-soft: #e8f7f4;
    --danger: #dc3545;
    --danger-soft: #fff0f2;
    --warn: #b26a00;
    --warn-soft: #fff2df;
    --shadow: 0 8px 24px rgba(31, 45, 61, .07);
    --radius: 10px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a { color: inherit; }

.page {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 14px 0 24px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 56px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(31, 45, 61, .04);
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: linear-gradient(135deg, #1e6ce6, #0f9f8f);
    color: white;
    font-size: .82rem;
    font-weight: 900;
    letter-spacing: .04em;
}

.app-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.app-subtitle {
    margin-top: 1px;
    color: var(--muted);
    font-size: .84rem;
}

.app-header__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
    white-space: nowrap;
}

.meta-pill--warn {
    border-color: #f1dfb6;
    background: var(--warn-soft);
    color: var(--warn);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #20b26b;
    box-shadow: 0 0 0 3px rgba(32, 178, 107, .12);
}

.page-heading {
    padding: 18px 4px 14px;
}

.page-kicker {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
}

h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2.6vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: -.03em;
    font-weight: 800;
}

.lead {
    max-width: 820px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.dashboard-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.finder-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 12px;
    width: min(1180px, 100%);
    margin: 12px auto 0;
}

.finder-grid .dashboard-card {
    margin-top: 0;
}

.card-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.card-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
    font-weight: 800;
}

.card-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .86rem;
}

.card-heading__text {
    flex: 1 1 auto;
    min-width: 0;
}

summary {
    cursor: pointer;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

.accordion > summary.card-heading {
    margin-bottom: 0;
}

.accordion[open] > summary.card-heading {
    margin-bottom: 12px;
}

.accordion-caret {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.accordion-caret::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform .15s ease;
}

.accordion[open] > summary .accordion-caret::before {
    transform: rotate(-135deg);
    margin-top: 2px;
}

.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    font-size: .88rem;
    font-weight: 700;
}

.actions-accordion .accordion-toggle {
    padding-top: 2px;
}

.actions-accordion[open] .accordion-toggle {
    margin-bottom: 12px;
}

.card-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 8px;
    font-size: .92rem;
    font-weight: 900;
}

.card-icon--blue {
    background: var(--primary-soft);
    color: var(--primary);
}

.card-icon--teal {
    background: var(--teal-soft);
    color: var(--teal);
}

label {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: .83rem;
    font-weight: 700;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 10px 13px;
    border: 1px solid #dce3ed;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus {
    border-color: #8fb3ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

button,
.button,
.region-link {
    appearance: none;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    transition: .15s ease;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 15px;
}

button,
.button.primary {
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

button:hover,
.button.primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.button.secondary {
    border: 1px solid #d8e0eb;
    background: #fff;
    color: #344054;
}

.button.secondary:hover {
    border-color: #b9c6d8;
    background: #f8fafc;
}

.button.disabled {
    border: 1px solid #e0e5ec;
    background: #f2f4f7;
    color: #98a2b3;
}

.hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .8rem;
}

.result-panel,
.message-panel {
    width: min(1180px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.small-label {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.result-panel h2 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: -.025em;
}

.result-panel p {
    color: var(--muted);
}

.region-number {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 900;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 12px;
}

.notice {
    margin-top: 12px;
    padding: 10px 13px;
    border: 1px solid #f1dfb6;
    border-radius: 8px;
    background: #fff8e9;
    color: #855e13;
    font-size: .84rem;
}

.message-panel.error {
    border-color: #f0c7ce;
    background: var(--danger-soft);
    color: #9b2737;
}

.region-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.region-link {
    display: block;
    padding: 11px 6px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: #344054;
    font-size: .85rem;
    text-align: center;
}

.region-link:hover {
    border-color: #b9c9e4;
    background: #f0f5ff;
    color: var(--primary);
}

.region-link.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.calendar-stage {
    width: 100%;
    padding: 14px;
}

.calendar-stage__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.calendar-stage[open] .calendar-stage__head {
    margin-bottom: 12px;
}

.calendar-heading {
    margin-bottom: 0;
}

.region-pill {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
}

.calendar-frame-wrap {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.calendar-frame {
    display: block;
    width: 100%;
    height: 620px;
    border: 0;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
    padding: 12px 4px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .78rem;
}

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

    .calendar-frame {
        height: 560px;
    }
}

@media (max-width: 720px) {
    .page {
        width: min(100% - 18px, 1480px);
        padding-top: 9px;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .app-header__meta {
        width: 100%;
        justify-content: center;
    }

    .page-heading {
        padding-top: 18px;
    }

    h1 {
        font-size: 1.7rem;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .region-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .region-link:last-child {
        grid-column: 1 / -1;
    }

    .calendar-stage__head {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-frame {
        height: 460px;
    }

    .app-footer {
        flex-direction: column;
    }
}
