/* admin.css — capa visual del panel. Reutiliza los tokens de theme.css
   (colores, fuentes, .cs-input, sombras, cs-fadein, etc.) y agrega el
   layout propio del panel: barra lateral, tarjetas, tablas, formularios. */

html, body { margin: 0; padding: 0; background: var(--cream); color: var(--ink); font-family: 'Inter', sans-serif; }
* { box-sizing: border-box; }
button { font-family: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  background: var(--ink);
  color: var(--cream);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 860px) {
  .sidebar { display: flex; flex-direction: row; overflow-x: auto; padding: 12px; gap: 8px; }
}
.sidebar__brand {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  padding: 0 10px 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
@media (max-width: 860px) { .sidebar__brand { display: none; } }
.sidebar__version { font-size: 11px; color: rgba(250,245,234,.45); font-weight: 600; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: rgba(250,245,234,.7);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn.is-active { background: var(--celeste); color: #fff; }

.sidebar__footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 860px) { .sidebar__footer { display: none; } }

/* ---------------- Main area ---------------- */
.main { padding: 28px clamp(16px, 4vw, 44px) 64px; max-width: 1180px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.topbar h1 { font-family: 'Fraunces', serif; font-size: 28px; margin: 0; }
.topbar p { margin: 4px 0 0; color: var(--ink3); font-size: 14px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5e0d3;
  font-size: 12.5px;
  font-weight: 700;
}
.status-dot { width: 8px; height: 8px; border-radius: 999px; }
.status-dot.is-online, .status-dot.is-saved { background: #2fae66; }
.status-dot.is-offline, .status-dot.is-error { background: var(--coral); }
.status-dot.is-syncing { background: var(--gold); animation: cs-pulse-ring 1.2s ease-in-out infinite; }

/* ---------------- Cards / secciones ---------------- */
.card {
  background: #fff;
  border: 1px solid #e5e0d3;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
}
.section-head { margin-bottom: 16px; }
.section-head h2 { font-family: 'Fraunces', serif; font-size: 19px; margin: 0 0 4px; }
.section-head p { margin: 0; color: var(--ink3); font-size: 13.5px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.hint { font-size: 12px; color: #94a3b8; }

.toggle-row { display: flex; align-items: center; gap: 12px; }
.toggle { position: relative; width: 44px; height: 26px; border-radius: 999px; background: #e2e6ea; border: none; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle.is-on { background: var(--celeste); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.is-on::after { transform: translateX(18px); }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s, filter .2s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--celeste); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-accent { background: var(--coral); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid #d7dbe0; }
.btn-danger { background: #fff; color: #d9432b; border: 1.5px solid #f3c9c1; }
.btn-danger:hover { background: #fff5f3; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #e5e0d3; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink3); }
.icon-btn:hover { background: #f7f4ec; }
.icon-btn.danger { color: #d9432b; }

/* ---------------- Listas de registros ---------------- */
.record-list { display: flex; flex-direction: column; gap: 10px; }
.record {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e5e0d3;
  border-radius: 14px;
  background: #fffdf9;
}
.record.is-inactive { opacity: .5; }
.record__thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--sand); flex-shrink: 0; }
.record__thumb-fallback { width: 56px; height: 56px; border-radius: 10px; background: var(--sand); display: flex; align-items: center; justify-content: center; color: var(--ink3); flex-shrink: 0; }
.record__body { flex: 1; min-width: 0; }
.record__title { font-weight: 700; font-size: 14.5px; }
.record__meta { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }
.record__actions { display: flex; gap: 6px; flex-shrink: 0; }

.empty-hint { padding: 24px; text-align: center; color: #94a3b8; font-size: 13.5px; }

/* ---------------- Subida de imagen ---------------- */
.image-drop {
  display: flex;
  align-items: center;
  gap: 14px;
}
.image-drop__preview { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; background: var(--sand); flex-shrink: 0; }
.image-drop__preview-empty { width: 88px; height: 88px; border-radius: 12px; background: var(--sand); display: flex; align-items: center; justify-content: center; color: var(--ink3); flex-shrink: 0; }
.image-drop__controls { display: flex; flex-direction: column; gap: 6px; }
.image-drop__error { color: #d9432b; font-size: 12.5px; }

/* ---------------- Tags ---------------- */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { border: none; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer; background: #f1f2f4; color: #9aa3b0; }
.tag-chip.is-on { background: var(--celeste); color: #fff; }

/* ---------------- Login ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 900px 500px at 8% -10%, var(--foam) 0%, transparent 60%),
    radial-gradient(ellipse 700px 420px at 105% 10%, #ffe9d9 0%, transparent 55%),
    var(--cream);
  padding: 20px;
}
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid #e5e0d3; border-radius: 20px; padding: 32px; }
.login-card h1 { font-family: 'Fraunces', serif; font-size: 24px; margin: 0 0 6px; }
.login-card p { margin: 0 0 22px; color: var(--ink3); font-size: 13.5px; }
.login-error { background: #fff1ee; border: 1px solid #f3c9c1; color: #b23a24; font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.login-notice { background: #eef8fb; border: 1px solid #cdeaf2; color: #145a72; font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.is-error { background: #b23a24; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-card { border: 1px solid #e5e0d3; border-radius: 14px; padding: 16px; background: #fffdf9; }
.stat-card__value { font-family: 'Fraunces', serif; font-size: 28px; }
.stat-card__label { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }

.confirm-note { font-size: 12px; color: #94a3b8; margin-top: 8px; }
