/* ============================================================
   Amnify · canonical theme — light + mono
   ============================================================ */

:root {
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --surface-hover: rgba(0, 0, 0, 0.025);

  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --border-bright: #a1a1aa;

  --text-1: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --text-4: #a1a1aa;

  --accent: #09090b;
  --accent-strong: #27272a;
  --accent-bg: #f4f4f5;
  --accent-bg-hover: #e4e4e7;
  --accent-border: #d4d4d8;

  --brand: #437df1;

  --emerald: #16a34a;
  --amber: #d97706;
  --rose: #e11d48;
  --sky: #0284c7;
  --red: #dc2626;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
body {
  font-size: 12.5px;
}

.mono {
  font-family: var(--mono);
}
.tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.dim {
  color: var(--text-3);
}
.dim-2 {
  color: var(--text-2);
}
.accent-text {
  color: var(--accent);
}
.brand-text {
  color: var(--brand);
}

::selection {
  background: var(--accent-bg-hover);
  color: var(--text-1);
}

/* ============================================================
   STATUS DOTS
   ============================================================ */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
  flex: none;
}
.dot-clean {
  background: var(--emerald);
}
.dot-findings {
  background: var(--amber);
}
.dot-critical {
  background: var(--rose);
}
.dot-running {
  background: var(--text-3);
  animation: pulse 1.6s ease-in-out infinite;
}
.dot-muted {
  background: var(--border-strong);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ============================================================
   CARD / DIVIDER
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ============================================================
   SEVERITY (text-only with leading dot)
   ============================================================ */
.sev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.sev::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex: none;
}
.sev-critical {
  color: var(--rose);
}
.sev-critical::before {
  background: var(--rose);
}
.sev-high {
  color: var(--red);
}
.sev-high::before {
  background: var(--red);
}
.sev-medium {
  color: var(--amber);
}
.sev-medium::before {
  background: var(--amber);
}
.sev-low {
  color: var(--sky);
}
.sev-low::before {
  background: var(--sky);
}
.sev-info {
  color: var(--text-3);
}
.sev-info::before {
  background: var(--text-4);
}

/* ============================================================
   STATUS PILL
   ============================================================ */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  height: 20px;
  border-radius: 4px;
  font-size: 10.5px;
  border: 1px solid;
  white-space: nowrap;
  font-weight: 500;
}
.status-open {
  color: var(--amber);
  border-color: rgba(217, 119, 6, 0.3);
  background: rgba(217, 119, 6, 0.06);
}
.status-resolved {
  color: var(--emerald);
  border-color: rgba(22, 163, 74, 0.3);
  background: rgba(22, 163, 74, 0.06);
}
.status-ignored {
  color: var(--text-3);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.status-running {
  color: var(--text-2);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* ============================================================
   CHIPS / PILLS
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.chip .lucide {
  width: 11px;
  height: 11px;
  flex: none;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  height: 20px;
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  cursor: help;
  transition: background 120ms;
}
.agent-pill:hover {
  background: var(--accent-bg-hover);
}
.agent-pill .lucide {
  width: 11px;
  height: 11px;
  flex: none;
}
.agent-pill.clean {
  color: var(--emerald);
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.05);
}
.agent-pill.running {
  color: var(--text-3);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--mono);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 120ms;
}
.btn .lucide {
  width: 13px;
  height: 13px;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-bright);
}

.btn-subtle {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-subtle:hover {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-strong);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
}
.btn-danger-ghost:hover {
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.4);
}

.btn-sm {
  height: 24px;
  padding: 0 9px;
  font-size: 11px;
}
.btn-sm .lucide {
  width: 12px;
  height: 12px;
}

.btn-link {
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  padding: 0;
  height: auto;
  text-decoration: none;
  cursor: pointer;
}
.btn-link:hover {
  color: var(--text-1);
}

.icon-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: all 120ms;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.icon-btn .lucide {
  width: 13px;
  height: 13px;
}

kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* ============================================================
   INPUTS
   ============================================================ */
