/* Unduit CRM — custom styles (supplements Tailwind) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --orange: #F97316;
  --blue:   #046BD2;
  --sidebar-bg: #0f1623;
  --sidebar-border: rgba(255,255,255,0.08);
}

body { font-family: 'Inter', system-ui, sans-serif; }

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}

.nav-active {
  background: rgba(249,115,22,0.15);
  color: #F97316;
  border-left: 3px solid #F97316;
  padding-left: calc(0.75rem - 3px);
}

/* ── Buttons ──────────────────────────────────────── */
.btn-primary {
  background: #F97316;
  color: white;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover { background: #ea6c0a; }

.btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #f9fafb; }

.btn-danger {
  background: #ef4444;
  color: white;
  font-weight: 600;
}
.btn-danger:hover { background: #dc2626; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ── Health badges ────────────────────────────────── */
.health-green  { background:#dcfce7; color:#166534; }
.health-amber  { background:#fef9c3; color:#854d0e; }
.health-red    { background:#fee2e2; color:#991b1b; }

/* ── Category badges ──────────────────────────────── */
.cat-Strategic   { background:#dcfce7; color:#15803d; }
.cat-Tactical    { background:#dbeafe; color:#1d4ed8; }
.cat-Leverage    { background:#fef3c7; color:#92400e; }
.cat-Maintenance { background:#fee2e2; color:#991b1b; }
.cat-NA          { background:#f3e8ff; color:#6b21a8; }
/* actual data values */
.cat-PLG         { background:#eff6ff; color:#1d4ed8; }
.cat-Large       { background:#fdf4ff; color:#7e22ce; }
.cat-Medium      { background:#fff7ed; color:#c2410c; }
.cat-Small       { background:#f0fdf4; color:#166534; }
.cat-default     { background:#f3f4f6; color:#4b5563; }

/* ── Stage badges ─────────────────────────────────── */
.stage-Active   { background:#dcfce7; color:#166534; }
.stage-At-Risk  { background:#fef3c7; color:#92400e; }
.stage-Churned  { background:#fee2e2; color:#991b1b; }
.stage-Dormant  { background:#f3f4f6; color:#4b5563; }

/* ── Flash messages ───────────────────────────────── */
.flash-success { background:#dcfce7; color:#15803d; border:1px solid #86efac; }
.flash-error   { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.flash-info    { background:#dbeafe; color:#1e40af; border:1px solid #93c5fd; }
.flash-warning { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }

/* ── Table ────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { background:#f3f4f6; }
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #374151;
  vertical-align: middle;
}
.data-table tr:hover td { background:#fafafa; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Solution type tags ───────────────────────────── */
.sol-tag {
  display: inline-block;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  white-space: nowrap;
  margin: 1px;
}

/* ── Journey timeline ─────────────────────────────── */
.journey-stage {
  flex: 1;
  text-align: center;
  position: relative;
}
.journey-stage::after {
  content: '';
  position: absolute;
  top: 14px;
  right: -50%;
  width: 100%;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}
.journey-stage:last-child::after { display: none; }
.journey-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: white;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  position: relative; z-index: 1;
  font-size: 0.75rem;
}
.journey-dot.complete  { background:#16a34a; border-color:#16a34a; color:white; }
.journey-dot.progress  { background:#F97316; border-color:#F97316; color:white; }
.journey-dot.pending   { background:white;   border-color:#d1d5db; color:#9ca3af; }

/* ── Activity feed ────────────────────────────────── */
.activity-item { display:flex; gap:12px; padding:0.75rem 0; }
.activity-item:not(:last-child) { border-bottom:1px solid #f3f4f6; }
.activity-icon {
  width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; font-size:0.85rem;
}
.act-note     { background:#f0f4ff; }
.act-email    { background:#fef3c7; }
.act-call     { background:#dcfce7; }
.act-meeting  { background:#f0fdf4; }
.act-qbr      { background:#ede9fe; }
.act-flag     { background:#fee2e2; }

/* ── Form inputs ──────────────────────────────────── */
.form-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #111827;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: #F97316;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Modal ────────────────────────────────────────── */
#modal-overlay { backdrop-filter: blur(2px); }

/* ── Chart container ──────────────────────────────── */
.chart-container { position: relative; height: 200px; }

/* ── Progress bar ─────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #F97316;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* ── Sticky table columns ─────────────────────────── */
.col-sticky-left {
  position: sticky;
  z-index: 2;
  background: white;
}
.col-sticky-right {
  position: sticky;
  right: 0;
  z-index: 2;
  background: white;
  box-shadow: -2px 0 6px rgba(0,0,0,0.06);
}
thead .col-sticky-left,
thead .col-sticky-right {
  z-index: 3;
  background: #f9fafb;
}
.data-table tr:hover .col-sticky-left,
.data-table tr:hover .col-sticky-right { background: #fafafa; }
.col-sticky-left + .col-sticky-left { box-shadow: 2px 0 6px rgba(0,0,0,0.06); }

/* company name truncation */
.company-cell { max-width: 180px; }
.company-cell a,
.company-cell .company-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sort arrows ──────────────────────────────────── */
.sort-arrow {
  font-size: 0.65rem;
  color: #F97316;
  vertical-align: middle;
}
.data-table th[data-sort] { padding-right: 1.25rem; }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }

/* ── Print ────────────────────────────────────────── */
@media print {
  .sidebar, header, .no-print { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: white !important; }
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 56px; }
  .sidebar span, .sidebar p, .nav-link span { display: none; }
}

/* ── Toast ────────────────────────────────────────── */
#toast { transition: opacity 0.3s; }
#toast.show { display: block !important; }
#toast.hide { opacity: 0; }

/* ── QBR status ───────────────────────────────────── */
.qbr-overdue   { background:#fee2e2; color:#991b1b; }
.qbr-due-soon  { background:#fef3c7; color:#92400e; }
.qbr-on-track  { background:#dcfce7; color:#166534; }
.qbr-unscheduled { background:#f3f4f6; color:#4b5563; }

/* ── Sticky tab nav ───────────────────────────────── */
.tab-nav-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tab-btn {
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: #111827; }
.tab-btn.active {
  color: #F97316;
  border-bottom-color: #F97316;
  font-weight: 600;
}

/* ── Health dimension bars ────────────────────────── */
.dim-bar {
  height: 8px;
  border-radius: 9999px;
  background: #e5e7eb;
  overflow: hidden;
}
.dim-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.dim-fill-engagement  { background: #3b82f6; }
.dim-fill-adoption    { background: #f97316; }
.dim-fill-commercial  { background: #8b5cf6; }
.dim-fill-sentiment   { background: #10b981; }

/* ── Stage stepper ────────────────────────────────── */
.stage-stepper {
  display: flex;
  align-items: center;
  gap: 0;
}
.stage-step {
  flex: 1;
  text-align: center;
  position: relative;
}
.stage-step::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}
.stage-step:last-child::after { display: none; }
.stage-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: white;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  position: relative; z-index: 1;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.2s;
}
.stage-dot.done    { background:#16a34a; border-color:#16a34a; color:white; }
.stage-dot.current { background:#F97316; border-color:#F97316; color:white; box-shadow:0 0 0 4px rgba(249,115,22,0.2); }
.stage-dot.future  { background:white;   border-color:#d1d5db; color:#9ca3af; }

/* ── Sentiment badges ─────────────────────────────── */
.sentiment-very_positive { background:#dcfce7; color:#14532d; }
.sentiment-positive      { background:#d1fae5; color:#065f46; }
.sentiment-neutral       { background:#f3f4f6; color:#374151; }
.sentiment-negative      { background:#fef3c7; color:#92400e; }
.sentiment-very_negative { background:#fee2e2; color:#991b1b; }

/* ── Data completeness nudge ──────────────────────── */
.nudge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(249,115,22,0.1);
  color: #c2410c;
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.nudge-pill:hover { background: rgba(249,115,22,0.18); }

/* ── Health score donut ───────────────────────────── */
.health-donut { transform: rotate(-90deg); }
.health-donut-track { fill: none; stroke: #f3f4f6; }
.health-donut-fill  { fill: none; stroke-linecap: round; transition: stroke-dasharray 0.8s ease; }

/* ── Count-up animation ───────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.count-up { animation: countUp 0.4s ease forwards; }

/* ── Cards — enhanced hover ───────────────────────── */
.card-hover {
  transition: box-shadow 0.2s, transform 0.2s;
}
.card-hover:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

/* ── Stat card accent line ────────────────────────── */
.stat-card-accent {
  border-top: 3px solid var(--orange);
}

/* ── Champion badge ───────────────────────────────── */
.champion-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
}

/* ── Single-threaded warning ──────────────────────── */
.single-threaded-warn {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: #78350f;
}

/* ── Empty state ──────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  text-align: center;
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}
.empty-state-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.25rem;
}
.empty-state-body {
  font-size: 0.8125rem;
  color: #9ca3af;
  max-width: 280px;
  line-height: 1.5;
}

/* ── Rate Card & Key Terms ─────────────────────────────── */
.rc-meta-panel { background:#f9fafb; border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.rc-meta-grid  { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
@media (max-width:768px) { .rc-meta-grid { grid-template-columns:1fr 1fr; } }
.rc-meta-label { display:block; font-size:0.65rem; font-weight:600; color:#9ca3af; text-transform:uppercase; letter-spacing:0.05em; margin-bottom:3px; }
.rc-meta-input { width:100%; font-size:0.8rem; color:#374151; background:white; border:1px solid #e5e7eb; border-radius:6px; padding:5px 8px; outline:none; }
.rc-meta-input:focus { border-color:#F97316; box-shadow:0 0 0 2px rgba(249,115,22,0.1); }

.rc-section      { margin-bottom:12px; border:1px solid #f3f4f6; border-radius:8px; overflow:hidden; }
.rc-section-head { display:flex; align-items:center; justify-content:space-between; padding:7px 12px; background:#f9fafb; border-bottom:1px solid #f3f4f6; }
.rc-section-title{ font-size:0.72rem; font-weight:600; color:#4b5563; text-transform:uppercase; letter-spacing:0.05em; }
.rc-add-btn      { font-size:0.7rem; color:#F97316; font-weight:500; background:none; border:none; cursor:pointer; padding:2px 8px; border-radius:4px; }
.rc-add-btn:hover{ background:#fff7ed; }

.rc-table         { width:100%; font-size:0.77rem; border-collapse:collapse; }
.rc-table th      { padding:6px 8px; text-align:left; font-size:0.64rem; font-weight:600; color:#9ca3af; text-transform:uppercase; letter-spacing:0.04em; white-space:nowrap; border-bottom:1px solid #f3f4f6; background:#fafafa; }
.rc-table td      { padding:3px 4px; border-bottom:1px solid #f9fafb; vertical-align:middle; }
.rc-table tr:last-child td { border-bottom:none; }
.rc-table tbody tr:hover { background:#fafafa; }

.rc-cell-input       { font-size:0.77rem; border:1px solid transparent; border-radius:4px; padding:4px 6px; background:transparent; color:#374151; outline:none; min-width:0; }
.rc-cell-input:focus { border-color:#F97316; background:white; box-shadow:0 0 0 2px rgba(249,115,22,0.08); }
.rc-cell-input:hover { border-color:#e5e7eb; background:white; }

.rc-del-btn      { font-size:0.65rem; color:#d1d5db; background:none; border:none; cursor:pointer; padding:3px 5px; border-radius:3px; }
.rc-del-btn:hover{ color:#ef4444; background:#fef2f2; }

.rc-total-row .rc-total-label { font-size:0.68rem; font-weight:600; color:#9ca3af; text-transform:uppercase; padding:8px 8px 6px; border-top:2px solid #e5e7eb; }
.rc-total-row .rc-total-value { font-size:0.9rem; font-weight:700; color:#111827; padding:8px 8px 6px; border-top:2px solid #e5e7eb; }

.rc-badge      { font-size:0.6rem; padding:1px 5px; border-radius:3px; font-weight:500; white-space:nowrap; }
.rc-badge-ext  { background:#eff6ff; color:#3b82f6; border:1px solid #dbeafe; }
.rc-badge-man  { background:#f9fafb; color:#6b7280; border:1px solid #e5e7eb; }

.rc-empty      { font-size:0.78rem; color:#9ca3af; font-style:italic; padding:10px 12px; margin:0; }

.rc-tags-container { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:8px 12px; }
.rc-country-tag    { display:inline-flex; align-items:center; gap:4px; font-size:0.75rem; background:#f0fdf4; color:#166534; border:1px solid #bbf7d0; border-radius:12px; padding:2px 8px 2px 10px; }
.rc-country-tag button { font-size:0.75rem; color:#16a34a; background:none; border:none; cursor:pointer; padding:0; line-height:1; }
.rc-country-tag button:hover { color:#dc2626; }
.rc-tag-input      { font-size:0.77rem; border:1px solid #e5e7eb; border-radius:12px; padding:3px 10px; outline:none; min-width:150px; color:#374151; }
.rc-tag-input:focus{ border-color:#F97316; }

.rc-footnote-list   { list-style:none; padding:8px 12px; margin:0; }
.rc-footnote-list li{ font-size:0.77rem; color:#6b7280; padding:3px 0; }
.rc-footnote-num    { font-weight:600; color:#374151; margin-right:4px; }

/* Rate card row types */
.rc-row-header td   { background:#e0e7ff; font-weight:700; font-size:0.75rem; color:#312e81; padding:6px 8px; text-transform:uppercase; letter-spacing:0.04em; border-bottom:1px solid #c7d2fe; }
.rc-row-header td:not(:first-child) { display:none; }
.rc-row-header td:first-child { display:table-cell; }
.rc-row-subtotal td { background:#f8fafc; font-weight:600; font-size:0.76rem; color:#374151; border-top:1px solid #e5e7eb; }
.rc-row-total    td { background:#f1f5f9; font-weight:700; font-size:0.82rem; color:#111827; border-top:2px solid #cbd5e1; }
.rc-subtotal-label,.rc-total-lbl { font-weight:600; color:#4b5563; }
.rc-subtotal-value,.rc-total-val { font-weight:700; text-align:right; }
.rc-row-total .rc-total-val { font-size:0.92rem; color:#111827; }

/* Price cell rendering */
.rc-price-text { font-style:italic; color:#6b7280; }
.rc-price-num  { font-weight:500; color:#111827; }
.rc-price-neg  { color:#dc2626; }

/* Header row spanning hack — use colspan on render side */
tr.rc-row-header td[colspan] { display:table-cell; }
