/* Kalynka Agent: стилі кабінету. Без довгих тире у текстах. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fa; --card: #fff; --ink: #1c2430; --muted: #67728a; --line: #e3e8f0;
  --brand: #b5232e; --brand-dark: #8d1a23; --accent: #1c64d9; --ok: #1d8a4e; --warn: #c47f00; --bad: #c0362c;
}
body { font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; margin-top: 8px; }
.error { color: var(--bad); background: #fdecea; border: 1px solid #f6c9c4; padding: 8px 10px; border-radius: 8px; margin: 8px 0; font-size: 13px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 9px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: #3a4356; color: #cdd5e4; }
.small-btn { padding: 5px 12px; font-size: 13px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; flex: none; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #1b2230 0%, #2a3348 60%, #3c2a2e 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 30px 28px; width: 400px; max-width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-card h1 { font-size: 21px; margin: 18px 0 4px; }
.login-card label { display: block; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }
.login-card .btn { width: 100%; margin-top: 16px; }
.login-card .small { margin-top: 12px; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: none; background: #1b2230; color: #cdd5e4; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand b { color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn { text-align: left; background: transparent; border: 0; color: #cdd5e4; padding: 10px 12px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.nav-btn:hover { background: #232c3f; }
.nav-btn.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1; padding: 22px 26px 40px; max-width: 1180px; }
.tab-head { margin-bottom: 14px; }
.tab-head h2 { font-size: 21px; }

.demo-banner { background: #fff7e0; border: 1px solid #f1dfa8; color: #6d5410; border-radius: 10px; padding: 9px 14px; font-size: 13px; margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 10px; }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; min-height: 200px; }
.msg { max-width: 88%; border-radius: 13px; padding: 11px 14px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msg .src { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.msg .exp { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: #38445c; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 6px 0 2px; }
.chat-form input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 8px; background: #f8fafd; }
.tbl td { border-bottom: 1px solid #eef1f6; padding: 6px 8px; }
.tbl tr:last-child td { border-bottom: 0; }
.msg .tbl { background: #fff; margin-top: 8px; }
.msg .tbl-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; margin-top: 8px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; }
.kpi .label { font-size: 12.5px; color: var(--muted); }
.kpi .value { font-size: 21px; font-weight: 700; margin-top: 3px; }
.kpi .delta { font-size: 12.5px; margin-top: 2px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); } .delta.warn { color: var(--warn); }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } .sidebar { display: none; } }

#dyn-chart svg { width: 100%; height: 150px; }
.digest { white-space: pre-wrap; font: 14px/1.65 "Segoe UI", system-ui, sans-serif; }

/* Journal */
.j-item { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; margin-bottom: 9px; }
.j-q { font-weight: 600; }
.j-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.j-a { font-size: 13.5px; white-space: pre-wrap; color: #38445c; margin-top: 4px; }

/* Settings */
.status-row { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed #eef1f6; }
.status-row:last-child { border-bottom: 0; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.pill.demo { background: #fff2d9; color: #8a6100; }
.pill.on { background: #e2f5e9; color: #14603a; }
.pill.off { background: #eceff5; color: #67728a; }
