/* Calculator UI: uses public/design-system.css tokens */
body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255,255,255,.9), rgba(245,247,250,.95) 40%, #eef1f6 100%);
    color: var(--ink);
    margin: 0;
    padding: 34px 14px 36px;
}

.wrap {
    position: relative;
    width: min(100%, 980px);
    margin: 0 auto;
    animation: tizion-rise-in var(--ease-long) both;
}

.wrap::before {
    content: "";
    display: none;
    position: absolute;
    top: 86px;
    right: -88px;
    width: 220px;
    height: 80px;
    border: 1px solid rgba(213, 32, 42, .18);
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(213, 32, 42, .72) 0 12%, transparent 12% 100%),
        repeating-linear-gradient(90deg, rgba(23, 24, 28, .13) 0 24px, transparent 24px 48px),
        rgba(255, 255, 255, .62);
    box-shadow: 0 22px 54px rgba(16, 24, 40, .08);
    opacity: .38;
    transform: rotate(-6deg);
    animation: tizion-panel-drift 9s ease-in-out infinite;
    pointer-events: none;
}

header.page {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,241,242,.8) 44%, rgba(255,255,255,.9));
    color: var(--ink);
    padding: 22px 28px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    backdrop-filter: blur(16px);
}

header.page::before {
    content: "";
    display: none;
    position: absolute;
    right: 255px;
    top: 15px;
    width: 180px;
    height: 48px;
    border: 1px solid rgba(213, 32, 42, .18);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.92), rgba(249,250,251,.68)),
        repeating-linear-gradient(90deg, rgba(213, 32, 42, .18) 0 18px, transparent 18px 32px);
    box-shadow: 0 16px 36px rgba(16, 24, 40, .08);
    opacity: .58;
    transform: rotate(2deg);
    animation: tizion-float 8s ease-in-out infinite;
}

header.page::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-deep), var(--brand), #ef6b73);
    z-index: 2;
    box-shadow: var(--red-glow);
}

header.page .brand {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-height: 64px;
}

header.page .brand img.brand-img {
    height: 64px;
    width: auto;
    display: block;
    filter: drop-shadow(0 10px 18px rgba(213, 32, 42, .1));
}

header.page .contacts {
    position: relative;
    z-index: 1;
    flex: 1 1 520px;
    min-width: 0;
}

header.page .contact-nav {
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}

header.page .contact-link {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 132px;
    min-height: 52px;
    padding: 8px 14px 9px;
    color: var(--ink-soft);
    text-decoration: none;
    text-align: left;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(228, 231, 236, .9);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

header.page .contact-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: rgba(213, 32, 42, .34);
    transition: background .18s ease;
}

header.page .contact-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .92);
    border-color: rgba(213, 32, 42, .34);
    box-shadow: 0 14px 30px rgba(16, 24, 40, .1);
}

header.page .contact-link:hover::before,
header.page .contact-phone::before {
    background: var(--brand);
}

header.page .contact-phone {
    min-width: 178px;
    border-color: rgba(213, 32, 42, .2);
}

header.page .contact-label {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 1.1;
}

header.page .contact-value {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

header.page .contact-phone .contact-value {
    color: var(--brand-deep);
    font-size: 15px;
}

main {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .88);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px 30px 20px;
    backdrop-filter: blur(18px);
}

main::before,
main::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

main::before {
    display: none;
    top: 24px;
    right: -86px;
    width: 338px;
    height: 188px;
    border: 1px solid rgba(23, 24, 28, .09);
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(213,32,42,.78) 0 18px, transparent 18px),
        linear-gradient(180deg, rgba(23,24,28,.08) 0 34px, transparent 34px),
        repeating-linear-gradient(180deg, transparent 0 42px, rgba(23, 24, 28, .08) 42px 43px, transparent 43px 72px),
        linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,241,242,.66));
    box-shadow: 0 24px 62px rgba(16, 24, 40, .1);
    opacity: .46;
    transform: rotate(-3deg);
    animation: tizion-panel-drift 10s ease-in-out infinite;
}

main::after {
    display: none;
    top: 128px;
    right: 42px;
    width: 184px;
    height: 42px;
    border: 1px solid rgba(213, 32, 42, .18);
    border-radius: 999px;
    background:
        linear-gradient(90deg, var(--brand), #ef6b73 46%, rgba(255,255,255,.82) 46% 100%);
    box-shadow: var(--red-glow);
    opacity: .28;
    animation: tizion-float 7s ease-in-out infinite reverse;
}

main > * {
    position: relative;
    z-index: 1;
}

h1 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.12;
    margin: 0 0 8px;
    letter-spacing: 0;
    color: var(--ink);
    max-width: 720px;
}

