/* ===== Base ===== */
:root {
  --ink: #111;
  --muted: #6b6b6b;
  --line: #e7e7e4;
  --soft: #f6f6f3;
  --bg: #ffffff;
  --hero: #1d1d1f;
  --danger: #b3261e;
  --ok: #1e7a46;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ===== Botones y campos ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  padding: 12px 22px; border-radius: 999px; font-weight: 600; text-decoration: none;
  transition: opacity .2s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }

input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #d6d6d2; border-radius: 10px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
.muted { color: var(--muted); font-size: .85rem; font-weight: 400; }

/* ===== Tienda: barra de anuncio y cabecera ===== */
.announce {
  background: var(--ink); color: #fff; text-align: center;
  font-size: .82rem; padding: 8px 12px; letter-spacing: .02em;
}
.header {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  font-weight: 800; font-size: 1.35rem; letter-spacing: .18em; text-decoration: none;
  white-space: nowrap;
}
.nav { display: flex; gap: 22px; flex: 1; justify-content: center; }
.nav button {
  background: none; border: 0; padding: 4px 0; font-size: .92rem; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.nav button:hover, .nav button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tools { display: flex; align-items: center; gap: 12px; }
.search {
  width: 200px; padding: 9px 14px; border-radius: 999px; font-size: .9rem;
}
.icon-btn {
  position: relative; background: none; border: 0; padding: 8px; color: var(--ink);
}
.badge {
  position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--ink); color: #fff; font-size: .7rem;
  display: grid; place-items: center; font-weight: 700;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(115deg, var(--hero) 0%, #000 100%);
  color: #fff; padding: 88px 20px; text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero h1 {
  margin: 0 0 14px; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -.02em;
}
.hero p { margin: 0 auto 28px; max-width: 540px; color: #d4d4d4; font-size: 1.05rem; line-height: 1.5; }
.hero .btn { background: #fff; color: var(--ink); border-color: #fff; padding: 14px 30px; }

/* ===== Catálogo ===== */
.wrap { max-width: 1280px; margin: 0 auto; padding: 36px 20px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  margin-bottom: 26px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; padding: 8px 16px; border-radius: 999px;
  font-size: .88rem; color: var(--ink);
}
.chip.on, .chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.sort { width: auto; min-width: 190px; padding: 9px 12px; }
.count { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }

.grid {
  display: grid; gap: 28px 20px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card { cursor: pointer; }
.thumb {
  position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden;
  background: var(--soft);
}
.media, .media img, .ph { width: 100%; height: 100%; }
.media img { object-fit: cover; }
.ph { display: grid; place-items: center; color: rgba(0,0,0,.25); font-size: 4rem; font-weight: 800; }
.card:hover .media img, .card:hover .ph { transform: scale(1.03); }
.media img, .ph { transition: transform .4s ease; }
.tag {
  position: absolute; left: 12px; top: 12px; padding: 5px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em; background: #fff; color: var(--ink);
}
.tag.out { background: var(--ink); color: #fff; }
.tag.low { background: #fff3d6; color: #7a5200; }
.info { padding: 12px 2px 0; }
.info .cat { margin: 0 0 4px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.info h3 { margin: 0 0 6px; font-size: .98rem; font-weight: 600; line-height: 1.3; }
.price { margin: 0; font-weight: 700; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; grid-column: 1 / -1; }

/* ===== Overlay, modal y carrito ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 40;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.modal, .drawer {
  position: fixed; z-index: 50; background: #fff; transition: transform .3s ease;
}
.modal {
  left: 50%; top: 50%; width: min(880px, calc(100% - 32px)); max-height: calc(100vh - 40px);
  overflow: auto; border-radius: 18px; transform: translate(-50%, -48%); opacity: 0; pointer-events: none;
  transition: transform .3s ease, opacity .3s;
}
.modal.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
.modal-media { aspect-ratio: 4 / 5; background: var(--soft); }
.modal-body { padding: 30px 28px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.modal-body .desc { color: var(--muted); line-height: 1.55; margin: 0; }
.close {
  position: absolute; right: 14px; top: 12px; background: #fff; border: 0; border-radius: 50%;
  width: 36px; height: 36px; font-size: 1.3rem; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,.15);
  z-index: 2;
}
.modal { position: fixed; }
.modal-body label.lbl { font-size: .85rem; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  min-width: 48px; padding: 10px 14px; border: 1px solid #cfcfca; background: #fff;
  border-radius: 8px; font-weight: 600;
}
.size.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.size:disabled { opacity: .35; text-decoration: line-through; }
.stock-msg { font-size: .88rem; color: var(--muted); margin: 0; }
.stock-msg.ok { color: var(--ok); }
.stock-msg.bad { color: var(--danger); }
.qty { display: inline-flex; align-items: center; border: 1px solid #cfcfca; border-radius: 999px; overflow: hidden; }
.qty button { background: none; border: 0; width: 40px; height: 40px; font-size: 1.1rem; }
.qty span { min-width: 30px; text-align: center; font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; }

.drawer {
  top: 0; right: 0; height: 100%; width: min(420px, 100%);
  transform: translateX(105%); display: flex; flex-direction: column;
  box-shadow: -10px 0 30px rgba(0,0,0,.1);
}
.drawer.open { transform: translateX(0); }
.drawer-head, .drawer-foot { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-foot { border-top: 1px solid var(--line); border-bottom: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; font-size: 1.1rem; }
.cart-items { flex: 1; overflow: auto; padding: 8px 22px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.line .thumb-s { width: 64px; height: 80px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.line h4 { margin: 0 0 4px; font-size: .95rem; }
.line .meta { color: var(--muted); font-size: .82rem; margin: 0 0 8px; }
.line .qty button { width: 30px; height: 30px; }
.line .remove { background: none; border: 0; color: var(--muted); font-size: .8rem; text-decoration: underline; padding: 0; margin-top: 6px; }
.total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; }
.note { color: var(--muted); font-size: .8rem; margin: 10px 0 0; text-align: center; }

/* ===== Pie ===== */
.footer { background: var(--ink); color: #cfcfcf; padding: 44px 20px; margin-top: 40px; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.footer .brand { color: #fff; }
.footer a { color: #fff; }

/* ===== Notificación ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 140%); z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .9rem;
  transition: transform .3s ease; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }

/* ===== Panel del dueño (admin) ===== */
.admin-body { background: var(--soft); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: #fff; padding: 36px; border-radius: 18px; width: min(380px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.06); display: grid; gap: 16px; }
.login-card h1 { margin: 0; font-size: 1.3rem; }
.err { color: var(--danger); margin: 0; font-size: .88rem; min-height: 1.2em; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar .brand { font-size: 1.1rem; }
.topbar nav { display: flex; gap: 10px; align-items: center; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs button {
  background: #fff; border: 1px solid var(--line); padding: 9px 18px; border-radius: 999px; font-weight: 600; color: var(--muted);
}
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel-card { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.panel-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-head .search-box { width: 260px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.mini { width: 110px; padding: 7px 9px; }
.swatch { display: inline-block; width: 28px; height: 36px; border-radius: 6px; border: 1px solid var(--line); }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.no { background: #f6e1df; color: var(--danger); }
.actions { white-space: nowrap; }
.actions .btn { margin-left: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: auto; }
.help { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: 10px 0 0; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; min-height: 280px; }
dialog { border: 0; border-radius: 18px; padding: 0; width: min(760px, calc(100% - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-body { padding: 26px; }
.dialog-body h2 { margin: 0 0 18px; font-size: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.status { font-size: .88rem; color: var(--muted); margin-left: 4px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .nav { display: none; }
  .search { width: 150px; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-media { aspect-ratio: 16 / 12; }
  .hero { padding: 64px 20px; }
}
@media (max-width: 560px) {
  .header-inner { gap: 12px; }
  .search { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .brand { font-size: 1.1rem; }
}
