﻿*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #212121;
    --bg2: #2a2a2a;
    --bg3: #303030;
    --bg4: #383838;
    --border: #3a3a3a;
    --text: #ececec;
    --text2: #9a9ab0;
    --text3: #55556a;
    --accent: #22c55e;
    --accent-bg: rgba(34,197,94,.1);
    --red: #f87171;
    --yellow: #facc15;
    --purple: #818cf8;
    --sidebar: 256px;
    --radius: 12px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter',-apple-system,sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* Layout */
.layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar);
    background: #171717;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 4px 16px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
    margin-bottom: 20px;
}

    .new-chat-btn:hover {
        background: var(--bg4);
    }

.sidebar-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text3);
    padding: 0 4px 8px;
}

.suggestions {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.suggestion-chip {
    text-align: left;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text2);
    cursor: pointer;
    font-size: 12.5px;
    transition: background .15s,color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .suggestion-chip:hover {
        background: var(--bg3);
        color: var(--text);
    }

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text3);
    padding: 12px 4px 0;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 8px;
    scroll-behavior: smooth;
}

    .messages::-webkit-scrollbar {
        width: 5px;
    }

    .messages::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 3px;
    }

/* Welcome */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 65vh;
    padding: 32px 24px;
    text-align: center;
}

.welcome-icon {
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-sub {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 28px;
}

.welcome-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.ex-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text2);
    transition: border-color .15s,background .15s;
    min-width: 155px;
}

    .ex-card:hover {
        border-color: var(--bg4);
        background: var(--bg3);
        color: var(--text);
    }

.ex-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text3);
}

/* Message rows */
.msg-row {
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    gap: 12px;
    animation: fadeUp .2s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.msg-row.user {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-av {
    background: var(--accent);
    color: #000;
}

.bot-av {
    background: var(--accent-bg);
    border: 1px solid rgba(34,197,94,.3);
}

.msg-content {
    max-width: calc(100% - 44px);
    flex: 1;
}

.msg-row.user .msg-content {
    display: flex;
    justify-content: flex-end;
}

.msg-bubble {
    font-size: 14px;
    line-height: 1.65;
}

.user-bubble {
    background: var(--bg3);
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    max-width: 600px;
}

.bot-bubble {
    background: transparent;
    padding: 4px 0;
    width: 100%;
}

/* Thinking */
.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text2);
    font-size: 13px;
    padding: 6px 0;
}

.dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: var(--text3);
    border-radius: 50%;
    animation: blink 1.2s infinite;
}

    .dots span:nth-child(2) {
        animation-delay: .2s;
    }

    .dots span:nth-child(3) {
        animation-delay: .4s;
    }

@keyframes blink {
    0%,80%,100% {
        opacity: .2
    }

    40% {
        opacity: 1
    }
}

.info-msg {
    color: var(--text2);
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    margin-bottom: 10px;
}

.warn-block {
    background: rgba(250,204,21,.08);
    border: 1px solid rgba(250,204,21,.3);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--yellow);
    font-size: 13px;
    margin-top: 12px;
}

/* Step UI */
.step-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.action-btn {
    padding: 9px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: opacity .15s,transform .1s;
}

    .action-btn:hover {
        opacity: .88;
        transform: scale(1.02);
    }

.green-btn {
    background: var(--accent);
    color: #000;
}

.gray-btn {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Product confirm */
.product-confirm-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.product-card {
    flex: 1;
    min-width: 200px;
    padding: 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mine-card {
    border-color: rgba(34,197,94,.3);
}

.other-card {
    border-color: rgba(99,102,241,.3);
}

.pc-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 6px 0 4px;
}

.pc-meta {
    font-size: 12px;
    color: var(--text2);
}

.pc-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 6px;
}

.cmp-vs {
    font-size: 13px;
    font-weight: 700;
    color: var(--text3);
    align-self: center;
    padding: 0 4px;
}

/* Prices form */
.prices-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 4px;
}

.price-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

    .price-input-row label {
        font-size: 13px;
        color: var(--text2);
        min-width: 160px;
    }

.price-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
}

.price-inp {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    padding: 8px 0;
    width: 90px;
}

.price-unit {
    font-size: 12px;
    color: var(--text3);
}

.std-price-btn {
    padding: 6px 12px;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    transition: background .15s;
}

    .std-price-btn:hover {
        background: var(--bg3);
        color: var(--text);
    }

/* Crops */
.crops-hint {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 8px;
}

    .crops-hint em {
        color: var(--text);
    }

.crop-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.crop-choice-btn {
    padding: 9px 18px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: border-color .15s,background .15s;
}

    .crop-choice-btn:hover {
        border-color: var(--accent);
        background: var(--accent-bg);
        color: var(--accent);
    }

/* Picker */
.picker-group {
    margin-bottom: 14px;
}

.picker-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text3);
    margin-bottom: 8px;
}

.picker-count {
    font-size: 11px;
    color: var(--text3);
    font-weight: 400;
    margin-left: 6px;
    text-transform: none;
    letter-spacing: 0;
}

.picker-filter {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2);
    color: var(--text1);
    font-size: 13px;
    outline: none;
}

    .picker-filter:focus {
        border-color: var(--accent);
    }

