/* HungryDB — clean light theme (white + green) */
:root {
  --bg:        #FFFFFF;
  --bg-warm:   #F4F6F8;
  --bg-card:   #FFFFFF;
  --ink:       #0F1419;
  --ink-mid:   #4B5765;
  --ink-mute:  #8A95A1;
  --line:      #E4E8EC;
  --line-soft: #EFF2F5;
  --accent:      #1F9F5A;     /* clear green */
  --accent-hov:  #1A8C4F;
  --accent-soft: #DFF4E6;
  --ok:        #1F9F5A;
  --warn:      #C97A0F;
  --bad:       #D24637;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
button { font-family: inherit; cursor: pointer; }
.app-root { height: 100%; }

/* ═════════════ DROP ZONE ═════════════ */
.dropzone-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  position: relative;
  overflow: hidden;
}
.hd-header {
  display: flex; align-items: center; justify-content: space-between;
}
.hd-brand { display: flex; align-items: center; gap: 10px; }
.hd-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.hd-logo-sm { width: 22px; height: 22px; border-radius: 6px; }
.hd-wordmark { font-family: 'Inter', sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.hd-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 100px;
  background: var(--bg-card); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-mid);
  font-family: 'JetBrains Mono', monospace;
}
.hd-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(31,159,90,0.18);
}

.hd-center {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; text-align: center;
  padding: 20px 0;
}
.hd-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
}
.hd-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700; font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.1; letter-spacing: -0.02em;
  margin: 0; color: var(--ink); max-width: 18ch;
}
.hd-title-em { color: var(--accent); font-weight: 700; }
.hd-sub { margin: 0; max-width: 54ch; color: var(--ink-mid); font-size: 17px; line-height: 1.55; }

.hd-drop {
  width: min(720px, 90%);
  height: 280px;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: var(--bg-card);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color .25s, background .25s, transform .25s;
}
.hd-drop:hover { border-color: var(--accent); }
.hd-drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.hd-drop-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  z-index: 2; pointer-events: none;
}
.hd-drop-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.hd-drop-headline { font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 600; }
.hd-drop-meta {
  font-size: 13px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}
.hd-link { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Floating chips around the drop zone */
.hd-chips {
  position: absolute; inset: 0; pointer-events: none;
}
.hd-chip {
  position: absolute;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px -12px rgba(40,32,25,0.18), 0 1px 0 rgba(40,32,25,0.04);
  pointer-events: auto;
  animation: hd-float 8s ease-in-out infinite;
  transform-origin: center;
}
.hd-chip-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hd-chip-name {
  font-size: 11px; color: var(--ink); font-weight: 500;
  white-space: nowrap;
}
.hd-chip-size {
  font-size: 10px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}
/* positions and offsets for each chip */
.hd-chip-0 { top: -28px;  left: -90px;  transform: rotate(-6deg);  animation-delay: 0s; }
.hd-chip-1 { top: -36px;  right: -70px; transform: rotate(5deg);   animation-delay: -1.2s; }
.hd-chip-2 { top: 50%;    left: -130px; transform: translateY(-50%) rotate(-3deg); animation-delay: -2.6s; }
.hd-chip-3 { top: 50%;    right: -120px; transform: translateY(-50%) rotate(4deg); animation-delay: -3.8s; }
.hd-chip-4 { bottom: -32px; left: -60px; transform: rotate(7deg);  animation-delay: -5s; }
.hd-chip-5 { bottom: -28px; right: -50px; transform: rotate(-5deg); animation-delay: -6.2s; }
@keyframes hd-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}
.hd-drop.is-drag .hd-chip {
  animation-play-state: paused;
  translate: var(--tx, 0) var(--ty, 0);
  transition: translate .35s ease, opacity .35s;
}
.hd-drop.is-drag .hd-chip-0 { --tx: 80px;   --ty: 80px;  }
.hd-drop.is-drag .hd-chip-1 { --tx: -60px;  --ty: 90px;  }
.hd-drop.is-drag .hd-chip-2 { --tx: 110px;  --ty: 0;     }
.hd-drop.is-drag .hd-chip-3 { --tx: -90px;  --ty: 0;     }
.hd-drop.is-drag .hd-chip-4 { --tx: 50px;   --ty: -70px; }
.hd-drop.is-drag .hd-chip-5 { --tx: -40px;  --ty: -80px; }

.hd-formats {
  display: flex; gap: 8px; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--ink-mute); letter-spacing: 0.04em;
}
.hd-footer {
  display: flex; gap: 8px; justify-content: center;
  font-size: 11px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em;
}
.hd-footer-dot { opacity: 0.5; }

