:root {
  --bg: #0a0a0a; --bg-2: #111; --card: #161616; --card-2: #1d1d1d;
  --line: rgba(255, 255, 255, .09); --text: #f4f1ea; --muted: #9d9a94;
  --gold: #d4a944; --gold-2: #f5d78e; --gold-grad: linear-gradient(135deg, #f5d78e, #d4a944 45%, #9c7425);
  --danger: #ef4444; --ok: #22c55e;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.lock { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
code { background: rgba(255, 255, 255, .08); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row--end { justify-content: flex-end; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px;
  border-radius: 999px; font-weight: 600; font-size: .92rem; white-space: nowrap; cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn--gold { background: var(--gold-grad); color: #111; box-shadow: 0 8px 24px -10px rgba(212, 169, 68, .8); }
.btn--gold:hover { box-shadow: 0 12px 30px -8px rgba(212, 169, 68, .9); }
.btn--ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.btn--ghost:hover { border-color: var(--gold); }
.btn--danger { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .4); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { padding: 8px 16px; font-size: .84rem; }
.btn--block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03); font-size: .95rem; transition: border-color .2s, background .2s, color .2s;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold-2); }
.icon-btn.danger:hover { border-color: var(--danger); color: #fca5a5; background: rgba(239, 68, 68, .1); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }

/* Campos */
.field { display: grid; gap: 6px; font-size: .88rem; }
.field > span { font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  outline: none; transition: border-color .2s, box-shadow .2s; font-size: .95rem;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 169, 68, .15); }
.field input[type="color"] { padding: 4px; height: 46px; cursor: pointer; }
.field textarea { resize: vertical; min-height: 90px; }
.field .invalid { border-color: var(--danger); }
.pass { position: relative; }
.pass__toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 6px; opacity: .6; }
.pass__toggle:hover { opacity: 1; }

/* Login */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(700px circle at 50% 0%, rgba(212, 169, 68, .18), transparent 60%), var(--bg);
}
.login__card {
  width: min(400px, 100%); display: grid; gap: 16px; padding: 40px 32px; border-radius: 26px;
  background: var(--bg-2); border: 1px solid rgba(212, 169, 68, .25); box-shadow: 0 30px 80px -30px #000;
  animation: rise .6s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
.login__card.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.login__logo { border-radius: 50%; margin: 0 auto; border: 1px solid rgba(212, 169, 68, .5); }
.login h1 { font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 2.2rem; letter-spacing: 1px; text-align: center; line-height: 1; }
.login__card > .muted { text-align: center; margin-top: -8px; }
.login__error { color: #fca5a5; font-size: .88rem; min-height: 1.2em; }
.login__back { text-align: center; font-size: .88rem; color: var(--muted); }
.login__back:hover { color: var(--gold); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px max(16px, calc((100% - 1100px) / 2)); background: rgba(10, 10, 10, .85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__brand img { border-radius: 50%; }
.topbar__brand b { display: block; font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 1.25rem; letter-spacing: 1.5px; line-height: 1; }
.topbar__brand small { color: var(--muted); font-size: .75rem; }
.topbar__actions { display: flex; gap: 8px; }

.wrap { width: min(1100px, 100% - 32px); margin: 28px auto 80px; display: grid; gap: 22px; }

.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-radius: 16px;
  background: rgba(212, 169, 68, .09); border: 1px solid rgba(212, 169, 68, .35); font-size: .9rem;
}
.notice b { display: block; color: var(--gold-2); }
.notice--ok { background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .35); }
.notice--ok b { color: #86efac; }
.cloud .local-only { display: none !important; }
.stat__user { font-family: "Inter", sans-serif !important; font-size: .95rem !important; font-weight: 600; color: var(--text) !important; margin-top: 8px; word-break: break-all; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Pestañas */
.tabs { display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); width: max-content; max-width: 100%; }
.tab { padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--muted); transition: background .25s, color .25s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--gold-grad); color: #111; }
.tabpanel { display: grid; gap: 22px; }

/* Textos de la web */
.tips { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 14px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.tips b { color: var(--text); }
kbd { background: rgba(255, 255, 255, .1); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 6px; border-radius: 6px; font-size: .85em; font-family: inherit; }
.content-form { display: grid; gap: 12px; }
.content-form .card summary { display: flex; align-items: center; gap: 10px; }
.content-form .card summary::after { margin-left: auto; }
.content-form .dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: none; }
.content-form .card.dirty .dirty-dot { display: inline-block; }
.cfields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 20px 22px; }
.cfields .hint { grid-column: 1 / -1; font-size: .84rem; color: var(--muted); margin-top: -6px; }
.cfield { display: grid; gap: 6px; font-size: .88rem; align-content: start; }
.cfield.wide { grid-column: 1 / -1; }
.cfield__head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cfield__head span { font-weight: 600; }
.cfield__reset { font-size: .76rem; color: var(--muted); text-decoration: underline; visibility: hidden; }
.cfield__reset:hover { color: var(--gold); }
.cfield.changed .cfield__reset { visibility: visible; }
.cfield input, .cfield textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  outline: none; font-size: .93rem; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.cfield input:focus, .cfield textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 169, 68, .15); }
.cfield.changed input, .cfield.changed textarea { border-color: rgba(212, 169, 68, .55); }
.faqed { display: grid; gap: 10px; }
.faqed__item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.faqed__fields { display: grid; gap: 8px; }
.faqed__tools { display: flex; flex-direction: column; gap: 6px; }
.faqed__item input, .faqed__item textarea { background: var(--card); }
.savebar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 14px 12px 20px; border-radius: 999px; background: rgba(22, 22, 22, .92); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 40px -10px #000; font-size: .9rem; color: var(--muted);
  transition: border-color .3s;
}
.savebar.dirty { border-color: var(--gold); color: var(--gold-2); }
@media (max-width: 600px) {
  .cfields { grid-template-columns: 1fr; padding: 0 14px 18px; }
  .savebar { border-radius: 18px; flex-direction: column; align-items: stretch; text-align: center; }
  .savebar .row { justify-content: center; }
  .tab { padding: 10px 14px; font-size: .86rem; }
}

