:root {
  --bg: #0b0e14;
  --panel: #141922;
  --panel-2: #1b2230;
  --line: #26304180;
  --line-solid: #263041;
  --text: #e6ebf2;
  --muted: #8a97a8;
  --accent: #6ea8fe;
  --accent-2: #7c5cff;
  --green: #2ec38b;
  --amber: #f5b544;
  --red: #ff6b6b;
  --blue: #5b9dff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  display: flex;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }

/* Sidebar */
.sidebar { width: 232px; flex: 0 0 232px; background: var(--panel); border-right: 1px solid var(--line-solid); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand.center { justify-content: center; padding-bottom: 8px; }
.brand-mark { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 11px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, #6ea8fe22, #7c5cff11); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-ico { width: 18px; text-align: center; opacity: .8; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side-link { color: var(--muted); font-size: 12px; }

/* Content */
.content { flex: 1; min-width: 0; padding: 22px 30px 60px; max-width: 1240px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page { display: flex; flex-direction: column; gap: 16px; }
.crumbs { color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); }
.muted { color: var(--muted); }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi-link { display: block; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-link:hover .kpi { border-color: var(--accent); text-decoration: none; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-actions { display: flex; gap: 8px; }
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .col-2 { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line-solid); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); }
.thumb { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; vertical-align: middle; margin-right: 8px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .02em; border: 1px solid transparent; }
.s-grey { background: #26304166; color: #a9b6c6; border-color: var(--line-solid); }
.s-blue { background: #5b9dff22; color: #8fbcff; border-color: #5b9dff44; }
.s-amber { background: #f5b54422; color: #f5c96e; border-color: #f5b54444; }
.s-green { background: #2ec38b22; color: #6ee0b4; border-color: #2ec38b44; }
.s-red { background: #ff6b6b22; color: #ff9d9d; border-color: #ff6b6b44; }

/* Bars / breakdown */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.bar-label { font-size: 13px; }
.bar-count { font-weight: 700; }

/* Feed */
.feed, .notes, .msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed li { display: flex; gap: 10px; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 8px; }
.feed-meta { font-size: 12px; }
.notes li, .msgs li { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; }

/* Buttons + chips + forms */
.btn { display: inline-block; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line-solid); color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel-2); border: 1px solid var(--line-solid); color: var(--muted); padding: 5px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; }
.chip.on, .chip:hover { color: var(--text); border-color: var(--accent); }
.filter select, .compose select, .compose input, .compose textarea, .note-form textarea { background: var(--panel-2); border: 1px solid var(--line-solid); color: var(--text); padding: 9px 11px; border-radius: 9px; font: inherit; width: 100%; }
.filter { max-width: 320px; }
.compose { display: flex; flex-direction: column; gap: 12px; }
.compose label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 12px; align-items: center; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pre, .code { background: #0e1420; border: 1px solid var(--line-solid); border-radius: 9px; padding: 12px; overflow-x: auto; font-size: 12px; color: #c8d3e0; }

/* Banners */
.banner { padding: 10px 14px; border-radius: 9px; font-size: 13px; }
.banner.info { background: #5b9dff18; border: 1px solid #5b9dff33; }
.banner.warn { background: #f5b54418; border: 1px solid #f5b54433; color: #f5c96e; }
.banner.error { background: #ff6b6b18; border: 1px solid #ff6b6b44; color: #ff9d9d; }
.banner.ok { background: #2ec38b18; border: 1px solid #2ec38b44; color: #6ee0b4; }

/* Login */
.login-body { align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line-solid); border-radius: 16px; padding: 32px; width: 340px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0; }
.login-card input { background: var(--panel-2); border: 1px solid var(--line-solid); color: var(--text); padding: 11px; border-radius: 9px; font: inherit; }
.login-card .brand-mark { font-size: 40px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 14px; min-height: 240px; max-height: 56vh; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg.user .bubble { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; }
.chat-msg.assistant .bubble { background: var(--panel-2); border: 1px solid var(--line); }
.bubble table { margin: 8px 0; }
.bubble .steps { margin-top: 8px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line-solid); padding-top: 6px; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; background: var(--panel-2); border: 1px solid var(--line-solid); color: var(--text); padding: 11px 13px; border-radius: 10px; font: inherit; }
.thinking { display: inline-block; }
.thinking::after { content: "…"; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0%,20%{content:"."} 40%{content:".."} 60%,100%{content:"..."} }