/* ═════════════ EXTRACTION ═════════════ */
.ex-stage {
  height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.ex-grid {
  width: 100%; max-width: 1280px;
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 32px;
  align-items: start;
}
.ex-col { display: flex; flex-direction: column; gap: 14px; }
.ex-coltitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
}
.ex-files { display: flex; flex-direction: column; gap: 8px; }
.ex-file {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--line);
  transition: border-color .3s, opacity .3s;
}
.ex-file-meta { flex: 1; min-width: 0; }
.ex-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-file-note { font-size: 11px; color: var(--ink-mute); }
.ex-file-status { color: var(--ink-mute); width: 18px; display: flex; justify-content: center; }
.ex-active { border-color: var(--accent); }
.ex-active .ex-file-status { color: var(--accent); }
.ex-done { opacity: 0.55; }
.ex-done .ex-file-status { color: var(--ok); }
.ex-wait { color: var(--ink-mute); opacity: .4; }
.ex-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--accent-soft); border-top-color: var(--accent);
  animation: ex-spin .7s linear infinite;
}
@keyframes ex-spin { to { transform: rotate(360deg); } }

.ex-center-col { align-items: stretch; }
.ex-viz {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; position: relative; overflow: hidden;
  height: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.ex-viz-bg {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(4, 1fr);
  padding: 18px; gap: 4px;
  opacity: 0.55;
}
.ex-cell {
  background: var(--bg-warm); border-radius: 2px;
  animation: ex-cell-pulse 1.4s ease-in-out infinite;
}
@keyframes ex-cell-pulse {
  0%, 100% { background: var(--bg-warm); }
  50%      { background: var(--accent-soft); }
}
.ex-percent { display: flex; align-items: baseline; gap: 4px; z-index: 2; }
.ex-percent-num {
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 84px; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}
.ex-percent-pct { font-size: 22px; color: var(--accent); font-weight: 600; }
.ex-viz-label {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); z-index: 2;
}
.ex-progress { height: 2px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.ex-progress-bar {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width .15s linear;
}

.ex-log {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; height: 360px; overflow-y: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  display: flex; flex-direction: column; gap: 8px;
}
.ex-log-line {
  display: flex; gap: 8px; align-items: flex-start;
  animation: ex-log-in .25s ease-out;
}
@keyframes ex-log-in { from { opacity: 0; transform: translateY(4px); } }
.ex-log-mark {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-mute);
  margin-top: 5px; flex-shrink: 0;
}
.ex-log-info  .ex-log-mark { background: var(--ink-mute); }
.ex-log-ok    .ex-log-mark { background: var(--ok); }
.ex-log-infer .ex-log-mark { background: var(--accent); }
.ex-log-done  .ex-log-mark { background: var(--ok); box-shadow: 0 0 0 3px rgba(94,138,77,0.2); }
.ex-log-text { color: var(--ink); line-height: 1.5; }

/* ═════════════ DATABASE VIEW ═════════════ */
.db-stage {
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.db-topbar {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
}
.db-topbar-left { display: flex; align-items: center; gap: 14px; }
.db-brand-mini { display: flex; align-items: center; gap: 8px; }
.db-brand-name { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.db-divider { width: 1px; height: 18px; background: var(--line); }
.db-crumb {
  background: none; border: none; padding: 4px 8px; border-radius: 6px;
  font-size: 13px; color: var(--ink-mid);
}
.db-crumb:hover { background: var(--bg-warm); color: var(--ink); }
.db-crumb.is-active { color: var(--ink); font-weight: 500; }
.db-crumb-sep { color: var(--ink-mute); font-size: 13px; }
.db-topbar-center {
  width: 380px; display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-warm); border-radius: 8px;
  color: var(--ink-mute); font-size: 13px;
}
.db-search-ph { flex: 1; }
.db-kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  padding: 2px 6px; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 4px; color: var(--ink-mid);
}
.db-topbar-right { display: flex; justify-content: flex-end; }
.db-btn-ghost {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: none; border: 1px solid var(--line);
  font-size: 13px; color: var(--ink);
}
.db-btn-ghost:hover { background: var(--bg-warm); }

.db-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 240px 1fr 360px;
}
@media (max-width: 1180px) {
  .db-main { grid-template-columns: 220px 1fr 320px; }
}
@media (max-width: 1024px) {
  .db-main { grid-template-columns: 200px 1fr 300px; }
}
.db-rail {
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 24px;
  background: var(--bg);
  overflow-y: auto;
}
.db-rail-section { display: flex; flex-direction: column; gap: 4px; }
.db-rail-section-bottom { margin-top: auto; gap: 10px; }
.db-rail-h {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); padding: 0 8px 6px;
}
.db-rail-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; text-align: left;
  padding: 7px 8px; border-radius: 6px;
  font-size: 13px; color: var(--ink-mid);
  width: 100%;
}
.db-rail-item:hover { background: var(--bg-warm); color: var(--ink); }
.db-rail-item.is-active {
  background: var(--bg-card); color: var(--ink); font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line);
}
.db-rail-item.is-active svg { color: var(--accent); }
.db-rail-item span:nth-of-type(1) { flex: 1; }
.db-rail-count {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--ink-mute);
}
.db-infer { padding: 0 8px; }
.db-infer-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; color: var(--ink-mute); margin-bottom: 2px;
}
.db-infer-value { font-size: 13px; color: var(--ink); line-height: 1.4; }

