/* Atlas OS — design system. Apple-grade dark, glassy, calm. */
:root {
  --bg: #07080d;
  --bg-2: #0c0e16;
  --panel: rgba(22, 25, 37, 0.72);
  --panel-solid: #14161f;
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f6;
  --muted: #9aa0b4;
  --faint: #6b7186;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --green: #10b981;
  --amber: #f59e0b;
  --pink: #ec4899;
  --sky: #0ea5e9;
  --red: #f43f5e;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 700px at 12% -10%, #1a1340 0%, transparent 55%),
              radial-gradient(1000px 600px at 100% 0%, #0a2540 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { display: grid; grid-template-columns: 256px 1fr; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, rgba(16,18,28,0.9), rgba(8,9,14,0.95));
  border-right: 1px solid var(--stroke);
  display: flex; flex-direction: column; padding: 20px 14px;
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-size: 20px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -6px rgba(99,102,241,0.7);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s ease;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,0.18), rgba(139,92,246,0.06));
  color: #fff; border-color: rgba(99,102,241,0.35);
}
.nav-item .ic { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); padding: 16px 12px 6px; }
.nav-footer { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.ai-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.ai-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
.ai-status.on .dot { background: var(--green); animation: pulse 2s infinite; }
.ai-status.off .dot { background: var(--amber); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(16,185,129,.5)} 70%{box-shadow:0 0 0 7px rgba(16,185,129,0)} 100%{box-shadow:0 0 0 0 rgba(16,185,129,0)} }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,#334155,#475569); display:grid; place-items:center; font-size:12px; font-weight:700; }
.who-name { font-size: 13px; font-weight: 600; }
.who-role { font-size: 11px; color: var(--faint); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; border-bottom: 1px solid var(--stroke); }
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.omni {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; min-width: 320px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: 11px;
  color: var(--muted); font-size: 13px; cursor: pointer; font-family: var(--font); transition: all .15s;
}
.omni:hover { border-color: var(--stroke-strong); color: var(--text); }
.omni-spark { color: var(--accent-2); }
.omni kbd { margin-left: auto; font-size: 11px; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--stroke); }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 60px; }
.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Cards & primitives ---------- */
.card {
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 16px; }
.section-head { display:flex; align-items:center; justify-content: space-between; margin: 26px 0 14px; }
.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.section-head .hint { font-size: 12px; color: var(--faint); }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: var(--font); border: 1px solid var(--stroke-strong);
  background: rgba(255,255,255,0.05); color: var(--text); transition: all .15s;
}
.btn:hover { background: rgba(255,255,255,0.1); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 10px 26px -10px rgba(99,102,241,.8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tag { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--muted); border: 1px solid var(--stroke); }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.pill.green { background: rgba(16,185,129,.14); color: #34d399; }
.pill.amber { background: rgba(245,158,11,.14); color: #fbbf24; }
.pill.red { background: rgba(244,63,94,.14); color: #fb7185; }
.pill.blue { background: rgba(99,102,241,.16); color: #a5b4fc; }
.pill.gray { background: rgba(255,255,255,.06); color: var(--muted); }

/* KPI */
.kpi { display:flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 12px; color: var(--muted); display:flex; align-items:center; gap:6px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.kpi .delta.up { color: #34d399; } .kpi .delta.down { color: #fb7185; }

/* Command Center brief */
.brief {
  background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(139,92,246,0.06));
  border: 1px solid rgba(99,102,241,0.3);
}
.brief .headline { font-size: 19px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; }
.brief-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 18px; }
.brief-col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 9px; }
.brief-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.brief-col li { font-size: 13px; color: var(--text); line-height: 1.45; padding-left: 16px; position: relative; }
.brief-col li::before { content: ''; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.brief-col.risk li::before { background: var(--red); }
.brief-col.opp li::before { background: var(--green); }
.next-action { margin-top: 18px; padding: 14px 16px; background: rgba(0,0,0,0.25); border-radius: 12px; border: 1px solid var(--stroke); display:flex; gap:12px; align-items:center; }
.next-action .star { color: var(--amber); font-size: 18px; }

/* Event feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--stroke); }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.feed-body { flex: 1; }
.feed-summary { font-size: 13px; line-height: 1.4; }
.feed-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; padding: 0 14px 12px; }
.table td { padding: 13px 14px; border-top: 1px solid var(--stroke); font-size: 13px; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: rgba(255,255,255,0.03); }
.cell-name { display:flex; align-items:center; gap:10px; }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; display:grid; place-items:center; font-size:11px; font-weight:700; color:#fff; flex:none; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.score-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; width: 64px; }
.score-fill { height: 100%; border-radius: 4px; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; }
.chip { padding: 7px 13px; border-radius: 9px; font-size: 13px; cursor: pointer; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); color: var(--muted); }
.chip.active { background: rgba(99,102,241,0.16); color: #fff; border-color: rgba(99,102,241,0.4); }

/* ---------- Drawer / slide-over ---------- */
.overlay { position: fixed; inset: 0; background: rgba(2,3,8,0.55); backdrop-filter: blur(3px); z-index: 40; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 540px; max-width: 92vw; z-index: 50;
  background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-left: 1px solid var(--stroke-strong);
  box-shadow: -30px 0 80px -20px rgba(0,0,0,0.8); display: flex; flex-direction: column;
  animation: slideIn .26s cubic-bezier(.22,1,.36,1);
}
.drawer.wide { width: 760px; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display:flex; align-items:flex-start; justify-content:space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--stroke); }
.drawer-close { background: rgba(255,255,255,0.06); border: 1px solid var(--stroke); color: var(--muted); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 16px; }
.drawer-close:hover { color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.drawer-body::-webkit-scrollbar { width: 8px; }
.drawer-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }

/* Journey timeline */
.journey { position: relative; padding-left: 26px; }
.journey::before { content:''; position:absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--accent), transparent); }
.journey-item { position: relative; padding: 0 0 20px 0; }
.journey-item .node { position: absolute; left: -26px; top: 2px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--bg); }
.journey-item .jt { font-size: 13px; font-weight: 500; }
.journey-item .jm { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* Agents grid */
.agent-card { cursor: pointer; transition: transform .18s, border-color .18s; position: relative; overflow: hidden; }
.agent-card:hover { transform: translateY(-3px); border-color: var(--stroke-strong); }
.agent-glow { position:absolute; inset: 0; opacity: .14; }
.agent-icon { width: 44px; height: 44px; border-radius: 12px; display:grid; place-items:center; font-size: 20px; color:#fff; margin-bottom: 14px; position: relative; }
.agent-name { font-size: 15px; font-weight: 600; }
.agent-tag { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; position: relative; }
.agent-photo { width: 58px; height: 58px; border-radius: 50%; margin-bottom: 14px; position: relative; background: var(--panel-solid); display: block; }
.agent-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-top: 3px; position: relative; }
.agent-photo-sm { width: 42px; height: 42px; border-radius: 50%; flex: none; background: var(--panel-solid); }

/* Chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-stream { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 14px; }
.chat-stream::-webkit-scrollbar { width: 8px; }
.chat-stream::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
.msg { max-width: 86%; padding: 12px 15px; border-radius: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: rgba(255,255,255,0.05); border: 1px solid var(--stroke); border-bottom-left-radius: 5px; }
.tool-chip { align-self: flex-start; font-size: 11.5px; color: var(--sky); background: rgba(14,165,233,0.1); border: 1px solid rgba(14,165,233,0.25); padding: 5px 11px; border-radius: 999px; display:inline-flex; gap:7px; align-items:center; }
.tool-chip .spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.chat-input { display:flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--stroke); }
.chat-input textarea { flex: 1; resize: none; background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 12px; color: var(--text); padding: 12px 14px; font-family: var(--font); font-size: 14px; max-height: 120px; }
.chat-input textarea:focus { outline: none; border-color: var(--accent); }
.suggested { display:flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.suggested .s { font-size: 12px; color: var(--muted); padding: 6px 11px; border-radius: 8px; border: 1px solid var(--stroke); cursor: pointer; }
.suggested .s:hover { color: #fff; border-color: var(--stroke-strong); }

/* Workflow canvas */
.canvas-wrap { position: relative; overflow: auto; border-radius: var(--radius); border: 1px solid var(--stroke); background:
  radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 26px 26px, var(--bg-2); height: 460px; }
.canvas { position: relative; min-width: 1600px; min-height: 440px; }
.wf-node { position: absolute; width: 200px; padding: 12px 14px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--stroke-strong); font-size: 13px; box-shadow: var(--shadow); z-index: 2; }
.wf-node .wf-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px; font-weight: 700; }
.wf-node.trigger { border-color: rgba(16,185,129,.5); } .wf-node.trigger .wf-type { color: #34d399; }
.wf-node.action { border-color: rgba(99,102,241,.5); } .wf-node.action .wf-type { color: #a5b4fc; }
.wf-node.wait { border-color: rgba(245,158,11,.5); } .wf-node.wait .wf-type { color: #fbbf24; }
.wf-node.condition { border-color: rgba(14,165,233,.5); } .wf-node.condition .wf-type { color: #38bdf8; }
.wf-node.ai { border-color: rgba(236,72,153,.5); background: linear-gradient(135deg, rgba(236,72,153,0.1), var(--panel-solid)); } .wf-node.ai .wf-type { color: #f472b6; }
.wf-svg { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

/* Knowledge graph */
.graph-wrap { height: 520px; border-radius: var(--radius); border: 1px solid var(--stroke); background: var(--bg-2); overflow: hidden; position: relative; }
.legend { position: absolute; top: 14px; left: 14px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); z-index: 3; }
.legend span { display:inline-flex; align-items:center; gap:6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }

/* Analytics bars */
.bar-row { display:flex; align-items:center; gap: 12px; margin-bottom: 12px; }
.bar-row .bl { width: 120px; font-size: 12px; color: var(--muted); }
.bar-track { flex: 1; height: 26px; background: rgba(255,255,255,0.04); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; display:flex; align-items:center; padding-left: 10px; font-size: 12px; font-weight: 600; color: #fff; }
.donut-wrap { display:flex; align-items:center; gap: 24px; }

.empty { text-align:center; color: var(--faint); padding: 40px 20px; font-size: 14px; }
.loading-shimmer { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display:inline-block; }

/* ---------- Login ---------- */
#loginScreen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); overflow: hidden; }
.login-aurora { position: absolute; inset: 0; background:
  radial-gradient(600px 400px at 25% 20%, rgba(99,102,241,0.35), transparent 60%),
  radial-gradient(560px 380px at 80% 75%, rgba(139,92,246,0.28), transparent 60%),
  radial-gradient(500px 360px at 60% 30%, rgba(14,165,233,0.18), transparent 60%); filter: blur(8px); animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(0,-14px,0) scale(1.04); } }
.login-card { position: relative; width: 400px; max-width: 92vw; padding: 30px 30px 26px; border-radius: 20px; background: var(--panel); border: 1px solid var(--stroke-strong); box-shadow: var(--shadow); backdrop-filter: blur(24px); z-index: 1; }
.login-title { font-size: 18px; font-weight: 600; text-align: center; letter-spacing: -0.01em; margin: 6px 0 22px; }
.login-label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px 2px; }
#loginForm input { width: 100%; background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 11px; color: var(--text); padding: 12px 14px; font-family: var(--font); font-size: 14px; margin-bottom: 14px; }
#loginForm input:focus { outline: none; border-color: var(--accent); }
.login-error { color: #fb7185; font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }
.login-demos { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--stroke); }
.demo-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 8px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); color: var(--text); cursor: pointer; font-family: var(--font); transition: all .15s; }
.demo-row:hover { border-color: var(--stroke-strong); background: rgba(255,255,255,0.06); }
.demo-row b { font-size: 12.5px; } .demo-row span { font-size: 11px; color: var(--faint); }

/* ---------- Account switcher ---------- */
.acct-wrap { position: relative; margin: 4px 4px 14px; }
.acct-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 11px; cursor: pointer; font-family: var(--font); text-align: left; background: var(--panel); border: 1px solid var(--stroke); transition: all .15s; }
.acct-switch[data-single] { cursor: default; }
.acct-switch:not([data-single]):hover { border-color: var(--stroke-strong); background: rgba(255,255,255,0.05); }
.acct-dot { width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: 0 4px 12px -3px rgba(99,102,241,0.7); }
.acct-meta { flex: 1; min-width: 0; }
.acct-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-role { font-size: 11px; color: var(--faint); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-caret { color: var(--faint); font-size: 14px; }
.acct-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--panel-solid); border: 1px solid var(--stroke-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.acct-menu-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 8px 10px 6px; }
.acct-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 9px; cursor: pointer; border: none; background: transparent; color: var(--text); font-family: var(--font); text-align: left; }
.acct-item:hover { background: rgba(255,255,255,0.06); }
.acct-item.active { background: rgba(99,102,241,0.14); }
.acct-item span { color: #34d399; }
.logout-btn { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.04); color: var(--muted); cursor: pointer; font-size: 14px; }
.logout-btn:hover { color: var(--text); border-color: var(--stroke-strong); }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }

