:root {
  --cs-primary: #b51e49;
  --cs-primary-deep: #8f1739;
  --cs-secondary: #ce652e;
  --cs-surface: #fdf6f2;
  --cs-ink: #1c1917;
  --cs-muted: #78716c;
  --cs-line: #edd5c8;
  --cs-white: #ffffff;
  --cs-danger: #b91c1c;
  --font-display: "Noto Serif", "Liberation Serif", Georgia, serif;
  --font-ui: Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body,
.admin-body {
  margin: 0;
  min-height: 100vh;
  color: var(--cs-ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgb(181 30 73 / 14%), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgb(206 101 46 / 12%), transparent 50%),
    linear-gradient(180deg, #fff8f4 0%, var(--cs-surface) 42%, #f7ebe3 100%);
  background-attachment: fixed;
}

a { color: var(--cs-primary); }
a:hover { color: var(--cs-primary-deep); }

/* ——— Login ——— */
.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgb(181 30 73 / 92%) 0%, rgb(142 24 58 / 88%) 48%, rgb(206 101 46 / 85%) 100%),
    url("/images/hero-local.webp") center/cover;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; }
}
.login-brand {
  color: #fff;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand .home-kicker { color: rgb(255 255 255 / 80%); }
.login-brand h1 {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  font-weight: 700;
}
.login-brand .home-lead { color: rgb(255 255 255 / 88%); max-width: 28rem; }
.login-card h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.login-back { margin: 1rem 0 0; font-size: .9rem; }
.login-back a { color: var(--cs-muted); text-decoration: none; }
.login-back a:hover { color: var(--cs-primary); }

.admin-card {
  background: var(--cs-white);
  padding: 1.75rem 1.5rem;
  border-radius: 4px;
  width: 100%;
  box-shadow: 0 18px 50px rgb(28 25 23 / 18%);
}
.muted { color: var(--cs-muted); margin: 0 0 1rem; font-size: .95rem; }
.error { color: var(--cs-danger); font-size: .875rem; margin: 0 0 .75rem; }
.flash-ok { color: #047857; font-size: .9rem; margin: 0 0 1rem; }

label {
  display: block;
  margin-bottom: .85rem;
  font-size: .85rem;
  font-weight: 600;
  color: #44403c;
}
input, select, textarea {
  width: 100%;
  margin-top: .35rem;
  padding: .7rem .8rem;
  border: 1px solid #e7e5e4;
  border-radius: 2px;
  font: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cs-primary);
  box-shadow: 0 0 0 3px rgb(181 30 73 / 15%);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: var(--cs-primary);
  color: #fff;
  border: 0;
  padding: .7rem 1.15rem;
  border-radius: 2px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  transition: background .15s, transform .15s;
}
button:hover, .btn:hover { background: var(--cs-primary-deep); }
button:active, .btn:active { transform: translateY(1px); }
button.btn-ghost, .btn-ghost {
  background: transparent;
  color: #44403c;
  border: 1px solid #d6d3d1;
}
.btn-danger { background: var(--cs-danger); }
.btn-secondary { background: #78716c; }
.btn-link {
  background: transparent;
  color: var(--cs-primary);
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font: inherit;
  font-weight: 600;
}

/* ——— Header ——— */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgb(255 255 255 / 86%);
  border-bottom: 1px solid var(--cs-line);
}
.admin-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: .85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-brand {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.admin-brand-name {
  font-family: var(--font-display);
  color: var(--cs-primary);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.1;
}
.admin-brand-sub {
  font-size: .72rem;
  color: var(--cs-muted);
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}
.admin-nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: .88rem;
  color: #57534e;
  padding: .5rem .8rem;
  border-radius: 2px;
  transition: background .15s, color .15s;
}
.admin-nav a:hover { background: #fce7ef; color: var(--cs-primary); }
.admin-nav a.is-active {
  background: var(--cs-primary);
  color: #fff;
}
.admin-nav-logout { color: var(--cs-danger) !important; }

/* ——— Layout ——— */
.admin-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}
.admin-home { animation: rise .45s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.home-kicker {
  margin: 0 0 .5rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cs-primary);
}
.home-lead {
  margin: 0;
  color: var(--cs-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.home-banner {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding: 1.75rem;
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 92%) 0%, rgb(255 248 244 / 88%) 100%);
  border: 1px solid var(--cs-line);
  box-shadow: 0 16px 40px rgb(181 30 73 / 6%);
  position: relative;
  overflow: hidden;
}
.home-banner::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(181 30 73 / 16%), transparent 70%);
  pointer-events: none;
}
@media (max-width: 800px) {
  .home-banner { grid-template-columns: 1fr; padding: 1.25rem; }
}
.home-banner-copy h1 {
  margin: 0 0 .85rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.08;
  color: var(--cs-ink);
  font-weight: 700;
}
.home-banner-aside {
  display: grid;
  gap: .75rem;
  align-content: center;
  position: relative;
  z-index: 1;
}
.stat-panel {
  background: #fff;
  border: 1px solid var(--cs-line);
  border-radius: 4px;
  padding: 1rem 1.1rem;
}
.stat-panel strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--cs-primary);
  line-height: 1;
}
.stat-panel span {
  display: block;
  margin-top: .35rem;
  font-size: .85rem;
  color: var(--cs-muted);
  font-weight: 600;
}