.input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text-1);
  font-size: 12.5px;
  font-family: var(--mono);
  width: 100%;
  transition:
    border-color 120ms,
    box-shadow 120ms;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.field-label {
  display: block;
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.checkbox {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  flex: none;
  transition: all 120ms;
}
.checkbox:hover {
  border-color: var(--text-3);
}
.checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox:checked::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.toggle {
  appearance: none;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background 120ms;
  flex: none;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-radius: 999px;
  transition: transform 160ms;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.toggle:checked {
  background: var(--accent);
}
.toggle:checked::after {
  transform: translateX(12px);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 9px 14px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-3);
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition:
    color 120ms,
    border-color 120ms;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tab:hover {
  color: var(--text-1);
}
.tab.active {
  color: var(--text-1);
  border-bottom-color: var(--text-1);
}
.tab-count {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.tab.active .tab-count {
  color: var(--text-2);
  border-color: var(--border-strong);
}

/* ============================================================
   RUN ROW
   ============================================================ */
.run-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  transition: background 120ms;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.run-row:hover {
  background: var(--surface-hover);
}
.run-row + .run-row {
  border-top: 1px solid var(--border);
}

/* ============================================================
   FINDING ROW (run-detail expandable)
   ============================================================ */
.finding {
  border-top: 1px solid var(--border);
  transition: background 120ms;
}
.finding:hover {
  background: var(--surface-hover);
}
.finding-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
}
.finding-body {
  display: none;
  padding: 0 18px 16px 18px;
}
.finding.open .finding-body {
  display: block;
}
.finding.open .finding-chevron {
  transform: rotate(90deg);
}
.finding-chevron {
  transition: transform 160ms;
  flex: none;
  color: var(--text-3);
}

/* ============================================================
   FILTER CHIPS
   ============================================================ */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 120ms;
}
.filter-chip:hover {
  color: var(--text-1);
  border-color: var(--border-strong);
}
.filter-chip.active {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.filter-chip .lucide {
  width: 12px;
  height: 12px;
}

/* ============================================================
   TABLE
   ============================================================ */
.findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.findings-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  white-space: nowrap;
}
.findings-table tbody tr {
  cursor: pointer;
  transition: background 120ms;
}
.findings-table tbody tr:hover {
  background: var(--surface-hover);
}
.findings-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.findings-table tbody td:first-child {
  color: var(--text-1);
}

/* ============================================================
   STACKED BAR
   ============================================================ */
.stack-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  display: flex;
}
.stack-bar > div {
  height: 100%;
}

/* ============================================================
   APP SHELL — sidebar | main | chat
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr 380px;
  min-height: 100vh;
}

/* ----- SIDEBAR ----- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-head {
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.sb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 12px 6px;
}
.sb-logo-mark {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex: none;
}
.sb-logo-mark svg {
  width: 100%;
  height: 100%;
}
.sb-logo-text {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--brand);
  line-height: 1;
}
.sb-org {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: border-color 120ms;
}
.sb-org:hover {
  border-color: var(--border-bright);
}
.sb-org-avatar {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #c7d2fe, #818cf8);
  flex: none;
}
.sb-org-text {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
}
.sb-org-text .top {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1;
  margin-bottom: 2px;
}
.sb-org-text .bot {
  color: var(--text-1);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.sb-section {
  padding-top: 12px;
}
.sb-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-4);
  padding: 6px 10px 4px 10px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 100ms;
  text-decoration: none;
}
.sb-item .lucide {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--text-3);
}
.sb-item:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.sb-item:hover .lucide {
  color: var(--text-1);
}
.sb-item.active {
  background: var(--surface-2);
  color: var(--text-1);
}
.sb-item.active .lucide {
  color: var(--text-1);
}
.sb-item .count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.sb-foot {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.sb-foot .avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #c7d2fe, #818cf8);
  color: #1e1b4b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex: none;
}
.sb-foot .who {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
}
.sb-foot .who .name {
  color: var(--text-1);
  font-weight: 500;
  line-height: 1.1;
}
.sb-foot .who .role {
  color: var(--text-3);
  font-size: 10px;
}

/* ----- MAIN ----- */
.main {
  padding: 28px 32px 60px 32px;
  min-width: 0;
}
.crumbs {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
}
.crumbs .sep {
  color: var(--text-4);
}

