/* === Sistema A — Fortiseg Portal === */
:root {
  --primary: #1F4E79;
  --primary-light: #2E6DA4;
  --primary-dark: #163A5C;
  --accent: #3498DB;
  --success: #27AE60;
  --warning: #F39C12;
  --danger: #E74C3C;
  --gray-50: #F8F9FA;
  --gray-100: #F0F2F5;
  --gray-200: #E2E6EA;
  --gray-300: #CED4DA;
  --gray-400: #ADB5BD;
  --gray-500: #6C757D;
  --gray-700: #495057;
  --gray-900: #212529;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
.header {
  background: var(--primary);
  color: var(--white);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header__inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--white);
}

.header__logo img {
  height: 32px;
  width: auto;
}

.header__logo-text {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header__nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.header__nav a:hover, .header__nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.15);
}

.header__user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.85);
}

.header__user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

/* === MAIN === */
.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === FOOTER === */
.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

/* === CARDS === */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
}

.card--hover:hover {
  box-shadow: var(--shadow);
  border-color: var(--gray-300);
  transition: var(--transition);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--primary);
  color: var(--white);
}
.btn--primary:hover:not(:disabled) { background: var(--primary-light); }

.btn--secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn--secondary:hover:not(:disabled) { background: var(--gray-50); }

.btn--success { background: var(--success); color: var(--white); }
.btn--success:hover:not(:disabled) { background: #219a52; }

.btn--danger { background: var(--danger); color: var(--white); }
.btn--danger:hover:not(:disabled) { background: #c0392b; }

.btn--sm { padding: 0.3rem 0.6rem; font-size: 0.8125rem; }
.btn--lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn--block { width: 100%; justify-content: center; }

/* === PROGRESS BAR === */
.progress {
  background: var(--gray-200);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress--lg { height: 12px; }

.progress__bar {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.progress__bar--success { background: var(--success); }
.progress__bar--warning { background: var(--warning); }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--intake { background: #EBF5FB; color: #2E86C1; }
.badge--review { background: #FEF9E7; color: #D4AC0D; }
.badge--exported { background: #EAFAF1; color: #27AE60; }
.badge--archived { background: var(--gray-100); color: var(--gray-500); }
.badge--basica { background: #EAFAF1; color: #27AE60; }
.badge--media { background: #FEF9E7; color: #D4AC0D; }
.badge--alta { background: #FDEDEC; color: #E74C3C; }
.badge--conflict { background: #FDEDEC; color: #E74C3C; }

/* === TABLE === */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table th {
  text-align: left;
  padding: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gray-200);
}

table.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

table.data-table tr:hover td { background: var(--gray-50); }

/* === TABS === */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  margin-left: 0.4rem;
}

.tab__badge--complete { background: #EAFAF1; color: var(--success); }
.tab__badge--partial { background: #FEF9E7; color: var(--warning); }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal__title { font-size: 1.125rem; font-weight: 600; }

.modal__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 0.25rem;
}

/* === ALERTS === */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert--info { background: #EBF5FB; color: #2E86C1; }
.alert--success { background: #EAFAF1; color: #1E8449; }
.alert--warning { background: #FEF9E7; color: #9A7D0A; }
.alert--danger { background: #FDEDEC; color: #C0392B; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}

.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state__title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--gray-700); }

/* === LOADING === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === UTILS === */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8125rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .main { padding: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .header__nav { display: none; }
  .card { padding: 1rem; }
}

/* Preventa score sidebar */
.preventa-score {
  background: var(--bg-card, #fff);
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color .2s;
}
.preventa-score__number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text, #1a202c);
}
.preventa-score__category {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: .25rem;
}
.preventa-score--básica, .preventa-score--basica {
  border-color: #38a169;
}
.preventa-score--básica .preventa-score__category,
.preventa-score--basica .preventa-score__category { color: #38a169; }
.preventa-score--media {
  border-color: #d69e2e;
}
.preventa-score--media .preventa-score__category { color: #d69e2e; }
.preventa-score--alta {
  border-color: #e53e3e;
}
.preventa-score--alta .preventa-score__category { color: #e53e3e; }