.db-content {
  overflow: auto; min-width: 0;
  background: var(--bg);
}
.db-side {
  border-left: 1px solid var(--line);
  background: var(--bg-card);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  overflow: hidden;
}
.db-side-tabs {
  display: flex; padding: 12px 12px 0; gap: 4px;
  border-bottom: 1px solid var(--line);
}
.db-side-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: none; border: none;
  font-size: 13px; color: var(--ink-mute); border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.db-side-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* Schema view */
.schema-wrap { padding: 28px 32px; height: 100%; display: flex; flex-direction: column; }
@media (max-width: 1180px) {
  .schema-wrap { padding: 20px 22px; }
  .grid-wrap   { padding: 20px 22px; }
}
.schema-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
}
.schema-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
  margin-bottom: 4px;
}
.schema-title {
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 28px; line-height: 1.1; letter-spacing: -0.015em; margin: 0;
}
@media (max-width: 1280px) {
  .schema-title { font-size: 28px; }
  .schema-stats { gap: 18px; }
  .schema-stat-num {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 20px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
}
.schema-stats { display: flex; gap: 28px; }
.schema-stat { text-align: right; }
.schema-stat-num {
  font-family: 'Inter', sans-serif; font-size: 24px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.schema-stat-lbl {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; color: var(--ink-mute); margin-top: 2px;
}
.schema-canvas {
  flex: 1;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; position: relative; min-height: 480px;
}
.schema-svg {
  width: 100%; height: 100%; display: block;
  cursor: grab;
  user-select: none;
}
.schema-svg:active { cursor: grabbing; }
.schema-node { animation: schema-in .5s cubic-bezier(.2,.8,.2,1) backwards; }
.schema-node:active { cursor: grabbing; }
.schema-node:hover rect:first-of-type { stroke: var(--accent); stroke-width: 1.5; }

.schema-tools {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.schema-tool {
  width: 28px; height: 28px; border-radius: 5px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; font-weight: 500; color: var(--ink-mid);
  display: flex; align-items: center; justify-content: center;
}
.schema-tool:hover { background: var(--accent-soft); color: var(--accent); }
.schema-tool-text { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; }
@keyframes schema-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; }
}
.schema-edge { animation: schema-edge-in .8s ease-out .5s backwards; }
@keyframes schema-edge-in {
  from { stroke-dashoffset: 60; opacity: 0; }
  to   { opacity: 0.55; }
}
.schema-hint {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font-size: 13px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}

/* Table grid */
.grid-wrap { padding: 28px 32px; height: 100%; display: flex; flex-direction: column; }
.grid-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
}
.grid-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
}
.grid-title {
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 24px; margin: 4px 0 0; letter-spacing: -0.015em;
}
.grid-en { color: var(--ink-mute); font-weight: 400; font-size: 16px; }
.grid-meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}
.grid-meta strong { color: var(--ink); font-weight: 600; }

