/* ==========================================================================
   Navidad con CIINSEV — Panel de administración (misma estética Liquid Glass)
   ========================================================================== */
:root {
  --cherry: #e0193f; --gold: #e8b45a; --gold-soft: #f6d897; --pine: #0f5a3c; --ice: #8cc2ff;
  --text: #f6f8fb; --text-2: rgba(240,245,252,.74); --text-3: rgba(240,245,252,.5);
  --ok: #5fd39a; --warn: #f6c56b; --err: #ff6b81;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22,1,.36,1);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: #06131c; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; font-family: var(--font); color: var(--text); background: #06131c; -webkit-font-smoothing: antialiased; line-height: 1.45; overflow-x: hidden; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, #061420, #0a1520); }
.ambient span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .28; }
.ambient span:nth-child(1) { width: 60vmax; height: 60vmax; left: -20vmax; top: -20vmax; background: #0f5a3c; }
.ambient span:nth-child(2) { width: 50vmax; height: 50vmax; right: -18vmax; bottom: -18vmax; background: #8a1129; }
.ambient span:nth-child(3) { width: 36vmax; height: 36vmax; right: -10vmax; top: -12vmax; background: #23458f; opacity: .4; }

.glass {
  position: relative;
  background: rgba(255,255,255,.05);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.1);
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: 15px; color: inherit; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { color: #0b1219; background: #fff; }
.btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.btn.ghost:hover { background: rgba(255,255,255,.14); }
.btn.danger { color: #fff; background: linear-gradient(180deg, #f1355a, #b3122e); }
.btn.danger-soft { color: #ffb3c0; background: rgba(224,25,63,.12); border-color: rgba(255,107,129,.3); }
.btn.text { min-height: 36px; padding: 0 4px; background: none; font-size: 14px; }
.btn.text.danger { color: #ff9aac; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 42px; padding: 0; min-height: 42px; }

/* Campos */
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > span { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field small { font-weight: 400; color: var(--text-3); }
.field .count { margin-left: auto; font-style: normal; font-weight: 500; font-size: 12px; color: var(--text-3); }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.16); border-radius: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus { outline: none; border-color: rgba(246,216,151,.7); background: rgba(0,0,0,.3); box-shadow: 0 0 0 4px rgba(232,180,90,.15); }
.field.invalid input, .field.invalid textarea { border-color: var(--err); box-shadow: 0 0 0 4px rgba(255,107,129,.15); }
.field input::placeholder, .field textarea::placeholder { color: rgba(240,245,252,.35); }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--text-3); }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

.alert { padding: 12px 14px; border-radius: 14px; font-size: 14px; margin: 0 0 14px; }
.alert.error { background: rgba(224,25,63,.16); border: 1px solid rgba(255,107,129,.35); color: #ffd0d8; }
.alert.ok { background: rgba(95,211,154,.13); border: 1px solid rgba(95,211,154,.3); color: #c9f5de; }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.chip.ok { color: #0d3a24; background: linear-gradient(180deg, #8ff0bf, #4fc78b); }
.chip.todo { color: var(--text-2); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); }

.mini-logo { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(120% 90% at 30% 15%, #fff, #e6edf5); box-shadow: 0 1px 0 #fff inset, 0 6px 14px -4px rgba(0,0,0,.5); }
.mini-logo { position: relative; }
.mini-logo img { position: absolute; width: 118%; height: auto; max-width: none; left: -7%; top: 5.3%; }

/* ---------------- Acceso ---------------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom)); }
.auth-card { width: 100%; max-width: 400px; padding: 30px 22px 22px; border-radius: 30px; text-align: center; }
.auth-card .field { text-align: left; }
.auth-card h1 { margin: 6px 0 6px; font-size: 28px; letter-spacing: -.03em; }
.auth-card .muted { margin: 0 0 20px; color: var(--text-2); font-size: 14.5px; }
.auth-logo { position: relative; width: 84px; height: 84px; margin: 6px auto 12px; border-radius: 26px; background: radial-gradient(120% 90% at 30% 15%, #fff, #e6edf5); box-shadow: 0 1px 0 #fff inset, 0 20px 40px -16px rgba(0,0,0,.7); }
.auth-logo img:first-child { position: absolute; width: 118%; max-width: none; left: -7%; top: 5%; }
.auth-logo .hat { position: absolute; width: 70%; left: -24%; top: -30%; transform: rotate(-24deg); filter: drop-shadow(0 4px 6px rgba(40,0,8,.4)); }
.back-link { display: inline-block; margin-top: 16px; font-size: 14px; color: var(--text-3); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* ---------------- Panel ---------------- */
.topbar {
  position: sticky; top: calc(8px + var(--safe-top)); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: calc(8px + var(--safe-top)) 10px 0; padding: 10px 10px 10px 12px; border-radius: 22px;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.topbar p { margin: 0; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; gap: 8px; }
.topbar__actions form { margin: 0; }
.topbar .btn { min-height: 40px; padding: 0 12px; }

.admin { max-width: 1180px; margin: 0 auto; padding: 14px 10px calc(40px + var(--safe-bottom)); display: grid; gap: 14px; }
.panel { border-radius: 26px; padding: 16px; }
.panel__head { display: grid; gap: 12px; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }

.stats { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 24px; flex-wrap: wrap; }
.ring { --p: 0; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255,255,255,.12) 0); position: relative; font-weight: 800; font-size: 14px; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #0d1d29; }
.ring span { position: relative; }
.stats__text { display: grid; flex: 1; min-width: 180px; }
.stats__text strong { font-size: 16.5px; letter-spacing: -.01em; }
.stats__text span { font-size: 13px; color: var(--text-3); }

.layout { display: grid; gap: 14px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.1); }
.segmented button { min-height: 36px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.segmented button[aria-selected="true"] { color: #fff; background: rgba(255,255,255,.16); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 4px 10px -4px rgba(0,0,0,.5); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { width: 100%; min-height: 44px; padding: 0 14px 0 38px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.2); color: var(--text); font: inherit; font-size: 16px; }

.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member-list .empty { padding: 18px; text-align: center; color: var(--text-3); }
.member {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 8px; border-radius: 16px; border: 1px solid transparent;
  background: rgba(255,255,255,.04); color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.member:hover { background: rgba(255,255,255,.08); }
.member.is-active { background: rgba(232,180,90,.14); border-color: rgba(246,216,151,.4); }
.member img { width: 44px; height: 55px; border-radius: 12px; object-fit: cover; object-position: 50% 0; background: linear-gradient(160deg, rgba(224,25,63,.5), rgba(15,90,60,.5)); }
.member__txt { flex: 1; min-width: 0; display: grid; }
.member__txt strong { font-size: 15.5px; }
.member__txt small { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Editor */
.empty-editor { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty-editor__icon { font-size: 44px; margin-bottom: 6px; }
.empty-editor h2 { margin-bottom: 6px; }
.editor__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.editor__photo { width: 56px; height: 70px; border-radius: 14px; object-fit: cover; object-position: 50% 0; background: linear-gradient(160deg, rgba(224,25,63,.5), rgba(15,90,60,.5)); }
.editor__who { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.editor__who h2 { font-size: 24px; overflow-wrap: anywhere; }
.link-group { margin: 0 0 12px; padding: 14px 14px 4px; border-radius: 18px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.12); }
.link-group legend { padding: 0 6px; font-weight: 700; font-size: 14px; }
.link-group legend small { font-weight: 400; color: var(--text-3); }
.link-group .btn.text { margin: -4px 0 8px; }
.add-link { width: 100%; margin-bottom: 14px; border-style: dashed !important; }
.editor__actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
.meta { margin: 10px 0 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
.more { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.more summary { cursor: pointer; font-weight: 650; color: var(--text-2); padding: 6px 0; }
.more .hint { margin-top: 8px; }
.account { margin-top: 14px; max-width: 420px; }
.panel > .more:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Vista previa (misma estética que la revelación pública) */
.preview { margin-top: 8px; }
.preview__label { margin: 0 0 22px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-soft); }
.preview__card { position: relative; padding: 20px 16px 18px; border-radius: 24px; text-align: center; background: rgba(22,30,40,.8); border: 1px solid rgba(255,255,255,.12); }
.gift-icon { display: inline-grid; place-items: center; width: 50px; height: 50px; margin: -44px auto 6px; border-radius: 16px; font-size: 26px; background: linear-gradient(180deg, #fff6dc, #f0c674); box-shadow: 0 10px 24px -8px rgba(232,180,90,.8), 0 1px 0 #fff inset; }
.preview__card.secret .gift-icon { background: linear-gradient(180deg, #e9f3ff, #9cc4f2); }
.gift-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; color: #fff; overflow-wrap: anywhere; }
.preview__card.secret .gift-title { font-size: 19px; background: linear-gradient(180deg, #fff, #cfe2fb); -webkit-background-clip: text; background-clip: text; }
.gift-desc { margin: 8px auto 0; max-width: 36ch; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.gift-links { display: grid; gap: 8px; margin-top: 14px; }
.link-btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border-radius: 14px; font-weight: 600; text-decoration: none; color: #0b1219; background: #fff; overflow-wrap: anywhere; }
.link-btn.secondary { color: var(--text); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); }
.link-btn.broken { opacity: .5; text-decoration: line-through; }

/* Subida de fotos */
.upload { display: grid; gap: 16px; }
.drop {
  position: relative; display: grid; place-items: center; min-height: 170px; padding: 16px;
  border-radius: 20px; border: 1.5px dashed rgba(255,255,255,.28); background: rgba(0,0,0,.15);
  text-align: center; color: var(--text-2); cursor: pointer; overflow: hidden; transition: border-color .2s, background .2s;
}
.drop:hover { border-color: rgba(246,216,151,.6); background: rgba(232,180,90,.06); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { max-height: 220px; width: auto; border-radius: 12px; pointer-events: none; }
.drop.has-file .drop__text { display: none; }
.drop__text small { color: var(--text-3); }
.folder-hint { margin-top: 14px; }

/* Avisos */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(16px + var(--safe-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 13px 16px; border-radius: 16px; font-size: 14.5px; font-weight: 600; background: rgba(20,32,44,.92); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 14px 34px -10px rgba(0,0,0,.7); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .3s, transform .4s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast.ok { border-color: rgba(95,211,154,.5); }
.toast.ok::before { content: "✓  "; color: var(--ok); }
.toast.warn { border-color: rgba(246,197,107,.5); }
.toast.error { border-color: rgba(255,107,129,.6); }
.toast.error::before { content: "!  "; color: var(--err); font-weight: 800; }

/* Confirmación */
.confirm { width: min(92vw, 400px); padding: 22px; border-radius: 24px; color: var(--text); background: rgba(22,34,46,.95); }
.confirm::backdrop { background: rgba(2,6,12,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.confirm h3 { margin: 0 0 8px; font-size: 19px; }
.confirm p { margin: 0 0 18px; color: var(--text-2); }
.confirm__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm form { margin: 0; }

.back-btn { display: inline-flex; }

/* ---------------- Adaptación ---------------- */
@media (max-width: 520px) {
  .topbar .btn span { display: none; }
  .topbar .btn { width: 40px; padding: 0; }
  .stats .btn span { display: none; }
  .stats .btn { width: 40px; padding: 0; }
}
@media (min-width: 700px) {
  .upload { grid-template-columns: 260px 1fr; align-items: start; }
  .editor__actions { grid-template-columns: 1fr auto; }
  .panel { padding: 20px; }
  .topbar { margin: calc(12px + var(--safe-top)) auto 0; max-width: 1160px; }
}
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
  .list-panel { position: sticky; top: 90px; max-height: calc(100dvh - 110px); overflow: auto; }
  .back-btn { display: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background-color: rgba(18,30,42,.94); }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; } }
.topbar__brand > div { min-width: 0; }
.editor-panel, .list-panel { scroll-margin-top: calc(96px + var(--safe-top)); }
