/* ============================================================
   Corp Brain v2 - style.css
   Dark theme matching corp_brain_mock_design.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #0F1729;
  --surface: #152036;
  --surface2: #1A2640;
  --border: #243049;
  --orange: #FF6B00;
  --orange-dim: rgba(255,107,0,0.12);
  --orange-glow: rgba(255,107,0,0.25);
  --green: #3FB950;
  --green-dim: rgba(63,185,80,0.12);
  --blue: #58A6FF;
  --blue-dim: rgba(88,166,255,0.12);
  --purple: #BC8CFF;
  --purple-dim: rgba(188,140,255,0.12);
  --text: #E6EDF3;
  --text-muted: #7D8590;
  --text-dim: #484F58;
}

/* Light theme override */
[data-theme="light"] {
  --bg: #F5F3EF;
  --surface: #FFFFFF;
  --surface2: #EDEBE7;
  --border: #D4D0C8;
  --orange-dim: rgba(255,107,0,0.08);
  --orange-glow: rgba(255,107,0,0.15);
  --green-dim: rgba(63,185,80,0.08);
  --blue-dim: rgba(88,166,255,0.08);
  --purple-dim: rgba(188,140,255,0.08);
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --text-dim: #999999;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  padding: 32px;
}

/* ── HEADER ── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--bg);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--orange);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.logo-icon svg { width: 20px; height: 20px; }

.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.logo-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid var(--orange);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.5px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.2s, border-color 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .theme-toggle { margin-left: auto; }
}
.theme-toggle:hover { color: var(--orange); border-color: var(--orange); }
.theme-toggle svg { width: 16px; height: 16px; }
/* Dark mode: show sun (to switch to light), hide moon */
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

.nav-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
}

.nav-pill.active {
  background: var(--orange-dim);
  border-color: var(--orange);
  color: var(--orange);
}

.nav-pill:hover { color: var(--text); }

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }

.view__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text);
  margin-bottom: 4px;
}

.view__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── STATS BAR ── */
.kb-stats-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.kb-stat { display: flex; flex-direction: column; gap: 2px; }

.kb-stat__value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}

.kb-stat__value--brand { color: var(--orange); }

.kb-stat__label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.kb-stat-divider {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
}

/* ── FILTER BAR ── */
.kb-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.kb-filter-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  transition: all 0.15s;
}

.kb-filter-chip:hover { border-color: var(--text-dim); color: var(--text); }
.kb-filter-chip.active { border-color: var(--text-dim); color: var(--text); background: var(--surface); }
.kb-filter-chip.pdf.active { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
.kb-filter-chip.xlsx.active { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.kb-filter-chip.docx.active { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.kb-filter-chip.txt.active { border-color: var(--text-dim); color: var(--text); background: var(--surface); }

.kb-type-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.kb-type-dot--pdf { background: var(--orange); }
.kb-type-dot--xlsx { background: var(--green); }
.kb-type-dot--docx { background: var(--blue); }
.kb-type-dot--txt { background: var(--text-muted); }

/* ── UPLOAD STRIP ── */
.db-upload-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  align-items: center;
}

.db-upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.15s;
}

.db-upload-btn svg { width: 14px; height: 14px; }
.db-upload-btn:hover { border-color: var(--orange); color: var(--orange); }

.db-upload-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── DB SECTIONS ── */
.db-section { margin-bottom: 28px; }

.db-section__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── DOCUMENT GRID ── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.doc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.doc-card.pdf::before { background: var(--orange); }
.doc-card.xlsx::before { background: var(--green); }
.doc-card.docx::before { background: var(--blue); }
.doc-card.txt::before { background: var(--text-muted); }

.doc-card:hover { border-color: var(--text-dim); transform: translateY(-2px); }
.doc-card:hover::before { opacity: 1; }

.doc-card__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.doc-card__badge {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.doc-card__badge.pdf { background: var(--orange-dim); color: var(--orange); }
.doc-card__badge.xlsx, .doc-card__badge.csv { background: var(--green-dim); color: var(--green); }
.doc-card__badge.docx { background: var(--blue-dim); color: var(--blue); }
.doc-card__badge.txt { background: var(--surface2); color: var(--text-muted); }

/* Legacy class names (from mockup) */
.doc-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }

.doc-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
  font-weight: 700; font-family: 'DM Mono', monospace;
}
.doc-icon.pdf { background: var(--orange-dim); color: var(--orange); }
.doc-icon.xlsx { background: var(--green-dim); color: var(--green); }
.doc-icon.docx { background: var(--blue-dim); color: var(--blue); }