.grid-table-wrap {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  overflow: auto;
}
.grid-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.grid-table thead th {
  position: sticky; top: 0; background: var(--bg-warm);
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line); z-index: 1;
}
.grid-th { display: flex; flex-direction: column; gap: 2px; }
.grid-th-name {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  font-weight: 500; color: var(--ink);
}
.grid-th-name.is-pk { color: var(--accent); }
.grid-th-name.is-fk { color: var(--ink-mid); }
.grid-th-type {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--ink-mute); letter-spacing: 0.04em;
}
.grid-table tbody tr {
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer; transition: background .1s;
}
.grid-table tbody tr:hover { background: rgba(31,159,90,0.05); }
.grid-table tbody tr.is-active { background: var(--accent-soft); }
.grid-td {
  padding: 11px 14px;
  position: relative;
  vertical-align: top;
}
.grid-td.has-prov:hover { background: rgba(31,159,90,0.10); cursor: cell; }
.grid-td-val { display: block; }
.grid-td-prov {
  display: block; margin-top: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: var(--ink-mute); letter-spacing: 0.04em;
  opacity: 0; transition: opacity .15s;
}
.grid-td.has-prov:hover .grid-td-prov,
tr.is-active .grid-td-prov { opacity: 1; }
.grid-fk {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: var(--bg-warm); padding: 2px 6px; border-radius: 4px;
  color: var(--ink-mid);
}
.grid-null { color: var(--ink-mute); }
.grid-status {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.grid-status-ok   { background: rgba(94,138,77,0.15); color: var(--ok); }
.grid-status-wait { background: rgba(196,154,63,0.18); color: var(--warn); }
.grid-status-bad  { background: rgba(178,58,46,0.12); color: var(--bad); }

/* Provenance overlay */
.prov-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(40,32,25,0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px; animation: prov-in .2s;
}
@keyframes prov-in { from { opacity: 0; } }
.prov-card {
  background: var(--bg); border-radius: 16px;
  width: min(940px, 100%); max-height: 84vh; overflow: hidden;
  display: flex; flex-direction: column;
  position: relative; padding: 24px;
  animation: prov-card-in .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes prov-card-in { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.prov-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--ink-mid);
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.prov-close:hover { background: var(--bg-warm); color: var(--ink); }
.prov-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
  margin-bottom: 16px;
}
.prov-grid { display: grid; grid-template-columns: 280px 1fr; gap: 24px; min-height: 0; }
.prov-left {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px;
}
.prov-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.08em; color: var(--ink-mute); text-transform: uppercase;
  margin-bottom: 6px;
}
.prov-value {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 20px;
  line-height: 1.25; color: var(--ink); margin-bottom: 18px;
  word-break: break-word;
}
.prov-meta { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.prov-meta > div { display: flex; justify-content: space-between; gap: 12px; }
.prov-meta span:first-child { color: var(--ink-mute); font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.prov-right { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.prov-source-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
}
.prov-source-name { font-size: 13px; font-weight: 500; }
.prov-source-loc { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--accent); }
.prov-doc {
  flex: 1; min-height: 0;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; overflow: auto;
}
.prov-doc-empty {
  font-size: 13px; color: var(--ink-mute); text-align: center;
  padding: 40px 20px; 
}

/* Fake document — Excel/CSV */
.fakedoc-xls { font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.fakedoc-xls-bar {
  display: flex; justify-content: space-between; padding: 6px 8px;
  background: #1F6F47; color: #fff; border-radius: 4px 4px 0 0;
  font-size: 11px;
}
.fakedoc-xls-tab { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 3px; }
.fakedoc-xls-grid { border: 1px solid var(--line); border-radius: 0 0 4px 4px; overflow: hidden; }
.fakedoc-xls-row { display: grid; grid-template-columns: 30px repeat(7, 1fr); }
.fakedoc-xls-row.fakedoc-xls-head .fakedoc-xls-cell { background: #E8E8E8; font-weight: 600; }
.fakedoc-xls-cell {
  padding: 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fakedoc-xls-rowhead, .fakedoc-xls-corner {
  background: #E8E8E8; font-weight: 600; text-align: center;
}
.fakedoc-xls-cell.is-hl {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--accent);
  animation: hl-pulse 1.5s ease-out;
}
@keyframes hl-pulse {
  0%   { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 0 rgba(31,159,90,0.45); }
  100% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 8px rgba(31,159,90,0); }
}

.fakedoc-pdf, .fakedoc-word, .fakedoc-scan {
  display: flex; justify-content: center;
}
.fakedoc-pdf-page, .fakedoc-word-page, .fakedoc-scan-paper {
  background: #FDFCFA; padding: 24px;
  width: 100%; max-width: 480px;
  box-shadow: 0 1px 0 var(--line), 0 8px 24px -16px rgba(0,0,0,0.15);
  border-radius: 4px; min-height: 320px;
  font-size: 11px;
}
.fakedoc-pdf-head { display: flex; justify-content: space-between; margin-bottom: 16px; }
.fakedoc-pdf-block { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fakedoc-pdf-line { height: 6px; background: var(--bg-warm); border-radius: 2px; }
.fakedoc-pdf-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.fakedoc-pdf-table th, .fakedoc-pdf-table td {
  text-align: left; padding: 6px; border-bottom: 1px solid var(--line);
}
.fakedoc-pdf-table th { background: var(--bg-warm); }
.fakedoc-hl {
  background: var(--accent-soft); padding: 1px 4px; border-radius: 3px;
  color: var(--accent); font-weight: 600;
}

.fakedoc-word-line { height: 6px; background: var(--bg-warm); border-radius: 2px; margin: 6px 0; width: 100%; }

.fakedoc-scan-paper {
  background: #F8F4EA; transform: rotate(-0.6deg);
  font-family: 'Caveat', cursive; font-size: 13px;
  color: #3a2818;
  position: relative;
}
.fakedoc-scan-line { margin-bottom: 4px; }
.fakedoc-scan-divider { border-top: 1px dashed #888; margin: 10px 0; }
.fakedoc-scan-row {
  display: flex; justify-content: space-between; margin-bottom: 4px;
}
.fakedoc-scan-stamp {
  position: absolute; bottom: 8px; right: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: var(--ink-mute); letter-spacing: 0.1em;
}

/* ═════════════ INTELLIGENCE PANEL ═════════════ */
.intel-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.intel-summaries {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border-bottom: 1px solid var(--line);
}
@media (max-width: 1180px) {
  .intel-summaries { grid-template-columns: 1fr; }
}
.intel-sum {
  background: var(--bg-card); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.intel-sum-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; color: var(--ink-mute);
}
.intel-sum-row { display: flex; justify-content: space-between; align-items: baseline; }
.intel-sum-value {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 18px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
  white-space: nowrap;
}
.intel-sum-delta {
  display: flex; align-items: center; gap: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
}
.intel-up   { color: var(--ok); }
.intel-down { color: var(--bad); }

.intel-divider {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px;
}
.intel-divider span {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
}
.intel-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.intel-chat {
  flex: 1; padding: 0 16px 12px;
  overflow-y: auto; min-height: 80px;
  display: flex; flex-direction: column; gap: 10px;
}
.intel-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px 16px; color: var(--ink-mute);
  text-align: center; font-size: 13px;
  height: 100%;
}
.intel-empty svg { color: var(--accent); }
.intel-msg { display: flex; flex-direction: column; }
.intel-msg.intel-user { align-items: flex-end; }
.intel-msg-user {
  background: var(--bg-warm); padding: 7px 11px; border-radius: 12px 12px 2px 12px;
  font-size: 13px; max-width: 90%;
}
.intel-msg-ai { display: flex; flex-direction: column; gap: 8px; }
.intel-msg-text { font-size: 13px; line-height: 1.45; color: var(--ink); }
.intel-list {
  display: flex; flex-direction: column;
  background: var(--bg-warm); border-radius: 8px; overflow: hidden;
}
.intel-list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; font-size: 11px;
  border-bottom: 1px solid var(--bg-card);
}
.intel-list-row:last-child { border-bottom: none; }
.intel-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
}
.intel-tag-ok   { background: rgba(94,138,77,0.18); color: var(--ok); }
.intel-tag-wait { background: rgba(196,154,63,0.2); color: var(--warn); }
.intel-tag-bad  { background: rgba(178,58,46,0.15); color: var(--bad); }

.intel-bars { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: var(--bg-warm); border-radius: 8px; }
.intel-bar-row { display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; gap: 8px; font-size: 11px; }
.intel-bar-track { height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.intel-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .8s; }
.intel-bar-val { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 10px; }

.intel-export-cta {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; align-self: flex-start;
}
.intel-msg-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; color: var(--accent);
  font-size: 11px; padding: 0; align-self: flex-start;
}

