:root {
  --bg: #f6f9fc;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --surface-alt: #f8fbff;
  --text: #0a2540;
  --muted: #6b7c93;
  --line: #e3e8ee;
  --line-strong: #c5ccd6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --blue: #3b82f6;
  --gradient: linear-gradient(135deg, #10b981 0%, #14b8a6 20%, #3b82f6 55%, #7c3aed 82%, #9333ea 100%);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 26%),
    radial-gradient(circle at right 10% top 18%, rgba(59, 130, 246, 0.12), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f6f9fc 58%, #eef4fb 100%);
}

button,
select,
input {
  font: inherit;
}

.page-shell {
  width: min(1440px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid rgba(227, 232, 238, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--gradient);
}

.brand-label,
.section-label,
.eyebrow {
  margin: 0;
  color: #7b8ba1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1,
.hero-panel h2,
.table-head h3 {
  margin: 4px 0 0;
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}

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

.topnav a,
.tab-button,
.toggle-chip {
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.25s ease;
}

.topnav a {
  padding: 10px 16px;
  color: var(--muted);
  background: rgba(99, 91, 255, 0.04);
  font-weight: 700;
}

.topnav a.is-active,
.topnav a:hover {
  color: var(--text);
  border-color: rgba(99, 91, 255, 0.16);
  background: rgba(99, 91, 255, 0.08);
}

.main-layout {
  display: grid;
  gap: 20px;
  margin-top: 20px;
  min-width: 0;
}

.hero-panel,
.progress-panel,
.toolbar-panel,
.table-panel,
.stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 24px;
  padding: 32px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: '';
  position: absolute;
  inset: auto -10% -25% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 91, 255, 0.16), rgba(99, 91, 255, 0));
  pointer-events: none;
}

.hero-panel h2 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.05;
  max-width: 12ch;
}

.hero-copy {
  margin: 16px 0 0;
  max-width: 720px;
  color: #425466;
  font-size: 17px;
  line-height: 1.75;
}

.hero-meta {
  display: flex;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-pill,
.summary-chip,
.job-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(99, 91, 255, 0.12);
  border-radius: 999px;
  color: #314055;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
}

.progress-panel,
.toolbar-panel,
.table-panel {
  padding: 24px;
}

.progress-panel {
  display: grid;
  gap: 16px;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-copy strong {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.03em;
}

#jobStatus {
  color: var(--muted);
  font-weight: 700;
}

.progress-track,
.confidence-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e9eef5;
  overflow: hidden;
}

.progress-bar,
.confidence-fill {
  height: 100%;
  border-radius: inherit;
}

.progress-bar {
  width: 0;
  background: var(--gradient);
  transition: width 0.35s ease;
}

.toolbar-panel {
  display: grid;
  gap: 22px;
}

.list-tabs-head {
  margin-top: 18px;
}

.toolbar-head,
.filters-panel,
.action-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.tab-row.compact {
  margin-top: 8px;
}

