* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #0f1115;
    color: #e4e6eb;
}
a { color: #7ea6ff; text-decoration: none; }
a:hover { color: #aac4ff; text-decoration: underline; }

.navbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1.5rem;
    background: #181b21;
    border-bottom: 1px solid #2a2e37;
}
.navbar a { color: #c5c9d3; text-decoration: none; font-size: 0.95rem; }
.navbar a:hover { color: #fff; }
.navbar-brand { font-weight: 600; margin-right: 1rem; color: #fff; }
.navbar-logout { margin-left: auto; }
.container { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 2rem; }

.stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card { background: #181b21; border: 1px solid #2a2e37; border-radius: 8px; padding: 1rem 1.5rem; min-width: 160px; text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { color: #9aa0ad; font-size: 0.85rem; margin-top: 0.25rem; }

button, input[type=submit], .button {
    background: #2a6df0;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-block;
}
button.off { background: #3a3f4b; }
button.on { background: #2fa86b; }
button.danger { background: #c0392b; }
button:hover, .button:hover { opacity: 0.9; text-decoration: none; }

input[type=text], input[type=password], textarea, select {
    background: #181b21;
    border: 1px solid #2a2e37;
    color: #e4e6eb;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.settings-form { display: flex; flex-direction: column; gap: 0.3rem; max-width: 560px; margin-bottom: 0.5rem; }
.settings-form label { font-size: 0.8rem; color: #9aa0ad; margin-top: 0.5rem; }
.settings-form button { margin-top: 0.75rem; align-self: flex-start; }

.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: #0f1115; }
.login-form { background: #181b21; border: 1px solid #2a2e37; border-radius: 10px; padding: 2rem; display: flex; flex-direction: column; gap: 0.5rem; width: 280px; }
.login-form h1 { margin-top: 0; font-size: 1.2rem; text-align: center; }
.error { color: #ff6b6b; font-size: 0.85rem; }
.hint { color: #9aa0ad; font-size: 0.85rem; }

/* ── Диалоги / инбокс ─────────────────────────────────────────── */
.inbox { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; height: 75vh; }
.inbox-list { overflow-y: auto; background: #181b21; border: 1px solid #2a2e37; border-radius: 8px; }
.inbox-search { display: flex; gap: 0.3rem; align-items: center; padding: 0.5rem 0.6rem; border-bottom: 1px solid #2a2e37; }
.inbox-search input { flex: 1; min-width: 0; }
.inbox-search-clear { color: #9aa0ad; text-decoration: none; padding: 0 0.3rem; }
.thread { display: block; padding: 0.6rem 0.9rem; border-bottom: 1px solid #2a2e37; text-decoration: none; color: #e4e6eb; }
.thread:hover { background: #1f232b; }
.thread-active { background: #232a3a; }
.thread-title { font-size: 0.9rem; font-weight: 600; }
.thread-preview { font-size: 0.8rem; color: #9aa0ad; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-time { font-size: 0.7rem; color: #6b7280; margin-top: 0.1rem; }

.inbox-pane { display: flex; flex-direction: column; min-width: 0; }
.inbox-pane-header { font-weight: 600; padding-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center; }
.inbox-pane .messages { flex: 1; max-height: none; }
.inbox-pane-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: #6b7280; }

.messages { display: flex; flex-direction: column; gap: 0.5rem; max-height: 60vh; overflow-y: auto; padding: 1rem; background: #181b21; border: 1px solid #2a2e37; border-radius: 8px; }
.msg { padding: 0.5rem 0.75rem; border-radius: 8px; max-width: 70%; }
.msg-user { background: #232733; align-self: flex-start; }
.msg-assistant { background: #2a6df0; align-self: flex-end; }
.msg-admin { background: #2fa86b; align-self: flex-end; }
.msg-meta { font-size: 0.7rem; color: #9aa0ad; margin-bottom: 0.2rem; }
.msg-error { color: #ff6b6b; font-size: 0.8rem; }
.msg-text { word-break: break-word; }
.msg-text a { color: #aee0ff; text-decoration: underline; }

.send-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.send-form textarea { flex: 1; min-height: 60px; }

/* ── Таблицы ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.data-table th, .data-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #2a2e37; font-size: 0.9rem; }
.row-actions { display: flex; gap: 0.6rem; align-items: center; }

.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-on { background: #1a3a26; color: #5dde96; }

/* ── Конструктор анкет ────────────────────────────────────────── */
.field-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.field-row .f-label { flex: 1; min-width: 160px; }
.field-row .f-options { flex: 1; min-width: 200px; }
.f-required-label { font-size: 0.8rem; color: #9aa0ad; display: flex; align-items: center; gap: 0.3rem; }
