:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5ea;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --primary: #e0393e;
  --primary-dark: #b92e32;
  --gold: #f4c542;
  --green: #17a34a;
  --green-bg: #e8f8ee;
  --red: #dc2626;
  --red-bg: #fdeaea;
  --gray-bg: #eef0f3;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; }

/* ---------- topbar / nav ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 18px; }
.brand-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold), var(--primary) 65%);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #222;
  flex-shrink: 0;
}
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.topnav a { text-decoration: none; color: var(--text-muted); }
.topnav a:hover { color: var(--text); }

.main { max-width: 1000px; margin: 0 auto; padding: 28px 20px 60px; }
.main.wide { max-width: 1160px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--text); color: #fff; }
.btn-secondary:hover { background: #000; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--gray-bg); }
.btn-danger { background: #fff; border-color: #f3caca; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- flash messages ---------- */

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; font-weight: 600; }
.flash-error   { background: var(--red-bg); color: var(--red); }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-info    { background: var(--gray-bg); color: var(--text-muted); }

/* ---------- cards / forms ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.hint { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=url], .field input[type=number], .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.field .field-hint { color: var(--text-muted); font-size: 12px; margin-top: 5px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }

.auth-card { max-width: 420px; margin: 30px auto; }
.auth-card .switch-link { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 14px; }

/* ---------- pills / badges ---------- */

.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-block; }
.pill-muted { background: var(--gray-bg); color: var(--text-muted); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-gray { background: var(--gray-bg); color: var(--text-muted); }
.pill-gold { background: #fdf3d6; color: #9a7300; }

.store-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--gray-bg); color: var(--text-muted); }

/* ---------- tables / lists ---------- */

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
table.data-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.empty-state { padding: 26px; text-align: center; color: var(--text-muted); font-size: 14px; border: 1px dashed var(--border); border-radius: 10px; }

.product-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.product-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap;
}
.product-main { min-width: 0; flex: 1; }
.product-main .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-main .meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.product-main .meta a { text-decoration: none; }
.product-main .meta a:hover { text-decoration: underline; }
.product-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.error-line { font-size: 12px; color: var(--red); margin-top: 6px; }

/* ---------- landing ---------- */

.hero {
  text-align: center;
  padding: 70px 20px 50px;
}
.hero h1 { font-size: 40px; margin: 0 0 16px; }
.hero p.lead { font-size: 18px; color: var(--text-muted); max-width: 620px; margin: 0 auto 28px; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.section { max-width: 1000px; margin: 0 auto; padding: 50px 20px; }
.section h2 { text-align: center; font-size: 28px; margin: 0 0 10px; }
.section p.section-sub { text-align: center; color: var(--text-muted); max-width: 560px; margin: 0 auto 36px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .features-grid { grid-template-columns: 1fr; } }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-card .icon { font-size: 26px; margin-bottom: 10px; }
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; align-items: stretch; }
.plan-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.plan-card.featured { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(224,57,62,.12); position: relative; }
.plan-card.featured::before {
  content: "Más popular"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.plan-card h3 { margin: 6px 0 0; font-size: 18px; }
.plan-card .price { font-size: 30px; font-weight: 800; color: var(--primary-dark); }
.plan-card .price span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.plan-card ul { list-style: none; padding: 0; margin: 6px 0; text-align: left; font-size: 13px; color: var(--text); flex: 1; }
.plan-card ul li { padding: 5px 0; display: flex; gap: 8px; align-items: flex-start; }
.plan-card ul li::before { content: "✓"; color: var(--green); font-weight: 700; }

.footer-cta { text-align: center; padding: 60px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.footer-cta h2 { margin: 0 0 18px; font-size: 26px; }

.sitefooter { text-align: center; padding: 24px 20px; color: var(--text-muted); font-size: 12px; }

/* ---------- misc ---------- */

.saved-text { color: var(--green); font-size: 13px; margin: 8px 0 0; min-height: 1em; }
.error-text { color: var(--red); font-size: 13px; margin: 8px 0 0; min-height: 1em; }

.tutorial { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: #fafbfc; }
.tutorial summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.tutorial ol { margin: 12px 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.tutorial code { background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-box .value { font-size: 26px; font-weight: 800; }
.stat-box .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }

.badge-pending { background: #fdf3d6; color: #9a7300; }

.log-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-row:last-child { border-bottom: none; }
.log-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.log-text { flex: 1; min-width: 0; }

.inline-form { display: inline; }
