#forecast-app {
    --card: rgba(18, 18, 18, 0.88);
    --line: rgba(255, 255, 255, 0.08);
    --text: #f5f5f5;
    --muted: #bdbdbd;
    --accent: #ffc107;
    --danger: #ef5350;
    --success: #4caf50;
    --shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
    --radius: 24px;
}

#forecast-app .wrap {
    max-width: 1224px;
    margin: 0 auto;
    padding: 0;
}

.forecast-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
    z-index: 1;
    position: relative;
}

#forecast-app .card {
    background: linear-gradient(180deg, rgba(28,28,28,0.96), rgba(22,22,22,0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.02);
    backdrop-filter: blur(18px);
}

#forecast-app .form-card {
    padding: 22px;
    position: sticky;
    top: 108px;
}

#forecast-app .result-card {
    padding: 22px;
    height: 100%;
}

#forecast-app .forecast-head h2 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.05;
}

#forecast-app .forecast-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #111;
    border-radius: 999px;
    padding: 8px 12px;
    background: linear-gradient(90deg, #ffd34d, #ffc107);
}

#forecast-app .lead {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 15px;
}

#forecast-app .label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 700;
}

#forecast-app input[type="text"],
#forecast-app select {
    width: 100%;
    height: 52px;
    border-radius: 16px;
    border: 1px solid var(--line);
    font-size: 15px;
    color: var(--text);
    background: rgba(255,255,255,0.02);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

#forecast-app input[type="text"] {
    padding: 0 14px;
}

#forecast-app input[type="text"]::placeholder {
    color: #8f8f8f;
}

/* Кастомный select под тёмную тему */
#forecast-app select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0 48px 0 14px;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, #ffc107 50%),
        linear-gradient(135deg, #ffc107 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

#forecast-app select option {
    background: #171717;
    color: #f5f5f5;
}

#forecast-app input[type="text"]:focus,
#forecast-app select:focus {
    border-color: rgba(255, 193, 7, 0.45);
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.08);
    background-color: rgba(255,255,255,0.03);
}

#forecast-app .row {
    margin-bottom: 16px;
    display: block;
}

#forecast-app .popular {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#forecast-app .chip {
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.02);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: .18s ease;
}

#forecast-app .chip:hover {
    border-color: rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.08);
}

#forecast-app .switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
}

#forecast-app .switch {
    position: relative;
    width: 52px;
    height: 30px;
    display: inline-block;
}

#forecast-app .switch input {
    display: none;
}

#forecast-app .slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #3d3d3d;
    transition: .2s ease;
}

#forecast-app .slider::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .16);
    transition: .2s ease;
}

#forecast-app .switch input:checked + .slider {
    background: var(--accent);
}

#forecast-app .switch input:checked + .slider::before {
    transform: translateX(22px);
}

#forecast-app .button {
    width: 100%;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 45%), linear-gradient(90deg, #ffd34d, #ffc107);
    color: #111;
    height: 54px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 36px rgba(255, 193, 7, 0.18);
}

#forecast-app .button:disabled {
    opacity: .7;
    cursor: progress;
}

#forecast-app .status {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    display: none;
}

#forecast-app .status.active {
    display: block;
}

#forecast-app .status strong {
    display: block;
    margin-bottom: 6px;
}

#forecast-app .status small {
    color: var(--muted);
}

#forecast-app .status.error {
    background: rgba(211, 47, 47, 0.08);
    border-color: rgba(211, 47, 47, 0.28);
    color: #ffb4bf;
}

#forecast-app .empty {
    min-height: 620px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    padding: 40px 24px;
}

#forecast-app .empty-box {
    max-width: 520px;
}

#forecast-app .empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

#forecast-app .loader {
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.12);
    border-top-color: var(--accent);
    animation: forecast-spin 1s linear infinite;
}

@keyframes forecast-spin {
    to {
        transform: rotate(360deg);
    }
}

#forecast-app .result-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 18px;
}

#forecast-app .result-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#forecast-app .result-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    min-width: 0;
}

