/* ============================================================
   VIEWS — view-specific layout overrides
============================================================ */

/* ---- DASHBOARD ---- */
.pipeline-funnel {
  display: flex; align-items: center; gap: 0;
  background: #fff; border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 20px;
}
.funnel-step {
  flex: 1; padding: 16px 12px; text-align: center;
  border-right: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
  position: relative;
}
.funnel-step:hover { background: var(--red); }
.funnel-step:hover .funnel-num,
.funnel-step:hover .funnel-label { color: #fff; }
.funnel-step.selected { background: var(--red); }
.funnel-step.selected .funnel-num,
.funnel-step.selected .funnel-label { color: #fff; }
.funnel-step.selected:hover ~ .funnel-step { background: none; }
.funnel-step-empty {
  opacity: 0.35;
  pointer-events: none;
}
.funnel-step-empty .funnel-num {
  color: #bbb;
}
.funnel-step-empty .funnel-label {
  color: #ccc;
}
.funnel-num   { font-size: 1.6rem; font-weight: 900; color: var(--black); line-height: 1; }
.funnel-label { font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-top: 4px; }
.funnel-arrow { color: #ddd; font-size: .7rem; font-weight: 900; flex-shrink: 0; padding: 0 2px; }

.source-chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.source-chip {
  background: #fff; border-radius: 8px; border-left: 3px solid var(--red);
  box-shadow: var(--shadow); padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
}
.source-chip-name  { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; }
.source-chip-count { font-size: 1.1rem; font-weight: 900; color: var(--red); }
.source-chip-lbl   { font-size: .6rem; color: #888; font-weight: 700; text-transform: uppercase; }

.activity-list { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: .78rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot  { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.activity-text { flex: 1; line-height: 1.4; font-weight: 700; }
.activity-time { font-size: .65rem; color: #888; font-weight: 700; white-space: nowrap; }
.activity-item-link {
  cursor: pointer;
  transition: background .12s;
}
.activity-item-link:hover {
  background: #fff5f5;
}

/* ---- PIPELINE ---- */
.kanban-more { font-size: .65rem; color: #999; text-align: center; padding: 6px; font-weight: 700; font-style: italic; }

/* Equal width pipeline columns */
.kanban {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow-x: auto;
}

.kanban-col {
  flex: 0 0 220px;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  box-sizing: border-box;
}

.kanban-col-header {
  width: 100%;
  box-sizing: border-box;
}

.kanban-cards {
  width: 100%;
  box-sizing: border-box;
}

.candidate-card {
  width: 100%;
  box-sizing: border-box;
}

/* Use available screen height for pipeline columns */
.kanban-col {
  height: calc(100vh - 310px);
  min-height: 420px;
  max-height: calc(100vh - 310px);
  display: flex;
  flex-direction: column;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* Optional: make scrollbar cleaner inside each stage */
.kanban-cards::-webkit-scrollbar {
  width: 6px;
}

.kanban-cards::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 999px;
}

.kanban-cards::-webkit-scrollbar-track {
  background: transparent;
}

/* Drag and drop pipeline feedback */
.candidate-card {
  cursor: grab;
}

.candidate-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-col.drag-over {
  outline: 3px dashed var(--red);
  outline-offset: 4px;
  background: #fff8f8;
}

/* ---- PROFILES ---- */
.profile-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: 8px; flex-shrink: 0; vertical-align: middle;
  text-transform: uppercase;
}

/* ---- PHASE 2/3 BANNERS ---- */
.phase-banner {
  background: #fff8e1; border-left: 4px solid var(--yellow);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
}
.phase-banner.phase3 { background: #f3e5f5; border-left-color: #9c27b0; }
.phase-banner-icon  { font-size: 1.4rem; flex-shrink: 0; }
.phase-banner-title { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: #666; }
.phase-banner-desc  { font-size: .78rem; color: #888; margin-top: 2px; line-height: 1.4; }
.phase-label {
  display: inline-block; font-size: .6rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 7px; border-radius: 4px; margin-left: 6px;
  vertical-align: middle;
}
.phase-label.p2 { background: #fff3e0; color: #e65100; }
.phase-label.p3 { background: #f3e5f5; color: #6a1b9a; }

/* ---- SETTINGS ---- */
.settings-section {
  background: #fff; border-radius: 12px; border-left: 4px solid var(--red);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.settings-section-title {
  font-size: .78rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--red); margin-bottom: 10px;
}
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .82rem;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-weight: 700; }
.settings-row-val   { color: #888; font-size: .75rem; }

/* ── AI Assistant ── */
.ai-assistant-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-assistant-header {
  background: var(--card);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.ai-eyebrow {
  font-size: .68rem;
  font-weight: 900;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.ai-assistant-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--black);
}

.ai-assistant-header p {
  margin: 6px 0 0;
  font-size: .82rem;
  color: #666;
  line-height: 1.5;
  max-width: 760px;
}

.ai-status-card {
  min-width: 0;
  background: #fff7f7;
  border: 1px solid #ffd6d6;
  border-radius: 999px;
  padding: 8px 12px;
}

.ai-status-label,
.ai-status-sub {
  display: none;
}

.ai-status-value {
  font-size: .72rem;
  color: var(--red);
  font-weight: 900;
  margin: 0;
}

.ai-status-value::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #27a844;
}

.ai-assistant-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: start;
}

.ai-chat-card,
.ai-side-card {
  background: var(--card);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.ai-chat-card {
  min-height: calc(100vh - 275px);
  display: flex;
  flex-direction: column;
}

.ai-chat-messages {
  flex: 1;
  min-height: 380px;
  max-height: calc(100vh - 380px);
  overflow-y: auto;
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-empty-state {
  margin: auto;
  text-align: center;
  color: #777;
  max-width: 420px;
}

.ai-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.ai-empty-title {
  font-size: .95rem;
  font-weight: 900;
  color: #222;
  margin-bottom: 4px;
}

.ai-empty-text {
  font-size: .78rem;
  line-height: 1.5;
}

.ai-message {
  border-radius: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  background: #fff;
}

.ai-message-user {
  max-width: 55%;
  margin-left: auto;
  background: #eef4ff;
  border-color: #cfddf4;
}

.ai-message-assistant {
  width: 92%;
  max-width: 92%;
  margin-right: auto;
  background: #fff;
  border-left: 3px solid var(--red);
}

.ai-message-label {
  font-size: .62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #999;
  margin-bottom: 4px;
}

.ai-message-body {
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #222;
}

.ai-compose {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
}

.ai-compose textarea {
  flex: 1;
  min-height: 42px;
  max-height: 100px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: .86rem;
  font-family: inherit;
  resize: none;
  outline: none;
}

.ai-compose textarea:focus {
  border-color: var(--red);
}

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

.ai-prompt-list button {
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 800;
  color: #333;
  line-height: 1.35;
  font-family: inherit;
}

.ai-prompt-list button:hover {
  border-color: var(--red);
  color: var(--red);
}

.ai-note {
  margin-top: 14px;
  background: #fffaf0;
  border: 1px solid #ffe4a3;
  border-radius: 9px;
  padding: 10px;
  font-size: .72rem;
  color: #666;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .ai-assistant-header,
  .ai-assistant-grid,
  .ai-compose {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .ai-status-card {
    width: 100%;
  }

  .ai-message {
    max-width: 100%;
  }
}

.ai-candidate-results {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}

.ai-candidate-result {
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 9px 11px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-candidate-result:last-child {
  border-bottom: none;
}

.ai-candidate-name {
  font-size: .78rem;
  font-weight: 900;
  color: #111;
}

.ai-candidate-reason {
  font-size: .7rem;
  color: #666;
  line-height: 1.4;
  margin-top: 2px;
}

/* ============================================================
   Profiles Call View full-screen scroll table
   Keeps filters/pagination visible and scrolls table internally
============================================================ */

#pane-profiles .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

/* Table gets its own scroll area */
#pane-profiles .profiles-table-scroll {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 235px);
  max-height: calc(100vh - 235px);
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #eee;
}

/* Fixed layout so columns hug their defined widths (no stretched empty gaps)
   and text can actually clip at the cell edge. Sum of column widths ~1690px. 1290px*/
#pane-profiles .profiles-table-scroll .tbl {
  width: 100%;
  min-width: 1290px;
  table-layout: fixed;
  font-size: .68rem;
}

/* Sticky header — titles wrap by WHOLE WORD (no mid-word "Plat-form" breaks) */
#pane-profiles .profiles-table-scroll .tbl thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1.02;
  vertical-align: bottom;
  padding: 4px 2px;
  font-size: .56rem;
}

/* SPREADSHEET CLIPPING — every cell hides overflow behind its edge with an
   ellipsis so text never covers the next column. Full text shows on hover via
   the native title tooltip (set per-cell in profiles.js _bindRows). Tight 1px
   side padding = minimal gap between columns. */
#pane-profiles .profiles-table-scroll .tbl th,
#pane-profiles .profiles-table-scroll .tbl td {
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  padding-left: 4px;
  padding-right: 4px;
  border-right: 1px solid #eee;
}

/* Action column is the exception — keep its Edit/Profile buttons fully visible */
#pane-profiles .profiles-table-scroll .call-action-cell {
  overflow: visible;
  min-width: 170px;
  width: 170px;
  white-space: nowrap;
}

/* Cleaner internal scrollbars */
#pane-profiles .profiles-table-scroll::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

#pane-profiles .profiles-table-scroll::-webkit-scrollbar-thumb {
  background: #aaa;
  border-radius: 99px;
}

#pane-profiles .profiles-table-scroll::-webkit-scrollbar-track {
  background: #f3f3f3;
}
