:root {
    --background: #eef3f9;
    --surface: #ffffff;
    --border: #d9e2ee;
    --text: #162236;
    --muted: #64748b;
    --primary: #1769e0;
    --primary-dark: #0f50b4;
    --success: #0b7d55;
    --success-soft: #e8f7f1;
    --danger: #a92f2f;
    --danger-soft: #ffeded;
    --shadow: 0 24px 70px rgba(25, 45, 72, 0.12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 9% 5%, rgba(23, 105, 224, 0.13), transparent 32%),
        radial-gradient(circle at 92% 90%, rgba(11, 125, 85, 0.1), transparent 30%),
        var(--background);
}

button,
input,
select,
textarea {
    font: inherit;
}

.installer-shell {
    width: min(1050px, calc(100% - 30px));
    margin: 0 auto;
    padding: 38px 0 70px;
}

.installer-card {
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid var(--border);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.installer-header {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 30px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.installer-logo {
    width: 78px;
    height: 78px;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.16em;
}

h1 {
    margin: 5px 0 5px;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -0.045em;
}

h2 {
    letter-spacing: -0.025em;
}

.lead,
.installer-header p:last-child,
.manual-config p,
.security-note {
    color: var(--muted);
}

.lead {
    margin: 0;
}

.notice {
    display: grid;
    gap: 5px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border-radius: 14px;
}

.notice.success {
    border: 1px solid #b9e5d4;
    background: var(--success-soft);
    color: var(--success);
}

.notice.error {
    border: 1px solid #efc0c0;
    background: var(--danger-soft);
    color: var(--danger);
}

.notice strong {
    font-size: 1rem;
}

.notice span {
    font-size: 0.88rem;
}

.installer-form {
    display: grid;
    gap: 22px;
}

fieldset {
    margin: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fbfcfe;
}

legend {
    padding: 0 10px;
    color: #334155;
    font-weight: 850;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 7px;
}

label > span {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c7d3e2;
    border-radius: 11px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input,
select {
    min-height: 47px;
    padding: 0 13px;
}

textarea {
    padding: 14px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.78rem;
    line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(23, 105, 224, 0.12);
}

small {
    color: var(--muted);
    font-size: 0.76rem;
}

.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    margin-top: 16px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
}

.checkbox-row input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.checkbox-row span {
    font-weight: 600;
}

.primary-button {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(23, 105, 224, 0.22);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

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

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 24px;
}

.summary-grid div {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcfe;
}

.summary-grid span,
.summary-grid strong {
    display: block;
}

.summary-grid span {
    color: var(--muted);
    font-size: 0.73rem;
}

.summary-grid strong {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.manual-config {
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid #efc0c0;
    border-radius: 16px;
    background: #fffafa;
}

.manual-config h2,
.manual-config p {
    margin-top: 0;
}

.security-note {
    margin: 10px 0 0 !important;
    font-size: 0.8rem;
}

@media (max-width: 760px) {
    .installer-shell {
        width: min(100% - 18px, 1050px);
        padding-top: 10px;
    }

    .installer-card {
        border-radius: 18px;
    }

    .installer-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .two-columns,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    fieldset {
        padding: 17px;
    }
}

.environment-section {
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #f8fafc;
}

.environment-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 15px;
}

.environment-heading h2,
.environment-heading p {
    margin: 0;
}

.environment-heading p {
    color: var(--muted);
    font-size: 0.84rem;
}

.environment-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.environment-item {
    display: grid;
    gap: 4px;
    min-height: 112px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
}

.environment-item > span {
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.environment-item > strong {
    font-size: 0.94rem;
}

.environment-item.ok {
    border-color: #b9e5d4;
    background: var(--success-soft);
}

.environment-item.warning {
    border-color: #ecd7a2;
    background: #fff8e7;
}

.environment-item.error {
    border-color: #efc0c0;
    background: var(--danger-soft);
}

.panel-address {
    display: grid;
    gap: 8px;
    margin: 18px 0 24px;
    padding: 17px;
    border: 1px solid #b9e5d4;
    border-radius: 14px;
    background: var(--success-soft);
}

.panel-address > span {
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 800;
}

.panel-address input {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .environment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .environment-heading {
        align-items: flex-start;
        flex-direction: column;
    }

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