:root {
    --background: #eef2f7;
    --surface: #ffffff;
    --surface-muted: #f7f9fc;
    --border: #d7dee8;
    --text: #1f2937;
    --muted: #64748b;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --success: #047857;
    --warning-background: #fff7ed;
    --warning-border: #fdba74;
    --warning-text: #9a3412;
    --error-background: #fef2f2;
    --error-border: #fecaca;
    --error-text: #b91c1c;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

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

.site-header {
    padding: 32px 24px;
    background:
        linear-gradient(
            135deg,
            #0f172a 0%,
            #1e3a8a 100%
        );
    color: white;
}

.header-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 1450px;
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 7px;
    color: #bfdbfe;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.subtitle {
    max-width: 760px;
    margin: 12px 0 0;
    color: #dbeafe;
    line-height: 1.6;
}

.version-badge {
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.85rem;
    font-weight: 700;
}

.page-container {
    display: grid;
    grid-template-columns:
        minmax(380px, 0.95fr)
        minmax(460px, 1.3fr);
    gap: 24px;
    max-width: 1450px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h2 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

form {
    padding: 24px;
}

.form-section {
    margin-bottom: 28px;
}

.form-section h3 {
    margin: 0 0 14px;
    color: #334155;
    font-size: 0.98rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: white;
    color: #0f172a;
    font: inherit;
    font-weight: 500;
}

input:focus,
select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(29, 78, 216, 0.14);
}

.input-with-unit {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
}

.input-with-unit input {
    border-radius: 9px 0 0 9px;
}

.input-with-unit span {
    display: flex;
    min-width: 54px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-left: 0;
    border-radius: 0 9px 9px 0;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.82rem;
}

.advanced-options {
    margin: 4px 0 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
}

.advanced-options summary {
    padding: 15px 17px;
    cursor: pointer;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 700;
}

.advanced-content {
    margin: 0;
    padding: 4px 17px 18px;
}

.form-actions {
    display: flex;
    gap: 12px;
}

button {
    min-height: 45px;
    padding: 10px 18px;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}

.primary-button {
    flex: 1;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
}

.primary-button:hover {
    background: var(--primary-hover);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.secondary-button {
    border: 1px solid #cbd5e1;
    background: white;
    color: #334155;
}

.results-panel {
    min-height: 600px;
}

.quality-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 24px;
}

.quality-card {
    padding: 18px;
    border: 1px solid #bfdbfe;
    border-radius: 13px;
    background: #eff6ff;
}

.quality-card span {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 0.82rem;
}

.quality-card strong {
    color: #1e3a8a;
    font-size: 1.55rem;
}

.result-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0 24px 24px;
}

.result-group {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-muted);
}

.result-group h3 {
    margin: 0 0 14px;
    color: #1e3a8a;
    font-size: 1rem;
}

dl {
    margin: 0;
}

dl div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px dashed #d8dee8;
}

dl div:last-child {
    border-bottom: 0;
}

dt {
    color: var(--muted);
    font-size: 0.84rem;
}

dd {
    margin: 0;
    color: #0f172a;
    font-size: 0.87rem;
    font-weight: 750;
    text-align: right;
}

.warning-box {
    margin: 0 24px 24px;
    padding: 15px 17px;
    border: 1px solid var(--warning-border);
    border-radius: 11px;
    background: var(--warning-background);
    color: var(--warning-text);
    font-size: 0.87rem;
    line-height: 1.5;
}

.error-message {
    margin: 24px;
    padding: 15px 17px;
    border: 1px solid var(--error-border);
    border-radius: 11px;
    background: var(--error-background);
    color: var(--error-text);
    line-height: 1.5;
}

.hidden {
    display: none;
}

footer {
    padding: 0 24px 36px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

@media (max-width: 1050px) {
    .page-container {
        grid-template-columns: 1fr;
    }

    .results-panel {
        min-height: auto;
    }
}

@media (max-width: 660px) {
    .site-header {
        padding: 25px 18px;
    }

    .header-content {
        flex-direction: column;
    }

    .page-container {
        padding: 18px 12px 35px;
    }

    .form-grid,
    .quality-summary,
    .result-groups {
        grid-template-columns: 1fr;
    }

    form,
    .panel-heading {
        padding: 18px;
    }

    .quality-summary {
        padding: 18px;
    }

    .result-groups {
        padding: 0 18px 18px;
    }

    .warning-box {
        margin: 0 18px 18px;
    }

    .form-actions {
        flex-direction: column;
    }
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title-row h3 {
    margin: 0;
}

.small-button {
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 750;
}

.small-button:hover {
    background: #dbeafe;
}

.small-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.locator-row {
    margin-bottom: 15px;
}

.locator-control {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
}

.locator-control input {
    text-transform: uppercase;
    border-radius: 9px 0 0 9px;
}

.locator-button {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #1d4ed8;
    border-radius: 0 9px 9px 0;
    background: #1d4ed8;
    color: white;
    font-size: 0.82rem;
}

.locator-button:hover {
    background: #1e40af;
}

.field-help {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.4;
}

.field-success {
    color: #047857;
}

.field-error {
    color: #b91c1c;
}

@media (max-width: 660px) {
    .section-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .small-button {
        width: 100%;
    }
}
