/* Panel de administración (usa los mismos colores de styles.css) */
body.admin { background: var(--color-surface); min-height: 100vh; }
.muted { color: var(--color-muted); font-size: .9rem; }

.demo-banner { background: #fff4d6; color: #7a5a00; padding: 10px 16px; font-size: .88rem; text-align: center; }
.demo-banner button { margin-left: 10px; text-decoration: underline; font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__box { background: var(--color-bg); padding: 32px; border-radius: 12px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.08); text-align: center; }
.login__box .field { text-align: left; }
.login__box p { color: var(--color-muted); margin-top: -8px; }

/* Barra superior */
.admin-top { background: var(--color-bg); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 10; }
.admin-top__in { display: flex; align-items: center; gap: 12px; height: 64px; }
.admin-top .logo { font-size: 1.4rem; }
.admin-top__tag { background: var(--color-primary); color: var(--color-primary-text); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 4px; }
.admin-top__user { margin-left: auto; color: var(--color-muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-main { padding-top: 28px; padding-bottom: 64px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab {
  font: inherit;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
.admin-tab.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-text);
}
.admin-section[hidden] { display: none !important; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.admin-head h1 { font-family: var(--font-display); text-transform: uppercase; font-size: 2rem; line-height: 1; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { background: var(--color-bg); border: 1px solid var(--color-border); max-width: 360px; }
.toolbar select { font: inherit; padding: 0 12px; height: 42px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text); }

.empty-state { background: var(--color-bg); border-radius: 10px; padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state h2 { font-family: var(--font-display); text-transform: uppercase; }
.empty-state p { color: var(--color-muted); max-width: 460px; }

/* Tabla */
.ptable { width: 100%; border-collapse: collapse; background: var(--color-bg); border-radius: 10px; overflow: hidden; font-size: .92rem; }
.ptable th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--color-muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.ptable td { padding: 10px 14px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tr.is-hidden td:not(:last-child) { opacity: .5; }
.ptable tbody tr:hover { background: #fafaf8; }
.thumb { width: 52px; height: 52px; border-radius: 6px; overflow: hidden; }
.thumb .ph { font-size: .5rem; padding: 3px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pname { font-weight: 500; }
.pname small { display: block; color: var(--color-muted); font-weight: 400; font-size: .78rem; }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--color-surface); margin-right: 4px; white-space: nowrap; }
.pill--star { background: #fff4d6; color: #7a5a00; }
.pill--badge { background: var(--color-accent); color: #fff; }
.pill--warn { background: #fde8e8; color: #9b1c1c; }
.pill--ok { background: #e8f6ed; color: #0f5132; }
.pill--off { background: #f1f3f5; color: #495057; }
.ctable__root td { background: var(--color-surface); }
.ctable__sub td:first-child { padding-left: 28px; }
.ctable__indent { color: var(--color-muted); margin-right: 8px; }
.ctable td:last-child { white-space: nowrap; text-align: right; }
.price small { display: block; color: var(--color-muted); font-size: .78rem; }

/* Switch de visibilidad */
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #ccc; border-radius: 12px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: #25a55f; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--color-text); outline-offset: 2px; }

/* Modal de edición */
.modal--wide { width: min(760px, calc(100% - 32px)); }
.edit-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.photo { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.photo__preview { aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.photo__preview img { width: 100%; height: 100%; object-fit: cover; }
.photo__btn { cursor: pointer; }
.edit-fields { display: flex; flex-direction: column; gap: 12px; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.hint { font-size: .8rem; color: var(--color-muted); }
.link-btn { font-size: .85rem; text-decoration: underline; color: var(--color-muted); }
.link-btn--danger { color: #c62828; }
.modal__actions { align-items: center; }
.shipping-config { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 10px; padding: 14px; }

@media (max-width: 760px) {
  .admin-top__user { display: none; }
  .admin-top .btn--ghost { margin-left: auto; }
  .edit-grid { grid-template-columns: 1fr; }
  .photo { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .photo__preview { width: 96px; }
  .photo__btn { width: auto; }
  /* Tabla -> tarjetas */
  .ptable thead { display: none; }
  .ptable, .ptable tbody { display: block; background: none; }
  .ptable tr { display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; background: var(--color-bg); border-radius: 10px; padding: 12px; margin-bottom: 10px; align-items: center; }
  .ptable td { padding: 0; border: 0; }
  .ptable td:nth-child(1) { grid-row: span 3; }
  .ptable td:nth-child(2) { grid-column: 2; }
  .ptable td:nth-child(3) { grid-column: 2; }
  .ptable td:nth-child(4) { grid-column: 2; }
  .ptable td:nth-child(5) { grid-column: 3; grid-row: 1; }
  .ptable td:nth-child(6) { grid-column: 3; grid-row: 2 / span 2; }
  .ctable tr { grid-template-columns: 1fr auto; }
  .ctable td { grid-column: auto !important; grid-row: auto !important; }
  .ctable td:nth-child(2), .ctable td:nth-child(3) { display: none; }
}
