﻿:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --line: #dfe3ea;
    --text: #1e2430;
    --muted: #667085;
    --accent: #2563eb;
    --accent-2: #1d4ed8;
    --danger: #b42318;
    --ok: #027a48;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--accent);
    color: white;
    transition: 0.15s ease;
}

    button:hover {
        background: var(--accent-2);
    }

    button.secondary {
        background: white;
        color: var(--text);
        border: 1px solid var(--line);
    }

        button.secondary:hover {
            background: #f9fafb;
        }

    button.danger {
        background: var(--danger);
    }

    button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: white;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.04);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

    .header h1,
    .header h2,
    .header h3,
    h1, h2, h3 {
        margin: 0;
    }

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.92rem;
}

.error {
    color: var(--danger);
}

.success {
    color: var(--ok);
}

.hidden {
    display: none !important;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
}

    .auth-card form {
        display: grid;
        gap: 14px;
    }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.menu-card {
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

    .menu-card .title {
        font-size: 1.1rem;
        font-weight: 700;
    }

.chat-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 340px;
    gap: 16px;
}

.sidebar-list {
    display: grid;
    gap: 10px;
    max-height: 70vh;
    overflow: auto;
}

.sidebar-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
}

    .sidebar-item.active {
        border-color: var(--accent);
        box-shadow: inset 0 0 0 1px var(--accent);
    }

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 75vh;
}

.chat-messages {
    flex: 1;
    overflow: auto;
    display: grid;
    gap: 12px;
    padding: 4px;
}

.msg {
    max-width: 86%;
    padding: 12px 14px;
    border-radius: 14px;
    white-space: pre-wrap;
    line-height: 1.45;
}

    .msg.user {
        justify-self: end;
        background: #dbeafe;
        border: 1px solid #bfdbfe;
    }

    .msg.assistant {
        justify-self: start;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
    }

.composer {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 14px;
    display: grid;
    gap: 12px;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

    .row > * {
        flex: initial;
    }

.stat-list {
    display: grid;
    gap: 10px;
}

.stat-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: white;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    background: white;
    font-size: 0.9rem;
}

.pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 12px;
    vertical-align: top;
}

th {
    font-size: 0.92rem;
    color: var(--muted);
    background: #f8fafc;
}

.notice {
    border-left: 4px solid var(--accent);
    background: #eff6ff;
    padding: 12px 14px;
    border-radius: 12px;
}

@media (max-width: 1024px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .menu-grid,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        min-height: 60vh;
    }
}
