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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f5f4f0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- TOPBAR ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e3dc;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-weight: 600;
  font-size: 16px;
  color: #2d5a1b;
}
nav a {
  color: #555;
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 14px;
}
nav a:hover, nav a.active { color: #2d5a1b; font-weight: 500; }

/* ---- PAGE HEADER ---- */
.page-header {
  padding: 2rem 0 1.5rem;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}
.page-header p { color: #666; font-size: 14px; }
.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: #2d5a1b;
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}
.btn-primary:hover { background: #234715; }
.btn-outline {
  background: transparent;
  color: #2d5a1b;
  border: 1px solid #2d5a1b;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-outline:hover { background: #f0f5ed; }

/* ---- UPLOAD CARD ---- */
.upload-card {
  background: #fff;
  border: 2px dashed #c8d4c0;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1.5rem;
}
.upload-card:hover, .upload-card.drag-over {
  border-color: #2d5a1b;
  background: #f0f5ed;
}
.upload-icon {
  font-size: 40px;
  color: #2d5a1b;
  margin-bottom: 0.75rem;
}
.upload-label {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.upload-hint { color: #888; font-size: 13px; margin-bottom: 1.25rem; }

/* ---- STATUS ---- */
.status-area {
  background: #fff;
  border: 1px solid #e5e3dc;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.status-icon { font-size: 28px; margin-bottom: 0.75rem; color: #2d5a1b; }
.spinning { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#status-msg { font-weight: 500; margin-bottom: 1.25rem; }
.progress-steps { display: flex; flex-direction: column; gap: 0.5rem; }
.step {
  font-size: 13px;
  color: #aaa;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.3s;
}
.step.active { color: #2d5a1b; font-weight: 500; background: #f0f5ed; }
.step.done { color: #666; }
.step.done::before { content: "✓ "; color: #2d5a1b; }

/* ---- RESULT ---- */
.result-area {
  background: #fff;
  border: 1px solid #e5e3dc;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.result-ok { border-left: 4px solid #2d5a1b; }
.result-error { border-left: 4px solid #c0392b; }
.result-area h3 { margin-bottom: 0.5rem; font-size: 16px; }
.result-area p { color: #555; font-size: 14px; }
.result-area a { color: #2d5a1b; font-weight: 500; text-decoration: none; }

/* ---- TABLE ---- */
.table-wrapper {
  background: #fff;
  border: 1px solid #e5e3dc;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  background: #f8f7f3;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 500;
  color: #555;
  border-bottom: 1px solid #e5e3dc;
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0ede6;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafaf8; }
.badge {
  background: #f0f5ed;
  color: #2d5a1b;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.link-action { color: #2d5a1b; text-decoration: none; font-size: 13px; white-space: nowrap; }
.link-action:hover { text-decoration: underline; }

/* ---- FICHA DETALLE ---- */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-full { grid-column: 1 / -1; }
.section-card {
  background: #fff;
  border: 1px solid #e5e3dc;
  border-radius: 12px;
  padding: 1.25rem;
}
.section-card h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2d5a1b;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0ede6;
}
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #faf9f6;
}
.field-row:last-child { border-bottom: none; }
.field-label { color: #888; font-size: 13px; flex-shrink: 0; }
.field-value { color: #1a1a1a; font-size: 14px; text-align: right; }
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
}
.pill-yes { background: #f0f5ed; color: #2d5a1b; }
.pill-no  { background: #fdf0ee; color: #c0392b; }
.obs-text { color: #555; font-size: 14px; line-height: 1.6; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: #fff;
  border: 1px solid #e5e3dc;
  border-radius: 12px;
  color: #888;
  margin-bottom: 2rem;
}
.empty-state p { margin-bottom: 1rem; }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.muted  { color: #999; }
.small  { font-size: 12px; margin-bottom: 2rem; display: block; }