.subtitle {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
    max-width: 720px;
    margin-bottom: 24px;
}

.calc-line {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .48);
    transition: background var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

#calc_form:has(.custom-select.open),
#engineering:has(.custom-select.open) {
    z-index: 60;
}

.calc-line:has(.custom-select.open) {
    z-index: 70;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 14px 34px rgba(16, 24, 40, .08);
}

.calc-line:hover {
    background: rgba(255, 255, 255, .9);
    border-color: #d9dee7;
    box-shadow: 0 10px 28px rgba(16, 24, 40, .06);
    transform: translateX(2px);
}

.calc-line label {
    flex: 1 1 56%;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink-soft);
}

.calc-line select {
    flex: 0 0 40%;
    max-width: 40%;
    min-height: 38px;
    padding: 8px 36px 8px 10px;
    font-size: 14px;
    background-color: var(--panel);
    box-shadow: var(--shadow-xs);
}

.calc-line select.native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    max-width: none;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.custom-select {
    position: relative;
    flex: 0 0 40%;
    max-width: 40%;
    z-index: 1;
}

.custom-select.open {
    z-index: 120;
}

.custom-select__button {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 11px;
    color: var(--ink);
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    text-align: left;
}

.custom-select__button:hover {
    border-color: #b8c0cc;
    box-shadow: 0 8px 18px rgba(16, 24, 40, .08);
}

.custom-select.open .custom-select__button,
.custom-select__button:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(213, 32, 42, .12), var(--shadow-sm);
}

.custom-select__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select__arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    color: var(--ink-soft);
    transition: transform var(--ease), color var(--ease);
}

.custom-select.open .custom-select__arrow {
    color: var(--brand);
    transform: rotate(180deg);
}

.custom-select__menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 400;
    max-height: 280px;
    overflow: auto;
    padding: 7px;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    box-shadow: 0 22px 56px rgba(16, 24, 40, .16);
    animation: tizion-pop 150ms ease-out both;
}

.custom-select__menu::-webkit-scrollbar {
    width: 10px;
}

.custom-select__menu::-webkit-scrollbar-track {
    background: #f3f5f8;
    border-radius: 999px;
}

.custom-select__menu::-webkit-scrollbar-thumb {
    background: #a8afba;
    border: 2px solid #f3f5f8;
    border-radius: 999px;
}

.custom-select__menu::-webkit-scrollbar-thumb:hover {
    background: var(--brand);
}

.custom-select__option {
    width: 100%;
    min-height: 36px;
    padding: 8px 11px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
}

.custom-select__option:hover,
.custom-select__option:focus {
    outline: 0;
    background: #f5f6f8;
    color: var(--brand-strong);
    transform: none;
}

.custom-select__option.is-selected {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 800;
    box-shadow: inset 3px 0 0 var(--brand);
}

.custom-select__option.is-selected:hover,
.custom-select__option.is-selected:focus {
    background: var(--brand-tint);
    color: var(--brand-deep);
}

.version-note {
    display: none;
    background: var(--brand-soft);
    border: 1px solid var(--brand-tint);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    color: var(--brand-deep);
    padding: 12px 14px;
    margin: 12px 0;
    box-shadow: 0 12px 26px rgba(213, 32, 42, .08);
}

#toggle_engineering {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    color: var(--brand);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid rgba(213, 32, 42, .32);
    transition: color var(--ease), border-color var(--ease);
}

#toggle_engineering::after {
    content: "›";
    font-size: 20px;
    line-height: 1;
    transition: transform var(--ease);
}

#toggle_engineering:hover {
    color: var(--brand-strong);
    border-color: var(--brand);
}

#toggle_engineering:hover::after {
    transform: translateX(2px);
}

#engineering { display: none; }
#engineering.open { display: block; }

.hidden-block {
    display: none;
    margin: 8px 0 14px 24px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .68);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.hidden-block.open { display: block; }
.hidden-block .calc-line {
    padding: 8px 10px;
}
.hidden-block .calc-line label {
    font-size: 13px;
    color: var(--muted);
}

.lead-panel {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 14px 34px rgba(16, 24, 40, .07);
    backdrop-filter: blur(14px);
}

.lead-panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.lead-panel h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: 0;
}

.lead-panel__head span {
    color: var(--muted);
    font-size: 13px;
}

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

.lead-grid label {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 700;
}