.doc-meta { flex: 1; min-width: 0; }

.doc-card__name, .doc-name {
  font-size: 13px; font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.doc-size {
  font-size: 11px; color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  margin-top: 2px;
}

.doc-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.doc-card__chunks {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

/* Doc suggested questions */
.doc-card__suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.doc-suggestions__loading, .doc-suggestions__empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.doc-suggestion-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.doc-suggestion-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.doc-card__delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}
.doc-card__delete svg { width: 14px; height: 14px; }
.doc-card__delete:hover { color: #f85149; }

/* Topic tags (for mockup-style cards) */
.doc-topics {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 8px;
}

.topic-tag {
  font-size: 10px; font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.doc-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.doc-chunks {
  font-size: 11px; color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

.doc-connections {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 3px;
}

.connection-dots { display: flex; gap: 3px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; opacity: 0.7; }

.db-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 0;
}

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

.db-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.db-item:hover { border-color: var(--text-dim); }

.db-item__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.db-item__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.db-table-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

.db-table-icon {
  width: 28px; height: 28px;
  background: var(--green-dim);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--green);
}

/* ── NL QUERY ── */
.db-query-area {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.db-query-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 10px 14px;
  resize: vertical;
  outline: none;
}

.db-query-input:focus { border-color: var(--orange); }
.db-query-input::placeholder { color: var(--text-dim); }

.db-query-btn {
  padding: 10px 20px;
  background: var(--orange);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.db-query-btn:hover { background: #e05e00; }

.db-query-result {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
}

.db-query-sql {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--orange);
  background: var(--surface2);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.db-query-table, .db-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.db-query-table th, .db-result-table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.3px;
}

.db-query-table td, .db-result-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.db-query-count, .db-result-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
}

/* ── UPLOAD ZONE (mockup style) ── */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px;
}
.upload-zone:hover { border-color: var(--orange); color: var(--orange); }

/* ── CHAT ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 140px; /* 140px bottom = prostor za fixed input */
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.chat-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 60px 20px;
}

.chat-message {
  margin-bottom: 20px;
}

.chat-message--user {
  display: flex;
  justify-content: flex-end;
}

.chat-message--user .chat-bubble {
  background: var(--orange-dim);
  border: 1px solid rgba(255,107,0,0.3);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px 12px 2px 12px;
  max-width: 70%;
  font-size: 14px;
}

.chat-message--assistant .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 2px 12px 12px 12px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.6;
}

.chat-citation {
  font-size: 11px;
  color: var(--orange);
  font-family: 'DM Mono', monospace;
}

.chat-bubble strong { font-weight: 600; color: var(--text); }
.chat-bubble em { font-style: italic; color: var(--text-muted); }
.chat-bubble .chat-h2 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; }
.chat-bubble .chat-h3 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; color: var(--text-muted); }
.chat-bubble .chat-hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.chat-status {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
  font-style: italic;
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  max-width: 860px;
  margin: 0 auto;
  z-index: 50;
}

.chat-input-area:focus-within {
  border-color: var(--orange);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  resize: none;
  max-height: 120px;
}

.chat-input::placeholder { color: var(--text-dim); }

.mic-btn, .audio-toggle-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.mic-btn svg, .audio-toggle-btn svg { width: 15px; height: 15px; }

.mic-btn:hover, .audio-toggle-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.mic-btn.mic-btn--recording {
  background: rgba(255,107,0,0.2);
  border-color: var(--orange);
  color: var(--orange);
}

.audio-toggle-btn.audio-toggle-btn--active {
  background: var(--orange-dim);
  border-color: var(--orange);
  color: var(--orange);
}

.chat-send {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--orange);
  border: none;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.chat-send svg { width: 16px; height: 16px; }
.chat-send:hover { background: #e05e00; }

/* ── SNIPER ── */
.sniper-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
  font-style: italic;
}
.sniper-input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.sniper-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 14px;
  resize: vertical;
  min-height: 120px;
  outline: none;
}

.sniper-input:focus { border-color: var(--orange); }
.sniper-input::placeholder { color: var(--text-dim); }

