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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: 220px;
  background: #0f1729;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #1e2d4a;
}
.brand-icon { color: #3b82f6; font-size: 1.3rem; }
.brand-name { color: #f8fafc; font-size: 0.85rem; font-weight: 800; letter-spacing: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #8892a4;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { color: #e2e8f0; background: #1a2740; }
.nav-item.active { color: #f8fafc; background: #1e3a5f; font-weight: 600; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 0.9rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  background: #1e3a5f;
  color: #60a5fa;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.nav-count.urgent { background: #450a0a; color: #f87171; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid #1e2d4a;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #1e3a5f;
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: 0.78rem; font-weight: 600; color: #e2e8f0; }
.user-role  { font-size: 0.68rem; color: #4b5563; }
.btn-logout {
  width: 100%;
  background: none;
  border: none;
  color: #4b5563;
  font-size: 0.75rem;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.btn-logout:hover { background: #1a2740; color: #f87171; }

/* ══════════════════════════════════════
   CONTENT
══════════════════════════════════════ */
.content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}
.topbar-left { font-size: 1rem; font-weight: 700; color: #0f172a; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.btn-lang {
  background: none;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-primary {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: #2563eb; }

.views-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.view.active { display: flex; }
.view > * { flex-shrink: 0; }

.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 1.3rem; font-weight: 700; color: #0f172a; }
.page-sub { font-size: 0.8rem; color: #6b7280; margin-top: 2px; }

/* ══════════════════════════════════════
   METRICS
══════════════════════════════════════ */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.metric-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 14px;
}
.metric-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.metric-icon.blue   { background: #dbeafe; }
.metric-icon.green  { background: #d1fae5; }
.metric-icon.orange { background: #fef3c7; }
.metric-icon.purple { background: #ede9fe; }
.metric-body {}
.metric-label { font-size: 0.72rem; color: #6b7280; font-weight: 500; }
.metric-value { font-size: 1.6rem; font-weight: 800; color: #0f172a; line-height: 1.2; }
.metric-sub   { font-size: 0.7rem; color: #9ca3af; margin-top: 1px; }

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.card-head h3 { font-size: 0.875rem; font-weight: 700; color: #0f172a; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ══════════════════════════════════════
   CLIENTS TABLE
══════════════════════════════════════ */
.table-card { margin-bottom: 0; }

.table-toolbar {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 280px;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #f9fafb;
  outline: none;
  color: #0f172a;
}
.search-input:focus { border-color: #3b82f6; background: #fff; }

.filters { display: flex; align-items: center; gap: 8px; }
.filter-select {
  padding: 7px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.78rem;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  outline: none;
}
.btn-clear-filters {
  background: none;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.75rem;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-clear-filters:hover { background: #f3f4f6; }

.clients-table {
  width: 100%;
  border-collapse: collapse;
}
.clients-table thead tr {
  background: #f9fafb;
}
.clients-table th {
  padding: 10px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}
.clients-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f9fafb;
  font-size: 0.82rem;
  vertical-align: middle;
}
.clients-table tbody tr:hover { background: #f9fafb; cursor: pointer; }
.clients-table tbody tr:last-child td { border-bottom: none; }

.client-cell { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.client-name  { font-weight: 600; color: #0f172a; font-size: 0.85rem; }
.client-stage { font-size: 0.68rem; font-weight: 600; margin-top: 2px; }

.contact-cell { font-size: 0.78rem; color: #374151; }
.contact-phone { color: #9ca3af; margin-top: 2px; font-size: 0.75rem; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge::before { content: '●'; font-size: 0.5rem; }
.badge.lead            { background: #f1f5f9; color: #475569; }
.badge.qualified       { background: #dbeafe; color: #1d4ed8; }
.badge.report_received { background: #fef9c3; color: #a16207; }
.badge.analysis_done   { background: #d1fae5; color: #065f46; }
.badge.plan_ready      { background: #ede9fe; color: #6d28d9; }
.badge.active          { background: #dcfce7; color: #166534; }
.badge.closed          { background: #f1f5f9; color: #6b7280; }

/* Score stars */
.score-cell { white-space: nowrap; }
.score-num  { font-weight: 700; font-size: 0.85rem; color: #0f172a; }
.stars      { color: #fbbf24; font-size: 0.7rem; letter-spacing: 1px; }
.stars .empty { color: #e5e7eb; }

/* Action buttons */
.actions-cell { display: flex; gap: 6px; }
.btn-action {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  color: #6b7280;
}
.btn-action:hover { background: #f3f4f6; border-color: #d1d5db; }
.btn-action.danger:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

.table-footer {
  padding: 12px 20px;
  font-size: 0.75rem;
  color: #9ca3af;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
}

/* ══════════════════════════════════════
   DASHBOARD ROWS
══════════════════════════════════════ */
.db-row {
  display: flex;
  align-items: center;
  padding: 11px 18px;
  gap: 12px;
  border-bottom: 1px solid #f9fafb;
  cursor: pointer;
  transition: background .1s;
}
.db-row:hover { background: #f9fafb; }
.db-row:last-child { border-bottom: none; }
.db-row-info { flex: 1; }
.db-row-name { font-size: 0.82rem; font-weight: 600; color: #0f172a; }
.db-row-sub  { font-size: 0.72rem; color: #9ca3af; margin-top: 1px; }

/* ══════════════════════════════════════
   PIPELINE
══════════════════════════════════════ */
.stage-group { margin-bottom: 20px; }
.stage-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b7280;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-cnt {
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 0.68rem;
}
.case-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #3b82f6;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow .15s, transform .1s;
}
.case-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.case-card.active-card { border-left-color: #10b981; background: #f0fdf4; }
.case-info { flex: 1; }
.case-name  { font-weight: 600; font-size: 0.875rem; color: #0f172a; }
.case-email { font-size: 0.75rem; color: #9ca3af; margin-top: 1px; }

/* ══════════════════════════════════════
   TODAY / TASKS
══════════════════════════════════════ */
#today-content { max-width: 680px; }
.today-group { margin-bottom: 24px; }
.today-group-label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.tg-count {
  background: #e5e7eb; color: #6b7280;
  border-radius: 20px; padding: 1px 8px; font-size: 0.68rem;
}
.label-urgent { color: #ef4444; }
.label-today  { color: #f59e0b; }
.label-soon   { color: #3b82f6; }
.label-waiting{ color: #6b7280; }

.today-task {
  background: #fff;
  border-radius: 10px;
  padding: 11px 16px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #e5e7eb;
  transition: box-shadow .15s;
}
.today-task:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.today-task.urgent  { border-left-color: #ef4444; }
.today-task.today   { border-left-color: #f59e0b; }
.today-task.soon    { border-left-color: #3b82f6; }
.today-task.waiting { border-left-color: #9ca3af; }
.tt-title { font-weight: 600; font-size: 0.85rem; color: #0f172a; }
.tt-case  { font-size: 0.73rem; color: #6b7280; margin-top: 2px; }
.tt-meta  { font-size: 0.73rem; font-weight: 700; white-space: nowrap; margin-left: 12px; }
.meta-urgent { color: #ef4444; }
.meta-today  { color: #f59e0b; }
.meta-soon   { color: #3b82f6; }
.meta-waiting{ color: #9ca3af; }
.today-empty { color: #9ca3af; font-size: 0.85rem; padding: 12px 0; }

/* ══════════════════════════════════════
   CASE PANEL
══════════════════════════════════════ */
#panel {
  width: 400px;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -4px 0 24px rgba(0,0,0,.07);
  overflow: hidden;
}
#panel.open { display: flex; }
#panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #f9fafb;
}
#panel-name  { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
#panel-email { font-size: 0.75rem; color: #9ca3af; margin-top: 2px; }
#btn-close-panel { background: none; border: none; cursor: pointer; color: #9ca3af; font-size: 1rem; }
#btn-close-panel:hover { color: #374151; }
#panel-body { flex: 1; overflow-y: auto; }
.panel-section { padding: 14px 18px; border-bottom: 1px solid #f3f4f6; }
.panel-section:last-child { border-bottom: none; }
.panel-section h3 { font-size: 0.65rem; text-transform: uppercase; color: #9ca3af; letter-spacing: 1px; margin-bottom: 8px; font-weight: 700; }

#stage-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 0.82rem;
  background: #f9fafb;
  cursor: pointer;
  color: #0f172a;
  outline: none;
}
#stage-select:focus { border-color: #3b82f6; }

.task-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-bottom: 1px solid #f9fafb;
  font-size: 0.82rem;
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.task-check:hover { border-color: #3b82f6; }
.task-check.done { background: #10b981; border-color: #10b981; color: #fff; font-size: 9px; }
.task-title { flex: 1; color: #0f172a; }
.task-title.done { text-decoration: line-through; color: #9ca3af; }
.task-due { font-size: 0.7rem; color: #9ca3af; }
.no-tasks { color: #9ca3af; font-size: 0.82rem; padding: 6px 0; }

#add-task-form { display: flex; gap: 7px; margin-top: 8px; }
#new-task-input {
  flex: 1; padding: 7px 10px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 0.8rem; background: #f9fafb; outline: none;
}
#new-task-input:focus { border-color: #3b82f6; background: #fff; }
#btn-add-task {
  background: #3b82f6; color: #fff;
  border: none; padding: 7px 13px;
  border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 700;
}
#btn-add-task:hover { background: #2563eb; }

.btn-upload, .btn-analyze {
  display: block; width: 100%;
  padding: 8px 12px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 0.8rem; text-align: center; margin-bottom: 6px; font-weight: 500;
}
.btn-upload  { background: #f9fafb; color: #475569; border: 1px dashed #d1d5db; }
.btn-upload:hover { background: #f3f4f6; }
.btn-analyze { background: #3b82f6; color: #fff; }
.btn-analyze:hover { background: #2563eb; }
.report-uploaded { font-size: 0.75rem; color: #10b981; margin-bottom: 6px; font-weight: 600; }

.analysis-summary {
  background: #f0fdf4; border-radius: 8px;
  padding: 9px 11px; font-size: 0.78rem; color: #166534;
  margin-bottom: 8px; border: 1px solid #bbf7d0;
}
.analysis-block { margin-bottom: 8px; }
.analysis-block h4 { font-size: 0.63rem; text-transform: uppercase; color: #9ca3af; letter-spacing: 1px; margin-bottom: 5px; font-weight: 700; }
.analysis-list { list-style: none; padding: 0; }
.analysis-list li { padding: 3px 0 3px 13px; font-size: 0.77rem; color: #374151; border-bottom: 1px solid #f9fafb; position: relative; }
.analysis-list li::before { content: '•'; position: absolute; left: 0; color: #d1d5db; }
.analysis-list.actions li::before { content: '→'; color: #3b82f6; }

/* ══════════════════════════════════════
   PIPELINE (TABS)
══════════════════════════════════════ */
.pipeline-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  flex-shrink: 0;
}
.pipeline-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}
.pipeline-tab:hover { border-color: #94a3b8; color: #1e293b; }
.pipeline-tab.active {
  background: var(--tab-color, #3b82f6);
  border-color: var(--tab-color, #3b82f6);
  color: #fff;
}
.pipeline-tab .tab-count {
  background: rgba(255,255,255,.25);
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.pipeline-tab:not(.active) .tab-count {
  background: #f1f5f9;
  color: #64748b;
}

.pipeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pipeline-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.pipeline-row:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); border-color: #cbd5e1; }
.pipeline-row .pr-info { flex: 1; min-width: 0; }
.pipeline-row .pr-name { font-weight: 600; font-size: 0.88rem; color: #0f172a; }
.pipeline-row .pr-sub  { font-size: 0.75rem; color: #6b7280; margin-top: 2px; }
.pipeline-row .pr-score {
  font-size: 0.8rem; font-weight: 700;
  white-space: nowrap;
}
.pipeline-row .pr-types { display: flex; flex-wrap: wrap; gap: 4px; }
.pl-empty {
  text-align: center; color: #94a3b8; font-size: .8rem;
  padding: 40px 0; font-style: italic;
}
.kc-types { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.wt-badge {
  font-size: .58rem; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
  white-space: nowrap;
}

/* ══════════════════════════════════════
   CLIENT DETAIL VIEW
══════════════════════════════════════ */
#view-client-detail { gap: 0; padding: 20px 28px; }

.detail-breadcrumb {
  font-size: 0.78rem; color: #9ca3af;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb-link {
  color: #3b82f6; cursor: pointer; font-weight: 600;
}
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: #d1d5db; }
.breadcrumb-current { color: #374151; font-weight: 600; }

.detail-header-card {
  background: #fff; border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 20px 24px;
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}
.detail-header-left { display: flex; align-items: center; gap: 18px; flex: 1; }
.detail-avatar-lg {
  width: 60px; height: 60px; border-radius: 50%;
  font-size: 1.2rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-name { font-size: 1.15rem; font-weight: 800; color: #0f172a; margin-bottom: 5px; }
.detail-badges { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.detail-contact-row { display: flex; gap: 16px; flex-wrap: wrap; }
.detail-contact-item { font-size: 0.75rem; color: #6b7280; display: flex; align-items: center; gap: 4px; }

.detail-header-btns { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.btn-detail-action {
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid #e5e7eb; background: #f9fafb;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  color: #374151; transition: all .15s; white-space: nowrap;
}
.btn-detail-action:hover { background: #f3f4f6; border-color: #d1d5db; }
.btn-detail-action.primary {
  background: #3b82f6; color: #fff; border-color: #3b82f6;
}
.btn-detail-action.primary:hover { background: #2563eb; }

.detail-tabs-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 18px;
  background: #fff; border-radius: 12px 12px 0 0;
  padding: 0 4px;
  border: 1px solid #e5e7eb;
  border-bottom: none;
}
.detail-tab {
  padding: 12px 18px;
  font-size: 0.82rem; font-weight: 500;
  background: none; border: none;
  color: #6b7280; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  margin-bottom: -1px;
}
.detail-tab:hover { color: #374151; }
.detail-tab.active {
  color: #3b82f6; font-weight: 700;
  border-bottom-color: #3b82f6;
}

.detail-tab-content { flex: 1; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  margin-bottom: 14px;
}
.detail-col-main { display: flex; flex-direction: column; gap: 14px; }
.detail-col-side  { display: flex; flex-direction: column; gap: 14px; }

.detail-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e5e7eb; overflow: hidden;
}
.detail-card-head {
  padding: 12px 18px;
  font-size: 0.78rem; font-weight: 700; color: #0f172a;
  border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
  background: #f9fafb;
}
.detail-card-body { padding: 14px 18px; }

/* Financial status */
.financial-status { display: flex; flex-direction: column; gap: 10px; }
.score-display { display: flex; align-items: center; gap: 14px; }
.score-big { font-size: 2.8rem; font-weight: 900; line-height: 1; }
.score-right { display: flex; flex-direction: column; gap: 3px; }
.score-label { font-size: 0.8rem; font-weight: 700; color: #374151; }
.score-stars-big .stars { font-size: 1.1rem; }
.score-summary {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 9px 12px;
  font-size: 0.78rem; color: #166534; line-height: 1.5;
}

.no-score {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 12px 0;
  text-align: center;
}
.no-score-icon { font-size: 2rem; opacity: .4; }
.no-score-text { font-size: 0.85rem; font-weight: 600; color: #374151; }
.no-score-sub  { font-size: 0.73rem; color: #9ca3af; margin-bottom: 8px; }
.btn-upload-inline {
  display: inline-block; padding: 8px 16px;
  background: #f9fafb; border: 1px dashed #d1d5db;
  border-radius: 8px; font-size: 0.78rem; cursor: pointer;
  color: #475569; font-weight: 500;
}
.btn-upload-inline:hover { background: #f3f4f6; }

/* Disputes empty state */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; gap: 5px; padding: 16px 0; text-align: center;
}
.empty-icon { font-size: 1.8rem; opacity: .3; }
.empty-text { font-size: 0.83rem; font-weight: 600; color: #6b7280; }
.empty-sub  { font-size: 0.73rem; color: #9ca3af; }
.empty-state-sm { font-size: 0.78rem; color: #9ca3af; padding: 6px 0; }

.btn-create-dispute {
  background: #3b82f6; color: #fff;
  border: none; padding: 5px 12px; border-radius: 6px;
  font-size: 0.73rem; font-weight: 600; cursor: pointer;
}
.btn-create-dispute:hover { background: #2563eb; }

/* Notes */
.notes-textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 0.82rem; color: #374151; background: #f9fafb;
  resize: vertical; min-height: 90px; outline: none;
  font-family: inherit; line-height: 1.5; margin-bottom: 8px;
  display: block;
}
.notes-textarea.tall { min-height: 260px; }
.notes-textarea:focus { border-color: #3b82f6; background: #fff; }
.btn-save-notes {
  background: #0f172a; color: #fff;
  border: none; padding: 8px 16px; border-radius: 8px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-save-notes:hover { background: #1e293b; }

/* Quick actions */
.quick-actions { display: flex; flex-direction: column; gap: 6px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid #e5e7eb; background: #f9fafb;
  font-size: 0.82rem; font-weight: 500; color: #374151;
  cursor: pointer; transition: all .15s; text-align: left;
  width: 100%;
}
.quick-action-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.qa-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Progress stages */
.progress-stages { display: flex; align-items: flex-start; gap: 0; }
.progress-stage {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 6px; position: relative;
}
.progress-stage + .progress-stage::before {
  content: '';
  position: absolute; top: 7px; right: 50%; width: 100%;
  height: 2px; background: #e5e7eb; z-index: 0;
}
.progress-stage.done + .progress-stage::before,
.progress-stage.current + .progress-stage::before { background: #3b82f6; }
.ps-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #e5e7eb; background: #fff; z-index: 1;
  transition: all .2s;
}
.progress-stage.done .ps-dot { background: #3b82f6; border-color: #3b82f6; }
.progress-stage.current .ps-dot {
  background: #fff; border-color: #3b82f6; border-width: 3px;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.ps-label {
  font-size: 0.62rem; text-align: center; color: #9ca3af;
  font-weight: 500; line-height: 1.2; padding: 0 2px;
}
.progress-stage.done .ps-label   { color: #3b82f6; font-weight: 600; }
.progress-stage.current .ps-label { color: #0f172a; font-weight: 700; }

/* Upcoming tasks */
.upcoming-task {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid #f9fafb;
}
.upcoming-task:last-of-type { border-bottom: none; }
.ut-info { flex: 1; }
.ut-title { font-size: 0.82rem; font-weight: 500; color: #0f172a; }
.ut-title.done { text-decoration: line-through; color: #9ca3af; }
.ut-due { font-size: 0.7rem; color: #9ca3af; margin-top: 2px; }
.ut-due.overdue { color: #ef4444; font-weight: 600; }

.task-input-inline {
  flex: 1; padding: 7px 10px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 0.78rem; background: #f9fafb; outline: none;
}
.task-input-inline:focus { border-color: #3b82f6; background: #fff; }
.btn-add-inline {
  background: #3b82f6; color: #fff;
  border: none; padding: 7px 13px; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; font-weight: 700;
  white-space: nowrap;
}
.btn-add-inline:hover { background: #2563eb; }
.btn-link {
  background: none; border: none; color: #3b82f6;
  font-size: 0.72rem; font-weight: 600; cursor: pointer;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* Task detail items in tareas tab */
.task-detail-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #f9fafb;
}
.task-detail-item:last-of-type { border-bottom: none; }
.tdi-info { flex: 1; }
.tdi-title { font-size: 0.82rem; font-weight: 500; color: #0f172a; }
.tdi-title.done { text-decoration: line-through; color: #9ca3af; }
.tdi-due { font-size: 0.7rem; color: #9ca3af; margin-top: 2px; }
.tdi-due.overdue { color: #ef4444; font-weight: 600; }

/* Document items */
.doc-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
}
.doc-icon { font-size: 1.5rem; flex-shrink: 0; }
.doc-info { flex: 1; }
.doc-name { font-size: 0.83rem; font-weight: 600; color: #0f172a; }
.doc-sub  { font-size: 0.73rem; color: #9ca3af; margin-top: 2px; }
.btn-analyze.sm { font-size: 0.73rem; padding: 5px 10px; }

/* 3-bureau scores */
.bureau-scores {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.bureau-score {
  flex: 1; min-width: 80px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 10px; padding: 10px 12px; text-align: center;
}
.bureau-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; color: #9ca3af; letter-spacing: .5px; margin-bottom: 4px; }
.bureau-num { font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.bureau-score .stars { font-size: .65rem; margin-top: 3px; }
.bureau-score-sub { font-size: .65rem; font-weight: 600; margin-top: 2px; }

/* Portales */
.portal-item {
  border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 11px 14px; margin-bottom: 8px; background: #f9fafb;
}
.portal-item:last-child { margin-bottom: 0; }
.portal-name { font-size: .72rem; font-weight: 800; color: #0f172a; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.portal-field { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .78rem; }
.portal-field-label { color: #9ca3af; font-weight: 600; min-width: 72px; font-size: .68rem; text-transform: uppercase; }
.portal-field-val { color: #374151; flex: 1; word-break: break-all; }
.portal-pw-wrap { display: flex; align-items: center; gap: 6px; flex: 1; }
.portal-pw-input {
  flex: 1; border: none; background: transparent;
  font-size: .78rem; color: #374151; font-family: monospace;
  outline: none; cursor: default;
}
.btn-eye { background: none; border: none; cursor: pointer; color: #9ca3af; font-size: .85rem; padding: 0; }
.btn-eye:hover { color: #374151; }

/* Work type badges */
.work-types-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

/* Info section */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-field { }
.info-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .5px; color: #9ca3af; font-weight: 700; margin-bottom: 3px; }
.info-value { font-size: .82rem; font-weight: 600; color: #0f172a; }
.info-value.empty { color: #d1d5db; font-weight: 400; }

/* Next followup date input */
.followup-input {
  border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 5px 8px; font-size: .78rem; color: #374151;
  background: #f9fafb; outline: none; cursor: pointer;
}
.followup-input:focus { border-color: #3b82f6; background: #fff; }

/* ══════════════════════════════════════
   PLACEHOLDER
══════════════════════════════════════ */
.placeholder-view {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 10px; color: #9ca3af;
}
.ph-icon { font-size: 3rem; opacity: .3; }
.placeholder-view h3 { font-size: 1rem; font-weight: 600; color: #6b7280; }
.placeholder-view p  { font-size: 0.82rem; }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
#modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); z-index: 100;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
#modal-overlay.open { display: flex; }
#modal {
  background: #fff; border-radius: 14px;
  padding: 28px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
#modal h2 { margin-bottom: 18px; font-size: 1rem; font-weight: 700; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 0.72rem; font-weight: 600; color: #374151; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.field input {
  width: 100%; padding: 9px 12px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 0.875rem; background: #f9fafb; outline: none;
}
.field input:focus { border-color: #3b82f6; background: #fff; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.btn-cancel {
  background: none; border: 1px solid #e5e7eb;
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-size: 0.82rem; color: #374151;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #f8fafc;
  padding: 10px 20px; border-radius: 8px;
  font-size: 0.8rem; opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 300;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
#toast.show { opacity: 1; }
