/* Sci-Expert chat surface.
   Follows the Data Driven Twin (Sensor Research Studio) design system.
   All color tokens use the shared studio palette. */

:root {
  --studio-bg: #070a12;
  --studio-panel: rgba(14, 19, 31, 0.9);
  --studio-panel-strong: #111725;
  --studio-line: rgba(151, 169, 206, 0.15);
  --studio-line-strong: rgba(151, 169, 206, 0.28);
  --studio-text: #f5f7fc;
  --studio-muted: #8d97ad;
  --studio-cyan: #55e6d1;
  --studio-cyan-rgb: 85, 230, 209;
  --studio-violet: #a892ff;
  --studio-violet-rgb: 168, 146, 255;
  --studio-amber: #f5c96a;
  --studio-red: #ff7a8d;
  --studio-radius: 18px;
  --studio-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --studio-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

#sci9b {
  position: relative;
  min-height: calc(100vh - 56px);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 52% -15%, rgba(var(--studio-cyan-rgb), .1), transparent 38%),
    var(--studio-bg);
  background-size: 36px 36px, 36px 36px, auto, auto;
  padding: 34px 24px 46px;
  color: var(--studio-text);
  font-family: var(--studio-font);
  overflow: hidden;
}

/* Ambient glow blobs behind the content */
#sci9b .sx-ambient {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: .08;
  filter: blur(110px);
  z-index: 0;
}
#sci9b .sx-ambient-one {
  width: 520px; height: 520px;
  top: -180px; left: -140px;
  background: var(--studio-cyan);
}
#sci9b .sx-ambient-two {
  width: 600px; height: 600px;
  bottom: -240px; right: -180px;
  background: var(--studio-violet);
}

#sci9b .sx-shell {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Hero ──────────────────────────────────────────────────────── */
#sci9b .sx-hero { padding-bottom: 4px; }

#sci9b .sx-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  color: var(--studio-cyan);
  font-family: var(--studio-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .19em;
  text-transform: uppercase;
}
#sci9b .sx-eyebrow > span {
  width: 22px;
  height: 1px;
  background: var(--studio-cyan);
  box-shadow: 0 0 10px var(--studio-cyan);
}

#sci9b .hd {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}
#sci9b .hd h2 {
  margin: 0;
  font-family: var(--studio-mono);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  text-shadow: 0 0 26px rgba(var(--studio-cyan-rgb), .28);
}

#sci9b .sx-version {
  padding: 5px 8px;
  border: 1px solid rgba(var(--studio-cyan-rgb), .34);
  border-radius: 999px;
  color: var(--studio-cyan);
  background: rgba(var(--studio-cyan-rgb), .07);
  font-family: var(--studio-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

#sci9b .sub {
  font-size: 12.5px;
  color: var(--studio-muted);
  font-family: var(--studio-mono);
  letter-spacing: .02em;
}

/* ── Status bar ────────────────────────────────────────────────── */
.sx-status {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  max-width: 1400px;
  min-height: 43px;
  margin: 0 auto 10px;
  padding: 8px 15px;
  border: 1px solid var(--studio-line);
  border-radius: 11px;
  background: rgba(9, 13, 22, .8);
}
.sx-status-track {
  display: flex;
  align-items: center;
}
.sx-status-dot {
  width: 7px;
  height: 7px;
  border: 1px solid #566076;
  border-radius: 50%;
  background: #111622;
  transition: .2s ease;
}
.sx-status-dot.is-active {
  border-color: var(--studio-cyan);
  background: var(--studio-cyan);
  box-shadow: 0 0 9px rgba(var(--studio-cyan-rgb), .8);
}
.sx-status-line {
  width: 17px;
  height: 1px;
  background: var(--studio-line-strong);
}
.sx-status strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.sx-status > div:nth-child(2) span {
  display: block;
  margin-top: 1px;
  color: var(--studio-muted);
  font-size: 10px;
}
.sx-provenance {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--studio-muted);
  font-family: var(--studio-mono);
  font-size: 9px;
}

/* ── Panels ────────────────────────────────────────────────────── */
#sci9b .sx-panel {
  background: var(--studio-panel);
  border: 1px solid var(--studio-line);
  border-radius: var(--studio-radius);
  padding: 18px 20px;
}
#sci9b .sx-log-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100vh - 380px);
}
#sci9b .panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--studio-line);
  background: rgba(255, 255, 255, .012);
  margin: -18px -20px 14px;
  border-radius: var(--studio-radius) var(--studio-radius) 0 0;
}
#sci9b .panel-heading h3 {
  display: inline;
  margin: 0;
  font-family: var(--studio-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--studio-muted);
}
#sci9b .panel-index {
  color: var(--studio-cyan);
  font-family: var(--studio-mono);
  font-size: 10px;
  letter-spacing: .14em;
  margin-right: 10px;
}
#sci9b .live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--studio-cyan);
  box-shadow: 0 0 9px var(--studio-cyan);
  animation: sx-pulse 2.1s ease-in-out infinite;
}
@keyframes sx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .24; } }