.sniper-btn {
  align-self: flex-start;
  padding: 10px 24px;
  background: var(--orange);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.sniper-btn:hover { background: #e05e00; }

.sniper-status {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 0;
  font-style: italic;
}

.sniper-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

/* Sniper card */
.sniper-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sniper-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sniper-card__identity h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.sniper-card__identity p {
  font-size: 13px;
  color: var(--text-muted);
}

.sniper-scores {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.sniper-score {
  text-align: center;
}

.sniper-score__value {
  font-size: 20px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
}

.sniper-score__label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.score--high { color: var(--green); }
.score--medium { color: var(--orange); }
.score--low { color: var(--text-muted); }

.sniper-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sniper-meta__chip {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.sniper-signals__row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.sniper-signals__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 40px;
}

.sniper-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.sniper-tag--tech {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(88,166,255,0.3);
}

.sniper-tag--pain {
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(255,107,0,0.3);
}

.sniper-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.sniper-summary__alt {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.sniper-company-intel {
  padding: 12px 16px;
  background: var(--blue-dim);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 4px;
}

.sniper-opportunity {
  padding: 12px 16px;
  background: var(--green-dim);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.sniper-approach {
  padding: 12px 16px;
  background: var(--purple-dim);
  border-left: 3px solid var(--purple);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.sniper-section-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Reputation score breakdown */
.sniper-reputation {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
}

.sniper-reputation__source {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.sniper-reputation__source-name {
  min-width: 120px;
  font-weight: 500;
  color: var(--text);
  text-transform: capitalize;
}

.sniper-reputation__bar {
  display: flex;
  flex: 1;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface2);
}

.sniper-reputation__bar-pos {
  background: var(--green);
}

.sniper-reputation__bar-neu {
  background: var(--text-muted);
  opacity: 0.4;
}

.sniper-reputation__bar-neg {
  background: var(--red);
}

.sniper-reputation__pcts {
  font-size: 11px;
  white-space: nowrap;
  min-width: 140px;
  text-align: right;
}

.rep-pos { color: var(--green); }
.rep-neu { color: var(--text-muted); }
.rep-neg { color: var(--red); }

.sniper-reputation__negatives {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Source labels */
.sniper-sources {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

/* Action buttons (copy / export) */
.sniper-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.sniper-action-btn {
  padding: 6px 16px;
  font-size: 12px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}
.sniper-action-btn:hover { opacity: 0.85; }
.sniper-action-btn--secondary {
  background: transparent;
  color: var(--brand);
}
.sniper-action-btn--secondary:hover {
  background: var(--brand);
  color: #fff;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2, #1e2430);
  color: var(--text, #e6edf3);
  border: 1px solid var(--border, #30363d);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  pointer-events: none;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Disambiguation */
.sniper-disambiguation__title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sniper-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sniper-candidate {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.sniper-candidate:hover {
  border-color: var(--orange);
  background: var(--surface2);
}

.sniper-candidate__name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.sniper-candidate__identity {
  font-size: 13px;
  color: var(--text-muted);
}

.sniper-candidate__desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.sniper-history-item {
  cursor: pointer;
}

.sniper-history-item:hover {
  border-color: var(--orange);
}

/* ── POJMOVNIK ── */
.gloss-actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.gloss-search {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}

.gloss-search:focus { border-color: var(--orange); }
.gloss-search::placeholder { color: var(--text-dim); }

.gloss-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.gloss-btn--primary {
  background: var(--orange);
  border: none;
  color: white;
}

.gloss-btn--primary:hover { background: #e05e00; }

.gloss-btn--secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.gloss-btn--secondary:hover { border-color: var(--text-dim); color: var(--text); }

.gloss-form-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gloss-input, .gloss-textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
}

.gloss-input:focus, .gloss-textarea:focus { border-color: var(--orange); }
.gloss-textarea { resize: vertical; }

.gloss-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

.gloss-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s;
}

.gloss-item:hover { border-color: var(--text-dim); }

.gloss-item__content { flex: 1; }

.gloss-item__term {
  font-size: 14px;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 4px;
}

.gloss-item__def {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.gloss-item__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.gloss-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.gloss-action-btn svg { width: 14px; height: 14px; }
.gloss-action-btn:hover { border-color: var(--orange); color: var(--orange); }
.gloss-action-btn--delete:hover { border-color: #f85149; color: #f85149; }

/* ── BOTTOM NAV (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
}

.bottom-nav__inner {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
}

.bottom-nav__item svg { width: 20px; height: 20px; }
.bottom-nav__item.active { color: var(--orange); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Desktop: hide hamburger and mobile panel, show sidebar */
@media (min-width: 769px) {
  .conv-toggle-btn { display: none !important; }
  .conv-list-panel { display: none !important; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  body { padding: 12px; padding-bottom: 72px; }

  /* Header: logo only, nav pills hidden */
  .header { margin-bottom: 20px; }
  .header-right { display: none; }
  .bottom-nav { display: block; }

  /* View titles */
  .view__title { font-size: 18px; }
  .view__subtitle { font-size: 12px; margin-bottom: 16px; }

  /* Chat: mobile layout - hide sidebar, use hamburger panel */
  .conv-sidebar { display: none !important; }
  .chat-layout { flex-direction: column; height: auto; }

  .chat-messages {
    min-height: 0;
    max-height: calc(100dvh - 170px);
    padding-bottom: 120px; /* prostor iznad fixed inputa na mobileu */
  }

  .chat-input-area {
    position: fixed;
    bottom: 56px;
    left: 0; right: 0;
    border-radius: 0;
    border-left: none; border-right: none;
    padding: 8px 12px;
    z-index: 100;
    background: var(--surface);
  }

  .chat-message--user .chat-bubble { max-width: 85%; }
  .chat-message--assistant .chat-bubble { max-width: 95%; font-size: 13px; }

  /* Baza Podataka */
  .doc-grid { grid-template-columns: 1fr; }
  .kb-stats-bar { padding: 10px 14px; gap: 16px; }
  .kb-filter-bar { flex-wrap: wrap; }
  .db-upload-strip { flex-wrap: wrap; }
  .db-query-area { flex-direction: column; }
  .db-query-btn { width: 100%; }
  .db-result-table { font-size: 11px; }
  .db-result-table th, .db-result-table td { padding: 6px 6px; }

  /* Sniper */
  .sniper-card__header { flex-direction: column; }
  .sniper-scores { align-self: flex-start; }
  .sniper-input { min-height: 80px; }

  /* Pojmovnik */
  .gloss-actions-bar { flex-direction: column; }
  .gloss-search { width: 100%; }
  .gloss-btn { width: 100%; text-align: center; }
  .gloss-item { flex-direction: column; gap: 8px; }
  .gloss-item__actions { align-self: flex-end; }

  /* Bottom nav: larger tap targets */
  .bottom-nav__inner { padding: 6px 0 env(safe-area-inset-bottom, 6px); }
  .bottom-nav__item { padding: 6px 8px; min-width: 40px; min-height: 44px; }
  .bottom-nav__item svg { width: 22px; height: 22px; }
  .bottom-nav__item span { font-size: 10px; }

  /* Pitaj Brain: input is fixed, no extra padding needed */
  #view-pitaj-brain { padding-bottom: 0; }
}

/* ============================================================
   Chat Layout + Conversation History
   ============================================================ */

/* Desktop: sidebar + main flex layout */
.chat-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 140px);
}

/* Left sidebar - visible on desktop, hidden on mobile */
.conv-sidebar {
  display: flex;
  flex-direction: column;
  width: 260px;
  min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
  overflow: hidden;
}

.conv-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.new-conv-btn-sm {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.new-conv-btn-sm:hover { color: var(--orange); border-color: var(--orange); }
.new-conv-btn-sm svg { width: 16px; height: 16px; }

.conv-sidebar .conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* Logout button (bottom of sidebar) */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.logout-btn:hover { color: var(--orange); background: var(--surface2); }
.logout-btn svg { flex-shrink: 0; }

/* ROI Badge (compact, in chat header) */
.chat-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.roi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: 'DM Mono', monospace;
}
.roi-badge:hover { border-color: var(--green); }
.roi-badge svg { color: var(--green); flex-shrink: 0; }

/* ROI Expandable Panel */
.roi-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.roi-panel__stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}
@media (max-width: 480px) {
  .roi-panel__stats { grid-template-columns: 1fr 1fr; }
}

/* Legacy ROI widget (no longer used) */
.roi-widget { display: none; }
.roi-widget__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.roi-widget__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.roi-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.roi-stat__value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: 'DM Mono', monospace;
}
.roi-stat__value--money {
  color: var(--green);
}
.roi-stat__label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Main chat area fills remaining space */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  padding-left: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

.chat-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger toggle - compact icon button */
.conv-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.conv-toggle-btn svg { width: 16px; height: 16px; }
.conv-toggle-btn:hover { border-color: var(--orange); color: var(--orange); }

/* New conversation - compact icon button (no text on mobile) */
.new-conv-btn {
  display: none;
}

/* Panel shown/hidden via JS (hidden attr) - mobile only */
.conv-list-panel[hidden] { display: none !important; }
.conv-list-panel {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  max-height: 350px;
  overflow-y: auto;
}
.conv-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.conv-list-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0 4px;
}
.conv-list-close:hover { color: var(--text); }

.conv-list { padding: 4px 0; }

.conv-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
  gap: 8px;
  position: relative;
}
.conv-item:hover { background: var(--surface2); }
.conv-item--active { background: var(--orange-dim); }
.conv-item--active:hover { background: var(--orange-dim); }

.conv-item__title {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.conv-item__delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.conv-item:hover .conv-item__delete { opacity: 1; }
.sniper-history-item .conv-item__delete { opacity: 0.5; } /* uvijek vidljiv (touch devices) */
.sniper-history-item:hover .conv-item__delete { opacity: 1; }
.conv-item__delete:hover { color: #DC2626; }

/* Audio player UX */
.audio-preparing {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
.audio-player-wrap {
  padding: 8px 0 12px;
}
.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.audio-play-btn:hover:not(:disabled) { opacity: 0.85; }
.audio-play-btn:disabled { opacity: 0.6; cursor: default; }
.audio-play-btn svg { flex-shrink: 0; }
.audio-text-revealed {
  animation: fadeInText 0.3s ease;
}
@keyframes fadeInText {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LOGIN OVERLAY ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 320px;
  max-width: 90vw;
}
.login-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  margin-bottom: 12px;
}
.login-input:focus { border-color: var(--orange); }
.login-input::placeholder { color: var(--text-dim); }
.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--orange);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.login-btn:hover { background: #e05e00; }
.login-error {
  color: #f85149;
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}

/* ── Print stylesheet ────────────────────────────────────────────── */
@media print {
  header, .bottom-nav, #conv-sidebar, .sniper-actions,
  .sniper-history, .sniper-input-area, #login-overlay,
  #conv-list-panel, .conv-toggle-btn { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .view { display: block !important; position: static !important; }
  .sniper-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #000 !important;
  }
  .sniper-card * { color: inherit !important; }
  .sniper-score__value { color: #333 !important; }
  .sniper-sources { color: #666 !important; }
}

/* ── KB Health metrics ───────────────────────────────────────────── */
.kb-health__list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.kb-health__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.kb-health__name {
  min-width: 160px;
  max-width: 160px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-health__bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.kb-health__bar {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.3s;
}
.kb-health__count {
  min-width: 40px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  font-family: 'DM Mono', monospace;
}

/* ── View max-width containers (ChatGPT/Claude style) ── */
#view-baza-podataka { max-width: 900px; margin: 0 auto; }
#view-sniper { max-width: 900px; margin: 0 auto; }
#view-pojmovnik { max-width: 700px; margin: 0 auto; }
#view-admin { max-width: 700px; margin: 0 auto; }

/* KB stats bar: compact, not full-width */
.kb-stats-bar { width: fit-content; }

/* KB health: more visible bars + container styling */
.kb-health {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.kb-health__bar-wrap { height: 10px; border-radius: 5px; }
.kb-health__bar { border-radius: 5px; }

/* Sniper input narrower */
.sniper-input { max-width: 600px; }

/* Sniper close button */
.sniper-results { position: relative; }
.sniper-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
  z-index: 1;
}
.sniper-close-btn:hover { color: var(--orange); border-color: var(--orange); }

/* ============================================================
   Admin Panel
   ============================================================ */
.admin-section { margin-bottom: 24px; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.admin-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  transition: border-color 0.15s;
}
.admin-card:hover { border-color: var(--orange); }
.admin-card__color {
  width: 8px;
  height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
}
.admin-card__info { flex: 1; min-width: 0; }
.admin-card__info strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-card__meta {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.admin-card__action {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--orange);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.admin-card__action:hover {
  background: var(--orange-dim);
  border-color: var(--orange);
}