.list.loading { opacity: .5; pointer-events: none; transition: opacity .2s; }
.notice span { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 18px 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.stat small { color: var(--muted); font-size: .8rem; }
.stat strong { display: block; font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 2.2rem; line-height: 1.1; color: var(--gold-2); }
.bar { height: 6px; border-radius: 9px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold-grad); transition: width .6s var(--ease); }
.bar i.warn { background: var(--danger); }

.toolbar { display: flex; gap: 12px; }
.search { flex: 1; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; fill: var(--muted); }
.search input {
  width: 100%; padding: 13px 16px 13px 42px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); outline: none; font-size: .95rem;
}
.search input:focus { border-color: var(--gold); }

/* Lista de palas */
.list { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 74px 1fr 150px auto auto; align-items: center; gap: 16px;
  padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  transition: border-color .2s, opacity .2s; animation: rise .4s var(--ease) both;
}
.item:hover { border-color: rgba(212, 169, 68, .35); }
.item.off { opacity: .55; }
.item__img { position: relative; width: 74px; height: 74px; border-radius: 12px; overflow: hidden; background: var(--bg); }
.item__img img { width: 100%; height: 100%; object-fit: cover; }
.item__img span {
  position: absolute; right: 4px; bottom: 4px; font-size: .68rem; font-weight: 700; padding: 1px 6px;
  border-radius: 6px; background: rgba(0, 0, 0, .7);
}
.item__info { min-width: 0; }
.item__brand { font-size: .72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.item__name { font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__meta { color: var(--muted); font-size: .84rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item__meta .dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3); }
.chip { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gold-grad); color: #111; }
.chip--off { background: rgba(255, 255, 255, .1); color: var(--muted); }
.price { position: relative; }
.price span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.price input {
  width: 100%; padding: 10px 10px 10px 38px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
  font-weight: 700; color: var(--gold-2); outline: none; transition: border-color .2s;
}
.price input:focus { border-color: var(--gold); }
.price input.saved { border-color: var(--ok); }
.item__actions { display: flex; gap: 6px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; flex: none; width: 44px; height: 24px; border-radius: 99px; background: rgba(255, 255, 255, .15); transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }

/* Configuración */
.settings { display: grid; gap: 12px; margin-top: 16px; }
.card { border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.card summary { list-style: none; cursor: pointer; padding: 18px 20px; font-weight: 600; }
.card summary::-webkit-details-marker { display: none; }
.card summary::after { content: "+"; float: right; color: var(--gold); font-size: 1.2rem; line-height: 1; transition: transform .25s; }
.card[open] summary::after { transform: rotate(45deg); }
.settings__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 0 20px 22px; }
.settings__grid h3 { font-size: .98rem; margin-bottom: 4px; }
.settings__grid p { font-size: .85rem; margin-bottom: 12px; }
.pwform { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 0 20px 22px; align-items: end; }

/* Drawer editor */
.drawer { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); opacity: 0; transition: opacity .3s; }
.drawer.open .drawer__backdrop { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid rgba(212, 169, 68, .25);
  transform: translateX(100%); transition: transform .4s var(--ease);
}
.drawer.open .drawer__panel { transform: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 1.9rem; letter-spacing: 1px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 22px 24px; display: grid; gap: 18px; align-content: start; }
.drawer__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: #fca5a5; font-size: .88rem; min-height: 1.2em; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photos:empty { display: none; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: var(--bg); animation: rise .3s var(--ease); }
.photo.main { border-color: var(--gold); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo__tag { position: absolute; left: 6px; top: 6px; font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--gold-grad); color: #111; }
.photo__tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: 4px; padding: 6px; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.photo__tools button { width: 28px; height: 28px; border-radius: 8px; background: rgba(0, 0, 0, .6); font-size: .8rem; display: grid; place-items: center; }
.photo__tools button:hover { background: var(--gold); color: #111; }
.photo__tools button.del:hover { background: var(--danger); color: #fff; }
.photo__tools button:disabled { opacity: .3; pointer-events: none; }
.photo.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); animation: shimmer 1s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.drop {
  display: grid; justify-items: center; gap: 4px; padding: 22px; border-radius: 14px; cursor: pointer; text-align: center;
  border: 2px dashed rgba(212, 169, 68, .35); background: rgba(212, 169, 68, .04); transition: background .2s, border-color .2s;
}
.drop:hover, .drop.over { background: rgba(212, 169, 68, .1); border-color: var(--gold); }
.drop svg { width: 28px; fill: var(--gold); }
.drop small { color: var(--muted); }

/* Confirmación */
.confirm { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .7); opacity: 0; visibility: hidden; transition: opacity .2s; }
.confirm.open { opacity: 1; visibility: visible; }
.confirm__box { width: min(400px, 100%); padding: 26px; border-radius: 20px; background: var(--bg-2); border: 1px solid var(--line); display: grid; gap: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 140%);
  padding: 12px 22px; border-radius: 999px; background: var(--text); color: #111; font-weight: 600; font-size: .9rem;
  transition: transform .35s var(--ease); max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* Responsive */
@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .settings__grid { grid-template-columns: 1fr; }
  .item { grid-template-columns: 64px 1fr auto; grid-template-areas: "img info act" "img price price"; row-gap: 10px; }
  .item__img { grid-area: img; width: 64px; height: 64px; align-self: start; }
  .item__info { grid-area: info; }
  .item__actions { grid-area: act; align-self: start; }
  .item .price { grid-area: price; }
  .item .switch { display: none; }
}
@media (max-width: 600px) {
  .topbar__brand small { display: none; }
  .topbar .btn { padding: 8px 12px; }
  .notice { flex-direction: column; align-items: stretch; }
  .toolbar { flex-direction: column; }
  .grid2, .pwform { grid-template-columns: 1fr; }
  .item__actions .hide-sm { display: none; }
  .drawer__body, .drawer__head, .drawer__foot { padding-left: 16px; padding-right: 16px; }
}
