* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #14161a;
  color: #e8e8ec;
}

.topbar {
  padding: 18px 24px;
  border-bottom: 1px solid #2a2d34;
  background: #1a1c21;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }

.layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: #1a1c21;
  border: 1px solid #2a2d34;
  border-radius: 10px;
  padding: 20px;
}

.panel h2 { margin: 0 0 6px; font-size: 15px; }
.panel h2 + h2 { margin-top: 28px; }

.hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: #9a9ea8;
}

.hint-inline {
  font-size: 12px;
  color: #6b6f78;
  font-style: italic;
}

/* ---------- Intro: cómo funciona ---------- */

.intro {
  border-color: rgba(216, 174, 74, 0.3);
  background: rgba(216, 174, 74, 0.06);
}

.steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: #c8cad0;
}

.steps li { margin-bottom: 6px; }
.steps li:last-child { margin-bottom: 0; }
.steps strong { color: #e8e8ec; }

/* ---------- Formularios con etiquetas ---------- */

.labeled-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.labeled-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: #9a9ea8;
  flex: 1 1 160px;
}

.labeled-form label.label-narrow { flex: 0 1 110px; }

.labeled-form input,
.labeled-form select {
  background: #101216;
  border: 1px solid #33363e;
  color: #e8e8ec;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.labeled-form button {
  background: #d8ad4a;
  color: #1a1206;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  height: 36px;
}

.labeled-form button:hover { background: #e8c874; }

.labeled-form--compact {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #2a2d34;
}

/* ---------- Premios agrupados por nivel ---------- */

.tier-card {
  border: 1px solid #2a2d34;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.tier-card:last-child { margin-bottom: 0; }

.tier-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.tier-card-title { font-size: 13px; padding: 4px 12px; }

.tier-total {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.tier-total--ok {
  background: rgba(90, 200, 130, 0.15);
  color: #7ee0a0;
  border-color: rgba(90, 200, 130, 0.3);
}

.tier-total--bad {
  background: rgba(216, 90, 90, 0.15);
  color: #f2a3a3;
  border-color: rgba(216, 90, 90, 0.3);
}

.empty-row {
  color: #6b6f78;
  font-style: italic;
}

/* ---------- Editar nivel de un link ---------- */

.link-edit {
  display: flex;
  gap: 6px;
  align-items: center;
}

.link-edit select {
  background: #101216;
  border: 1px solid #33363e;
  color: #e8e8ec;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}

/* ---------- Tabla ---------- */

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

.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #2a2d34;
}

.table th {
  color: #9a9ea8;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag--bronce { background: rgba(201, 138, 75, 0.2); color: #e0a566; }
.tag--plata { background: rgba(183, 193, 200, 0.2); color: #eef1f3; }
.tag--oro { background: rgba(232, 200, 116, 0.2); color: #e8c874; }
.tag--diamante { background: rgba(168, 32, 45, 0.25); color: #e18a94; }

.tag--pending { background: rgba(255, 255, 255, 0.1); color: #9a9ea8; }
.tag--opened { background: rgba(90, 200, 130, 0.2); color: #7ee0a0; }

.row-inactive { opacity: 0.45; }

.icon-btn {
  background: none;
  border: 1px solid #33363e;
  color: #e8e8ec;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.icon-btn:hover { border-color: #d8ad4a; color: #d8ad4a; }
.icon-btn.danger:hover { border-color: #d85a5a; color: #d85a5a; }

.link-result {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #101216;
  border: 1px solid #33363e;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 20px;
  font-size: 13px;
}

.link-result code {
  flex: 1;
  color: #e8c874;
  overflow-x: auto;
  white-space: nowrap;
}

.error-banner {
  background: rgba(216, 90, 90, 0.15);
  border: 1px solid rgba(216, 90, 90, 0.4);
  color: #f2a3a3;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
