/* H FIND DESIGN SYSTEM v1.0 ====================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Quicksand:wght@500;600&display=swap');

:root {
  --hux-orange: #E8600A;
  --hux-orange-hover: #C8520A;
  --hux-orange-light: #FBE5D2;
  --hux-orange-soft: #FFF4EC;
  --hux-navy: #3A3A3A;
  --hux-navy-deep: #2A2A2A;
  --hux-navy-soft: #F4F4F2;

  --gray-50: #FAFAF7;
  --gray-100: #F4F3EF;
  --gray-200: #E8E6DF;
  --gray-300: #D3D1C7;
  --gray-400: #B4B2A9;
  --gray-500: #888780;
  --gray-600: #5F5E5A;
  --gray-700: #444441;
  --gray-800: #2C2C2A;
  --gray-900: #1A1A18;

  --success: #1D9E75;
  --success-bg: #EAF3DE;
  --success-fg: #27500A;
  --warning: #BA7517;
  --warning-bg: #FAEEDA;
  --warning-fg: #633806;
  --danger: #E24B4A;
  --danger-bg: #FCEBEB;
  --danger-fg: #791F1F;
  --info: #378ADD;
  --info-bg: #E6F1FB;
  --info-fg: #0C447C;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Quicksand', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(58, 58, 58, 0.04);
  --shadow-sm: 0 2px 8px rgba(58, 58, 58, 0.06), 0 1px 2px rgba(58, 58, 58, 0.04);
  --shadow-md: 0 4px 16px rgba(58, 58, 58, 0.08), 0 2px 4px rgba(58, 58, 58, 0.04);
  --shadow-lg: 0 12px 32px rgba(58, 58, 58, 0.12), 0 4px 8px rgba(58, 58, 58, 0.06);

  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* LAYOUT ===================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.app-main { background: var(--gray-50); min-height: 100vh; }
.app-content { padding: 32px 40px; max-width: 1440px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-content { padding: 24px 16px; }
}

/* SIDEBAR ==================================================== */
.app-sidebar {
  background: white;
  border-right: 1px solid var(--gray-200);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0px;
  padding: 0 8px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 44px;
  height: 44px;
  /*background: var(--hux-navy);*/
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 1.5px;
  color: var(--gray-900);
}
.brand-sub {
  font-size: 10.5px;
  color: var(--gray-500);
  margin-top: 2px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--gray-700);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.nav-item:hover { background: var(--gray-100); }
.nav-item.active { background: var(--hux-orange-soft); color: var(--hux-orange); }
.nav-item.active .nav-icon { stroke: var(--hux-orange); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--gray-500); stroke-width: 2; fill: none; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
}
.user-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--hux-navy);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.user-name { font-weight: 500; font-size: 13px; }
.user-role { font-size: 11px; color: var(--gray-500); }

/* PAGE HEADER ================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.breadcrumb {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.breadcrumb a { transition: color var(--transition-fast); }
.breadcrumb a:hover { color: var(--hux-orange); }
.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--gray-900);
}
.page-meta {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-meta strong { color: var(--gray-900); font-weight: 600; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* BUTTONS ==================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: white;
  color: var(--gray-900);
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--gray-100); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--hux-orange);
  color: white;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(232, 96, 10, 0.2);
}
.btn-primary:hover { background: var(--hux-orange-hover); }

.btn-secondary {
  background: white;
  border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 16px; height: 16px; stroke-width: 2; fill: none; }
.btn-block { width: 100%; }

/* CARDS ====================================================== */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.card-sub { font-size: 12.5px; color: var(--gray-500); margin-top: 2px; }
.card-body { padding: 24px; }

/* KPI ======================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
}
.kpi:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.kpi-label {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
  margin-bottom: 12px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  font-feature-settings: 'tnum';
}
.kpi-value.success { color: var(--success-fg); }
.kpi-value.warning { color: var(--warning-fg); }
.kpi-value.danger { color: var(--danger-fg); }
.kpi-foot {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--gray-500);
}

/* GRID-2 ===================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* SOURCE BARS ================================================ */
.source-list { display: flex; flex-direction: column; gap: 14px; }
.source-top {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; margin-bottom: 6px;
}
.source-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.source-dot { width: 8px; height: 8px; border-radius: var(--radius-full); }
.source-stats { color: var(--gray-500); font-size: 12px; }
.source-stats strong { color: var(--gray-900); font-weight: 600; margin-right: 4px; }
.bar-track { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* ALERTS ===================================================== */
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  display: flex;
  gap: 10px;
}
.alert-danger { background: var(--danger-bg); border-color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-fg); }
.alert-info { background: var(--info-bg); border-color: var(--info-fg); }
.alert-success { background: var(--success-bg); border-color: var(--success-fg); }
.alert-danger .alert-title { color: var(--danger-fg); }
.alert-warning .alert-title { color: var(--warning-fg); }
.alert-info .alert-title { color: var(--info-fg); }
.alert-success .alert-title { color: var(--success-fg); }
.alert-title { font-size: 13px; font-weight: 600; }
.alert-body { font-size: 12px; color: var(--gray-700); margin-top: 2px; }