/* ---------- Real-time: toasts, live pip, feed flash ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 11px; width: 320px; padding: 13px 15px; border-radius: 13px; background: var(--panel-solid); border: 1px solid var(--stroke-strong); box-shadow: var(--shadow); transform: translateX(360px); opacity: 0; transition: transform .32s cubic-bezier(.22,1,.36,1), opacity .32s; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; box-shadow: 0 0 0 4px rgba(255,255,255,0.04); }
.toast-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.toast-meta { font-size: 11px; color: var(--faint); margin-top: 3px; }

.live-pip { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; margin-right: 6px; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s infinite; vertical-align: middle; }
.sim-link { color: var(--accent-2); cursor: pointer; }
.sim-link:hover { text-decoration: underline; }
.rt-new { animation: rtflash 1.6s ease-out; }
@keyframes rtflash {
  0% { background: rgba(99,102,241,0.22); box-shadow: inset 2px 0 0 var(--accent); }
  100% { background: transparent; box-shadow: none; }
}

/* ---------- Communications Hub / Inbox ---------- */
.inbox { display: grid; grid-template-columns: 380px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 520px; }
.inbox-list, .inbox-thread { display: flex; flex-direction: column; overflow: hidden; padding: 18px; }
.ch-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ch-chip { padding: 5px 11px; border-radius: 8px; font-size: 12px; cursor: pointer; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); color: var(--muted); white-space: nowrap; }
.ch-chip.active { background: rgba(99,102,241,0.16); color: #fff; border-color: rgba(99,102,241,0.4); }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 4px; }
.conv-list::-webkit-scrollbar, .thread-msgs::-webkit-scrollbar { width: 8px; }
.conv-list::-webkit-scrollbar-thumb, .thread-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
.conv-row { display: flex; align-items: flex-start; gap: 11px; padding: 12px 11px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: background .12s; }
.conv-row:hover { background: rgba(255,255,255,0.03); }
.conv-row.active { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.3); }
.ch-badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: none; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--faint); flex: none; }
.conv-sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: flex; align-items: center; gap: 7px; }
.ch-name { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.conv-row.is-unread .conv-name { color: #fff; }
.conv-row.is-unread .conv-sub { color: var(--text); font-weight: 500; }
.unread-badge { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 8px; }

.thread-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--stroke); margin-bottom: 14px; }
.thread-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.m-bubble { max-width: 78%; padding: 11px 14px; border-radius: 14px; }
.m-bubble.inbound { align-self: flex-start; background: rgba(255,255,255,0.05); border: 1px solid var(--stroke); border-bottom-left-radius: 5px; }
.m-bubble.outbound { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-bottom-right-radius: 5px; }
.m-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.m-meta { font-size: 10.5px; margin-top: 5px; opacity: .7; }
.m-bubble.outbound .m-meta { text-align: right; }
.composer { border-top: 1px solid var(--stroke); padding-top: 14px; margin-top: 14px; }
.composer textarea { width: 100%; resize: none; background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 12px; color: var(--text); padding: 12px 14px; font-family: var(--font); font-size: 14px; max-height: 140px; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; }

