/* ============================================================
   SLACK KNOWLEDGE BASE — style.css
   Aesthetic: Editorial × Industrial
   Fonts: Syne (Display) · DM Mono (Code) · Literata (Body)
   Theme: Ink black · Amber accent · Sepia detail
============================================================ */

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --ink:       #0C0D10;
  --ink-2:     #141519;
  --ink-3:     #1E2028;
  --ink-4:     #2A2D37;
  --wire:      #32363F;
  --wire-2:    #424654;
  --mute:      #6B7080;
  --ghost:     #9BA0AF;
  --fog:       #C5C9D4;
  --paper:     #E8E4DC;
  --amber:     #E8A827;
  --amber-2:   #F5C24A;
  --amber-dim: rgba(232,168,39,.12);
  --amber-glow:rgba(232,168,39,.06);
  --red:       #C94444;
  --green:     #4AAF6E;
  --blue:      #4A7FC1;

  --f-display: 'Syne', sans-serif;
  --f-mono:    'DM Mono', monospace;
  --f-body:    'Literata', Georgia, serif;

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 12px;

  --header-h:  88px;
  --ticker-h:  28px;
  --sidebar-w: 220px;

  --ease-snap: cubic-bezier(.22,1,.36,1);
  --ease-out:  cubic-bezier(.16,1,.3,1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  background: var(--ink);
  color: var(--fog);
  font-family: var(--f-body);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--ink-2); }
::-webkit-scrollbar-thumb { background: var(--wire-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--mute); }

/* ── Selection ──────────────────────────────────────────── */
::selection { background: var(--amber); color: var(--ink); }

/* ============================================================
   HEADER
============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--ink-2);
  border-bottom: 1px solid var(--wire);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: calc(var(--header-h) - var(--ticker-h));
  padding: 0 24px;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .15em;
  color: var(--ink);
  background: var(--amber);
  padding: 6px 9px;
  border-radius: var(--r-sm);
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--paper);
  line-height: 1;
}

.brand-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .06em;
  margin-top: 4px;
}

/* Nav */
.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-btn {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--mute);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .2s, border-color .2s, background .2s;
}

.nav-btn:hover { color: var(--fog); border-color: var(--wire-2); }
.nav-btn.active { color: var(--amber); border-color: var(--amber); background: var(--amber-dim); }

.nav-icon { font-size: 13px; }

/* Status */
.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mute);
  transition: background .4s;
  animation: pulse-idle 3s infinite;
}
.status-dot.online  { background: var(--green); animation: pulse-active 2s infinite; }
.status-dot.loading { background: var(--amber); animation: pulse-amber 1s infinite; }
.status-dot.error   { background: var(--red); animation: none; }

@keyframes pulse-idle   { 0%,100%{opacity:.4} 50%{opacity:1} }
@keyframes pulse-active { 0%,100%{opacity:.7} 50%{opacity:1} }
@keyframes pulse-amber  { 0%,100%{opacity:.5} 50%{opacity:1} }

.status-text {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .06em;
}

/* Ticker */
.header-ticker {
  height: var(--ticker-h);
  background: var(--ink-3);
  border-top: 1px solid var(--wire);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .06em;
  overflow: hidden;
}

.ticker-sep { color: var(--amber); opacity: .6; }

/* ============================================================
   LAYOUT
============================================================ */
.main-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink-2);
  border-right: 1px solid var(--wire);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--wire);
}

.sidebar-label {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--mute);
  padding: 0 16px 10px;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
  max-height: 320px;
  overflow-y: auto;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ghost);
  text-align: left;
  transition: all .15s;
}
.channel-item:hover { background: var(--ink-3); color: var(--fog); }
.channel-item.active {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: var(--amber);
}

.channel-hash { color: var(--wire-2); margin-right: -2px; }
.channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-count {
  font-size: 9px;
  color: var(--mute);
  background: var(--ink-3);
  padding: 1px 5px;
  border-radius: 10px;
}

.session-info { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.session-id {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--wire-2);
  word-break: break-all;
  letter-spacing: .04em;
}