.intel-suggest {
  padding: 0 16px 10px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.intel-chip {
  font-size: 11px; padding: 6px 10px; border-radius: 100px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--ink-mid);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intel-chip:hover { border-color: var(--accent); color: var(--accent); }

.intel-input {
  display: flex; gap: 6px; padding: 12px 16px;
  border-top: 1px solid var(--line); background: var(--bg);
}
.intel-input input {
  flex: 1; padding: 9px 12px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--line);
  font-size: 13px; font-family: inherit; color: var(--ink);
  outline: none;
}
.intel-input input:focus { border-color: var(--accent); }
.intel-input button {
  width: 34px; border-radius: 8px;
  background: var(--accent); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ═════════════ EXPORTS PANEL ═════════════ */
.exports-panel { padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.exports-intro { font-size: 13px; color: var(--ink-mid); line-height: 1.45; margin-bottom: 4px; }
.exports-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.exports-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.exports-meta {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--ink-mute); display: flex; align-items: center; gap: 6px;
}
.exports-meta-dot { opacity: .5; }
.exports-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--ink-mid);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.exports-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.exports-divider { height: 1px; background: var(--line); margin: 8px 0; }
.exports-foot {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.exports-foot-h { font-size: 13px; font-weight: 600; }
.exports-foot-t { font-size: 11px; color: var(--ink-mid); line-height: 1.5; }
.exports-foot-btn {
  align-self: flex-start;
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 4px 0;
  color: var(--accent); font-size: 11px;
}


/* Excel-like grid ───────────────────────────────────────────── */
.grid-meta-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px; margin-left: 6px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 6px; font-size: 12px; font-weight: 500;
  color: var(--ink-mid); cursor: pointer;
  transition: all 0.12s;
}
.grid-meta-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.xl-formula {
  display: flex; align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  height: 32px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.xl-addr {
  min-width: 70px; padding: 0 12px;
  background: var(--bg-warm);
  border-right: 1px solid var(--line);
  display: flex; align-items: center;
  font-weight: 600; color: var(--ink-mid);
  letter-spacing: 0.04em;
}
.xl-fx {
  padding: 0 12px;
  display: flex; align-items: center;
  color: var(--ink-mute);
  border-right: 1px solid var(--line);
  font-style: italic;
  font-family: Georgia, serif;
}
.xl-fbar {
  flex: 1; border: 0; outline: none; padding: 0 12px;
  font: inherit; color: var(--ink); background: transparent;
}
.xl-fbar:focus { background: rgba(31,159,90,0.04); }

.xl-wrap {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  outline: none;
  position: relative;
}
.xl-wrap:focus-visible { box-shadow: 0 0 0 2px rgba(31,159,90,0.2); }

.xl-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  width: max-content;
  min-width: 100%;
}