.picker-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.picker-cards-scroll {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.picker-card {
    padding: 10px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s,background .15s;
}

    .picker-card:hover {
        border-color: var(--accent);
        background: var(--accent-bg);
    }

    .picker-card.selected {
        border-color: var(--accent);
        background: var(--accent-bg);
    }

.picker-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.picker-card-meta {
    font-size: 11.5px;
    color: var(--text2);
    margin-top: 3px;
}

.pbadge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

.pbadge-mine {
    background: rgba(34,197,94,.18);
    color: var(--accent);
}

.pbadge-other {
    background: rgba(99,102,241,.18);
    color: var(--purple);
}

/* Full result */
.full-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

/* Price section */
.price-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-compare {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.price-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text3);
    font-weight: 600;
}

.price-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.other-price {
    color: var(--text2);
}

.win-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(34,197,94,.15);
    color: var(--accent);
}

.loss-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(250,204,21,.12);
    color: var(--yellow);
}

.neutral-badge {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg3);
    color: var(--text2);
}

/* Tables */
.tbl-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cmp-table {
    width: 100%;
    border-collapse: collapse;
}

    .cmp-table th {
        padding: 9px 14px;
        background: var(--bg3);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: #ffffff;
        text-align: left;
        border-bottom: 1px solid var(--border);
    }

        .cmp-table th:first-child {
            color: var(--text3);
            font-size: 11px;
        }

    .cmp-table td {
        padding: 9px 14px;
        border-bottom: 1px solid rgba(255,255,255,.04);
        vertical-align: top;
    }

    .cmp-table tr:last-child td {
        border-bottom: none;
    }

    .cmp-table tr:hover td {
        background: rgba(255,255,255,.018);
    }

.td-param {
    width: 22%;
}

.td-val {
    text-align: left;
    vertical-align: middle;
}

.td-comment {
    width: 32%;
    font-size: 12px;
    color: var(--text2);
    line-height: 1.55;
    vertical-align: middle;
    padding: 10px 14px;
}

.th-comment {
    color: var(--text2) !important;
    font-size: 11px !important;
    font-weight: 600;
}

.td-compat {
    font-size: 12px;
    color: var(--text2);
    max-width: 300px;
}

.param-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.no-dose {
    font-size: 11px;
    color: var(--text3);
    font-style: italic;
}

.no-dose-warn {
    background: rgba(234,179,8,.08);
    border: 1px solid rgba(234,179,8,.25);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ca8a04;
    margin-bottom: 10px;
}

.diff-label {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
}

    .diff-label.green {
        color: var(--accent);
    }
/* Победитель или эксклюзивное наличие — один зелёный цвет */
.cell-win, .cell-exclusive {
    background: rgba(34,197,94,.12) !important;
    font-weight: 500;
}
/* Разделитель секций в таблице */
.section-sep td {
    padding: 5px 14px;
    background: var(--bg3);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-sep span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text3);
}

.tbl-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 8px;
}

.norm-hint {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-top: 3px;
}

.norm-in {
    font-size: 11px;
    color: #22c55e;
    margin-top: 3px;
    font-weight: 500;
}

.norm-below {
    font-size: 11px;
    color: #eab308;
    margin-top: 3px;
    font-weight: 500;
}

.norm-above {
    font-size: 11px;
    color: #f97316;
    margin-top: 3px;
    font-weight: 500;
}

.crop-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.func-hint {
    font-size: 11px;
    color: var(--text3);
    font-style: italic;
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-top: 3px;
}

.s-IN {
    background: rgba(34,197,94,.15);
    color: var(--accent);
}

.s-ABOVE {
    background: rgba(248,113,113,.15);
    color: var(--red);
}

.s-BELOW {
    background: rgba(250,204,21,.12);
    color: var(--yellow);
}

/* App cost */
.app-cost-section {
}

.app-cost-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ac-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ac-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text3);
    font-weight: 600;
}

.ac-dose {
    font-size: 13px;
    color: var(--text2);
}

.ac-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

/* AI summary */
.ai-summary {
    background: rgba(34,197,94,.05);
    border-color: rgba(34,197,94,.2);
}

.ai-text {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    white-space: pre-wrap;
}

.result-actions {
    margin-top: 4px;
}

/* Input */
.input-area {
    padding: 10px 24px 18px;
    border-top: 1px solid var(--border);
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    align-items: flex-end;
    transition: border-color .15s;
}

    .input-wrapper:focus-within {
        border-color: var(--bg4);
    }

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    padding: 13px 16px;
    resize: none;
    max-height: 200px;
}

    .chat-input::placeholder {
        color: var(--text3);
    }

.send-btn {
    width: 36px;
    height: 36px;
    margin: 5px;
    background: var(--accent);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    flex-shrink: 0;
    transition: opacity .15s,transform .1s;
}

    .send-btn:hover {
        opacity: .88;
        transform: scale(1.05);
    }

    .send-btn:active {
        transform: scale(.96);
    }

.input-hint {
    max-width: 900px;
    margin: 6px auto 0;
    font-size: 11.5px;
    color: var(--text3);
    text-align: center;
}

@media(max-width:680px) {
    .sidebar {
        display: none;
    }

    .msg-row {
        padding: 8px 14px;
    }

    .product-confirm-row {
        flex-direction: column;
    }

    .input-area {
        padding: 8px 14px 14px;
    }
}
