
/* ===== BOSIA design system (templates/design-system/design.css) ===== */
:root {
  --bosia-bg: #0a0e17;
  --bosia-bg-2: #0e1420;
  --bosia-panel: #121a2a;
  --bosia-border: #22304a;
  --bosia-border-2: #2e3f5e;
  --bosia-text: #e8eefc;
  --bosia-muted: #8b9cc0;
  --bosia-accent: #4f8cff;
  --bosia-ok: #2fd46e;
  --bosia-fail: #ff5c66;
  --bosia-warn: #ffb648;
  --bosia-radius: 12px;
  --bosia-font: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --bosia-mono: "Cascadia Code", Consolas, monospace;
  --fs-1: 12px; --fs-2: 14px; --fs-3: 16px; --fs-4: 19px; --fs-5: 24px; --fs-6: 32px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.28);
  --shadow-2: 0 8px 24px rgba(0,0,0,.34);
  --shadow-3: 0 18px 48px rgba(0,0,0,.42);
  --ring: 0 0 0 3px color-mix(in srgb, var(--bosia-accent) 45%, transparent);
  --motion: 160ms cubic-bezier(.2,.8,.2,1);
  --bosia-maxw: 1200px;
}
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bosia-bg); color: var(--bosia-text); font-family: var(--bosia-font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: #7ab0ff; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--bosia-text); line-height: 1.25; margin: 0 0 10px; }
h1 { font-size: var(--fs-5); letter-spacing: -0.02em; } h2 { font-size: var(--fs-4); } h3 { font-size: var(--fs-3); }
p { margin: 6px 0; }
small { color: var(--bosia-muted); }
code, pre { font-family: var(--bosia-mono); }
.bosia-card { background: var(--bosia-panel); border: 1px solid var(--bosia-border); border-radius: var(--bosia-radius); padding: 16px; margin-bottom: 14px; }
.bosia-btn { display: inline-block; padding: 8px 16px; border-radius: 9px; cursor: pointer; border: 1px solid var(--bosia-border-2); background: #1b2740; color: var(--bosia-text); font-family: inherit; font-size: 13px; transition: background 0.15s, transform 0.1s, border-color 0.15s; }
.bosia-btn:hover { background: #243354; border-color: var(--bosia-accent); }
.bosia-btn:active { transform: translateY(1px); }
.bosia-btn:focus-visible { outline: 2px solid #7ab0ff; outline-offset: 2px; }
.bosia-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.bosia-btn-primary { background: var(--bosia-accent); border-color: transparent; color: #fff; font-weight: 600; }
.bosia-btn-success { background: #1f9e4d; border-color: transparent; color: #04210f; font-weight: 600; }
.bosia-btn-danger { background: #c22f3b; border-color: transparent; color: #fff; font-weight: 600; }
.bosia-input { width: 100%; background: var(--bosia-bg-2); color: var(--bosia-text); border: 1px solid var(--bosia-border-2); border-radius: 9px; padding: 9px 12px; font-size: 13px; font-family: inherit; }
.bosia-input:focus { outline: none; border-color: var(--bosia-accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15); }
.bosia-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 650; background: #1b2740; border: 1px solid var(--bosia-border-2); }
.bosia-badge.ok { background: rgba(47, 212, 110, 0.12); color: var(--bosia-ok); border-color: rgba(47, 212, 110, 0.4); }
.bosia-badge.fail { background: rgba(255, 92, 102, 0.12); color: var(--bosia-fail); border-color: rgba(255, 92, 102, 0.4); }
.bosia-badge.warn { background: rgba(255, 182, 72, 0.12); color: var(--bosia-warn); border-color: rgba(255, 182, 72, 0.4); }
.bosia-table { width: 100%; border-collapse: collapse; }
.bosia-table th, .bosia-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--bosia-border); font-size: 13px; }
.bosia-table th { color: var(--bosia-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.bosia-table tr:hover td { background: rgba(79, 140, 255, 0.04); }
.bosia-empty { text-align: center; padding: 48px 16px; color: var(--bosia-muted); border: 1px dashed var(--bosia-border-2); border-radius: var(--bosia-radius); }
.bosia-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #7ab0ff; border-radius: 50%; animation: bosia-spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes bosia-spin { to { transform: rotate(360deg); } }
.bosia-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bosia-muted { color: var(--bosia-muted); }
.bosia-mt { margin-top: 10px; } .bosia-mb { margin-bottom: 10px; }
.bosia-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.bosia-label { font-size: 12px; color: var(--bosia-muted); letter-spacing: .02em; }
.bosia-hint { font-size: 11px; color: var(--bosia-muted); }
.bosia-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--bosia-radius); border: 1px solid var(--bosia-border-2); background: var(--bosia-bg-2); }
.bosia-alert.info { border-color: rgba(79,140,255,.4); }
.bosia-alert.ok { border-color: rgba(47,212,110,.4); }
.bosia-alert.warn { border-color: rgba(255,182,72,.45); }
.bosia-alert.error { border-color: rgba(255,92,102,.45); }
.bosia-kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--bosia-radius); background: var(--bosia-panel); border: 1px solid var(--bosia-border); box-shadow: var(--shadow-1); }
.bosia-kpi .kpi-value { font-size: var(--fs-6); font-weight: 700; letter-spacing: -.02em; }
.bosia-kpi .kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--bosia-muted); }
.bosia-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bosia-border); }
.bosia-tab { padding: 9px 14px; border: none; background: transparent; color: var(--bosia-muted); cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; }
.bosia-tab:hover { color: var(--bosia-text); }
.bosia-tab.active { color: var(--bosia-text); border-bottom-color: var(--bosia-accent); }
.bosia-modal-backdrop { position: fixed; inset: 0; background: rgba(3,6,12,.6); display: grid; place-items: center; padding: 16px; }
.bosia-modal { width: min(520px, 100%); background: var(--bosia-panel); border: 1px solid var(--bosia-border); border-radius: var(--bosia-radius); box-shadow: var(--shadow-3); padding: 20px; }
.bosia-skeleton { background: linear-gradient(90deg, #182238 25%, #22304a 37%, #182238 63%); background-size: 400% 100%; animation: bosia-shimmer 1.4s ease infinite; border-radius: 8px; height: 14px; }
@keyframes bosia-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.bosia-btn-ghost { background: transparent; border-color: transparent; color: var(--bosia-muted); }
.bosia-btn-ghost:hover { color: var(--bosia-text); background: rgba(255,255,255,.04); }
.bosia-btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.bosia-app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.bosia-sidebar { background: var(--bosia-bg-2); border-right: 1px solid var(--bosia-border); padding: 16px; }
.bosia-main { padding: 24px; max-width: var(--bosia-maxw); }
.bosia-stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.bosia-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 820px) { .bosia-app { grid-template-columns: 1fr; } .bosia-sidebar { border-right: none; border-bottom: 1px solid var(--bosia-border); } }
@media (max-width: 600px) {
  body { font-size: 13px; }
  .bosia-table { display: block; overflow-x: auto; }
  .bosia-card { padding: 12px; }
  .bosia-main { padding: 16px; }
}


:root{
  --bosia-bg: #0f0b18;
  --bosia-bg-2: #171024;
  --bosia-panel: #201732;
  --bosia-border: #2e2146;
  --bosia-border-2: #3d2c5c;
  --bosia-text: #f0eaff;
  --bosia-muted: #b3a6c9;
  --bosia-accent: #8b5cf6;
  --bosia-ok: #34d399;
  --bosia-fail: #fb7185;
  --bosia-warn: #fbbf24;
  --bosia-radius: 14px;
  --bosia-font: Inter, "Segoe UI", system-ui, sans-serif;
  --bosia-maxw: 1480px;
}


/* Estrutura sidebar-split: sidebar 248px + topbar + master-detail */
[hidden] { display: none !important; }
body { background:
  radial-gradient(1100px 520px at 82% -8%, rgba(139,92,246,.16), transparent 60%),
  radial-gradient(720px 420px at 6% 108%, rgba(251,113,133,.08), transparent 60%),
  var(--bosia-bg); }
.app-shell { grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.app-sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  gap: 20px; padding: 20px 16px; background: linear-gradient(180deg, rgba(32,23,50,.72), rgba(23,16,36,.92));
  border-right: 1px solid var(--bosia-border); backdrop-filter: blur(10px); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, #8b5cf6, #d946ef 60%, #fb7185); color: #fff;
  font-weight: 800; font-size: 15px; letter-spacing: -.03em; box-shadow: 0 8px 20px rgba(139,92,246,.35);
}
.brand-name { font-size: 15px; font-weight: 750; letter-spacing: -.01em; line-height: 1.15; }
.brand-sub { font-size: 11px; color: var(--bosia-muted); letter-spacing: .08em; text-transform: uppercase; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-caption { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--bosia-muted); padding: 0 10px; margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--bosia-muted);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; text-align: left;
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: rgba(139,92,246,.10); color: var(--bosia-text); }
.nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
.nav-item.active { background: rgba(139,92,246,.16); border-color: var(--bosia-border-2); color: var(--bosia-text); }
.nav-item.active svg { color: #c4b5fd; }
.nav-item .nav-count { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(139,92,246,.24); color: #ddd6fe; }
.side-context { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.context-card { padding: 14px; border-radius: 12px; border: 1px solid var(--bosia-border); background: rgba(15,11,24,.55); }
.context-card .ctx-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--bosia-muted); }
.context-card .ctx-title { font-weight: 650; margin-top: 3px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 9px; color: var(--bosia-muted); }
.stat-row b { color: var(--bosia-text); font-size: 13px; }
.operator { display: flex; align-items: center; gap: 10px; padding: 8px 4px 0; border-top: 1px solid var(--bosia-border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 750; color: #1a0b2e; background: linear-gradient(135deg, #fbbf24, #fb7185); flex: none; }
.operator-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.operator-mail { font-size: 10.5px; color: var(--bosia-muted); word-break: break-all; }
.app-body { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  min-height: 64px; padding: 12px 28px; background: rgba(15,11,24,.78);
  border-bottom: 1px solid var(--bosia-border); backdrop-filter: blur(12px);
}
.crumbs { font-size: 11px; color: var(--bosia-muted); letter-spacing: .06em; text-transform: uppercase; }
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.preview-flag { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #e9d5ff; background: rgba(217,70,239,.14); border: 1px solid rgba(217,70,239,.34); padding: 3px 9px; border-radius: 999px; }
.app-main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 26px 28px 56px; }
.screen { animation: fade .18s ease; }
@keyframes fade { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* split master-detail */
.split { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
.list-panel { position: sticky; top: 88px; }
.detail-panel { min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .spacer { margin-left: auto; }
.kicker { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--bosia-muted); }
.list-item {
  display: block; width: 100%; text-align: left; padding: 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: inherit; font: inherit;
  transition: background var(--motion), border-color var(--motion);
}
.list-item + .list-item { margin-top: 4px; }
.list-item:hover { background: rgba(139,92,246,.08); }
.list-item:focus-visible { outline: none; box-shadow: var(--ring); }
.list-item.active { background: rgba(139,92,246,.14); border-color: var(--bosia-border-2); }
.list-item .li-title { font-size: 13px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.list-item .li-meta { font-size: 11.5px; color: var(--bosia-muted); margin-top: 3px; }
.li-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bosia-accent); box-shadow: 0 0 0 3px rgba(139,92,246,.16); flex: none; }
.li-dot.ok { background: var(--bosia-ok); box-shadow: 0 0 0 3px rgba(52,211,153,.14); }
.li-dot.warn { background: var(--bosia-warn); box-shadow: 0 0 0 3px rgba(251,191,36,.14); }

/* chat */
.chat-head { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--bosia-border); }
.chat-head .spacer { margin-left: auto; }
.participants { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 999px;
  background: rgba(139,92,246,.10); border: 1px solid var(--bosia-border-2); font-size: 12px;
}
.chip .ord { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 750; background: var(--bosia-accent); color: #fff; }
.chip.add { border-style: dashed; color: var(--bosia-muted); cursor: pointer; background: transparent; }
.chat-stream { display: flex; flex-direction: column; gap: 14px; padding: 18px 2px; max-height: 430px; overflow-y: auto; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .who { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 750; flex: none; color: #1a0b2e; }
.who.user { background: linear-gradient(135deg, #c4b5fd, #8b5cf6); }
.who.a { background: linear-gradient(135deg, #a7f3d0, #34d399); }
.who.b { background: linear-gradient(135deg, #fecdd3, #fb7185); }
.who.c { background: linear-gradient(135deg, #fde68a, #fbbf24); }
.bubble { background: var(--bosia-bg-2); border: 1px solid var(--bosia-border); border-radius: 12px; padding: 10px 13px; max-width: 640px; }
.msg.mine { justify-content: flex-end; }
.msg.mine .bubble { background: rgba(139,92,246,.16); border-color: var(--bosia-border-2); }
.msg.meta { font-size: 11.5px; color: var(--bosia-muted); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.msg.meta b { color: var(--bosia-text); font-weight: 650; }
.msg.err .bubble { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.42); }
.loading-line { display: inline-flex; align-items: center; gap: 8px; color: var(--bosia-muted); font-size: 12px; }
.composer { border-top: 1px solid var(--bosia-border); padding-top: 14px; }
.composer textarea.bosia-input { min-height: 76px; resize: vertical; }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.composer-row .spacer { margin-left: auto; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.masked { display: flex; align-items: center; gap: 10px; }
.masked code { background: var(--bosia-bg); border: 1px solid var(--bosia-border); border-radius: 8px; padding: 4px 9px; color: #ddd6fe; font-size: 12.5px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.form-actions .spacer { margin-left: auto; }

/* integration */
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.provider-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.provider-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex: none; }
.provider-logo.openai { background: linear-gradient(135deg, #10a37f, #0e7c61); }
.provider-logo.anthropic { background: linear-gradient(135deg, #d97706, #b45309); }
.provider-head .spacer { margin-left: auto; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--bosia-muted); margin-top: 10px; }
.divider { height: 1px; background: var(--bosia-border); margin: 14px 0; }

/* history */
.transcript { display: flex; flex-direction: column; gap: 12px; }
.history-note { font-size: 12px; color: var(--bosia-muted); display: flex; gap: 8px; align-items: center; }

/* login */
.login-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, 420px); gap: 28px; align-items: center; min-height: calc(100vh - 150px); }
.login-aside h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.08; letter-spacing: -.035em; margin-bottom: 12px; }
.login-aside p.lead { color: var(--bosia-muted); font-size: 15px; max-width: 46ch; }
.feature-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--bosia-muted); }
.feature-list .fi { width: 20px; height: 20px; border-radius: 6px; background: rgba(139,92,246,.18); color: #c4b5fd; display: grid; place-items: center; font-size: 11px; flex: none; margin-top: 1px; }
.login-card { margin: 0; padding: 24px; box-shadow: var(--shadow-2); }
.login-card h2 { margin-bottom: 4px; }

.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.small-note { font-size: 11.5px; color: var(--bosia-muted); }
.mono { font-family: var(--bosia-mono); }
.wrap-any { overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .list-panel { position: static; }
  .integration-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; min-height: 0; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; overflow: visible; }
  .nav-group { flex-direction: row; flex-wrap: wrap; }
  .nav-caption { width: 100%; }
  .side-context { margin-top: 8px; }
  .app-topbar { padding: 10px 16px; }
  .app-main { padding: 18px 16px 44px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand-name { font-size: 14px; }
  .topbar-actions .preview-flag { display: none; }
  .bubble { max-width: 100%; }
  .chat-head { flex-wrap: wrap; }
  .chat-head .spacer { margin-left: 0; }
  .provider-head { flex-wrap: wrap; }
}