#forecast-app .result-title h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    min-width: 0;
    overflow-wrap: anywhere;
}

#forecast-app .result-title p,
#forecast-app .submeta {
    margin: 0;
    color: var(--muted);
}

#forecast-app .scenario {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
    max-width: 100%;
}

#forecast-app .scenario.long {
    color: #87d79c;
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.24);
}

#forecast-app .scenario.short {
    color: #ed314b;
    background: rgb(211 47 47 / 14%);
    border-color: rgb(249 6 6 / 92%);
}

#forecast-app .chart-box {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px;
    background: rgba(255,255,255,0.02);
    margin-bottom: 18px;
}

#forecast-app .chart-box img {
    display: block;
    width: 100%;
    border-radius: 12px;
}

#forecast-app .grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

#forecast-app .metric {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
    padding: 14px;
}

#forecast-app .metric-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

#forecast-app .metric-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
}

#forecast-app .analysis {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    background: rgba(255,255,255,0.02);
}

#forecast-app .analysis h3 {
    margin: 0 0 14px;
    font-size: 20px;
}

#forecast-app .analysis p,
#forecast-app .analysis li {
    color: #f0f0f0;
    line-height: 1.65;
    font-size: 15px;
}

#forecast-app .analysis ul {
    padding-left: 18px;
    margin: 12px 0 0;
}

#forecast-app .disclaimer {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

#forecast-app .result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

#forecast-app .ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    height: 44px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.02);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

#forecast-app .analysis-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#forecast-app .analysis-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
}

#forecast-app .analysis-badge.ai {
    color: #111;
    background: linear-gradient(90deg, #ffd34d, #ffc107);
    border-color: rgba(255, 193, 7, 0.35);
}

#forecast-app .analysis-badge.system {
    color: var(--text);
    background: rgba(255,255,255,0.03);
}

#forecast-app .analysis-note {
    color: var(--muted);
    font-size: 12px;
}

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

    #forecast-app .form-card {
        position: static;
    }
}

@media (max-width: 700px) {
    #forecast-app .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #forecast-app .result-title h2 {
        font-size: 24px;
    }
}

@media (max-width: 520px) {
    #forecast-app .form-card,
    #forecast-app .result-card {
        padding: 16px;
    }

    #forecast-app .metric-value {
        font-size: 18px;
    }

    #forecast-app .grid {
        grid-template-columns: 1fr 1fr;
    }

    #forecast-app .result-top {
        gap: 10px;
    }

    #forecast-app .result-title-line {
        gap: 8px 10px;
    }

    #forecast-app .scenario {
        padding: 7px 12px;
        font-size: 12px;
    }
}

#forecast-app .share-wrap {
    position: relative;
    justify-self: end;
    align-self: start;
    flex: 0 0 auto;
}

#forecast-app .result-share {
    display: inline-flex;
    align-items: center;
}

#forecast-app .share-icon-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.02);
    color: #ffd34d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

#forecast-app .share-icon-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 193, 7, 0.32);
    background: rgba(255, 193, 7, 0.08);
}

#forecast-app .share-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#forecast-app .share-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

#forecast-app .share-toggle.is-open {
    border-color: rgba(255, 193, 7, 0.35);
    background: rgba(255, 193, 7, 0.08);
}

#forecast-app .share-toggle.is-copied {
    color: #111;
    border-color: rgba(255, 193, 7, 0.48);
    background: linear-gradient(90deg, #ffd34d, #ffc107);
}

#forecast-app .share-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 220px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(28,28,28,0.98), rgba(18,18,18,0.96));
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
    z-index: 30;
}

#forecast-app .share-item {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

#forecast-app .share-item:hover {
    background: rgba(255,255,255,0.05);
}

#forecast-app .share-item + .share-item {
    margin-top: 4px;
}

@media (max-width: 640px) {
    #forecast-app .share-menu {
        right: 0;
        left: auto;
    }

    #forecast-app .share-icon-btn {
        width: 40px;
        min-width: 40px;
        height: 40px;
    }
}