.page-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text-1);
}
.page-subtitle {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  margin-top: 6px;
}
.underline-accent {
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.stat-label {
  font-size: 10.5px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.stat-num {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--text-1);
}
.stat-delta {
  font-size: 11px;
  color: var(--text-3);
}

.scanner-name {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.scanner-tool {
  font-size: 11px;
  color: var(--text-3);
}
.scanner-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}
.scanner-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.chat-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  position: relative;
}
.chat-avatar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--emerald);
  border: 2px solid var(--surface);
}
.chat-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.chat-sub {
  font-size: 10.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-context {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  background: var(--surface-2);
}
.ctx-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
}
.ctx-chip .lucide {
  width: 10px;
  height: 10px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 4px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  display: flex;
  gap: 10px;
  animation: fade-up 240ms ease both;
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
}
.msg-avatar.agent {
  background: var(--accent);
  color: var(--bg);
}
.msg-avatar.user {
  background: linear-gradient(135deg, #c7d2fe, #818cf8);
  color: #1e1b4b;
}
.msg-body {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-1);
}
.msg-name {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-2);
}
.msg-name .ts {
  color: var(--text-4);
  margin-left: 4px;
  font-weight: 400;
}
.msg p {
  margin-bottom: 6px;
}
.msg p:last-child {
  margin-bottom: 0;
}
.msg ul {
  margin: 4px 0 6px 0;
  padding-left: 14px;
}
.msg ul li {
  list-style: disc;
  color: var(--text-2);
  margin-bottom: 3px;
}
.msg code {
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-1);
}

.codeblock {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 6px 0;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
}
.codeblock .ln {
  color: var(--text-4);
  margin-right: 12px;
  user-select: none;
}
.codeblock .key {
  color: var(--accent);
  font-weight: 500;
}
.codeblock .str {
  color: var(--amber);
}
.codeblock .com {
  color: var(--text-4);
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text-2);
  margin: 4px 0;
}
.tool-card .tool-tag {
  color: var(--accent);
  font-weight: 500;
}
.tool-card .tool-status {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tool-card .tool-status .lucide {
  width: 11px;
  height: 11px;
  color: var(--emerald);
}

.find-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  height: 19px;
  border-radius: 4px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  vertical-align: 1px;
}
.find-ref:hover {
  background: var(--accent-bg-hover);
}
.find-ref .lucide {
  width: 10px;
  height: 10px;
}

.file-ref {
  font-size: 11.5px;
  color: var(--text-1);
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
}

.conf-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-3);
}
.conf-bar .bar {
  flex: 1;
  max-width: 80px;
  height: 3px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.conf-bar .bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.sugg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 120ms;
}
.sugg:hover {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--accent-border);
}
.sugg .lucide {
  width: 11px;
  height: 11px;
  color: var(--accent);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--text-2);
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
}
.typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes bounce {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-input-wrap {
  padding: 10px 12px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-scope {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  height: 18px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  cursor: pointer;
  font-family: var(--mono);
}
.scope-chip .lucide {
  width: 10px;
  height: 10px;
}
.chat-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px 6px 10px;
  transition:
    border-color 140ms,
    box-shadow 140ms;
}
.chat-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.chat-input textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-1);
  font-size: 12.5px;
  font-family: var(--mono);
  resize: none;
  min-height: 32px;
  line-height: 1.5;
}
.chat-input textarea::placeholder {
  color: var(--text-3);
}
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.chat-send {
  margin-left: auto;
  height: 24px;
  padding: 0 10px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 120ms;
}
.chat-send:hover {
  background: var(--accent-strong);
}
.chat-send .lucide {
  width: 11px;
  height: 11px;
}
.keyhint {
  font-size: 10px;
  color: var(--text-4);
  margin-left: auto;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 160ms ease;
}
.modal-overlay.open {
  display: flex;
  opacity: 1;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.18);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ============================================================
   TERMINAL (modal stream)
   ============================================================ */
.terminal {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  color: var(--text-1);
  line-height: 1.75;
  max-height: 320px;
  overflow-y: auto;
}
.terminal .line {
  opacity: 0;
  animation: line-in 240ms ease forwards;
  white-space: pre-wrap;
}
@keyframes line-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.t-tag {
  color: var(--accent);
  font-weight: 500;
}
.t-tool {
  color: var(--sky);
}
.t-dim {
  color: var(--text-3);
}
.t-success {
  color: var(--emerald);
}
.t-warn {
  color: var(--amber);
}

/* ============================================================
   DRAWER
   ============================================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 200ms;
}
.drawer-overlay.open {
  display: block;
  opacity: 1;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  max-width: 92vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -24px 0 60px -10px rgba(0, 0, 0, 0.12);
  z-index: 41;
}
.drawer.open {
  transform: translateX(0);
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tip] {
  position: relative;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--text-1);
  color: var(--bg);
  font-size: 10.5px;
  padding: 4px 7px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms,
    transform 160ms;
  z-index: 60;
}
[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 999px;
  border: 2px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-bright);
}
::-webkit-scrollbar-track {
  background: transparent;
}