.tab-button,
.toggle-chip {
  padding: 12px 16px;
  background: rgba(99, 91, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab-button.is-active,
.toggle-chip.is-active {
  color: #ffffff;
  background: var(--gradient);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.22);
}

.btn {
  min-height: 50px;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn-small {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.18);
}

.btn-secondary {
  color: var(--text);
  background: #eef4fb;
  border: 1px solid var(--line);
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: var(--accent, var(--gradient));
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: var(--accent, var(--gradient));
}

.stat-value {
  margin-top: 20px;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.table-head h3 {
  font-size: 28px;
}

.table-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.table-wrap {
  margin-top: 20px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
}

table {
  width: 100%;
  min-width: 1650px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(246, 249, 252, 0.98);
  color: #7b8ba1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.82);
}

tbody tr:nth-child(even) {
  background: rgba(248, 251, 255, 0.92);
}

tbody tr:hover {
  background: #f5f9ff;
}

.sticky-left,
.sticky-right {
  position: sticky;
  background: inherit;
  z-index: 4;
}

.sticky-left {
  left: 0;
  min-width: 220px;
  box-shadow: 12px 0 24px rgba(10, 37, 64, 0.06);
}

.sticky-right {
  right: 0;
  min-width: 124px;
  box-shadow: -12px 0 24px rgba(10, 37, 64, 0.06);
}

.name-cell strong {
  display: block;
  margin-bottom: 4px;
}

.mobile-badge-row {
  display: none;
  margin-top: 10px;
}

.mobile-action-row {
  display: none;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.company-line {
  display: block;
  margin-bottom: 4px;
  color: #425466;
  font-size: 13px;
  font-weight: 700;
}

.name-cell span,
.muted-copy {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-waiting {
  color: #6b7c93;
  background: #eef4fb;
}

.badge-ARCHIVER {
  color: #fff;
  background: #ef4444;
}

.badge-DEPLACER {
  color: #fff;
  background: #f59e0b;
}

.badge-GARDER {
  color: #fff;
  background: #10b981;
}

.badge-history-client {
  color: #fff;
  background: #10b981;
}

.badge-history-prospect {
  color: #fff;
  background: #3b82f6;
}

.badge-VALIDER {
  color: #fff;
  background: #10b981;
}

.confidence-cell {
  min-width: 140px;
}

.confidence-track {
  margin-top: 8px;
  height: 8px;
}

.confidence-fill.is-low {
  background: var(--danger);
}

.confidence-fill.is-mid {
  background: var(--warning);
}

.confidence-fill.is-high {
  background: var(--success);
}

.justification-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.expand-button,
.mini-btn {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 40px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.validation-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 196px;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mini-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.mini-btn-keep {
  border-color: rgba(16, 185, 129, 0.24);
  color: #0f8f66;
  background: rgba(16, 185, 129, 0.08);
}

.mini-btn-move {
  border-color: rgba(245, 158, 11, 0.24);
  color: #b86b00;
  background: rgba(245, 158, 11, 0.1);
}

.mini-btn-archive {
  border-color: rgba(239, 68, 68, 0.22);
  color: #d43737;
  background: rgba(239, 68, 68, 0.08);
}

.mini-btn-icon {
  display: none;
  font-size: 18px;
  line-height: 1;
}

.mini-btn-text {
  white-space: nowrap;
}

.filters-toggle {
  display: none;
}

.pagination-row {
  display: flex;
  margin-top: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-actions {
  display: flex;
  gap: 10px;
}

.detail-row td {
  background: rgba(10, 37, 64, 0.03);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
}

.detail-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8ba1;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    justify-content: flex-start;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: 100%;
    padding-top: 12px;
  }

  .topbar,
  .progress-panel,
  .toolbar-panel,
  .table-panel,
  .hero-panel {
    padding: 18px;
  }

  .topbar,
  .progress-copy,
  .toolbar-head,
  .filters-panel,
  .action-row {
    align-items: stretch;
  }

  .topbar,
  .progress-meta,
  .toolbar-head,
  .filters-panel,
  .action-row {
    flex-direction: column;
  }

  .tab-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
  }

  .filters-panel {
    display: none;
  }

  .filters-panel.is-open {
    display: flex;
  }
}

@media (max-width: 640px) {
  body {
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
  }

  .page-shell {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .topbar {
    top: 6px;
    border-radius: 18px;
  }

  .hero-panel h2 {
    font-size: 28px;
  }

  .progress-copy strong {
    font-size: 26px;
  }

  .toolbar-field,
  .search-field {
    min-width: 100%;
  }

  .table-wrap {
    margin-left: -6px;
    margin-right: -6px;
    padding-bottom: 4px;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 12px 12px;
  }

  .sticky-left {
    min-width: 208px;
  }

  .sticky-left,
  .sticky-right {
    position: static;
    min-width: 118px;
    box-shadow: none;
  }

  .mobile-badge-row {
    display: flex;
  }

  .mobile-action-row {
    display: flex;
  }

  thead th:nth-child(2),
  tbody td:nth-child(2),
  thead th:nth-child(3),
  tbody td:nth-child(3),
  thead th:nth-child(5),
  tbody td:nth-child(5),
  thead th:nth-child(6),
  tbody td:nth-child(6),
  thead th:nth-child(7),
  tbody td:nth-child(7),
  thead th:nth-child(8),
  tbody td:nth-child(8),
  thead th:nth-child(9),
  tbody td:nth-child(9),
  thead th:nth-child(10),
  tbody td:nth-child(10),
  thead th:nth-child(11),
  tbody td:nth-child(11) {
    display: none;
  }

  .badge {
    min-width: 88px;
    padding: 7px 10px;
    font-size: 10px;
  }

  .confidence-cell {
    min-width: 96px;
  }

  .justification-preview {
    max-width: 180px;
  }

  .validation-cell {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
  }

  .mini-btn,
  .expand-button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .mini-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  table {
    min-width: 680px;
  }

  .sticky-right {
    min-width: 84px;
  }

  .mini-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
  }

  .mini-btn-text {
    display: none;
  }

  .mini-btn-icon {
    display: inline-block;
  }

  .mobile-action-row {
    gap: 6px;
  }
}