/* TABLE ====================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition-fast); cursor: pointer; }
.table tbody tr:hover { background: var(--hux-orange-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table .center { text-align: center; }
.cell-primary { font-weight: 500; }
.cell-secondary { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.cell-mono { font-family: var(--font-mono); font-size: 11px; color: var(--gray-500); }

/* BADGES ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.badge-rh { background: #EEEDFE; color: #3C3489; }
.badge-fin { background: var(--warning-bg); color: var(--warning-fg); }
.badge-com { background: var(--info-bg); color: var(--info-fg); }
.badge-dir { background: #FBEAF0; color: #72243E; }
.badge-whats { background: #E1F5EE; color: #085041; }
.badge-socio { background: #FFE3D0; color: #843E0A; }
.badge-mei { background: var(--hux-orange-light); color: var(--hux-orange); }
.badge-geral { background: var(--gray-100); color: var(--gray-700); }
.badge-none { background: var(--danger-bg); color: var(--danger-fg); }

/* SCORE ====================================================== */
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 12px;
  font-feature-settings: 'tnum';
}
.score-high { background: var(--success-bg); color: var(--success-fg); }
.score-mid { background: var(--warning-bg); color: var(--warning-fg); }
.score-low { background: var(--danger-bg); color: var(--danger-fg); }

/* FORMS ====================================================== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  font-size: 13.5px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: white;
  color: var(--gray-900);
  transition: all var(--transition-fast);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--hux-orange);
  box-shadow: 0 0 0 3px var(--hux-orange-soft);
}
.textarea { font-family: var(--font-mono); font-size: 12.5px; resize: vertical; min-height: 220px; }
.form-help { font-size: 12px; color: var(--gray-500); margin-top: 6px; }
.search-input {
  width: 240px;
  padding: 8px 12px;
  font-size: 12.5px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: white;
}

/* TOGGLE ===================================================== */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
}
.toggle {
  position: relative;
  width: 36px; height: 20px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.toggle input { display: none; }
.toggle.on { background: var(--hux-orange); }
.toggle.on::after { transform: translateX(16px); }
.toggle-content { flex: 1; }
.toggle-title { font-size: 13px; font-weight: 500; }
.toggle-sub { font-size: 11.5px; color: var(--gray-500); margin-top: 2px; }

/* UPLOAD AREA ================================================ */
.upload-area {
  display: block;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--gray-50);
}
.upload-area:hover { border-color: var(--hux-orange); background: var(--hux-orange-soft); }
.upload-icon {
  width: 36px; height: 36px;
  margin: 0 auto 8px;
  color: var(--gray-500);
  stroke-width: 1.5;
}
.upload-text { font-weight: 500; font-size: 13.5px; }
.upload-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* HERO ======================================================= */
.hero {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px 16px;
}
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; }
.hero p { color: var(--gray-600); font-size: 15px; max-width: 540px; margin: 0 auto; }

.container-narrow { max-width: 720px; margin: 0 auto; padding: 32px 24px; }

/* INFO CARDS ================================================= */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.info-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px;
}
.info-card-icon {
  width: 32px; height: 32px;
  background: var(--hux-orange-soft);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--hux-orange);
  margin-bottom: 10px;
}
.info-card-icon svg { width: 18px; height: 18px; stroke-width: 2; fill: none; }
.info-card-title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.info-card-text { font-size: 12px; color: var(--gray-600); line-height: 1.5; }

/* RECENT BATCHES ============================================= */
.recent-batches { margin-top: 32px; }
.recent-batches h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  margin-bottom: 10px;
}
.batch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}
.batch-item:hover { border-color: var(--hux-orange); transform: translateX(2px); }
.batch-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--gray-700); font-weight: 500; }
.batch-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

/* PROGRESS =================================================== */
.progress-container {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 8px;
}
.progress-bar {
  height: 100%;
  background: var(--hux-orange);
  transition: width 0.4s ease;
}
.log-stream {
  background: var(--hux-navy-deep);
  color: #C4C2BB;
  border-radius: var(--radius-lg);
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 380px;
  overflow-y: auto;
  margin-top: 20px;
}
.log-line {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* DETAIL PANEL =============================================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(58, 58, 58, 0.45);
  display: none;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.overlay.open { display: block; }
.detail-panel {
  position: fixed;
  top: 0; right: 0;
  width: 480px; max-width: 100vw;
  height: 100vh;
  background: white;
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.detail-panel.open { transform: translateX(0); }
.detail-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.detail-title { font-size: 16px; font-weight: 700; }
.detail-cnpj {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}
.close-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.close-btn:hover { background: var(--gray-100); }
.detail-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.detail-section { margin-bottom: 28px; }
.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  margin-bottom: 12px;
}
.info-list { display: flex; flex-direction: column; gap: 8px; }
.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.info-label { color: var(--gray-600); }
.info-value { font-weight: 500; text-align: right; }
.contact-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}
.contact-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.contact-channel { font-size: 11px; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.contact-value { font-size: 14px; font-weight: 500; word-break: break-all; }
.contact-meta { font-size: 11px; color: var(--gray-500); margin-top: 6px; }
.score-detail {
  font-size: 11px;
  color: var(--gray-600);
  background: white;
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 8px;
}
.score-detail-row { padding: 2px 0; font-family: var(--font-mono); }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { display: flex; gap: 12px; }
.tl-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--hux-orange);
  margin-top: 6px;
  flex-shrink: 0;
}
.tl-content { font-size: 12.5px; }

/* AUTH LGPD ROW ============================================== */
.lgpd-banner {
  background: var(--info-bg);
  border-left: 3px solid var(--info-fg);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--info-fg);
}