/* ── Panels ─────────────────────────────────────────────── */
.panel {
  flex: 1;
  display: none;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.panel.active { display: flex; }

/* ── Chat Panel ─────────────────────────────────────────── */
.chat-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--wire);
  flex-shrink: 0;
}

.channel-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-field {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fog);
  background: var(--ink-3);
  border: 1px solid var(--wire);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  min-width: 220px;
  transition: border-color .2s;
}
.select-field:focus { border-color: var(--amber); }

.topbar-meta {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .05em;
}

/* Chat log */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Welcome */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 16px;
  min-height: 380px;
  animation: fade-in .6s var(--ease-out);
}

.welcome-icon {
  font-size: 48px;
  color: var(--amber);
  opacity: .5;
  animation: float 4s ease-in-out infinite;
}

@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.welcome-title {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: -.02em;
}

.welcome-desc {
  font-size: 14px;
  color: var(--mute);
  line-height: 1.7;
  max-width: 440px;
}

.welcome-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.example-btn {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ghost);
  background: var(--ink-3);
  border: 1px solid var(--wire);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: all .2s;
}
.example-btn:hover {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-dim);
}

/* ── Message ────────────────────────────────────────────── */
.msg { animation: msg-in .35s var(--ease-snap); }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.msg-role {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--mute);
  text-transform: uppercase;
}

.msg-ts {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--wire-2);
}

.msg-badge-found {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(232,168,39,.25);
  padding: 1px 6px;
  border-radius: 10px;
}

/* User message */
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-user .msg-body {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--paper);
  background: var(--ink-3);
  border: 1px solid var(--wire);
  border-radius: var(--r-md) var(--r-md) 3px var(--r-md);
  padding: 12px 16px;
  max-width: 620px;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* AI message */
.msg-ai { display: flex; flex-direction: column; gap: 16px; }

.msg-ai .msg-body {
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--fog);
  line-height: 1.75;
  white-space: pre-wrap;
  border-left: 2px solid var(--amber);
  padding-left: 16px;
}

/* Sources */
.msg-sources { display: flex; flex-direction: column; gap: 10px; }

.sources-label {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--amber);
  opacity: .8;
}

.sources-list { display: flex; flex-direction: column; gap: 8px; }

/* Source card */
.source-card {
  background: var(--ink-2);
  border: 1px solid var(--wire);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .2s;
  animation: msg-in .3s var(--ease-snap);
}
.source-card:hover { border-color: var(--amber); }

.source-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--ink-3);
  border-bottom: 1px solid var(--wire);
}

.source-author {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fog);
}

.source-date {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  flex: 1;
}

.source-link {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--amber);
  text-decoration: none;
  letter-spacing: .04em;
  padding: 2px 8px;
  border: 1px solid rgba(232,168,39,.3);
  border-radius: 20px;
  transition: all .2s;
  white-space: nowrap;
}
.source-link:hover { background: var(--amber); color: var(--ink); }
.source-link[href="#"] { opacity: .35; pointer-events: none; }

.source-content {
  padding: 12px 14px;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--ghost);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/* Loading */
.msg-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  opacity: .7;
}

.loading-dots { display: flex; gap: 5px; align-items: center; }
.loading-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dot-pulse { 0%,80%,100%{transform:scale(.6);opacity:.3} 40%{transform:scale(1);opacity:1} }

.loading-text {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: .1em;
}

/* ── Chat Input ─────────────────────────────────────────── */
.chat-input-area {
  flex-shrink: 0;
  padding: 20px 24px 24px;
  background: var(--ink-2);
  border-top: 1px solid var(--wire);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  background: var(--ink-3);
  border: 1px solid var(--wire);
  border-radius: var(--r-md);
  padding: 12px 14px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrapper:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  min-height: 24px;
  max-height: 200px;
}
.chat-textarea::placeholder { color: var(--wire-2); }

.input-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.char-count {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--wire-2);
}

