*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0F0F0F;
  color: #F5F0E8;
  font-family: 'Instrument Sans', sans-serif;
  min-height: 100vh;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(201, 169, 110, 0.2);
  position: sticky;
  top: 0;
  background: #0F0F0F;
  z-index: 100;
}
.nav-logo { text-decoration: none; }
.nav-logo-main {
  display: block;
  font-family: 'Gloock', serif;
  font-size: 1.1rem;
  color: #F5F0E8;
  letter-spacing: 0.08em;
}
.nav-logo-sub {
  display: block;
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.55rem;
  color: #C9A96E;
  letter-spacing: 0.5em;
  text-align: center;
  margin-top: 0.15rem;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.admin-badge {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0F0F0F;
  background: #C9A96E;
  padding: 0.25rem 0.6rem;
}
.nav-link {
  font-size: 0.8rem;
  color: rgba(245, 240, 232, 0.55);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.nav-link:hover { color: #F5F0E8; }
.btn-logout {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #C9A96E;
  background: none;
  border: 1px solid rgba(201, 169, 110, 0.35);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  border-color: #C9A96E;
  background: rgba(201, 169, 110, 0.07);
}

/* ── Tab nav ─────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(201, 169, 110, 0.15);
  padding: 0 2rem;
  background: #0F0F0F;
  position: sticky;
  top: 65px;
  z-index: 90;
}
.tab-btn {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.38);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: rgba(245, 240, 232, 0.7); }
.tab-btn.active {
  color: #C9A96E;
  border-bottom-color: #C9A96E;
}

/* ── Main layout ─────────────────────────────────────────── */
.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}
.admin-section { }

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
}
.stat-card {
  border: 1px solid rgba(201, 169, 110, 0.2);
  padding: 1.5rem 1.75rem;
  background: rgba(255, 255, 255, 0.015);
}
.stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.38);
  margin-bottom: 0.75rem;
}
.stat-value {
  font-family: 'Gloock', serif;
  font-size: 2rem;
  font-weight: 400;
  color: #C9A96E;
  letter-spacing: 0.02em;
}

/* ── Section blocks ─────────────────────────────────────── */
.section-block { margin-bottom: 2rem; }
.block-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #C9A96E;
  margin-bottom: 1rem;
}
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.loading-text {
  font-size: 0.875rem;
  color: rgba(245, 240, 232, 0.3);
  font-style: italic;
  padding: 2rem 0;
}
.empty-text {
  font-size: 0.875rem;
  color: rgba(245, 240, 232, 0.3);
  font-style: italic;
  padding: 1.5rem 0;
}