/* ── Conversation ──────────────────────────────────────────────── */
#sci9b .log { flex: 1; overflow-y: auto; padding-right: 5px; }
/* base.html loads Bootstrap, whose .row is display:flex with negative margins.
   That turns .cols into a shrink-to-fit flex item and squeezes the two compare
   columns together. Neutralise it here; .row.user below is more specific and
   keeps its own display:flex. */
#sci9b .row { display: block; margin-right: 0; margin-left: 0; margin-bottom: 17px; }
#sci9b .row.user { display: flex; justify-content: flex-end; }
#sci9b .row.user .msg {
  max-width: 76%;
  background: rgba(var(--studio-violet-rgb), .09);
  border-color: rgba(var(--studio-violet-rgb), .55);
  color: #ede9ff;
}
#sci9b .cols { display: flex; gap: 14px; align-items: flex-start; }
#sci9b .col { flex: 1; min-width: 0; }
#sci9b .who {
  font-family: var(--studio-mono);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--studio-muted);
  margin-bottom: 6px;
}
#sci9b .msg {
  background: rgba(14, 19, 31, 0.6);
  border: 1px solid var(--studio-line);
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--studio-text);
}
#sci9b .msg.err {
  color: var(--studio-red);
  border-color: rgba(255, 90, 110, .4);
  background: rgba(255, 60, 80, .07);
}
#sci9b .think {
  border-left: 2px solid rgba(var(--studio-cyan-rgb), .55);
  background: rgba(var(--studio-cyan-rgb), .035);
  border-radius: 0 10px 10px 0;
  padding: 8px 12px;
  margin-bottom: 8px;
}
#sci9b .think summary {
  cursor: pointer;
  font-family: var(--studio-mono);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--studio-cyan);
  outline: none;
  user-select: none;
}
#sci9b .think .body {
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--studio-muted);
  max-height: 250px;
  overflow-y: auto;
  margin-top: 8px;
}

/* ── Composer ──────────────────────────────────────────────────── */
#sci9b .sx-composer { padding: 16px 20px 18px; }
#sci9b .sx-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
#sci9b .sx-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--studio-line-strong), transparent);
}
#sci9b .bar { display: flex; gap: 11px; align-items: flex-end; }
#sci9b textarea {
  flex: 1;
  resize: none;
  padding: 11px 13px;
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--studio-line);
  border-radius: 11px;
  color: var(--studio-text);
  font: inherit;
  font-family: var(--studio-font);
  font-size: 14.5px;
  min-height: 46px;
  max-height: 170px;
  outline: none;
  transition: border-color .15s;
}
#sci9b textarea::placeholder { color: var(--studio-muted); }
#sci9b textarea:focus {
  border-color: rgba(var(--studio-violet-rgb), .55);
  box-shadow: 0 0 0 3px rgba(var(--studio-violet-rgb), .07);
}
#sci9b .bar button {
  height: 46px;
  padding: 0 24px;
  border: 1px solid rgba(var(--studio-violet-rgb), .55);
  border-radius: 11px;
  background: rgba(var(--studio-violet-rgb), .12);
  color: var(--studio-violet);
  font-family: var(--studio-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
#sci9b .bar button:hover:not(:disabled) {
  background: rgba(var(--studio-violet-rgb), .22);
  box-shadow: 0 0 18px rgba(var(--studio-violet-rgb), .22);
}
#sci9b .bar button:disabled { opacity: .4; cursor: default; }
#sci9b .opt {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 46px;
  font-size: 13px;
  color: var(--studio-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
#sci9b .opt input { accent-color: var(--studio-cyan); }
#sci9b .hint {
  margin-top: 10px;
  font-family: var(--studio-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--studio-muted);
}

/* Bench button (triggers benchmark overlay) */
#sci9b .bench-btn {
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--studio-line-strong);
  border-radius: 8px;
  background: rgba(var(--studio-cyan-rgb), .06);
  color: var(--studio-cyan);
  font-family: var(--studio-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
#sci9b .bench-btn:hover {
  background: rgba(var(--studio-cyan-rgb), .14);
  box-shadow: 0 0 14px rgba(var(--studio-cyan-rgb), .18);
}

/* Scrollbars */
#sci9b .log::-webkit-scrollbar,
#sci9b .think .body::-webkit-scrollbar { width: 7px; }
#sci9b .log::-webkit-scrollbar-thumb,
#sci9b .think .body::-webkit-scrollbar-thumb {
  background: rgba(var(--studio-cyan-rgb), .15);
  border-radius: 4px;
}