.lead-grid input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .92);
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
    transition: border-color var(--ease), box-shadow var(--ease);
}

.lead-grid input:focus {
    outline: none;
    border-color: rgba(213, 32, 42, .62);
    box-shadow: 0 0 0 3px rgba(213, 32, 42, .12);
}

.lead-submit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 14px;
}

#lead_send {
    min-height: 42px;
    border: 1px solid rgba(213, 32, 42, .22);
    border-radius: var(--radius);
    background: #fff;
    color: var(--brand-strong);
    padding: 10px 18px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(16, 24, 40, .07);
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}

#lead_send:hover {
    transform: translateY(-1px);
    border-color: rgba(213, 32, 42, .48);
    box-shadow: 0 16px 32px rgba(213, 32, 42, .13);
}

#lead_status {
    min-height: 20px;
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

#lead_status.is-error {
    color: var(--brand-strong);
}

#lead_status.is-success {
    color: #247a4b;
    font-weight: 800;
}

.actions {
    text-align: center;
    margin-top: 16px;
    padding-top: 0;
}

#calc_button {
    position: relative;
    overflow: hidden;
    background: var(--brand);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    border: 0;
    border-radius: var(--radius);
    padding: 14px 34px;
    cursor: pointer;
    letter-spacing: 0;
    box-shadow: var(--red-glow);
    min-width: 260px;
}

#calc_button::before {
    content: "";
    position: absolute;
    inset: -40% auto -40% -55%;
    width: 48%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent);
    transform: skewX(-18deg);
}

#calc_button:hover::before {
    animation: tizion-shimmer 850ms ease-out;
}

#calc_button:hover {
    background: var(--brand-strong);
    box-shadow: 0 20px 42px rgba(213, 32, 42, .28);
}

#calc_error {
    color: var(--brand-strong);
    font-size: 14px;
    min-height: 20px;
    margin-top: 12px;
    text-align: center;
}

#calc_error:empty {
    min-height: 0;
    margin-top: 0;
}

footer {
    width: min(100%, 760px);
    margin: 16px auto 0;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.55;
    background: rgba(255, 255, 255, .78);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(16, 24, 40, .07);
    backdrop-filter: blur(12px);
}

footer .footer-line {
    display: block;
}

footer .footer-name {
    color: var(--ink);
    font-weight: 800;
}

footer .footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
}

footer a {
    color: var(--brand-strong);
    font-weight: 800;
    text-decoration: none;
    border-bottom: 1px solid rgba(213, 32, 42, .28);
    transition: color .18s ease, border-color .18s ease;
}

footer a:hover {
    color: var(--brand-deep);
    border-color: var(--brand);
}

@media (max-width: 900px) {
    header.page {
        align-items: flex-start;
    }

    header.page .contacts {
        flex-basis: 100%;
    }

    header.page .contact-nav {
        justify-content: stretch;
    }

    header.page .contact-link {
        flex: 1 1 160px;
    }
}

@media (max-width: 640px) {
    body { padding: 14px 10px; }
    .wrap::before,
    header.page::before,
    main::before,
    main::after { display: none; }
    header.page {
        justify-content: center;
        text-align: center;
        padding: 18px;
    }
    header.page .brand img.brand-img { height: 54px; }
    header.page .contacts { flex-basis: 100%; }
    header.page .contact-nav {
        gap: 8px;
        justify-content: center;
    }
    header.page .contact-link {
        align-items: center;
        flex-basis: 100%;
        min-width: 0;
        text-align: center;
    }
    header.page .contact-link::before {
        left: 12px;
        right: 12px;
        top: 0;
        bottom: auto;
        width: auto;
        height: 3px;
        border-radius: 0 0 999px 999px;
    }
    main { padding: 20px 14px 16px; }
    .calc-line { flex-direction: column; align-items: stretch; }
    .calc-line select { max-width: 100%; flex-basis: auto; }
    .custom-select { max-width: 100%; flex-basis: auto; }
    .custom-select__button,
    .lead-grid input,
    #lead_send {
        min-height: 44px;
        font-size: 16px;
    }
    #toggle_engineering {
        align-items: center;
        justify-content: center;
        min-height: 44px;
        margin: 16px 0;
        padding: 10px 0;
    }
    .hidden-block { margin-left: 0; }
    .lead-panel__head,
    .lead-submit {
        align-items: stretch;
        flex-direction: column;
    }
    .lead-grid {
        grid-template-columns: 1fr;
    }
    #lead_status {
        text-align: left;
    }
    #calc_button { width: 100%; min-width: 0; }
    footer a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}
