/* Cuponi — dashboard del comercio */
:root {
  --brand: #e11d48;
  --brand-ink: #fff;
  --bg: #f6f7f9;
  --surface: #fff;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

/* El atributo [hidden] debe ganarle a cualquier display: grid/flex de abajo,
   si no, las vistas ocultas se siguen viendo. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
a { color: var(--brand); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

/* ---------- Layout ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--brand);
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  object-fit: cover;
  flex: none;
}
.biz-name { font-weight: 650; font-size: 15px; }
.biz-plan { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }

.tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.tab {
  border: 0; background: none;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 550; font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 14px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 680; letter-spacing: -.02em; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 2px; }

label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=color] { width: 54px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.field + .field { margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 600; cursor: pointer;
  transition: filter .12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-sm { padding: 6px 11px; font-size: 13px; font-weight: 550; }

/* Botones grandes de la caja: pensados para tablet, se aciertan sin mirar */
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.btn-huge {
  padding: 26px 18px;
  font-size: 18px; font-weight: 680;
  border-radius: 14px;
  flex-direction: column; gap: 4px;
  min-height: 104px;
}
.btn-huge small { font-weight: 500; font-size: 13px; opacity: .85; }
.btn-redeem { background: #101828; }
@media (max-width: 560px) { .action-buttons { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
.row-hover:hover { background: #fafbfc; cursor: pointer; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-muted { background: #f2f4f7; color: var(--muted); }

/* Progreso de sellos */
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--border); background: #fff; }
.dot.on { background: var(--brand); border-color: var(--brand); }

.alert { padding: 12px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: #101828; color: #fff;
  padding: 13px 20px; border-radius: 10px;
  font-weight: 550; font-size: 15px;
  box-shadow: 0 8px 24px rgba(16,24,40,.24);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #067647; }
.toast.err { background: #b42318; }

.muted { color: var(--muted); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 16px; }

.usage-bar { height: 6px; background: #f2f4f7; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.usage-bar > i { display: block; height: 100%; background: var(--brand); }
.usage-bar.over > i { background: var(--danger); }