/* Headers */
.xl-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--bg-warm);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  height: 44px;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  user-select: none;
}
.xl-corner {
  width: 44px;
  background: var(--bg-warm) !important;
  border-right: 1px solid var(--line);
  position: sticky; left: 0; z-index: 4 !important;
}
.xl-th { position: relative; }
.xl-th.is-sel-col { background: rgba(31,159,90,0.08); }
.xl-th-inner {
  padding: 5px 10px;
  display: flex; flex-direction: column; gap: 1px;
  line-height: 1.15;
}
.xl-th-letter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.xl-th-name {
  font-size: 13px; color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xl-th-name.is-pk { color: var(--accent); }
.xl-th-name.is-fk { color: var(--ink-mid); }
.xl-th-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--ink-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xl-resize {
  position: absolute; top: 0; right: -3px;
  width: 6px; height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.xl-resize:hover { background: var(--accent); opacity: 0.4; }

.xl-th-add {
  width: 32px; cursor: pointer;
  color: var(--ink-mute);
  text-align: center;
}
.xl-th-add:hover { color: var(--accent); background: var(--accent-soft); }
.xl-th-add svg { display: inline-block; }

/* Row numbers (gutter) */
.xl-rownum {
  position: sticky; left: 0; z-index: 2;
  width: 44px;
  background: var(--bg-warm);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500;
  color: var(--ink-mute);
  user-select: none; cursor: pointer;
  height: 32px;
}
.xl-rownum:hover { background: var(--accent-soft); color: var(--accent); }
.xl-rownum.is-sel { background: rgba(31,159,90,0.12); color: var(--accent); font-weight: 600; }
.xl-rownum.is-add { color: var(--accent); font-weight: 600; }

/* Cells */
.xl-td {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 0 10px;
  height: 32px;
  position: relative;
  vertical-align: middle;
  cursor: cell;
  background: #fff;
}
.xl-table tbody tr.is-sel-row .xl-td {
  background: rgba(31,159,90,0.025);
}
.xl-td.is-sel {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: #fff !important;
  z-index: 1;
}
.xl-td-val {
  display: inline-block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}

.xl-input {
  position: absolute; inset: 0;
  border: 0; outline: 2px solid var(--accent); outline-offset: -2px;
  padding: 0 10px;
  font: inherit; font-size: 13px;
  background: #fff;
  width: 100%; height: 100%;
}

.xl-prov-dot {
  position: absolute; top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.45;
  cursor: pointer;
}
.xl-prov-dot:hover { opacity: 1; }

.xl-rowend {
  width: 32px;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
  text-align: center;
  vertical-align: middle;
  padding: 0;
}
.xl-row-del {
  width: 22px; height: 22px;
  border: 0; background: transparent;
  border-radius: 4px;
  color: var(--ink-mute);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: all 0.12s;
}
.xl-table tbody tr:hover .xl-row-del { opacity: 1; }
.xl-row-del:hover {
  background: rgba(220, 80, 80, 0.1);
  color: #c0392b;
}

/* Add-row sentinel */
.xl-addrow { cursor: pointer; }
.xl-addrow:hover .xl-rownum { background: var(--accent-soft); color: var(--accent); }
.xl-addrow:hover .xl-td-add { background: var(--accent-soft); color: var(--accent); }
.xl-td-add {
  height: 32px;
  color: var(--ink-mute);
  font-size: 12px;
  padding: 0 10px;
  border-bottom: 1px dashed var(--line);
  border-right: 0;
}

/* ------------- NEW: search popover, new-table form, ingest dropzone ------------- */

/* The center pill needs to anchor the floating results dropdown */
.db-topbar-center { position: relative; }

.db-search-input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  font: inherit; color: var(--ink);
  padding: 0;
}
.db-search-input::placeholder { color: var(--ink-mute); }

.db-search-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
  max-height: 360px; overflow-y: auto;
  padding: 4px;
  z-index: 50;
}
.db-search-empty {
  padding: 14px 12px; font-size: 12px; color: var(--ink-mute);
  text-align: center;
}
.db-search-row {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px; border-radius: 6px;
  background: none; border: 0; text-align: left;
  font: inherit; color: var(--ink);
  cursor: pointer;
}
.db-search-row:hover { background: var(--bg-warm); }
.db-search-kind {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-warm); color: var(--ink-mid);
}
.db-search-kind-table { background: var(--accent-soft); color: var(--accent); }
.db-search-kind-field { background: #f0eee6; color: #7a6a3a; }
.db-search-kind-row   { background: #eef3ee; color: #3a6a4a; }
.db-search-label {
  font-size: 13px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.db-search-hint {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--ink-mute);
}

/* Sidebar �New table� affordance */
.db-rail-add {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-top: 6px;
  background: none; border: 1px dashed var(--line);
  padding: 7px 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-mute);
  cursor: pointer;
}
.db-rail-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.db-rail-newform {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 6px; padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 8px;
}
.db-rail-input, .db-rail-select {
  width: 100%; height: 30px; padding: 0 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; color: var(--ink);
  outline: none;
}
.db-rail-input:focus, .db-rail-select:focus { border-color: var(--accent); }
.db-rail-sublabel {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute); margin-top: 4px;
}
.db-rail-newform-acts {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px;
}
.db-rail-cancel {
  background: none; border: 0; padding: 6px 10px; border-radius: 6px;
  font-size: 12px; color: var(--ink-mid); cursor: pointer;
}
.db-rail-cancel:hover { background: var(--bg-warm); }
.db-rail-create {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: #fff; border: 0;
  padding: 6px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.db-rail-create:disabled { background: var(--ink-mute); cursor: not-allowed; }
.db-rail-newform-hint {
  font-size: 11px; color: var(--ink-mute); line-height: 1.4;
}

/* Agent ingest drop zone */
.intel-ingest {
  margin: 14px 16px 6px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.intel-ingest:hover { border-color: var(--accent); background: var(--accent-soft); }
.intel-ingest.is-drag {
  border-color: var(--accent); background: var(--accent-soft);
  transform: scale(1.01);
}
.intel-ingest-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  background: #fff; border: 1px solid var(--line);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.intel-ingest-text { display: flex; flex-direction: column; min-width: 0; }
.intel-ingest-title { font-size: 12px; font-weight: 600; color: var(--ink); }
.intel-ingest-sub   { font-size: 11px; color: var(--ink-mute); margin-top: 1px; }

/* ───────────────────────────────────────────────────────────── */
/* Activity panel + ingest cards (animated, demo-tone)             */
/* ─────────────────────────────────────────────────────────────── */

.activity-panel {
  display: flex; flex-direction: column;
  flex: 1; min-width: 0; min-height: 0;
  background: var(--bg-card);
}

/* Drop zone (top of panel) */
.activity-drop {
  margin: 14px 14px 10px;
  padding: 12px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
  min-width: 0;
}
.activity-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.activity-drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(31, 159, 90, 0.08);
}
.activity-drop-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  flex-shrink: 0;
}
.activity-drop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-drop-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.activity-drop-sub   { font-size: 11.5px; color: var(--ink-mute); line-height: 1.35; }