.section-head { margin-bottom: 1rem; }
.section-head h2 {
  margin: 0 0 .25rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.section-head p { margin: 0; color: var(--cs-muted); }

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 900px) {
  .action-grid { grid-template-columns: 1fr; }
}
.action-card {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-height: 13.5rem;
  padding: 1.35rem 1.3rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--cs-line);
  border-radius: 4px;
  box-shadow: 0 10px 28px rgb(28 25 23 / 4%);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.action-card:hover {
  transform: translateY(-4px);
  border-color: rgb(181 30 73 / 35%);
  box-shadow: 0 18px 36px rgb(181 30 73 / 12%);
}
.action-card-primary {
  background:
    linear-gradient(160deg, var(--cs-primary) 0%, var(--cs-primary-deep) 100%);
  color: #fff;
  border-color: transparent;
}
.action-card-primary:hover {
  box-shadow: 0 20px 40px rgb(181 30 73 / 28%);
}
.action-step {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-size: .8rem;
  font-weight: 800;
  background: #fce7ef;
  color: var(--cs-primary);
}
.action-card-primary .action-step {
  background: rgb(255 255 255 / 18%);
  color: #fff;
}
.action-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
}
.action-desc {
  flex: 1;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--cs-muted);
}
.action-card-primary .action-desc { color: rgb(255 255 255 / 88%); }
.action-cta {
  display: inline-flex;
  align-self: flex-start;
  margin-top: .25rem;
  padding: .45rem .8rem;
  border-radius: 2px;
  font-size: .85rem;
  font-weight: 700;
  background: #fce7ef;
  color: var(--cs-primary);
}
.action-card-primary .action-cta {
  background: #fff;
  color: var(--cs-primary);
}

.home-help {
  padding: 1.35rem 1.4rem 1.5rem;
  background: rgb(255 255 255 / 80%);
  border: 1px solid var(--cs-line);
  border-radius: 4px;
}
.help-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  counter-reset: step;
}
@media (max-width: 800px) {
  .help-steps { grid-template-columns: 1fr; }
}
.help-steps li {
  position: relative;
  padding: 1rem 1rem 1rem 1.1rem;
  background: #fff;
  border-left: 3px solid var(--cs-primary);
  border-radius: 0 4px 4px 0;
}
.help-steps strong {
  display: block;
  margin-bottom: .3rem;
  font-size: .98rem;
}
.help-steps span {
  display: block;
  color: var(--cs-muted);
  font-size: .9rem;
  line-height: 1.4;
}

/* ——— List pages (productos / categorías) ——— */
.admin-list { animation: rise .35s ease both; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.toolbar-copy { max-width: 36rem; }
.toolbar h1 {
  margin: 0 0 .35rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  line-height: 1.1;
}
.toolbar-lead {
  margin: 0;
  color: var(--cs-muted);
  font-size: .95rem;
  line-height: 1.45;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .75rem;
}
.filter-pill {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 0;
  padding: .55rem .75rem;
  background: #fff;
  border: 1px solid var(--cs-line);
  border-radius: 4px;
  min-width: 11rem;
}
.filter-pill label {
  margin: 0;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cs-muted);
}
.filter-pill select {
  margin: 0;
  width: 100%;
  border: 0;
  padding: .15rem 0;
  background: transparent;
  font-weight: 600;
  color: var(--cs-ink);
  cursor: pointer;
}
.filter-pill select:focus { box-shadow: none; }
.btn-new {
  white-space: nowrap;
  min-height: 2.75rem;
  padding-inline: 1.2rem;
  box-shadow: 0 10px 22px rgb(181 30 73 / 18%);
}

