* { box-sizing: border-box; }
body { margin: 0; background: #f1f5f9; color: #1e293b; font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 18px 28px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 0; font-size: 13px; opacity: .9; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav button { border: none; background: rgba(255,255,255,.16); color: #fff; padding: 8px 14px; border-radius: 999px; font: 600 13px inherit; cursor: pointer; }
nav button.active { background: #fff; color: #3b82f6; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.muted { color: #64748b; font-size: 13px; margin: 0 0 12px; }
.error { color: #b91c1c; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
input, textarea { border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; font: inherit; color: inherit; }
input:focus, textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
textarea { width: 100%; resize: vertical; }
button { border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 8px 14px; font: 600 13px inherit; cursor: pointer; color: #1e293b; }
button:hover { background: #f8fafc; }
button.primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
button.danger { color: #b91c1c; border-color: #fecaca; }
button.small { padding: 4px 9px; font-size: 12px; }
.table-wrap { overflow-x: auto; max-height: 70vh; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { position: sticky; top: 0; text-align: left; padding: 10px 12px; background: #f8fafc; color: #64748b; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: rgba(34,197,94,.15); color: #15803d; }
.badge.warning { background: rgba(245,158,11,.18); color: #b45309; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; }
.kpi .label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.kpi .value { font-size: 24px; font-weight: 700; }
.kpi .hint { font-size: 12px; color: #64748b; margin-top: 4px; }
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.list-item { padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.list-item.active { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.list-item strong { display: block; }
.message { padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; max-width: 85%; background: #f1f5f9; }
.message.sent { background: rgba(59,130,246,.12); margin-left: auto; }
.message small { display: block; color: #64748b; margin-top: 2px; }
.chart-box { position: relative; height: 280px; }
.empty { text-align: center; color: #64748b; padding: 40px 12px; }