/* ── Orders table ───────────────────────────────────────── */
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.35);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(201, 169, 110, 0.1);
}
.orders-table td {
  font-size: 0.84rem;
  color: rgba(245, 240, 232, 0.75);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
.orders-table tr:hover td {
  background: rgba(201, 169, 110, 0.03);
}
.order-date { color: rgba(245, 240, 232, 0.42); font-size: 0.78rem; }
.order-total { color: #F5F0E8; font-weight: 600; }
.order-id { font-size: 0.72rem; color: rgba(245, 240, 232, 0.3); font-family: monospace; }

/* ── Status badges ──────────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
}
.status-pendiente   { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.status-confirmado  { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.status-despachado  { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.status-entregado   { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.status-cancelado   { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.status-devolucion  { background: rgba(251, 146, 60, 0.15); color: #fb923c; }

/* ── Status select ──────────────────────────────────────── */
.status-select {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #1a1a1a;
  color: #F5F0E8;
  border: 1px solid rgba(201, 169, 110, 0.25);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.status-select:hover { border-color: #C9A96E; }

/* ── Order detail row ───────────────────────────────────── */
.order-detail-row td {
  padding: 0 0 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.order-detail-inner {
  padding: 1rem 1rem 1.25rem 1rem;
  background: rgba(201, 169, 110, 0.03);
  border-left: 2px solid rgba(201, 169, 110, 0.25);
}
.order-items-list {
  list-style: none;
  margin-bottom: 0.75rem;
}
.order-items-list li {
  font-size: 0.82rem;
  color: rgba(245, 240, 232, 0.6);
  padding: 0.2rem 0;
}
.order-meta {
  font-size: 0.75rem;
  color: rgba(245, 240, 232, 0.3);
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-btn {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.42);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover { color: #F5F0E8; border-color: rgba(255, 255, 255, 0.2); }
.filter-btn.active {
  color: #C9A96E;
  border-color: rgba(201, 169, 110, 0.45);
  background: rgba(201, 169, 110, 0.06);
}

/* ── Products table ─────────────────────────────────────── */
.products-table {
  width: 100%;
  border-collapse: collapse;
}
.products-table th {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.35);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(201, 169, 110, 0.1);
}
.products-table td {
  font-size: 0.84rem;
  color: rgba(245, 240, 232, 0.75);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
.products-table tr:hover td {
  background: rgba(201, 169, 110, 0.03);
}
.product-sku {
  font-size: 0.72rem;
  color: rgba(245, 240, 232, 0.35);
  font-family: monospace;
}

/* ── Inline edit ─────────────────────────────────────────── */
.editable-cell {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.editable-cell:hover .edit-hint { opacity: 1; }
.edit-hint {
  font-size: 0.62rem;
  color: rgba(201, 169, 110, 0.5);
  opacity: 0;
  transition: opacity 0.15s;
}
.inline-input {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.06);
  color: #F5F0E8;
  border: 1px solid rgba(201, 169, 110, 0.4);
  padding: 0.3rem 0.5rem;
  width: 90px;
  outline: none;
}
.inline-input:focus { border-color: #C9A96E; }

/* ── Visibility toggle ───────────────────────────────────── */
.toggle-visible {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.toggle-visible input[type="checkbox"] { display: none; }
.toggle-track {
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(245, 240, 232, 0.4);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.2s;
}
.toggle-visible.on .toggle-track { background: rgba(201, 169, 110, 0.4); }
.toggle-visible.on .toggle-track::after {
  background: #C9A96E;
  left: 19px;
}

/* ── Add product ─────────────────────────────────────────── */
.btn-add-product {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #C9A96E;
  background: none;
  border: 1px solid rgba(201, 169, 110, 0.35);
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-add-product:hover {
  border-color: #C9A96E;
  background: rgba(201, 169, 110, 0.07);
}
.add-product-form {
  border: 1px solid rgba(201, 169, 110, 0.15);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.015);
  margin-top: 1.5rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-field label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.38);
}
.form-field input {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.05);
  color: #F5F0E8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-field input:focus { border-color: rgba(201, 169, 110, 0.5); }
.form-actions {
  display: flex;
  gap: 0.75rem;
}
.btn-save {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0F0F0F;
  background: #C9A96E;
  border: none;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.85; }
.btn-cancel {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.42);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { color: #F5F0E8; border-color: rgba(255, 255, 255, 0.2); }
.form-error {
  font-size: 0.8rem;
  color: #f87171;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-main { padding: 1.5rem 1rem 4rem; }
  .navbar { padding: 1rem 1rem; }
  .admin-tabs { padding: 0 1rem; overflow-x: auto; }
  .orders-table th:nth-child(4),
  .orders-table td:nth-child(4) { display: none; }
}

/* ── Coupon form ── */
.add-product-form select {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #e8e0d0;
  padding: .5rem .75rem;
  font-family: inherit;
  font-size: .85rem;
  outline: none;
  cursor: pointer;
}
.coupon-checkbox-field label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: #b0a898;
  cursor: pointer;
}
.coupon-checkbox-field input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #c9a76e;
}

.coupon-delete-btn {
  background: none;
  border: 1px solid rgba(248,113,113,.35);
  color: #f87171;
  width: 24px; height: 24px;
  font-size: .75rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background .15s, color .15s;
  line-height: 1;
  padding: 0;
}
.coupon-delete-btn:hover {
  background: #f87171;
  color: #0f0f0f;
}
