/* ── Reset básico ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f5f5f0;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: #dd9933;
  border-bottom: none;
  padding: 0.75rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}
nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.9rem; }
nav a { color: #fff; }
.btn-nav {
  background: rgba(255,255,255,0.2);
  color: #fff !important;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.5);
}
.btn-nav:hover { background: rgba(255,255,255,0.35); text-decoration: none; }

/* ── Main ─────────────────────────────────────────────────── */
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid #e5e5e5;
  padding: 1.25rem 0;
  font-size: 0.85rem;
  color: #888;
  text-align: center;
}

/* ── Auth forms ───────────────────────────────────────────── */
.auth-box {
  max-width: 420px;
  margin: 2rem auto;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 2rem;
}
.auth-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.auth-alt { margin-top: 1.25rem; font-size: 0.9rem; color: #555; }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: #333;
}
.form-group input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: #2563eb;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.65rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
.btn-primary:hover { background: #333; }

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  list-style: none;
  font-size: 0.875rem;
  color: #b91c1c;
}
.form-errors li + li { margin-top: 0.25rem; }

/* ── Dashboard ────────────────────────────────────────────── */
.dash { max-width: 720px; }

.dash-hello { margin-bottom: 1.75rem; }
.dash-hello h1 { font-size: 1.6rem; font-weight: 500; }
.dash-username { font-weight: 700; }
.dash-empty { margin-bottom: 2rem; }

/* KPIs */
.dash-general {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.dash-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  flex: 1;
  min-width: 200px;
}
.kpi { }
.kpi-num {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
}
.kpi-label {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.2rem;
}

/* Donut */
.dash-pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.pie-legend { display: flex; flex-direction: column; gap: 0.3rem; }
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #555;
}
.pie-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pie-dot-first { background: #1d9e75; }
.pie-dot-other { background: #e5e7eb; }

/* Sección colecciones */
.dash-collections { margin-bottom: 2rem; }
.dash-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
  margin-bottom: 0.75rem;
}

/* ── Tarjetas de colección ───────────────────────────────────── */
.col-cards { display: flex; flex-direction: column; gap: 1rem; }

.col-card {
  background: #d4c9a8;
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.col-card-top {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem 0.5rem;
  gap: 1rem;
}
.col-card-icon {
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}
.col-card-center {
  flex: 1;
  text-align: center;
}
.col-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #3b2f0f;
  margin-bottom: 0.1rem;
}
.col-card-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #6b5a2e;
}
.col-card-pct {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.col-card-sub {
  font-size: 0.8rem;
  color: #6b5a2e;
}

/* Barra de progreso 4 colores */
.col-bar {
  display: flex;
  height: 10px;
  width: 100%;
  margin: 0.5rem 0 0;
}
.col-bar-seg { height: 100%; transition: width 0.6s ease; }
.col-bar-primera { background: #1d9e75; }
.col-bar-mas     { background: #9fe1cb; }
.col-bar-fallado { background: #e24b4a; }
.col-bar-noint   { background: #b8a97a; }

/* Filas de estadísticas */
.col-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #e8e0cc;
}
.col-stats-row2 {
  grid-template-columns: repeat(3, 1fr);
  background: #dfd7c2;
}
.col-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.45rem 0.25rem;
  border-right: 1px solid rgba(0,0,0,0.07);
}
.col-stat:last-child { border-right: none; }
.col-stat-num {
  font-size: 0.95rem;
  font-weight: 600;
  color: #3b2f0f;
}
.col-stat-icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.col-stats-row2 .col-stat-icon {
  font-size: 0.85rem;
}
.col-icon-primera { color: #1d9e75; }
.col-icon-mas     { color: #5dcaa5; }
.col-icon-fallado { color: #e24b4a; }
.col-icon-noint   { color: #7a6a3e; }

/* Listas */
.dash-list-section { margin-bottom: 2rem; }
.dash-list { list-style: none; }
.dash-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-link {
  font-size: 0.9rem;
  color: #1a1a1a;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list-link:hover { color: #2563eb; text-decoration: none; }
.dash-list-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.diff-badge {
  font-size: 0.75rem;
  background: #f0f0f0;
  color: #555;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
}
.muted { color: #888; font-size: 0.85rem; }

/* ── Responsive móvil ─────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header .container { flex-wrap: wrap; gap: 0.5rem; }
  nav { gap: 0.75rem; font-size: 0.85rem; }

  main.container { padding-top: 1.25rem; }

  /* Dashboard */
  .dash-general { flex-direction: column; align-items: flex-start; gap: 1.25rem; padding: 1.25rem; }
  .dash-kpis { grid-template-columns: 1fr 1fr; width: 100%; }
  .dash-pie-wrap { flex-direction: row; align-items: center; gap: 1rem; width: 100%; }
  .kpi-num { font-size: 1.5rem; }

  /* Listado problemas */
  .filters-form { flex-direction: column; align-items: stretch; }
  .filters-form select { width: 100%; }

  /* Problema individual */
  .problem-header { flex-direction: column; gap: 0.5rem; }
  .problem-actions { align-self: flex-start; }

  /* Admin */
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 0.4rem 0.5rem; }
  .admin-section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Responsive tarjetas colección ───────────────────────────── */
@media (max-width: 600px) {
  .col-card-top { padding: 0.75rem 0.75rem 0.4rem; gap: 0.75rem; }
  .col-card-pct { font-size: 1.8rem; }
  .col-stat-num { font-size: 0.85rem; }
  .col-stat { padding: 0.35rem 0.15rem; }
}

/* ── Listas últimos / favoritos (reemplazo problem-list) ─────── */
.dash-list { list-style: none; }
.dash-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-link {
  font-size: 0.9rem;
  color: #1a1a1a;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list-link:hover { color: #2563eb; text-decoration: none; }
.dash-list-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