/* Summary strip — wraps on narrow sidebar */
.activity-summary {
  margin: 0 14px 10px;
  display: flex; gap: 6px 14px;
  padding: 8px 12px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--ink-mid);
  min-width: 0;
  flex-wrap: wrap;
}
.activity-summary-stat {
  display: inline-flex; align-items: baseline; gap: 5px;
  white-space: nowrap;
}
.activity-summary-stat + .activity-summary-stat::before {
  content: ""; display: inline-block; width: 1px; height: 11px;
  background: var(--line); margin-right: 9px;
  align-self: center;
}
.activity-summary-v {
  font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.activity-summary-v.is-live {
  font-size: 10.5px; font-weight: 600;
  color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: inline-flex; align-items: center; gap: 4px;
}
.activity-summary-v.is-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 159, 90, 0.18);
  animation: ingest-live-pulse 1600ms ease-in-out infinite;
}
@keyframes ingest-live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31, 159, 90, 0.15); }
  50%      { box-shadow: 0 0 0 5px rgba(31, 159, 90, 0.02); }
}

.activity-divider {
  margin: 4px 14px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; align-items: center; gap: 10px;
}
.activity-divider::before, .activity-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.activity-feed {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.activity-feed::-webkit-scrollbar { width: 6px; }
.activity-feed::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.activity-empty {
  text-align: center; padding: 28px 12px; color: var(--ink-mute);
  font-size: 12.5px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* ── Ingest card ───────────────────────────────────────────── */
.ingest-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
  flex-shrink: 0;
  animation: ingest-card-in 320ms cubic-bezier(0.22, 1, 0.36, 1);
  transition: border-color 160ms, box-shadow 160ms;
}
.ingest-card.is-running {
  border-color: rgba(31, 159, 90, 0.35);
  box-shadow: 0 0 0 3px rgba(31, 159, 90, 0.08);
  animation: ingest-card-in 320ms cubic-bezier(0.22, 1, 0.36, 1),
             ingest-card-glow 2200ms ease-in-out infinite;
}
.ingest-card.is-done.is-expanded { border-color: rgba(31, 159, 90, 0.28); }

@keyframes ingest-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ingest-card-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31, 159, 90, 0.06); }
  50%      { box-shadow: 0 0 0 4px rgba(31, 159, 90, 0.14); }
}