/* ---------- System & observability ---------- */
.health-dot { width: 12px; height: 12px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s infinite; flex: none; }
.log-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--stroke); }
.log-row:last-child { border-bottom: none; }

/* ---------- Snapshots & templates ---------- */
.snap-create { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.snap-create input { flex: 1; min-width: 200px; background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 10px; color: var(--text); padding: 10px 12px; font-family: var(--font); font-size: 13px; }
.snap-create input:focus { outline: none; border-color: var(--accent); }
.snap-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.snap-deploy { display: flex; align-items: center; gap: 9px; }

/* ---------- Integration marketplace ---------- */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); margin-bottom: 18px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); }
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.conn-card { position: relative; background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 16px; transition: border-color .15s, transform .15s; }
.conn-card:hover { border-color: var(--stroke-strong); transform: translateY(-2px); }
.conn-card.connected { border-color: rgba(16,185,129,0.35); }
.conn-pop { position: absolute; top: 12px; right: 12px; font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: #fbbf24; background: rgba(251,191,36,.12); padding: 2px 7px; border-radius: 999px; }
.conn-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; margin-bottom: 12px; }
.conn-name { font-size: 14px; font-weight: 700; }
.conn-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 2px 0 8px; }
.conn-blurb { font-size: 12px; color: var(--muted); line-height: 1.45; min-height: 52px; }
.conn-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.link-btn { background: none; border: none; color: var(--faint); font-size: 12px; cursor: pointer; font-family: var(--font); }
.link-btn:hover { color: #fb7185; }
.wh-card { margin-bottom: 12px; }
.wh-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.url-box { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; }
.url-box code { flex: 1; font-size: 12px; color: #a5b4fc; overflow-x: auto; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.url-box .btn { padding: 5px 11px; font-size: 12px; }
.wh-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.code-box { background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.code-box pre { margin: 0; font-size: 12.5px; color: #cbd2e0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Billing & white-label ---------- */
.plan-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.plan-opt { position: relative; padding: 14px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); cursor: pointer; transition: all .15s; }
.plan-opt:hover { border-color: var(--stroke-strong); background: rgba(255,255,255,0.06); }
.plan-opt.current { border-color: var(--accent); background: rgba(99,102,241,0.12); cursor: default; }
.plan-name { font-size: 13px; font-weight: 700; }
.plan-price { font-size: 18px; font-weight: 700; margin: 3px 0 6px; }
.plan-feat { font-size: 11px; color: var(--faint); line-height: 1.4; min-height: 30px; }
.plan-badge { font-size: 10px; color: var(--accent); font-weight: 700; margin-top: 8px; }
.plan-cta { font-size: 11px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.plan-opt:hover .plan-cta { color: #fff; }
.meter { height: 8px; background: rgba(255,255,255,0.05); border-radius: 5px; overflow: hidden; margin-top: 10px; }
.meter-fill { height: 100%; border-radius: 5px; transition: width .4s cubic-bezier(.22,1,.36,1); }
.mini-select { background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 8px; color: var(--text); padding: 6px 9px; font-family: var(--font); font-size: 12px; }
.brand-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bl-label { display: block; font-size: 11px; color: var(--muted); margin: 0 0 6px 2px; }
.bl-input, #brandCard input[type=text], #brandCard input:not([type]) { width: 100%; background: var(--panel-solid); border: 1px solid var(--stroke); border-radius: 9px; color: var(--text); padding: 10px 12px; font-family: var(--font); font-size: 13px; }
#brandCard input:focus { outline: none; border-color: var(--accent); }
#brandCard input[type=color] { width: 100%; border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel-solid); cursor: pointer; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: rgba(255,255,255,0.12); border-radius: 999px; transition: .2s; }
.slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Autonomous optimization ---------- */
.vrow { margin-bottom: 12px; }
.vrow.retired { opacity: 0.42; }
.vhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.vlabel { font-size: 13px; font-weight: 500; }
.vtag { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--muted); white-space: nowrap; }
.vtag.win { background: rgba(16,185,129,.16); color: #34d399; }
.vtag.sig { background: rgba(251,191,36,.16); color: #fbbf24; }
.vtag.up { background: rgba(16,185,129,.14); color: #34d399; }
.vtag.down { background: rgba(244,63,94,.14); color: #fb7185; }
.vbar-wrap { display: flex; align-items: center; gap: 9px; }
.vbar { flex: 1; height: 8px; background: rgba(255,255,255,0.05); border-radius: 5px; overflow: hidden; }
.vbar-fill { height: 100%; border-radius: 5px; transition: width .4s cubic-bezier(.22,1,.36,1); }
.vrate { font-size: 12px; font-weight: 700; width: 42px; text-align: right; }
.vmeta { font-size: 11px; color: var(--faint); margin-top: 3px; }
.opt-rec { font-size: 12.5px; color: var(--muted); margin-top: 14px; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); border-radius: 10px; line-height: 1.45; }
.opt-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Workflow runtime ---------- */
.wf-toolbar { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--stroke); flex-wrap: wrap; }
.exec-row { display: flex; align-items: center; gap: 11px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.exec-row:hover { background: rgba(255,255,255,0.04); }
.exec-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.exec-dot.done { background: #34d399; }
.exec-dot.running { background: #6366f1; animation: pulse 1.5s infinite; }
.exec-dot.interrupted { background: #9aa0b4; }

/* ---------- desktop default for workflow split ---------- */
.split-sidebar { grid-template-columns: 260px 1fr; }

/* ---------- mobile nav scaffolding ---------- */
.menu-btn { display: none; background: rgba(255,255,255,0.06); border: 1px solid var(--stroke); color: var(--text); width: 38px; height: 38px; border-radius: 10px; font-size: 17px; cursor: pointer; margin-right: 12px; flex: none; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(2,3,8,0.55); backdrop-filter: blur(3px); z-index: 55; animation: fade .2s; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .cols-3 { grid-template-columns: repeat(2,1fr); }
  .brief-grid { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .plan-picker { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 60; transform: translateX(-100%); transition: transform .26s cubic-bezier(.22,1,.36,1); box-shadow: 30px 0 80px -20px rgba(0,0,0,0.8); }
  .sidebar.open { transform: translateX(0) !important; }
  .omni { min-width: 0; padding: 9px 12px; }
  .omni-text, .omni kbd { display: none; }
  .topbar { padding: 14px 18px; }
  .content { padding: 18px 16px 60px; }
  .split-sidebar { grid-template-columns: 1fr; }
  .inbox-list, .inbox-thread { height: auto; max-height: 60vh; }
}
@media (max-width: 680px) {
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .plan-picker { grid-template-columns: 1fr; }
  .brief-grid { grid-template-columns: 1fr; }
  .drawer, .drawer.wide { width: 100vw; max-width: 100vw; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 10px 8px; }
  .topbar-title { font-size: 17px; }
  .mkt-grid { grid-template-columns: 1fr; }
  .tab-bar { overflow-x: auto; }
}
