/* ── BUTTONS ── */
.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary:hover { background: #C41F1F; }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-secondary:hover { background: var(--bg-subtle); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-danger:hover { background: #C41F1F; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-pending  { background: var(--badge-pending-bg);  color: var(--badge-pending-fg); }
.badge-success  { background: var(--badge-success-bg);  color: var(--badge-success-fg); }
.badge-active   { background: var(--badge-active-bg);   color: var(--badge-active-fg); }
.badge-expired  { background: var(--badge-expired-bg);  color: var(--badge-expired-fg); }

/* ── INPUTS ── */
.input {
  width: 100%;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-body);
  font-family: var(--font);
  outline: none;
}

.input::placeholder { color: var(--text-muted); }
.input:focus { border-color: var(--navy); }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body);
}

.input-label .required { color: var(--red); margin-left: 2px; }

/* Select */
.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper select {
  appearance: none;
  width: 100%;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 32px 8px 10px;
  font-size: 13px;
  color: var(--text-body);
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

/* ── CARD ── */
.card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

/* ── TABLE ── */
.table-wrapper {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead tr {
  border-bottom: 0.5px solid var(--border);
}

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--navy); }

.table td {
  padding: 12px 16px;
  color: var(--text-body);
  border-bottom: 0.5px solid var(--border);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-subtle); }

/* ── FORM SECTION ── */
.form-section { margin-bottom: 28px; }

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ── FILTERS ROW ── */
.filters-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-input input {
  width: 100%;
  padding: 8px 10px 8px 34px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-body);
  font-family: var(--font);
  outline: none;
}

.search-input input:focus { border-color: var(--navy); }
.search-input input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── DIVIDER ── */
.divider {
  height: 0.5px;
  background: var(--border);
  margin: 20px 0;
}

/* ── METRIC CARDS ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
}

.metric-value.accent { color: var(--red); }

/* ── REPORTES ── */
.report-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.report-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px 28px;
}

.report-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 16px;
}

.report-link-list { list-style: disc; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }

.report-link {
  font-size: 13px;
  color: var(--red);
  cursor: pointer;
  text-decoration: none;
}

.report-link:hover { text-decoration: underline; }

.report-link.disabled {
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
}

/* Botones de acción de reporte (pill) */
.report-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.btn-report {
  padding: 8px 22px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-report.navy  { background: var(--navy); color: #fff; }
.btn-report.red   { background: var(--red);  color: #fff; }
.btn-report.navy:hover { background: #0a1540; }
.btn-report.red:hover  { background: #C41F1F; }

/* Filtros de reporte */
.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.report-filters .select-wrapper { width: auto; min-width: 180px; flex: 1; }

/* ── CONTACTOS / CLIENTES / PROVEEDORES ── */
.btn-pill-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1.5px solid var(--red); color: var(--red);
  background: #fff; white-space: nowrap;
}
.btn-pill-solid {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1.5px solid var(--red); background: var(--red);
  color: #fff; white-space: nowrap;
}
.btn-pill-outline:hover { background: #FEF2F2; }
.btn-pill-solid:hover   { opacity: .9; }

.filter-bar   { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.filter-row   { display: flex; gap: 8px; flex-wrap: wrap; }

.search-field { position: relative; flex: 1; min-width: 180px; }
.search-field .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field .input { padding-left: 32px; width: 100%; }

.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 12px; color: var(--text-muted); }
.results-bar-actions { display: flex; gap: 16px; }
.results-bar-actions a { color: var(--navy); font-size: 12px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.results-bar-actions a:hover { text-decoration: underline; }

.status-active { color: #059669; font-size: 12.5px; font-weight: 500; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px 6px; display: inline-flex; border-radius: 4px; }
.btn-icon:hover { background: var(--bg-subtle); color: var(--red); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: #D1D5DB; border-radius: 20px; transition: background .2s; cursor: pointer; }
.toggle-track::after { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; left: 3px; top: 3px; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked ~ .toggle-track { background: var(--red); }
.toggle input:checked ~ .toggle-track::after { transform: translateX(16px); }