.btn-send {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--amber);
  border: none;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn-send:hover:not(:disabled) { background: var(--amber-2); transform: translateY(-1px); }
.btn-send:active:not(:disabled) { transform: translateY(0); }
.btn-send:disabled { opacity: .35; cursor: not-allowed; }

.send-icon { font-size: 10px; }

.input-hint {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--wire-2);
  margin-top: 8px;
  letter-spacing: .05em;
}

/* ============================================================
   IMPORT PANEL
============================================================ */
.panel-import { overflow-y: auto; }

.import-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.import-header {}
.import-title {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.import-desc { font-size: 14px; color: var(--mute); }

/* Steps */
.import-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.step {
  display: flex;
  gap: 14px;
  background: var(--ink-2);
  border: 1px solid var(--wire);
  border-radius: var(--r-md);
  padding: 16px;
}

.step-num {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--amber);
  opacity: .4;
  line-height: 1;
  flex-shrink: 0;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.step-body strong {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--fog);
}
.step-body span { font-size: 12px; color: var(--mute); }

/* Form */
.import-form {}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }

.field-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--mute);
}

.required { color: var(--amber); }
.optional { color: var(--wire-2); font-size: 9px; }

.input-field {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--fog);
  background: var(--ink-3);
  border: 1px solid var(--wire);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input-field::placeholder { color: var(--wire-2); }
.input-field:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }

/* File drop */
.file-drop-zone {
  position: relative;
  background: var(--ink-3);
  border: 1px dashed var(--wire);
  border-radius: var(--r-md);
  transition: border-color .2s, background .2s;
  cursor: pointer;
  overflow: hidden;
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--amber);
  background: var(--amber-glow);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 24px;
  pointer-events: none;
}

.file-icon { font-size: 28px; color: var(--amber); opacity: .5; }

.file-prompt {
  font-size: 14px;
  color: var(--ghost);
}
.file-link { color: var(--amber); text-decoration: underline; cursor: pointer; }

.file-types {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .08em;
}

.file-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--amber);
  pointer-events: none;
}

/* Actions */
.form-actions { margin-top: 20px; display: flex; gap: 12px; }

.btn-primary {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink);
  background: var(--amber);
  border: none;
  border-radius: var(--r-sm);
  padding: 11px 28px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-primary:hover:not(:disabled) { background: var(--amber-2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--mute);
  background: transparent;
  border: 1px solid var(--wire);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.btn-ghost:hover { color: var(--fog); border-color: var(--ghost); }
.btn-sm { font-size: 9px; padding: 4px 8px; }

/* Progress */
.import-progress { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.progress-bar { height: 3px; background: var(--wire); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width .3s;
  animation: progress-anim 1.5s linear infinite;
  background: linear-gradient(90deg, var(--amber), var(--amber-2), var(--amber));
  background-size: 200%;
}
@keyframes progress-anim { from{background-position:200% 0} to{background-position:-200% 0} }

.progress-msg {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--mute);
  letter-spacing: .08em;
}

/* Result */
.import-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-family: var(--f-mono);
  font-size: 12px;
  border: 1px solid;
}
.import-result.success { color: var(--green); border-color: rgba(74,175,110,.3); background: rgba(74,175,110,.06); }
.import-result.error   { color: var(--red);   border-color: rgba(201,68,68,.3);   background: rgba(201,68,68,.06); }

/* Imported channels list */
.import-channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 8px;
}

.import-channel-card {
  background: var(--ink-2);
  border: 1px solid var(--wire);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
}

.icc-name { color: var(--fog); flex: 1; }
.icc-count { color: var(--amber); }
.icc-date  { color: var(--mute); font-size: 10px; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--wire-2);
  letter-spacing: .06em;
  text-align: center;
  padding: 16px;
}

/* ── Fade in ────────────────────────────────────────────── */
@keyframes fade-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .import-steps { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .chat-log { padding: 20px 16px 0; }
  .chat-input-area { padding: 14px 16px 18px; }
  .header-inner { padding: 0 16px; }
  .welcome-title { font-size: 22px; }
}
