/*
 * iNexus — "Considered Space"
 * Colors: #FFF bg, #FAFAFA panels, #EAEAEA borders, #111/#333/#666/#999 text
 * No shadows, no gradients, no color accents
 */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  background: #FFFFFF;
  color: #111;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { cursor: pointer; background: none; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── APP SHELL ─────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #FFFFFF;
}

/* ── TOP BAR ───────────────────────────────────────────────────────────────── */
.topbar {
  height: 56px;
  border-bottom: 1px solid #EAEAEA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  background: #FFFFFF;
  z-index: 10;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.credits-btn {
  font-size: 14px;
  font-weight: 400;
  color: #666;
  transition: color 100ms;
  padding: 0;
}
.credits-btn:hover { color: #111; }
.credits-btn strong, .credits-btn span { font-weight: 600; color: #111; }

.icon-btn {
  color: #999;
  display: flex;
  align-items: center;
  transition: color 100ms;
  padding: 4px;
}
.icon-btn:hover { color: #111; }

/* ── BODY ROW ──────────────────────────────────────────────────────────────── */
.body-row {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── LEFT SIDEBAR ──────────────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #FAFAFA;
  border-right: 1px solid #EAEAEA;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  padding: 16px 12px 0;
  flex-shrink: 0;
}

.new-conv-btn {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  border: 1px solid #EAEAEA;
  background: #FFFFFF;
  border-radius: 8px;
  transition: background 100ms;
}
.new-conv-btn:hover { background: #F0F0F0; }

.sidebar-label {
  padding: 12px 15px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-convs {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
}

.conv-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 100ms;
  display: block;
  cursor: pointer;
  background: transparent;
  border: none;
  margin-bottom: 2px;
}
.conv-item:hover { background: #F5F5F5; }
.conv-item.active { background: #F0F0F0; }

.conv-name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  line-height: 18px;
}
.conv-role {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  line-height: 16px;
}
.conv-preview {
  font-size: 12px;
  font-weight: 400;
  color: #999;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid #EAEAEA;
  flex-shrink: 0;
}

.signout-btn {
  font-size: 13px;
  font-weight: 400;
  color: #999;
  padding: 0;
  transition: color 100ms;
}
.signout-btn:hover { color: #111; }
.landing-link {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #bbb;
  text-decoration: none;
  text-align: center;
  transition: color 100ms;
}
.landing-link:hover { color: #555; }

/* ── MAIN CHAT ─────────────────────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px 0;
}

/* ── HERO ──────────────────────────────────────────────────────────────────── */
.hero {
  margin-top: 48px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.hero.typing {
  opacity: 0;
  transform: translateY(-12px);
}
.hero.hidden {
  display: none;
}

.hero-title {
  font-size: 32px;
  font-weight: 600;
  color: #111;
  line-height: 40px;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 16px;
  font-weight: 400;
  color: #666;
  line-height: 24px;
  max-width: 480px;
}

/* ── MESSAGES ──────────────────────────────────────────────────────────────── */
.msg-user {
  margin-bottom: 16px;
  animation: fadeIn 120ms ease-in;
}
.msg-user .msg-sender {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
}
.msg-user .msg-text {
  font-size: 15px;
  font-weight: 400;
  color: #333;
  line-height: 22px;
}

.msg-insight {
  margin-bottom: 16px;
  animation: fadeIn 120ms ease-in;
}
.msg-insight .msg-sender {
  font-size: 12px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.msg-insight .msg-text {
  font-size: 14px;
  font-weight: 400;
  color: #666;
  line-height: 20px;
  font-style: italic;
}

.msg-suggested {
  margin-bottom: 16px;
  border-left: 2px solid #EAEAEA;
  padding-left: 16px;
  animation: fadeIn 120ms ease-in;
}
.msg-suggested .msg-sender {
  font-size: 12px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.msg-suggested .msg-text {
  font-size: 15px;
  font-weight: 400;
  color: #333;
  line-height: 22px;
}
.msg-suggested-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
.msg-action-btn {
  font-size: 13px;
  font-weight: 400;
  color: #666;
  padding: 0;
  transition: color 100ms;
}
.msg-action-btn:hover { color: #111; }

.msg-thinking {
  display: flex;
  gap: 4px;
  padding: 8px 0 16px;
  align-items: center;
}
.msg-thinking .dot {
  width: 6px;
  height: 6px;
  background: #CCC;
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
.msg-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.msg-thinking .dot:nth-child(3) { animation-delay: 0.4s; }

.msg-error {
  font-size: 13px;
  color: #999;
  padding: 8px 0 16px;
  font-style: italic;
}

/* Sharing/recording intent */
.msg-sharing .msg-sender {
  color: #6b7280 !important;
}
.msg-sharing .msg-text {
  color: #6b7280 !important;
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.9); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── INPUT AREA ────────────────────────────────────────────────────────────── */
.input-area {
  padding: 16px 40px 24px;
  flex-shrink: 0;
}

.input-box {
  border: 1px solid #EAEAEA;
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 56px;
  background: #FFFFFF;
  transition: border-color 150ms;
}
.input-box:focus-within { border-color: #CCCCCC; }

.chat-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  font-weight: 400;
  color: #111;
  line-height: 22px;
  background: transparent;
  padding: 17px 0;
  overflow-y: hidden;
}
.chat-textarea::placeholder { color: #999; }

.input-left-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  flex-shrink: 0;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
  flex-shrink: 0;
}

.input-icon-btn {
  color: #CCC;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  transition: color 100ms;
  padding: 4px;
  border-radius: 6px;
}
.input-icon-btn:hover { color: #666; background: #F5F5F5; }
.input-icon-btn.recording { color: #dc2626; }
.input-icon-btn.realtime-active { color: #dc2626; }

.send-btn {
  color: #CCC;
  display: flex;
  align-items: center;
  transition: color 100ms;
  padding: 0;
}
.send-btn:not(:disabled) { color: #111; }
.send-btn:disabled { cursor: default; }

/* Mode switcher — hidden, kept for compatibility */
.mode-row {
  display: none;
}

.mode-btn {
  font-size: 13px;
  font-weight: 400;
  color: #999;
  padding: 0;
  border: none;
  background: none;
  transition: color 150ms;
}
.mode-btn.active {
  font-weight: 600;
  color: #111;
}
.mode-btn:hover:not(.active) { color: #666; }

.chat-status {
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── RIGHT PANEL ───────────────────────────────────────────────────────────── */
.right-panel {
  width: 320px;
  flex-shrink: 0;
  background: #FAFAFA;
  border-left: 1px solid #EAEAEA;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tabs at top */
.rp-tabs {
  display: flex;
  border-bottom: 1px solid #EAEAEA;
  flex-shrink: 0;
  padding: 0 24px;
}

.rp-tab {
  flex: 0;
  padding: 14px 0;
  margin-right: 24px;
  font-size: 14px;
  font-weight: 600;
  color: #999;
  border-bottom: 2px solid transparent;
  transition: color 150ms, border-color 150ms;
}
.rp-tab.active { color: #111; border-bottom-color: #111; }
.rp-tab:hover:not(.active) { color: #666; }

/* Pane */
.rp-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Insights data view — fills pane, lets gpt-msg-items scroll */
#insightsDataView,
#insightsDataViewDesk {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Sub-panes fill remaining space */
#insightsSubpaneGptMob,
#insightsSubpaneGptDesk {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 16px 16px;
}

/* Voice sub-pane: scrollable container for tiles + utterances */
#insightsSubpaneVoiceMob,
#insightsSubpaneVoiceDesk {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 0 16px;
}

/* Import Hub and flow screens get padding */
.import-hub,
.import-flow-screen {
  padding: 0;
  overflow-y: auto;
}

.rp-empty {
  font-size: 13px;
  color: #999;
  margin-top: 8px;
  line-height: 1.5;
}

/* Insight rows */
.insight-row {
  margin-bottom: 20px;
}
.insight-label {
  font-size: 11px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.insight-value {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
}

.rp-divider {
  border-top: 1px solid #EAEAEA;
  margin: 8px 0 20px;
}

/* Deep insight */
.deep-blur {
  font-size: 14px;
  font-weight: 400;
  color: #333;
  line-height: 20px;
  filter: blur(4px);
  user-select: none;
  margin-bottom: 8px;
  margin-top: 8px;
}
.deep-blur.revealed {
  filter: none;
  user-select: auto;
}

.unlock-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  padding: 0;
  transition: color 100ms;
}
.unlock-btn:hover { color: #111; }

/* History pane */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.history-count {
  font-size: 12px;
  color: #999;
}
.clear-btn {
  font-size: 12px;
  color: #999;
  padding: 0;
  transition: color 100ms;
}
.clear-btn:hover { color: #dc2626; }

/* History items */
.hist-item {
  padding: 12px 0;
  border-bottom: 1px solid #EAEAEA;
  cursor: pointer;
  transition: background 100ms;
  border-radius: 4px;
  padding-left: 4px;
  padding-right: 4px;
  margin-left: -4px;
  margin-right: -4px;
}
.hist-item:last-child { border-bottom: none; }
.hist-item:hover { background: #FAFAFA; }
.hist-item:hover .hist-situation { color: #111; }

.hist-date {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
}
.hist-situation {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 18px;
  margin-bottom: 4px;
  transition: color 100ms;
}
.hist-reply {
  font-size: 12px;
  color: #999;
  font-style: italic;
  line-height: 16px;
}
.hist-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}
.hist-action {
  font-size: 11px;
  color: #999;
  padding: 0;
  transition: color 100ms;
}
.hist-action:hover { color: #111; }
.hist-action.del:hover { color: #dc2626; }

/* Risk badge (inline in history) */
.risk-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── MODALS ────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay.open { display: flex; }

.modal {
  background: #FFFFFF;
  border: 1px solid #EAEAEA;
  border-radius: 14px;
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
}
.modal.modal-sm { width: 380px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #EAEAEA;
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #111;
}
.modal-sub {
  font-size: 13px;
  color: #999;
  margin-top: 2px;
}
.modal-x {
  color: #999;
  padding: 4px;
  border-radius: 5px;
  transition: color 100ms, background 100ms;
  display: flex;
  align-items: center;
}
.modal-x:hover { color: #111; background: #F5F5F5; }

.modal-body {
  overflow-y: auto;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Form fields */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-select, .field-input, .field-textarea {
  padding: 9px 12px;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  background: #FAFAFA;
  color: #111;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms;
}
.field-select:focus, .field-input:focus, .field-textarea:focus { border-color: #CCCCCC; }
.field-textarea { resize: vertical; line-height: 1.5; }

.field-hint {
  font-size: 12px;
  color: #999;
  line-height: 1.4;
  margin-top: -4px;
}

/* Gender toggle */
.gender-toggle {
  display: flex;
  gap: 8px;
}
.gender-btn {
  flex: 1;
  padding: 10px 0;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  background: #FAFAFA;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #999;
  cursor: pointer;
  transition: all 150ms;
}
.gender-btn:hover {
  border-color: #CCCCCC;
  color: #555;
}
.gender-btn.active {
  background: #111;
  border-color: #111;
  color: #FFFFFF;
  font-weight: 600;
}

.field-btn {
  padding: 8px 16px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: opacity 150ms;
  align-self: flex-start;
}
.field-btn:hover { opacity: 0.85; }

.field-btn-ghost {
  padding: 8px 16px;
  border-radius: 8px;
  background: #FFFFFF;
  color: #666;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid #EAEAEA;
  transition: background 100ms;
  align-self: flex-start;
}
.field-btn-ghost:hover { background: #F5F5F5; }

/* Sections */
.section-item {
  background: #FAFAFA;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-index { font-size: 11px; color: #999; }
.section-title-inp, .section-content-inp, .section-category-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #EAEAEA;
  border-radius: 6px;
  background: #FFFFFF;
  color: #111;
  font-size: 13px;
  outline: none;
}
.section-content-inp { resize: vertical; }

/* Danger zone */
.danger-zone {
  padding-top: 16px;
  border-top: 1px solid #EAEAEA;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Credits info */
.credits-info {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}
.pack-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 14px;
  color: #111;
  transition: background 100ms;
}
.pack-btn:hover { background: #FAFAFA; }
.pack-badge {
  font-size: 11px;
  font-weight: 600;
  background: #111;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
}

/* Onboarding */
.ob-skip {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: #FFFFFF;
  color: #666;
  font-size: 14px;
  border: 1px solid #EAEAEA;
  transition: background 100ms;
}
.ob-skip:hover { background: #F5F5F5; }
.ob-save {
  flex: 2;
  padding: 10px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: opacity 150ms;
}
.ob-save:hover { opacity: 0.85; }

/* ── LOGIN PAGE ────────────────────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAFAFA;
}
.auth-card {
  background: #FFFFFF;
  border: 1px solid #EAEAEA;
  border-radius: 14px;
  padding: 36px 40px;
  width: 360px;
  max-width: 95vw;
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.auth-sub {
  font-size: 13px;
  color: #999;
  margin-bottom: 24px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.auth-field label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-field input {
  padding: 9px 12px;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  background: #FAFAFA;
  color: #111;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms;
}
.auth-field input:focus { border-color: #CCCCCC; }
.auth-error {
  font-size: 13px;
  color: #dc2626;
  margin-bottom: 12px;
}
.auth-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 150ms;
  margin-top: 6px;
}
.auth-btn:hover { opacity: 0.85; }

/* ── SCROLLBARS ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #EAEAEA; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #CCCCCC; }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .right-panel { width: 280px; } }
@media (max-width: 900px) { .right-panel { display: none; } }
@media (max-width: 640px) { .sidebar { display: none; } .chat-window, .input-area { padding-left: 20px; padding-right: 20px; } }

/* ── CONTACTS SIDEBAR ──────────────────────────────────────────────────────── */
.contacts-sidebar {
  width: 260px;
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 8px;
}

.add-contact-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid #EAEAEA;
  background: #FFFFFF;
  color: #666;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms, color 100ms;
}
.add-contact-btn:hover { background: #F0F0F0; color: #111; }

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
}

.contacts-empty {
  padding: 16px 8px;
  font-size: 12px;
  color: #999;
  line-height: 1.6;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 100ms;
  margin-bottom: 2px;
  position: relative;
}
.contact-card:hover { background: #F5F5F5; }
.contact-card.active { background: #F0F0F0; }
.contact-card:hover .contact-edit-btn { opacity: 1; }

.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #EAEAEA;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-meta {
  font-size: 11px;
  color: #999;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-status {
  font-size: 11px;
  color: #666;
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.contact-actions {
  flex-shrink: 0;
}

.contact-edit-btn {
  opacity: 0;
  font-size: 14px;
  color: #999;
  padding: 3px 5px;
  border-radius: 5px;
  transition: opacity 100ms, color 100ms, background 100ms;
}
.contact-edit-btn:hover { color: #111; background: #EAEAEA; }

/* ── TOPBAR CENTER (breadcrumb) ─────────────────────────────────────────────── */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.breadcrumb-name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.breadcrumb-type {
  font-size: 12px;
  color: #999;
  text-transform: capitalize;
}

.breadcrumb-workspace-btn {
  font-size: 12px;
  color: #999;
  padding: 3px 8px;
  border: 1px solid #EAEAEA;
  border-radius: 6px;
  background: transparent;
  transition: background 100ms, color 100ms;
  margin-left: 4px;
}
.breadcrumb-workspace-btn:hover { background: #F5F5F5; color: #111; }

/* ── CHAT EMPTY STATE ───────────────────────────────────────────────────────── */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #999;
  overflow: hidden;
}

#emptySelectState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

#onboardingChat {
  width: 100%;
  max-width: 600px;
  height: 100%;
  flex-direction: column;
}

#onboardingWindow {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 16px;
}

.empty-icon-big {
  font-size: 48px;
  opacity: 0.2;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.empty-sub {
  font-size: 14px;
  color: #999;
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

/* ── CHAT WORKSPACE ─────────────────────────────────────────────────────────── */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── WORKSPACE TABS ─────────────────────────────────────────────────────────── */
.ws-tabs {
  display: flex;
  border-bottom: 1px solid #EAEAEA;
  flex-shrink: 0;
  padding: 0 24px;
  background: #FFFFFF;
}

.ws-tab {
  padding: 13px 0;
  margin-right: 24px;
  font-size: 13px;
  font-weight: 600;
  color: #999;
  border-bottom: 2px solid transparent;
  transition: color 150ms, border-color 150ms;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}
.ws-tab.active { color: #111; border-bottom-color: #111; }
.ws-tab:hover:not(.active) { color: #666; }
.ws-lock { font-size: 10px; opacity: .6; margin-left: 2px; }
.ws-tab-spacer { flex: 1 1 auto; }
.ws-tab.ws-gear {
  margin-right: 0; font-size: 16px; padding: 11px 0; color: #999;
}
.ws-tab.ws-gear.active { border-bottom-color: transparent; color: #111; }

/* Secondary sub-navigation under a top group (Profile / Insights / Timeline) */
.ws-subtabs {
  display: flex; gap: 4px; flex-shrink: 0;
  padding: 8px 24px; background: #FAFAFA; border-bottom: 1px solid #EEE;
}
.ws-subtab {
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: #777;
  background: #fff; border: 1px solid #E3E3E3; border-radius: 999px;
  cursor: pointer; transition: all 120ms; white-space: nowrap;
}
.ws-subtab:hover:not(.active) { color: #333; border-color: #cfcfcf; }
.ws-subtab.active { color: #fff; background: #111; border-color: #111; }

/* ── WORKSPACE PANELS ───────────────────────────────────────────────────────── */
.ws-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat panel: window + input */
#wsPanelChat {
  flex-direction: column;
}

/* History panel */
#wsPanelHistory {
  padding: 20px 24px;
  overflow-y: auto;
}

/* Insights panel */
#wsPanelInsights {
  padding: 12px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── MESSAGE BUBBLES (new style) ────────────────────────────────────────────── */
.msg {
  margin-bottom: 16px;
  animation: fadeIn 120ms ease-in;
  display: flex;
  flex-direction: column;
}

.msg-user {
  align-items: flex-end;
}

.msg-agent {
  align-items: flex-start;
}

.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}

.msg-user .msg-bubble {
  background: #111;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-agent .msg-bubble {
  background: #F5F5F5;
  color: #111;
  border-bottom-left-radius: 4px;
}

.msg-sharing .msg-bubble {
  background: #FAFAFA;
  color: #666;
  font-style: italic;
  border: 1px solid #EAEAEA;
}

/* Typing indicator */
.msg-bubble.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
}
.msg-bubble.typing span {
  width: 6px;
  height: 6px;
  background: #CCC;
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
.msg-bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-bubble.typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── HIST ITEM (new) ────────────────────────────────────────────────────────── */
.hist-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hist-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 18px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-item-meta {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
  margin-bottom: 3px;
}

.hist-item-msg {
  font-size: 12px;
  color: #999;
  line-height: 1.4;
}

/* ── RISK BADGES ────────────────────────────────────────────────────────────── */
.risk-low      { background: #6b7280; }
.risk-medium   { background: #d97706; }
.risk-high     { background: #ea580c; }
.risk-critical { background: #dc2626; }

/* ── CONTACT MODAL (uses overlay + modal classes) ───────────────────────────── */
#addContactModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* ── Print hint ───────────────────────────────────────────────────────────── */
.print-hint {
  text-align: center;
  font-size: 11px;
  color: #c4c9d4;
  padding: 4px 0 2px;
  letter-spacing: 0.01em;
  user-select: none;
  pointer-events: none;
  transition: color 0.15s;
}
.print-hint:hover { color: #9ca3af; }
@media (max-width: 600px) {
  .print-hint { display: none; }
}
@media print {
  .print-hint { display: none; }
}

/* ── File progress bar ──────────────────────────────────────────────────────── */
.file-progress-bubble {
  min-width: 260px;
  max-width: 340px;
}
.file-progress-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  color: #374151;
}
.file-progress-bar-wrap {
  background: #e5e7eb;
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.file-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
  transition: width 0.8s ease;
}
.file-progress-status {
  font-size: 11px;
  color: #9ca3af;
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE ADAPTIVE — ≤ 640px
   ═══════════════════════════════════════════════════════════════════════════ */

/* Bottom nav + backdrop: hidden on desktop */
.mob-bottom-nav { display: none; }
.mob-backdrop { display: none; }

@media (max-width: 640px) {

  /* App shell */
  #app { height: 100dvh; }

  /* Topbar */
  .topbar { padding: 0 14px; height: 50px; }
  .topbar-brand { font-size: 15px; }
  .topbar-contact-name { font-size: 13px; }
  .topbar-contact-type { font-size: 11px; }
  .topbar-right { gap: 8px; }

  /* Body row */
  .body-row { position: relative; overflow: hidden; }

  /* LEFT SIDEBAR: hidden by default, slides in as drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 80vw; max-width: 300px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    display: flex !important;
  }
  .sidebar.mob-open { transform: translateX(0); }

  /* Backdrop */
  .mob-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
  }
  .mob-backdrop.visible { display: block; }

  /* Main chat: full width */
  .chat-main { width: 100%; flex: 1; }

  /* Right panel: hidden */
  .right-panel { display: none !important; }

  /* Chat window */
  .chat-window { padding: 16px 16px 0; }

  /* Input area */
  .input-area { padding: 8px 12px 10px; }
  .input-box { min-height: 48px; padding: 0 10px; border-radius: 10px; }
  .chat-textarea { font-size: 16px; padding: 13px 0; }
  .input-icon-btn { padding: 6px; }
  .send-btn { padding: 4px; }

  /* Bottom nav bar */
  .mob-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 54px;
    background: #FAFAFA;
    border-top: 1px solid #EAEAEA;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mob-nav-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    font-size: 10px; font-weight: 500;
    color: #999;
    padding: 6px 0;
    border: none; background: none;
    transition: color 120ms;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .mob-nav-btn.active { color: #111; }
  .mob-nav-btn svg { width: 20px; height: 20px; }

  /* Workspace tabs */
  .ws-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 14px; }
  .ws-tabs::-webkit-scrollbar { display: none; }
  .ws-tab { font-size: 13px; padding: 12px 0; margin-right: 18px; white-space: nowrap; }
  .ws-subtabs { overflow-x: auto; scrollbar-width: none; padding: 8px 14px; }
  .ws-subtabs::-webkit-scrollbar { display: none; }

  /* Hero */
  .hero { margin-top: 20px; }
  .hero-title { font-size: 22px; line-height: 30px; }
  .hero-sub { font-size: 14px; }

  /* Messages */
  .msg-user .msg-text, .msg-suggested .msg-text { font-size: 14px; line-height: 20px; }
  .msg-insight .msg-text { font-size: 13px; }

  /* Onboarding */
  .ob-bubble { max-width: 90%; }

  /* Contact cards */
  .contact-card { padding: 10px 12px; }
  .contact-avatar { width: 36px; height: 36px; font-size: 14px; }
  .contact-name { font-size: 13px; }
  .contact-meta { font-size: 11px; }

  /* Modal: bottom sheet */
  .overlay { align-items: flex-end; padding-bottom: 0; }
  .modal.modal-sm {
    border-radius: 16px 16px 0 0;
    width: 100%; max-width: 100%; margin: 0;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  /* History */
  .hist-item { padding: 10px 12px; }
  .hist-msg { font-size: 12px; }

  /* Print hint */
  .print-hint { display: none; }
}

/* ── Parse GPT Chat Button & Modal ─────────────────────────────────────────── */
.parse-gpt-wrap {
  position: relative;
  display: inline-block;
}
.parse-gpt-btn {
  background: none;
  border: none;
  font-size: 11px;
  color: #9CA3AF;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.parse-gpt-btn:hover { color: #6B7280; background: #f3f4f6; }

.parse-gpt-modal {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 16px;
  z-index: 200;
}
.parse-gpt-modal h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #111;
}
.parse-gpt-modal .pgm-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.parse-gpt-modal .pgm-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  font-size: 16px; color: #9CA3AF;
  cursor: pointer; line-height: 1;
}
.pgm-author-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.pgm-author-btn {
  flex: 1;
  padding: 6px 0;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.pgm-author-btn.active {
  border-color: #111;
  background: #111;
  color: #fff;
  font-weight: 600;
}
.pgm-insight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #374151;
}
.pgm-insight-row input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: #111;
}
.pgm-upload-btn {
  width: 100%;
  padding: 9px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.pgm-upload-btn:hover { opacity: 0.85; }

/* ── GPT Chat Bubbles ────────────────────────────────────────────────────────── */
.gpt-bubbles-wrap {
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.gpt-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.bubble-me {
  align-self: flex-end;
  background: #111;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble-partner {
  align-self: flex-start;
  background: #f3f4f6;
  color: #111;
  border-bottom-left-radius: 4px;
}
.bubble-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.bubble-date {
  font-size: 10px;
  opacity: 0.6;
  font-weight: 500;
}
.bubble-insight-badge {
  font-size: 10px;
  background: rgba(255,200,0,0.2);
  color: #92400e;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.bubble-me .bubble-date { color: rgba(255,255,255,0.7); }
.bubble-me .bubble-insight-badge { background: rgba(255,255,255,0.2); color: #fef3c7; }
.bubble-text { font-size: 13.5px; }

.gpt-bubbles-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
  margin-top: 8px;
}
.btn-save-events {
  flex: 1;
  padding: 8px 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save-events:hover { opacity: 0.85; }
.btn-save-events:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cancel-events {
  padding: 8px 12px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.btn-cancel-events:hover { background: #e5e7eb; }

@media (max-width: 640px) {
  .parse-gpt-modal {
    right: -8px;
    width: calc(100vw - 32px);
    max-width: 320px;
  }
  .gpt-bubble { max-width: 92%; }
}

/* ── Input footer row ───────────────────────────────────────────────────────── */
.input-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 2px;
}

/* ── Insights panel Parse GPT Chat footer ───────────────────────────────────── */
.insight-parse-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}
.insight-parse-footer .parse-gpt-wrap {
  position: relative;
  display: block;
}
.insight-parse-footer .parse-gpt-btn {
  width: 100%;
  text-align: center;
}
.insight-parse-footer .parse-gpt-modal {
  position: absolute;
  bottom: calc(100% + 8px);
  top: auto;
  left: 0;
  right: 0;
  width: auto;
  min-width: 240px;
}

/* ── Saved label in bubbles actions ─────────────────────────────────────────── */
.gpt-bubbles-saved-label {
  font-size: 13px;
  color: #22c55e;
  font-weight: 500;
  flex: 1;
}

/* ── Mobile Insights panel Parse GPT Chat modal fix ─────────────────────────── */
#wsPanelInsights .insight-parse-footer .parse-gpt-modal {
  position: absolute;
  bottom: calc(100% + 8px);
  top: auto;
  left: 0;
  right: 0;
  width: auto;
  min-width: 240px;
}

/* ── Insights tab question mark hint ────────────────────────────────────────── */
.insights-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  font-size: 9px;
  font-weight: 700;
  font-style: normal;
  cursor: default;
  vertical-align: middle;
  margin-left: 4px;
  position: relative;
  top: -1px;
  transition: background 0.15s, color 0.15s;
}
.insights-hint:hover {
  background: #d1d5db;
  color: #6b7280;
}

/* ── 3-Layer Architecture: Phrases, Insights v2, Patterns ───────────────────── */

/* Phrases panel toolbar */
.phrases-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.phrases-toggle {
  display: flex;
  gap: 2px;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px;
}
.phrases-view-btn {
  padding: 3px 8px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.phrases-view-btn.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.phrases-count {
  font-size: 11px;
  color: #9ca3af;
}

/* Phrases list */
.phrases-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.phrase-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  position: relative;
}
.phrase-card.role-me {
  border-left: 3px solid #111;
}
.phrase-card.role-partner {
  border-left: 3px solid #9ca3af;
}
.phrase-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.phrase-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.phrase-role-badge.me {
  background: #111;
  color: #fff;
}
.phrase-role-badge.partner {
  background: #f3f4f6;
  color: #374151;
}
.phrase-date {
  font-size: 10px;
  color: #9ca3af;
  margin-left: auto;
}
.phrase-raw {
  color: #6b7280;
  font-style: italic;
  margin-bottom: 2px;
}
.phrase-arrow {
  color: #d1d5db;
  font-size: 10px;
  margin: 2px 0;
}
.phrase-clean {
  color: #111;
  font-weight: 500;
}
.phrase-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.phrase-card:hover .phrase-delete-btn {
  opacity: 1;
}
.phrase-delete-btn:hover {
  color: #ef4444;
}

/* Patterns panel */
.patterns-toolbar {
  padding: 8px 12px 4px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.patterns-count {
  font-size: 11px;
  color: #9ca3af;
}
.patterns-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pattern-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  position: relative;
}
.pattern-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.pattern-category-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pattern-text {
  color: #111;
}
.pattern-insights-ref {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
}
.pattern-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.pattern-card:hover .pattern-delete-btn {
  opacity: 1;
}
.pattern-delete-btn:hover {
  color: #ef4444;
}

/* Insights v2 badge on insight cards */
.insight-phrase-ref {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 3px;
}

/* Parse Dialog footer */
.parse-dialog-footer {
  padding: 8px 10px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.parse-dialog-btn {
  width: 100%;
  padding: 7px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.parse-dialog-btn:hover {
  background: #e5e7eb;
}
.parse-dialog-textarea {
  width: 100%;
  min-height: 80px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}
.parse-dialog-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.parse-dialog-run-btn {
  flex: 1;
  padding: 7px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.parse-dialog-run-btn:hover {
  background: #333;
}
.parse-dialog-cancel-btn {
  padding: 7px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.parse-dialog-status {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  min-height: 16px;
}

/* ── Suggestion chips ────────────────────────────────────────────────────────── */

.suggestions-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.suggestions-row::-webkit-scrollbar {
  display: none;
}
.suggestion-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 400;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  line-height: 1.4;
}
.suggestion-chip:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #111;
}
.suggestion-chip:active {
  background: #111;
  color: #fff;
  border-color: #111;
}

/* ── File Clarify Cards ──────────────────────────────────────────────────── */
.file-clarify-card .msg-bubble {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 420px;
}
.clarify-title {
  font-size: 14px;
  font-weight: 500;
  color: #222;
  margin-bottom: 12px;
}
.clarify-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.clarify-btn {
  background: #fff;
  border: 1.5px solid #ccc;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.clarify-btn:hover {
  background: #222;
  color: #fff;
  border-color: #222;
}

/* ── Softness Modal ──────────────────────────────────────────────────────────── */
.softness-phrase-preview {
  font-size: 14px;
  color: #555;
  background: #F7F7F7;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.5;
  font-style: italic;
}
.softness-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.softness-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.softness-slider {
  width: 100%;
  accent-color: #222;
  cursor: pointer;
}
.softness-variant-box {
  font-size: 15px;
  color: #111;
  background: #fff;
  border: 1.5px solid #222;
  border-radius: 10px;
  padding: 14px 16px;
  line-height: 1.55;
  min-height: 52px;
}
.softness-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Conflict Panel */
.conflict-panel {
  flex-direction: column;
  padding: 24px 40px;
  overflow-y: auto;
}
.conflict-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
  width: 100%;
}
.conflict-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.conflict-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #999;
}
.conflict-textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border: 1px solid #EAEAEA;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #111;
  background: #FAFAFA;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.conflict-textarea:focus {
  outline: none;
  border-color: #999;
  background: #fff;
}
.conflict-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}
.conflict-save-btn {
  padding: 8px 20px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.conflict-save-btn:hover { opacity: 0.75; }
.conflict-saved-hint {
  font-size: 12px;
  color: #999;
}

/* ── Admin button in topbar ──────────────────────────────────────────────────── */
.admin-btn {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 4px 10px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  margin-right: 6px;
}
.admin-btn:hover {
  background: #e4e4e4;
  color: #555;
}

/* ── Partner Settings Panel ──────────────────────────────────────────────────── */
.partner-settings-panel {
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 24px 32px;
  gap: 0;
}
.psettings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
  width: 100%;
}
.psettings-row-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.psettings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 100%;
}
.psettings-field-sm {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 240px;
}
.psettings-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.psettings-hint {
  font-size: 12px;
  color: #aaa;
  margin-top: -2px;
}
.psettings-input {
  font-size: 14px;
  font-family: inherit;
  color: #111;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.psettings-input:focus {
  border-color: #bbb;
}
.psettings-textarea {
  font-size: 14px;
  font-family: inherit;
  color: #111;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.55;
  transition: border-color 0.15s;
}
.psettings-textarea:focus {
  border-color: #bbb;
}
.psettings-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}
.psettings-save-btn {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #111;
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  cursor: pointer;
  transition: background 0.15s;
}
.psettings-save-btn:hover {
  background: #333;
}
.psettings-saved-hint {
  font-size: 13px;
  color: #4caf50;
}
.psettings-full-link {
  font-size: 12px;
  color: #aaa;
  text-decoration: none;
  margin-left: auto;
  transition: color 0.15s;
}
.psettings-full-link:hover {
  color: #555;
}

/* ── GPT Export Preview ──────────────────────────────────────────────────────── */
.gpt-export-preview {
  margin: 4px 0 8px 0;
  padding: 0 16px;
}
.gpt-export-bubbles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.gpt-export-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 80%;
  font-size: 13px;
  line-height: 1.45;
}
.gpt-bubble-me {
  background: #111;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.gpt-bubble-partner {
  background: #f0f0f0;
  color: #111;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.gpt-bubble-date {
  font-size: 10px;
  opacity: 0.55;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.gpt-bubble-text {
  word-break: break-word;
}
.gpt-bubble-insight {
  font-size: 12px;
  margin-top: 3px;
}
.gpt-export-more {
  font-size: 12px;
  color: #aaa;
  text-align: center;
  padding: 4px 0;
}
.gpt-export-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.clarify-btn-secondary {
  background: transparent;
  color: #aaa;
  border-color: #ddd;
  font-size: 12px;
}
.clarify-btn-secondary:hover {
  background: #f5f5f5;
  color: #666;
}

/* ── GPT Messages Panel (Insights tab) ─────────────────────────────────────── */
.gpt-msg-list {
  margin: 8px 0 0 0;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.gpt-msg-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f2f2f2;
  border-bottom: 1px solid #e8e8e8;
  flex-wrap: wrap;
}
.gpt-msg-count {
  font-size: 11px;
  color: #888;
  flex: 1;
  min-width: 80px;
}
.gpt-msg-filter-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gpt-msg-filter-btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
}
.gpt-msg-filter-btn:hover:not(.active) { background: #eee; }
.gpt-msg-clear-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid #f0a0a0;
  background: #fff5f5;
  color: #c0392b;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.15s;
}
.gpt-msg-clear-btn:hover { background: #fde8e8; }
.gpt-msg-download-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.gpt-msg-download-btn:hover { background: #e8e8e8; }
.gpt-msg-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gpt-msg-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  border: 1.5px solid transparent;
  position: relative;
  margin-bottom: 4px;
}
.gpt-msg-item .gpt-msg-text {
  flex: 1;
  min-width: 0;
}

/* Thought-bubble style for partner messages */
.gpt-msg-partner.thought-bubble {
  background: #f5f5f5;
  border-color: #d0d0d0;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.gpt-msg-partner.thought-bubble::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: #f5f5f5;
  border: 1.5px solid #d0d0d0;
  border-top: none;
  border-right: none;
  border-radius: 0 0 0 8px;
  transform: rotate(-10deg);
}
.gpt-msg-gpt {
  background: #ebebeb;
  border-color: #d8d8d8;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.gpt-msg-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}
.partner-badge { background: #e0e0e0; color: #333; }
.gpt-badge { background: #d4d4d4; color: #555; }
.gpt-msg-date {
  font-size: 10px;
  color: #aaa;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.gpt-msg-insight { flex-shrink: 0; margin-top: 1px; }
.gpt-msg-text { color: #333; flex: 1; }

/* Gender icon in thought bubbles */
.gpt-gender-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.7;
}
.gpt-gender-icon.female { color: #555; }
.gpt-gender-icon.male { color: #444; }
.gpt-msg-empty {
  text-align: center;
  color: #bbb;
  font-size: 12px;
  padding: 16px 0;
}

/* ── GPT-msg delete button ─────────────────────────────────────── */
.gpt-msg-item { position: relative; }
.gpt-msg-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.gpt-msg-item:hover .gpt-msg-delete-btn { opacity: 0.55; }
.gpt-msg-delete-btn:hover { opacity: 1 !important; background: rgba(255,80,80,0.12); }

/* ── Settings: Danger zone / Clear Chat ─────────────────────────────────────── */
.psettings-danger-zone {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0e8e8;
  display: flex;
  align-items: center;
  gap: 12px;
}
.psettings-clear-chat-btn {
  background: none;
  border: 1px solid #e0a0a0;
  color: #c0392b;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.psettings-clear-chat-btn:hover {
  background: #fdf0f0;
  border-color: #c0392b;
}
.psettings-clear-hint {
  font-size: 12px;
  color: #666;
}

/* ── INSIGHTS FULLSCREEN MODE ───────────────────────────────────────────────── */
.gpt-msg-expand-btn {
  font-size: 14px;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-left: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.gpt-msg-expand-btn:hover { background: #eee; }
.gpt-msg-expand-btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
}
/* When fullscreen is active: hide sidebar, expand Insights panel to fill screen */
.insights-fullscreen .contacts-sidebar {
  display: none !important;
}
.insights-fullscreen #wsPanelInsights {
  position: fixed !important;
  inset: 0 !important;
  z-index: 500 !important;
  background: #fff !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.insights-fullscreen #gptMsgListMob {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  overflow: hidden !important;
}
.insights-fullscreen .gpt-msg-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid #eee;
}
.insights-fullscreen .gpt-msg-items {
  flex: 1 !important;
  padding: 10px 20px;
}
.insights-fullscreen .insight-parse-footer {
  display: none !important;
}
.insights-fullscreen .rp-empty {
  padding: 20px;
}

/* ── Audio diarization speaker samples ─────────────────────────────────────── */
.audio-speaker-sample {
  margin: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audio-speaker-label {
  font-size: 13px;
  color: #444;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 6px 10px;
  line-height: 1.4;
  border-left: 3px solid #ccc;
}
.audio-speaker-label strong {
  color: #111;
  margin-right: 6px;
}

/* Audio speaker identification - two-column layout */
.audio-speaker-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 14px;
}
.audio-speaker-col {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
}
.audio-speaker-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddd;
}
.audio-speaker-phrase {
  font-size: 12.5px;
  color: #222;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
}
.audio-speaker-phrase:last-child { border-bottom: none; }

/* Audio speaker ID pagination */
.clarify-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
}
.clarify-btn-nav {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 10px;
  background: #f5f5f5;
  cursor: pointer;
  transition: background 100ms;
}
.clarify-btn-nav:hover { background: #e8e8e8; }
.clarify-page-info {
  font-size: 11px;
  color: #999;
}

/* ── TTS (text-to-speech) buttons ──────────────────────────────────────────── */
.gpt-msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: 6px;
}
.gpt-msg-tts-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.gpt-msg-item:hover .gpt-msg-tts-btn { opacity: 0.55; }
.gpt-msg-tts-btn:hover { opacity: 1 !important; background: rgba(0,0,0,0.06); }
.gpt-msg-tts-btn.tts-playing { opacity: 1 !important; }
.gpt-msg-tts-btn:disabled { cursor: wait; opacity: 0.4 !important; }

/* Reposition delete button when actions wrapper is present */
.gpt-msg-item .gpt-msg-actions .gpt-msg-delete-btn {
  position: static;
  opacity: 0;
  transition: opacity 0.15s;
}
.gpt-msg-item:hover .gpt-msg-actions .gpt-msg-delete-btn { opacity: 0.55; }

/* TTS button inside audio speaker phrase rows */
.audio-speaker-phrase {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.audio-tts-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s;
  line-height: 1.4;
}
.audio-tts-btn:hover { opacity: 1; }
.audio-tts-btn.tts-playing { opacity: 1; }
.audio-tts-btn:disabled { cursor: wait; opacity: 0.3; }

/* ── Red Lines panel ─────────────────────────────────────────────────────── */
.redlines-panel {
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.redlines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.redlines-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.redlines-title {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  margin: 0;
}
.redlines-subtitle {
  font-size: 12px;
  color: #888;
}
.redlines-add-btn {
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.redlines-add-btn:hover { background: #c62828; }

.redlines-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.redlines-empty {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  padding: 32px 0;
  line-height: 1.6;
}
.redline-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.redline-item:hover { border-color: #ddd; }
.redline-item-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.redline-badge {
  display: inline-block;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.redline-text {
  font-size: 13.5px;
  color: #222;
  line-height: 1.5;
  word-break: break-word;
}
.redline-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.redline-edit-btn,
.redline-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 3px 5px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s;
}
.redline-edit-btn:hover { opacity: 1; background: #f0f0f0; }
.redline-delete-btn:hover { opacity: 1; background: #fdecea; }

/* Red Lines inline form */
.redlines-form {
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
.redlines-textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.redlines-textarea:focus { border-color: #e53935; }
.redlines-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.redlines-category {
  border: 1px solid #ddd;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fafafa;
  cursor: pointer;
  outline: none;
}
.redlines-form-actions {
  display: flex;
  gap: 8px;
}
.redlines-save-btn {
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.redlines-save-btn:hover { background: #c62828; }
.redlines-cancel-btn {
  background: #f0f0f0;
  color: #555;
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.redlines-cancel-btn:hover { background: #e0e0e0; }

/* ── Speaker audio clip player ───────────────────────────────────────────── */
.speaker-clip-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 8px;
  background: #f0f4ff;
  border-radius: 8px;
  padding: 7px 10px;
}
.speaker-clip-label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.speaker-clip-audio {
  width: 100%;
  height: 32px;
  outline: none;
  border-radius: 6px;
}

/* Timestamp badge in speaker phrase rows */
.audio-seg-time {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #888;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 5px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.audio-speaker-phrase {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Insights PIN lock modal ─────────────────────────────────────────────── */
.insights-pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.insights-pin-box {
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px 24px;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.insights-pin-title {
  font-size: 20px;
  font-weight: 700;
  color: #111;
}
.insights-pin-subtitle {
  font-size: 13px;
  color: #888;
  margin-top: -6px;
}
.insights-pin-dots {
  display: flex;
  gap: 14px;
  margin: 4px 0;
}
.insights-pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.insights-pin-dots span.filled {
  background: #111;
  border-color: #111;
}
.insights-pin-error {
  font-size: 12px;
  color: #e53935;
  min-height: 16px;
  font-weight: 500;
}
.insights-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.pin-key {
  background: #f5f5f5;
  border: none;
  border-radius: 12px;
  height: 52px;
  font-size: 20px;
  font-weight: 600;
  color: #111;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
  user-select: none;
}
.pin-key:hover { background: #ebebeb; }
.pin-key:active { background: #e0e0e0; transform: scale(0.95); }
.pin-key-empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}
.insights-pin-cancel {
  background: none;
  border: none;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: color 0.15s;
  margin-top: 2px;
}
.insights-pin-cancel:hover { color: #333; }

/* ── History (Sessions/Transcripts) panel ────────────────────────────────── */
.history-panel {
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.history-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.history-subtitle {
  font-size: 12px;
  color: #888;
}

.history-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.history-upload-btn:hover { background: #333; }

.history-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-empty {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
  line-height: 1.6;
}

.history-session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.history-session-card:hover { border-color: #1a1a1a; background: #fafafa; }

.history-session-info {
  flex: 1;
  min-width: 0;
}

.history-session-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-session-meta {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.history-session-participants {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
}

.history-session-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #aaa;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color 0.15s, background 0.15s;
}
.history-session-delete:hover { color: #e53935; background: #ffeaea; }

.history-viewer {
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.history-viewer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.history-back-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s, color 0.15s;
}
.history-back-btn:hover { border-color: #1a1a1a; color: #1a1a1a; }

.history-viewer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-viewer-actions {
  display: flex;
  gap: 6px;
}

.history-rename-btn, .history-delete-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s, color 0.15s;
}
.history-rename-btn:hover { border-color: #1976d2; color: #1976d2; }
.history-delete-btn:hover { border-color: #e53935; color: #e53935; }

.history-rename-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.history-rename-content {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  min-width: 300px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.history-rename-content h4 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

.history-rename-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.history-rename-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.history-rename-input {
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.history-rename-input:focus { border-color: #1a1a1a; }

.history-rename-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.history-rename-save {
  flex: 1;
  padding: 9px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.history-rename-save:hover { background: #333; }

.history-rename-cancel {
  padding: 9px 16px;
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s;
}
.history-rename-cancel:hover { border-color: #1a1a1a; }

.history-utterances {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-utterance {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8f8f8;
  border-left: 3px solid transparent;
}

.history-utt-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.history-utt-speaker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.history-utt-time {
  font-size: 11px;
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

.history-utt-tts {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #aaa;
  margin-left: auto;
  transition: color 0.15s, background 0.15s;
}
.history-utt-tts:hover { color: #1976d2; background: #e3f0ff; }
.history-utt-tts.playing { color: #1976d2; }

.history-utt-text {
  font-size: 13px;
  color: #333;
  line-height: 1.55;
}

/* ── Clarify card: file date/time ─────────────────────────────────────────── */
.clarify-file-date {
  font-size: 12px;
  color: #888;
  margin: -4px 0 10px;
  padding: 0 2px;
  letter-spacing: 0.01em;
}

/* ── Audio Utterances section ─────────────────────────────────────────────── */
.audio-utt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
}
.audio-utt-title {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  flex: 1;
}
.audio-utt-count {
  font-size: 12px;
  color: #888;
}
.audio-utt-speakers-btn,
.audio-utt-clear-btn {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #555;
}
.audio-utt-speakers-btn:hover { background: #f5f5f5; }
.audio-utt-clear-btn:hover { background: #fff0f0; color: #c00; }

.batch-progress-bar {
  padding: 8px 16px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.batch-progress-inner {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.batch-progress-fill {
  height: 100%;
  background: #4a90e2;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.batch-progress-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

/* audioUtterancesSection fills remaining space in voice pane */
#audioUtterancesSection,
#audioUtterancesSectionR {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.audio-utt-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
}
.audio-utt-date-sep {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  padding: 10px 16px 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-top: 1px solid #f5f5f5;
}
.audio-utt-item {
  padding: 8px 16px;
  border-bottom: 1px solid #f8f8f8;
}
.audio-utt-item:hover { background: #fafafa; }
.audio-utt-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.audio-utt-speaker {
  font-size: 12px;
  font-weight: 600;
}
.audio-utt-ts {
  font-size: 11px;
  color: #bbb;
}
.audio-utt-text {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
}
.audio-utt-empty {
  padding: 24px 16px;
  color: #aaa;
  font-size: 13px;
  text-align: center;
}

/* ── Chat bubbles for audio utterances ─────────────────────────────────────── */
.audio-utt-bubble {
  display: flex;
  padding: 4px 12px;
  gap: 6px;
  align-items: flex-end;
}
.audio-utt-bubble-left {
  flex-direction: row;
  justify-content: flex-start;
}
.audio-utt-bubble-right {
  flex-direction: row-reverse;
  justify-content: flex-start;
}
.audio-utt-bubble-name {
  font-size: 11px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  opacity: 0.85;
}
.audio-utt-speaker-label {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  opacity: 0.75;
  padding: 0 4px;
  width: 100%;
}
.audio-utt-bubble-inner {
  max-width: 88%;
  display: flex;
  flex-direction: column;
}
.audio-utt-bubble-left .audio-utt-bubble-inner {
  align-items: flex-start;
}
.audio-utt-bubble-right .audio-utt-bubble-inner {
  align-items: flex-end;
}
.audio-utt-bubble-text {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 16px;
  word-break: break-word;
  white-space: pre-wrap;
}
.audio-utt-bubble-left .audio-utt-bubble-text {
  background: #f0f0f0;
  color: #222;
  border-bottom-left-radius: 4px;
}
.audio-utt-bubble-right .audio-utt-bubble-text {
  background: #4a90e2;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.audio-utt-bubble-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 0 2px;
}
.audio-utt-bubble-left .audio-utt-bubble-footer {
  flex-direction: row;
}
.audio-utt-bubble-right .audio-utt-bubble-footer {
  flex-direction: row-reverse;
}
.audio-utt-time {
  font-size: 10px;
  color: #aaa;
  white-space: nowrap;
}
.audio-utt-bubble-actions {
  display: flex;
  gap: 4px;
}
.audio-utt-bubble-actions .tts-btn,
.audio-utt-bubble-actions .audio-clip-btn,
.audio-utt-bubble-actions .audio-rename-btn {
  font-size: 12px;
  padding: 2px 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.6;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.audio-utt-bubble-actions .tts-btn:hover,
.audio-utt-bubble-actions .audio-clip-btn:hover,
.audio-utt-bubble-actions .audio-rename-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.07);
}

/* ── Collapsible long bubble text ───────────────────────────────────────────── */
.audio-utt-bubble-text-collapsed {
  max-height: 7em;
  overflow: hidden;
  position: relative;
}
.audio-utt-bubble-text-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5em;
  background: linear-gradient(transparent, rgba(255,255,255,0.95));
  pointer-events: none;
}
.audio-utt-bubble-left .audio-utt-bubble-text-collapsed::after {
  background: linear-gradient(transparent, rgba(245,245,245,0.95));
}
.audio-utt-expand-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 3px 0;
  font-size: 11px;
  color: #4a90e2;
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
}
.audio-utt-expand-btn:hover {
  text-decoration: underline;
}

/* ── Speaker toggle pills ─────────────────────────────────────────────────── */
.audio-spk-pills {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.audio-spk-pill {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #f5f5f5;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  font-weight: 500;
}
.audio-spk-pill:hover {
  background: #e8e8e8;
  border-color: #aaa;
}
.audio-spk-pill.active {
  background: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
}
.audio-utt-bubble-left .audio-spk-pill.active {
  background: #555;
  border-color: #555;
}

/* ── Partner name input in voice drop zone ────────────────────────────────── */
.voice-partner-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  justify-content: center;
}
.voice-partner-name-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}
.voice-partner-name-input {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  width: 140px;
  background: #fff;
  color: #333;
  transition: border-color 0.15s;
}
.voice-partner-name-input:focus {
  border-color: #4a90e2;
}

.audio-utt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
}
.audio-utt-page-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #555;
}
.audio-utt-page-btn:disabled { opacity: 0.4; cursor: default; }
.audio-utt-page-info {
  font-size: 12px;
  color: #888;
}

/* Month tabs */
.audio-month-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 8px;
  border-bottom: 1px solid #eaeaea;
  background: #fafafa;
  flex-shrink: 0;
}
.audio-month-tab {
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.audio-month-tab:hover { background: #f0f4ff; border-color: #aac; }
.audio-month-tab.active {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 600;
}

/* Batch stop button */
.batch-stop-btn {
  flex-shrink: 0;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #e53e3e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.batch-stop-btn:hover { background: #c53030; }

/* Audio clip play button */
.audio-clip-btn { display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px; border:none; border-radius:50%; background:#e8f4e8; color:#2d7a2d; font-size:11px; cursor:pointer; flex-shrink:0; transition:background 0.15s; }
.audio-clip-btn:hover { background:#c8e6c8; }
.audio-clip-btn.clip-playing { background:#2d7a2d; color:#fff; }
.audio-clip-btn:disabled { opacity:0.6; cursor:not-allowed; }

/* Highlight the bubble whose audio is currently playing */
.audio-utt-bubble.audio-playing {
  background: rgba(74, 144, 226, 0.07);
  border-radius: 12px;
  outline: 2px solid rgba(74, 144, 226, 0.35);
  outline-offset: 1px;
  transition: outline 0.2s, background 0.2s;
}
.audio-utt-bubble.audio-playing .audio-utt-bubble-inner {
  animation: pulse-playing 1.8s ease-in-out infinite;
}
@keyframes pulse-playing {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}
/* Highlight the bubble that was last played (grey background) */
.audio-utt-bubble.audio-clip-last-played {
  background: rgba(0, 0, 0, 0.045);
  border-radius: 12px;
  outline: 1.5px solid rgba(0, 0, 0, 0.10);
  outline-offset: 1px;
}
.audio-clip-btn.clip-last-played {
  background: #d8d8d8 !important;
  color: #555 !important;
}


/* ── Global Stop Audio button ─────────────────────────────────────────────── */
.global-stop-audio-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 6px rgba(229,62,62,0.35);
  white-space: nowrap;
}
.global-stop-audio-btn:hover { background: #c53030; transform: scale(1.04); }
.global-stop-audio-btn:active { transform: scale(0.97); }
.global-stop-audio-btn svg { flex-shrink: 0; }

/* ── Clear Chat button ────────────────────────────────────────────────────── */
.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 12px 0;
  flex-shrink: 0;
}
.clear-chat-btn {
  font-size: 12px;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.clear-chat-btn:hover { background: #f5f5f5; color: #e53e3e; }

/* ── Voice badge on audio utterance bubbles ──────────────────────────────── */
.audio-utt-voice-badge {
  font-size: 10px;
  color: #888;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Insights: Clear All button ─────────────────────────────────────────── */
.gpt-msg-clear-all-btn {
  background: #ff4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.gpt-msg-clear-all-btn:hover {
  background: #cc0000;
}

/* ── Insights: Play ▶ button ─────────────────────────────────────────────── */
.gpt-msg-play-btn {
  background: #4a90e2;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.gpt-msg-play-btn:hover {
  background: #2a6fc0;
}

/* ── Insights Sub-tabs ─────────────────────────────────────────────────────── */
.insights-subtabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}
.insights-subtab {
  padding: 6px 14px;
  border: none;
  background: none;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.insights-subtab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #f0f5ff;
}
.insights-subtab:hover:not(.active) {
  color: #444;
  background: #f5f5f5;
}

/* ── WhatsApp voice badge ──────────────────────────────────────────────────── */
.audio-utt-voice-badge-wa {
  background: #e8fdf0 !important;
  color: #25d366 !important;
  border: 1px solid #b7f0cc !important;
}

/* ── AI SUMMARY CARD ────────────────────────────────────────────────────────── */
.ai-summary-card {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 420px;
  border-left-width: 3px;
  border-left-style: solid;
}
.risk-border-low    { border-left-color: #6b7280; }
.risk-border-medium { border-left-color: #f59e0b; }
.risk-border-high   { border-left-color: #ef4444; }
.risk-border-critical { border-left-color: #7c3aed; }
.ai-summary-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}
.ai-summary-title {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: auto;
}
.ai-summary-risk {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.05em;
}
.ai-summary-score {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
}
.ai-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-summary-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.ai-summary-key {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  min-width: 68px;
  flex-shrink: 0;
}
.ai-summary-val {
  font-size: 12px;
  color: #374151;
}
.ai-summary-preds {
  margin-top: 6px;
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
}
.ai-summary-preds ul {
  margin: 4px 0 0 0;
  padding-left: 16px;
}
.ai-summary-preds li {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}

/* Voice Upload Zone */
.voice-upload-area {
  display: flex; align-items: center; justify-content: center;
  min-height: 320px; border: 2px dashed #d0d5dd; border-radius: 16px;
  margin: 16px; background: #fafafa; transition: border-color .2s, background .2s; cursor: pointer;
}
.voice-upload-area.drag-over { border-color: #4f8ef7; background: #eef4ff; }
.voice-upload-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px; text-align: center; }
.voice-drop-icon { font-size: 48px; line-height: 1; }
.voice-drop-title { font-size: 16px; font-weight: 600; color: #333; }
.voice-drop-sub { font-size: 13px; color: #999; }
.voice-drop-btn { margin-top: 4px; padding: 10px 24px; background: #4f8ef7; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.voice-drop-btn:hover { background: #3a7de0; }
.voice-drop-hint { font-size: 12px; color: #aaa; margin-top: 4px; }
.voice-progress-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #f8f9fb; border-bottom: 1px solid #eee; flex-shrink: 0; }
.voice-progress-bar-wrap { flex: 1; height: 8px; background: #e8eaed; border-radius: 4px; overflow: hidden; }
.voice-progress-fill { height: 100%; background: #4f8ef7; border-radius: 4px; transition: width .4s ease; }
.voice-progress-label { font-size: 12px; color: #666; white-space: nowrap; }
.voice-stop-btn { padding: 4px 10px; background: #ff4d4f; color: #fff; border: none; border-radius: 6px; font-size: 12px; cursor: pointer; }
.voice-speakers-btn, .voice-clear-btn, .voice-export-btn { padding: 4px 10px; background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px; font-size: 12px; cursor: pointer; }
.voice-clear-btn { color: #e53e3e; }
.voice-export-btn { color: #2b6cb0; }
.voice-tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; padding: 12px 16px; align-content: start; max-height: 240px; overflow-y: auto; flex-shrink: 0; }
.voice-tile { position: relative; border-radius: 8px; padding: 8px 10px; background: #fff; border: 1px solid #e8eaed; display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: border-color .2s, background .2s; }
.voice-tile--pending { border-color: #e8eaed; background: #fafafa; }
.voice-tile--processing { border-color: #4f8ef7; background: #eef4ff; animation: vt-pulse 1.2s ease-in-out infinite; }
.voice-tile--done { border-color: #52c41a; background: #f6ffed; }
.voice-tile--cancelled { border-color: #d9d9d9; background: #f5f5f5; opacity: .6; }
.voice-tile--error { border-color: #ff4d4f; background: #fff2f0; }
@keyframes vt-pulse { 0%,100%{opacity:1} 50%{opacity:.7} }
.vt-status-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #d9d9d9; }
.voice-tile--processing .vt-status-dot { background: #4f8ef7; }
.voice-tile--done .vt-status-dot { background: #52c41a; }
.voice-tile--error .vt-status-dot { background: #ff4d4f; }
.vt-ext { font-size: 10px; font-weight: 700; color: #888; text-transform: uppercase; }
.vt-name { font-size: 11px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-date { font-size: 10px; color: #888; }
.vt-time { font-size: 10px; color: #aaa; }

/* ═══════════════════════════════════════════════════════════════
   IMPORT HUB — unified import entry point in Insights
   ═══════════════════════════════════════════════════════════════ */

/* Import Hub main screen */
.import-hub { display: flex; flex-direction: column; align-items: center; padding: 32px 20px 24px; gap: 24px; }
.import-hub-header { text-align: center; }
.import-hub-title { font-size: 18px; font-weight: 700; color: #111; margin-bottom: 6px; }
.import-hub-sub { font-size: 13px; color: #888; }

/* Source cards */
.import-hub-cards { display: flex; gap: 16px; width: 100%; max-width: 480px; }
.import-hub-card { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 16px; background: #fff; border: 2px solid #e8eaed; border-radius: 16px; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .15s; text-align: center; }
.import-hub-card:hover { border-color: #4f8ef7; box-shadow: 0 4px 20px rgba(79,142,247,.15); transform: translateY(-2px); }
.ihc-icon { font-size: 36px; line-height: 1; }
.ihc-name { font-size: 15px; font-weight: 700; color: #111; }
.ihc-desc { font-size: 12px; color: #888; line-height: 1.4; }

/* Quick action chips */
.import-quick-chips { width: 100%; max-width: 480px; }
.import-quick-label { font-size: 11px; font-weight: 600; color: #aaa; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.import-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.import-chip { padding: 6px 14px; background: #f4f5f7; border: 1px solid #e8eaed; border-radius: 20px; font-size: 12px; color: #444; cursor: pointer; transition: background .15s, border-color .15s; }
.import-chip:hover { background: #eef4ff; border-color: #4f8ef7; color: #4f8ef7; }

/* Flow screens */
.import-flow-screen { display: flex; flex-direction: column; height: 100%; }
.import-flow-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid #eee; flex-shrink: 0; }
.import-back-btn { background: none; border: none; font-size: 14px; color: #4f8ef7; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.import-back-btn:hover { background: #eef4ff; }
.import-flow-title { font-size: 15px; font-weight: 700; color: #111; }

/* Flow steps */
.import-flow-step { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.import-step-label { font-size: 14px; font-weight: 600; color: #333; }

/* Checkboxes */
.import-checkboxes { display: flex; flex-direction: column; gap: 10px; }
.import-checkbox-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fafafa; border: 1px solid #e8eaed; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; font-size: 14px; color: #333; }
.import-checkbox-row:hover { background: #eef4ff; border-color: #4f8ef7; }
.import-checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: #4f8ef7; cursor: pointer; flex-shrink: 0; }
.import-checkbox-icon { font-size: 18px; }
.import-checkbox-hint { font-size: 11px; color: #aaa; margin-left: 4px; }

/* Next / Continue button */
.import-next-btn { align-self: flex-end; padding: 10px 24px; background: #111; color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.import-next-btn:hover { background: #333; }

/* Owner cards (GPT flow) */
.import-owner-cards { display: flex; gap: 10px; }
.import-owner-card { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; background: #fafafa; border: 2px solid #e8eaed; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: #333; transition: border-color .15s, background .15s; }
.import-owner-card:hover, .import-owner-card.active { border-color: #4f8ef7; background: #eef4ff; color: #4f8ef7; }
.ioc-icon { font-size: 22px; }

/* Generic drop zone (for text / GPT) */
.import-drop-zone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px; background: #fafafa; border: 2px dashed #d0d7de; border-radius: 14px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.import-drop-zone.drag-over, .import-drop-zone:hover { border-color: #4f8ef7; background: #eef4ff; }
.import-drop-icon { font-size: 32px; }
.import-drop-title { font-size: 14px; color: #555; }

/* Import-more tab button */
.insights-subtab.import-more-btn { margin-left: auto; background: #f0f4ff; color: #4f8ef7; border-color: transparent; font-weight: 600; }
.insights-subtab.import-more-btn:hover { background: #dde8ff; }

/* ── Import Hub: spinner ─────────────────────────────────────────────────────── */
@keyframes import-spin {
  to { transform: rotate(360deg); }
}
.import-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: import-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
/* When spinner is inside a dark button */
.voice-drop-btn .import-spinner,
.import-next-btn .import-spinner {
  border-color: rgba(255,255,255,0.3);
  border-top-color: #fff;
}
/* When spinner is inside the drop zone (light bg) */
.import-drop-zone .import-spinner {
  border-color: rgba(80,80,80,0.2);
  border-top-color: #555;
}
.gpt-drop-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ── GPT parse progress bar ─────────────────────────────────────────────────── */
.gpt-parse-progress {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f0f4ff;
  border: 1px solid #c7d8ff;
  border-radius: 10px;
}
.gpt-parse-progress-bar-wrap {
  height: 6px;
  background: #dce8ff;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.gpt-parse-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f8ef7, #7c3aed);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.gpt-parse-progress-status {
  font-size: 12px;
  color: #4f6eb0;
  text-align: center;
}

/* ── Voice import persistent banner ─────────────────────────────────────────── */
.voice-import-banner {
  margin: 8px 12px 4px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eef4ff 0%, #f0e8ff 100%);
  border: 1px solid #c5d8ff;
  border-radius: 10px;
  flex-shrink: 0;
}
.vib-title {
  font-size: 12px;
  font-weight: 600;
  color: #3a5fcc;
  margin-bottom: 6px;
}
.vib-bar-wrap {
  height: 5px;
  background: #d8e6ff;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
.vib-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4f8ef7, #7c3aed);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.vib-status {
  font-size: 11px;
  color: #5a6fa8;
  text-align: right;
}

/* ── WA Speaker selection ─────────────────────────────────── */
.wa-speaker-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.wa-speaker-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.wa-speaker-card:hover {
  border-color: #4f8ef7;
  background: #f0f6ff;
}

.wa-speaker-card.active {
  border-color: #4f8ef7;
  background: #4f8ef7;
  color: #fff;
}

.wa-speaker-card .wsc-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.wa-speaker-card.active .wsc-avatar {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.wa-speaker-custom {
  margin: 6px 0 0;
}

.wa-speaker-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #d0d0d0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.wa-speaker-input:focus {
  border-color: #4f8ef7;
}

/* ── Persistent private conversations inside Insights ─────────────────────── */
.insight-conversations-shell{width:100%;padding:22px 24px 8px;flex:0 0 auto}
.ic-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}
.ic-title{font-size:19px;font-weight:650;color:#171717;letter-spacing:-.01em}
.ic-sub{font-size:13px;color:#777;margin-top:4px;max-width:680px;line-height:1.4}
.ic-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.ic-add,.ic-more{display:inline-flex;align-items:center;justify-content:center;border-radius:9px;padding:8px 12px;font-size:13px;text-decoration:none;cursor:pointer;white-space:nowrap}
.ic-add{background:#111;color:#fff;border:1px solid #111}
.ic-more{background:#fff;color:#555;border:1px solid #e3e3e3}
.ic-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:10px}
.ic-card{display:block;position:relative;text-decoration:none;color:inherit;background:#fff;border:1px solid #e8e8e8;border-radius:12px;padding:14px 15px;transition:border-color .15s,box-shadow .15s,transform .15s}
.ic-card:hover{border-color:#cfcfcf;box-shadow:0 4px 16px rgba(0,0,0,.055);transform:translateY(-1px)}
.ic-card-top{display:flex;align-items:center;gap:10px}
.ic-avatar{width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#f2f2f4;color:#444;font-size:14px;font-weight:650;flex:0 0 auto}
.ic-card-name{font-size:15px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ic-card-meta{font-size:12px;color:#777;margin-top:8px;display:flex;gap:8px;flex-wrap:wrap}
.ic-card-status{font-size:12px;color:#6c5aa5;margin-top:7px}
.ic-card-status.ready{color:#40815b}
.ic-empty,.ic-loading{grid-column:1/-1;padding:22px;border:1px dashed #ddd;border-radius:12px;text-align:center;color:#777;font-size:13px}
.ic-delete{position:absolute;right:9px;top:9px;width:26px;height:26px;border:0;border-radius:7px;background:transparent;color:#aaa;cursor:pointer;font-size:14px}
.ic-delete:hover{background:#f4f4f4;color:#c33}
.insight-conversations-shell.compact{padding:12px 12px 4px}
.insight-conversations-shell.compact .ic-list{grid-template-columns:1fr}
.insight-conversations-shell.compact .ic-sub,.insight-conversations-shell.compact .ic-more{display:none}
@media(max-width:700px){.insight-conversations-shell{padding:16px 12px 6px}.ic-head{flex-direction:column}.ic-actions{justify-content:flex-start}.ic-list{grid-template-columns:1fr}}

/* ── V72 home redesign: welcome overlay, footer, system font ─────────────── */
.chat-welcome {
  position: absolute; left: 0; right: 0; top: 0; bottom: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; pointer-events: none; z-index: 1;
}
.chat-welcome.hide { display: none; }
.chat-welcome .cw-icon { opacity: .9; margin-bottom: 18px; }
.chat-welcome .cw-title {
  font-family: Georgia, 'Times New Roman', serif; font-weight: 500;
  font-size: 40px; color: #2b2f36; margin: 0 0 14px; letter-spacing: .2px;
}
.chat-welcome .cw-lead {
  font-family: Georgia, 'Times New Roman', serif; font-size: 20px;
  color: #5b616b; margin: 0 0 12px;
}
.chat-welcome .cw-sub { font-size: 15px; color: #8a9098; margin: 0; max-width: 620px; }
/* the chat panel must be the positioning context for the overlay */
#wsPanelChat { position: relative; }

.app-footer {
  flex: 0 0 auto; text-align: center; font-size: 11.5px; color: #a7adb5;
  padding: 8px 12px; border-top: 1px solid #F0F0F0; background: #fff;
}

@media (max-width: 760px) {
  .chat-welcome .cw-title { font-size: 30px; }
  .chat-welcome .cw-lead { font-size: 17px; }
  .chat-welcome { bottom: 110px; }
}
