/* ===================================================================
   Power By Steps — Uniformes (app interna)
   Estética: refinada estilo Apple. Tema claro y aireado, tipografía
   Manrope, acentos de marca azul marino + dorado.
   =================================================================== */
:root {
  --navy:      #002245;
  --navy-soft: #1c3a5e;
  --gold:      #f5b301;
  --gold-deep: #e0a400;
  --ink:       #0e1726;   /* texto principal */
  --muted:     #6b7787;   /* texto secundario */
  --line:      #e6e8ec;   /* bordes sutiles */
  --bg:        #f4f5f7;   /* fondo app */
  --card:      #ffffff;
  --ok:        #1f9d57;
  --ok-bg:     #e7f7ee;
  --err:       #d13b3b;
  --err-bg:    #fdeaea;
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 1px 2px rgba(16,23,38,.04), 0 8px 24px -12px rgba(16,23,38,.12);
  --shadow-lg: 0 20px 50px -24px rgba(16,23,38,.28);
  --maxw:      940px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}
body.is-bare {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 100% -10%, #eaf0fb 0%, transparent 55%),
    radial-gradient(700px 500px at -10% 110%, #fff6e0 0%, transparent 55%),
    var(--bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand__logo { width: 30px; height: 30px; border-radius: 8px; }
.brand__txt { font-size: 1.02rem; letter-spacing: -.02em; color: var(--ink); }
.brand__txt span { color: var(--gold-deep); margin: 0 5px; font-weight: 700; }

.usermenu { display: flex; align-items: center; gap: 12px; font-size: .92rem; }
.usermenu__panel {
  font-weight: 700; color: var(--navy);
  background: #eef2f8; padding: 7px 14px; border-radius: 999px;
}
.usermenu__panel:hover { background: #e4ebf5; }
.usermenu__name { color: var(--muted); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu__out { color: var(--muted); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.usermenu__out:hover { background: #f0f1f3; color: var(--err); }

/* Subnav (admin) */
.subnav {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; gap: 4px; padding: 0 14px 10px; overflow-x: auto;
}
.subnav a {
  font-size: .9rem; font-weight: 600; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; white-space: nowrap;
}
.subnav a:hover { background: #eef0f3; color: var(--ink); }
.subnav a.is-active { background: var(--navy); color: #fff; }

/* ---------------- Layout ---------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px 60px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; letter-spacing: -.03em; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: .96rem;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .2s ease, box-shadow .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: #00305f; }
.btn--gold { background: var(--gold); color: #3a2c00; box-shadow: 0 8px 20px -10px rgba(245,179,1,.8); }
.btn--gold:hover { background: var(--gold-deep); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: #cfd4db; }
.btn--danger { background: var(--err-bg); color: var(--err); }
.btn--danger:hover { background: #fbdada; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Tarjetas ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card--pad { padding: 22px; }

/* ---------------- Formularios ---------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 7px; color: var(--ink); }
.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(245,179,1,.18);
}
.textarea { resize: vertical; min-height: 90px; }
.field__hint { color: var(--muted); font-size: .82rem; margin-top: 6px; }

/* Honeypot anti-bots (invisible para personas) */
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------------- Auth (login/registro) ---------------- */
.auth { width: 100%; max-width: 400px; }
.auth__logo { width: 60px; height: 60px; border-radius: 15px; margin: 0 auto 18px; box-shadow: var(--shadow); }
.auth h1 { text-align: center; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.auth__sub { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.auth__alt { text-align: center; color: var(--muted); margin-top: 18px; font-size: .92rem; }
.auth__alt a { color: var(--navy); font-weight: 700; }

/* ---------------- Flash ---------------- */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem; margin-bottom: 20px; }
.flash--ok { background: var(--ok-bg); color: var(--ok); }
.flash--error { background: var(--err-bg); color: var(--err); }

/* ---------------- Catálogo ---------------- */
.cat { margin-bottom: 34px; }
.cat__title {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em;
  text-transform: uppercase; color: var(--navy);
  margin: 0 4px 14px;
}
.cat__title small { font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}
.prod {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s, box-shadow .2s, transform .12s;
}
.prod:has(.prod__qty:focus), .prod:has(select:focus) { border-color: #cfd6e0; box-shadow: var(--shadow); }
.prod.is-selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,179,1,.15); }
.prod__img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #eef1f5; }
.prod__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prod__name { font-weight: 700; line-height: 1.25; }
.prod__type { color: var(--muted); font-size: .86rem; font-weight: 600; }
.prod__price { font-weight: 800; white-space: nowrap; color: var(--navy); }
.prod__controls { display: flex; gap: 8px; margin-top: auto; }
.prod__controls .select { flex: 1; padding: 9px 10px; font-size: .92rem; }
.prod__qty { width: 92px; }

/* Stepper de cantidad */
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; width: 110px; }
.stepper button { width: 34px; height: 40px; border: 0; background: #f7f8fa; font-size: 1.2rem; color: var(--navy); cursor: pointer; }
.stepper button:active { background: #eef0f3; }
.stepper input { width: 42px; text-align: center; border: 0; font-family: inherit; font-size: 1rem; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------- Barra resumen (carrito) fija ---------------- */
.summary {
  position: sticky; bottom: 0; z-index: 40; margin-top: 20px;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px;
}
.summary__info { font-size: .9rem; color: var(--muted); }
.summary__total { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.summary__total small { font-size: .8rem; color: var(--muted); font-weight: 600; display: block; }

/* ---------------- Tablas (admin) ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { background: #fafbfc; font-weight: 700; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fcfcfd; }

/* Badges de estado */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge--pendiente_pago { background: #fff3d6; color: #9a6b00; }
.badge--pagado        { background: #e7f7ee; color: var(--ok); }
.badge--en_produccion { background: #e7eefb; color: #2a5bd7; }
.badge--entregado     { background: #eef0f3; color: #3a4658; }
.badge--anulado       { background: #fdeaea; color: var(--err); }
.badge--pendiente     { background: #fff3d6; color: #9a6b00; }
.badge--aprobado      { background: #e7f7ee; color: var(--ok); }
.badge--inactivo      { background: #eef0f3; color: #3a4658; }

/* Avatar (placeholder con iniciales; futura foto del socio) */
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #e9eef6, #d7e2f1);
  color: var(--navy); font-weight: 800; font-size: 1.45rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Novedades (anuncios) */
.novedad { overflow: hidden; padding: 0; }
.novedad__img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.novedad__body { padding: 22px 24px 24px; }
.novedad__date { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.novedad__title { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 800; letter-spacing: -.01em; margin: 5px 0 10px; }
.novedad__text { color: #33414f; }

/* Utilidades */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 20px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }

/* Animación de entrada */
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop .35s ease-out both; }

@media (max-width: 540px) {
  .wrap { padding: 18px 14px 50px; }
  .summary__total { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