/* Card head */
.ingest-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  min-width: 0;
}
.ingest-card.is-running .ingest-card-head { cursor: default; }
.ingest-card.is-expanded .ingest-card-head { border-bottom: 1px solid var(--line-soft); }

.ingest-card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ingest-card-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.ingest-card-sub {
  font-size: 11px; color: var(--ink-mute);
  display: flex; align-items: center; gap: 6px;
  min-width: 0; flex-wrap: wrap;
}
.ingest-dot-sep { opacity: 0.5; }
.ingest-table-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 600; cursor: pointer;
  transition: background 120ms;
  white-space: nowrap;
}
.ingest-table-chip:hover { background: #C9ECD5; }

.ingest-running-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px 3px 7px; border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ingest-spinner {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  border-top-color: transparent;
  animation: ingest-spin 700ms linear infinite;
}
@keyframes ingest-spin { to { transform: rotate(360deg); } }

.ingest-expand-btn {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--ink-mute); display: grid; place-items: center;
  flex-shrink: 0;
}
.ingest-expand-btn:hover { color: var(--ink); }
.ingest-chev { display: inline-flex; transition: transform 200ms ease; }
.ingest-chev.is-open { transform: rotate(180deg); }

/* Running body — phases */
.ingest-card-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line-soft);
}
.ingest-progress {
  height: 3px; background: var(--line-soft); border-radius: 999px;
  overflow: hidden; margin-bottom: 10px;
}
.ingest-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ingest-phases { display: flex; flex-direction: column; gap: 5px; }
.ingest-phase {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px;
  color: var(--ink-mute);
  transition: color 200ms;
}
.ingest-phase.is-active { color: var(--ink); font-weight: 600; }
.ingest-phase.is-past   { color: var(--ink-mid); }
.ingest-phase-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  transition: background 200ms;
}
.ingest-phase.is-active .ingest-phase-dot {
  background: var(--accent);
  animation: ingest-pulse 1100ms ease-in-out infinite;
}
.ingest-phase.is-past .ingest-phase-dot { background: var(--accent); }
@keyframes ingest-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(31, 159, 90, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(31, 159, 90, 0); }
}
.ingest-phase-label { flex: 1; min-width: 0; }
.ingest-phase svg { color: var(--accent); }

/* Expanded — stats + row preview */
.ingest-card-expanded {
  padding: 10px 12px 12px;
  animation: ingest-expand-in 240ms ease;
}
@keyframes ingest-expand-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ingest-stats {
  display: flex; gap: 6px 14px;
  padding: 6px 10px;
  background: var(--bg-warm);
  border-radius: 6px;
  margin-bottom: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.ingest-stat { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ingest-stat + .ingest-stat::before {
  content: ""; display: inline-block; width: 1px; height: 10px;
  background: var(--line);
  margin-right: 8px; align-self: center;
}
.ingest-stat-v {
  font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ingest-stat-v.ingest-stat-ok { color: var(--accent); }
.ingest-stat-l {
  font-size: 10.5px; color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.ingest-rowprev-h {
  font-size: 11px; color: var(--ink-mid); margin-bottom: 6px;
}
.ingest-rowprev-h strong { color: var(--ink); font-weight: 600; }

.ingest-rows {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--bg-card);
  min-width: 0;
}
.ingest-cell {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 10px; padding: 6px 10px;
  font-size: 11.5px;
  cursor: pointer;
  opacity: 0;
  animation: ingest-row-in 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: background 120ms;
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
}
.ingest-cell:last-child { border-bottom: none; }
.ingest-cell:hover { background: var(--bg-warm); }
@keyframes ingest-row-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ingest-cell-name {
  color: var(--ink-mid);
  display: flex; align-items: center; gap: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ingest-cell-pk, .ingest-cell-fk {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
  padding: 1px 4px; border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  flex-shrink: 0;
}
.ingest-cell-pk { background: var(--accent-soft); color: var(--accent); }
.ingest-cell-fk { background: #EAF1FA; color: #2A5BB0; }
.ingest-cell-val {
  color: var(--ink); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 0;
}
.ingest-val-money::before { content: "€"; opacity: 0.55; margin-right: 1px; font-weight: 400; }
.ingest-val-pk           { color: var(--accent); font-weight: 600; }

.ingest-open-table {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 7px 10px;
  background: var(--bg-card); color: var(--ink-mid);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.ingest-open-table:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(31, 159, 90, 0.35);
}

/* Small "switch to Activity" hint inside Intelligence panel */
.intel-activity-hint {
  margin: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(31, 159, 90, 0.18);
  color: var(--accent);
  border-radius: 8px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 140ms;
  font-family: inherit;
}
.intel-activity-hint:hover { background: #D2EFDC; }
.intel-activity-hint span { flex: 1; }
.intel-activity-hint strong { color: var(--ink); font-weight: 600; }