.table-panel {
  background: rgb(255 255 255 / 78%);
  border: 1px solid var(--cs-line);
  border-radius: 4px;
  padding: .35rem .35rem .85rem;
  box-shadow: 0 14px 34px rgb(28 25 23 / 5%);
}
.table-wrap {
  background: #fff;
  border: 1px solid #f0e2d8;
  border-radius: 3px;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-family: var(--font-ui);
}
th, td {
  border-bottom: 1px solid #f3e7de;
  padding: .9rem 1rem;
  text-align: left;
  font-size: .9rem;
  vertical-align: middle;
}
th {
  background: #fff8f4;
  white-space: nowrap;
  color: #57534e;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 700;
}
th.sortable { padding: 0; }
th.sortable button {
  width: 100%;
  background: transparent;
  color: inherit;
  border: 0;
  padding: .9rem 1rem;
  font-weight: 700;
  text-align: left;
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
th.sortable button:hover { background: #fce7ef; color: var(--cs-primary); }
th.sortable button::after { content: "⇅"; opacity: .35; font-size: .7rem; text-transform: none; letter-spacing: 0; }
th.sortable button[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
th.sortable button[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
tr[hidden] { display: none; }
tbody tr:hover td { background: #fffaf7; }
tbody tr:last-child td { border-bottom: 0; }
.cell-name { font-weight: 600; color: var(--cs-ink); }
.cell-muted { color: var(--cs-muted); }
.col-num { width: 5.5rem; text-align: center; }
.col-num button { justify-content: center; }
.col-status { width: 7.5rem; }
.col-actions { width: 1%; white-space: nowrap; }

.actions { padding-right: .75rem; }
.action-row {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: nowrap;
}
.action-row form { display: inline; margin: 0; }
.btn-soft {
  appearance: none;
  background: #fff;
  color: #44403c;
  border: 1px solid #e7d5c8;
  border-radius: 2px;
  padding: .4rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: border-color .15s, background .15s, color .15s;
}
.btn-soft:hover {
  border-color: var(--cs-primary);
  color: var(--cs-primary);
  background: #fff5f8;
}
.btn-soft-danger {
  color: #9f1239;
  border-color: #f3c4d0;
}
.btn-soft-danger:hover {
  background: #fff1f2;
  border-color: #e11d48;
  color: #9f1239;
}

.form-grid { display: grid; gap: 1rem; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: .85rem .65rem 0;
  font-size: .85rem;
  color: var(--cs-muted);
}
.pagination-btns { display: flex; gap: .35rem; flex-wrap: wrap; }
.pagination-btns button {
  background: #fff;
  color: var(--cs-ink);
  border: 1px solid var(--cs-line);
  padding: .4rem .7rem;
  font-weight: 600;
  min-width: 2.25rem;
}
.pagination-btns button[aria-current="page"] {
  background: var(--cs-primary);
  color: #fff;
  border-color: var(--cs-primary);
}
.pagination-btns button:disabled { opacity: .4; cursor: not-allowed; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .28rem .55rem;
  border-radius: 2px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-on { background: #ecfdf5; color: #047857; }
.badge-off { background: #fff1f2; color: #be123c; }

/* Toasts */
.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--cs-line);
  box-shadow: 0 14px 36px rgb(28 25 23 / 16%);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-in {
  opacity: 1;
  transform: none;
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}
.toast-success {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #ecfdf5, #fff);
}
.toast-error {
  border-color: #fecdd3;
  background: linear-gradient(180deg, #fff1f2, #fff);
}
.toast-text {
  margin: 0;
  flex: 1;
  font-size: .92rem;
  line-height: 1.35;
  color: var(--cs-ink);
  font-weight: 600;
}
.toast-success .toast-text { color: #047857; }
.toast-error .toast-text { color: #be123c; }
.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: var(--cs-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.toast-close:hover { color: var(--cs-ink); }

@media (max-width: 720px) {
  .action-row { flex-wrap: wrap; }
  .col-actions { white-space: normal; }
  .toast-root {
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}

dialog.admin-dialog {
  border: 0;
  border-radius: 6px;
  padding: 0;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: 0 24px 60px rgb(28 25 23 / 28%);
}
dialog.admin-dialog::backdrop { background: rgb(28 25 23 / 48%); }
.dialog-panel { padding: 1.35rem 1.4rem 1.45rem; }
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dialog-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.dialog-close {
  background: transparent;
  color: var(--cs-muted);
  border: 0;
  font-size: 1.4rem;
  line-height: 1;
  padding: .25rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .5rem;
}

.field-file {
  display: grid;
  gap: .45rem;
}
.field-file-label {
  font-size: .85rem;
  font-weight: 600;
  color: #44403c;
}
.field-file input[type="file"] {
  margin: 0;
  padding: .65rem .75rem;
  border: 1px dashed #e7d5c8;
  background: #fffaf7;
  cursor: pointer;
}
.field-file-hint {
  margin: 0;
  font-size: .78rem;
  color: var(--cs-muted);
  line-height: 1.35;
}
.image-preview {
  width: 7.5rem;
  height: 7.5rem;
  border: 1px solid var(--cs-line);
  border-radius: 2px;
  overflow: hidden;
  background: #fff;
}
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
