:root {
    --bg: #050814;
    --bg-elevated: #0c1020;
    --bg-elevated-soft: #11172a;
    --accent: #42e8c4;
    --accent-soft: rgba(66, 232, 196, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0a8c0;
    --border: #1c2238;
    --alert: #ff6b6b;
    --orange: #ffb347;
    --purple: #b492ff;
    --green: #53e88b;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition-fast: 0.18s ease-out;
    --transition-med: 0.25s ease-out;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #101735 0, #050814 55%, #02030a 100%);
    color: var(--text-main);
    font-family: var(--font-main);
}

/* ==== TOPBAR ==== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 26px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    background: linear-gradient(
        135deg,
        rgba(5, 8, 20, 0.96),
        rgba(10, 16, 36, 0.92)
    );
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 0 26px rgba(66, 232, 196, 0.6);
}

.company-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.company-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: radial-gradient(circle at center, #42e8c4, #0aff9d);
    box-shadow: 0 0 16px rgba(66, 232, 196, 0.9);
}

.status-text {
    font-size: 13px;
}

/* ==== LAYOUT ==== */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 2.3fr) minmax(0, 1.2fr);
    gap: 18px;
    padding: 16px 18px 24px;
}

/* ==== GRID MAIN ==== */

.grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr);
    gap: 14px;
}

/* ==== WIDGETS ==== */

.widget-card {
    background: radial-gradient(circle at top left, #18203a 0, #0b1020 42%, #060916 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: var(--shadow-soft);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition:
        transform var(--transition-med),
        box-shadow var(--transition-med),
        border-color var(--transition-med),
        background var(--transition-med);
}

.widget-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at top right,
        rgba(66, 232, 196, 0.16),
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition-med);
    pointer-events: none;
}

.widget-card:hover {
    transform: translateY(-3px);
    border-color: rgba(66, 232, 196, 0.55);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.9);
}

.widget-card:hover::before {
    opacity: 1;
}

/* самая верхняя плитка на всю ширину сетки слева */
.widget-card.widget-large {
    grid-column: 1 / -1;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.widget-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.widget-sub {
    margin: 2px 0 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.widget-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.metric {
    flex: 1 1 90px;
    min-width: 90px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(9, 14, 32, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.metric-value {
    font-size: 17px;
    font-weight: 600;
}

.metric-alert {
    color: var(--alert);
}

.widget-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==== TAGS ==== */

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 18, 46, 0.9);
    color: var(--text-muted);
    white-space: nowrap;
}

.tag-green {
    border-color: rgba(83, 232, 139, 0.7);
    color: var(--green);
    background: rgba(83, 232, 139, 0.15);
}

.tag-orange {
    border-color: rgba(255, 179, 71, 0.7);
    color: var(--orange);
    background: rgba(255, 179, 71, 0.16);
}

.tag-purple {
    border-color: rgba(180, 146, 255, 0.7);
    color: var(--purple);
    background: rgba(180, 146, 255, 0.18);
}

/* ==== SIDEBAR / AI ==== */

.sidebar {
    cursor: default; /* AI-панель не кликабельна как кнопка */
}

.widget-ai {
    position: sticky;
    top: 74px;
    align-self: flex-start;
    padding-bottom: 12px;
}

.ai-chat-window {
    margin-top: 8px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(6, 10, 28, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    height: 280px;
    overflow-y: auto;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-message {
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 10px;
    line-height: 1.4;
}

.ai-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1c2b4a, #27396a);
}

.ai-message.ai {
    align-self: flex-start;
    background: rgba(15, 24, 55, 0.95);
    border: 1px solid rgba(180, 146, 255, 0.4);
}

.ai-form {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-input {
    resize: vertical;
    min-height: 70px;
    max-height: 150px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(5, 9, 24, 0.96);
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
}

.ai-input:focus {
    outline: none;
    border-color: rgba(66, 232, 196, 0.7);
    box-shadow: 0 0 0 1px rgba(66, 232, 196, 0.3);
}

.ai-submit {
    align-self: flex-end;
    border-radius: 999px;
    border: none;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #b492ff, #42e8c4);
    color: #050814;
    box-shadow: 0 10px 24px rgba(180, 146, 255, 0.4);
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

.ai-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(180, 146, 255, 0.55);
}

.ai-submit:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(180, 146, 255, 0.3);
}

.ai-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ==== FOOTER ==== */

.footer {
    padding: 6px 18px 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    text-align: right;
}

/* ==== RESPONSIVE ==== */

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .widget-ai {
        position: static;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .layout {
        padding: 10px 10px 18px;
    }

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

    .widget-card {
        cursor: pointer;
    }

    .ai-chat-window {
        height: 220px;
    }
}
.header-logo {
    max-height: 40px !important; /* высота логотипа */
    width: auto !important;      /* ширина по пропорциям */
    max-width: 60px !important;  /* страховка, чтобы не разрастался */
    object-fit: contain !important;
    border-radius: 10px;
    display: inline-block;
}
