/* ════════════════════════════════════════════════════════════════════════
   Panel de administración — Medina de La Paz Consultores (iOS)
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #f6f5f3;
  --fg: #2d2d2d;
  --card: #ffffff;
  --brand: #cc6805;
  --brand-dark: #a35304;
  --brand-light: #e8954f;
  --ink: #2d2d2d;
  --ink-soft: #545454;
  --muted: #8a8a8a;
  --secondary: #f3f1ee;
  --accent: #faf3ea;
  --accent-fg: #a35304;
  --danger: #cc4b37;
  --ok: #4f9d69;
  --border: rgba(45, 45, 45, .08);
  --ring: rgba(204, 104, 5, .45);
  --dark: #161513;
  --radius-card: 1.5rem;
  --radius-soft: 12px;
  --shadow-ios: 0 8px 30px rgba(45, 45, 45, .08), 0 2px 8px rgba(45, 45, 45, .04);
  --shadow-ios-lg: 0 18px 60px rgba(45, 45, 45, .14), 0 4px 16px rgba(45, 45, 45, .06);
  --shadow-brand: 0 10px 34px rgba(204, 104, 5, .32);
  --ease-ios: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --font-serif: 'Merriweather', Georgia, serif;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.ico {
  width: 1em; height: 1em;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

.muted { color: var(--muted); font-size: .875rem; margin: 0; }

.card-ios {
  background: var(--card);
  border: 1px solid rgba(45, 45, 45, .06);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-ios);
  padding: 1.5rem;
}

/* ═══════════════ LOGIN ═══════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(60rem 40rem at 85% 10%, rgba(204, 104, 5, .18), transparent 60%),
    radial-gradient(50rem 36rem at 10% 90%, rgba(204, 104, 5, .1), transparent 55%),
    var(--dark);
}
.login-bg {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
.login-card {
  position: relative;
  width: min(100%, 26rem);
  background: rgba(28, 27, 25, .78);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 1.75rem;
  padding: 2.5rem 2rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: loginIn .7s var(--ease-spring);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo { display: flex; justify-content: center; margin-bottom: .25rem; }
.login-logo img { height: 3rem; width: auto; object-fit: contain; }
.login-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
}
.login-sub { margin: -.25rem 0 .5rem; font-size: .8125rem; color: rgba(255, 255, 255, .55); text-align: center; }

.login-card .field label { color: rgba(255, 255, 255, .6); }
.login-card .field input {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
}
.login-card .field input::placeholder { color: rgba(255, 255, 255, .3); }
.login-card .field input:focus {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 4px rgba(232, 149, 79, .25);
  background: rgba(255, 255, 255, .1);
}
.login-error {
  min-height: 1.25rem;
  margin: 0;
  font-size: .8125rem;
  color: #f2937f;
  text-align: center;
}
.login-back {
  margin-top: .5rem;
  text-align: center;
  font-size: .8125rem;
  color: rgba(255, 255, 255, .45);
  transition: color .3s;
}
.login-back:hover { color: #fff; }
.login-screen[hidden] { display: none; }

/* ═══════════════ CAMPOS Y BOTONES ═══════════════ */
.field { display: flex; flex-direction: column; gap: .375rem; }
.field label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field input, .field textarea, .field select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(45, 45, 45, .12);
  border-radius: .875rem;
  padding: .7rem .95rem;
  width: 100%;
  transition: border-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 6.5rem; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}
.field input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 640px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-hint { font-size: .75rem; color: var(--muted); margin: 0; }
.field-check { flex-direction: row; align-items: center; gap: .625rem; }
.field-check label { text-transform: none; letter-spacing: 0; font-size: .875rem; }
.field-error { font-size: .75rem; color: var(--danger); margin: 0; }
.field.is-error input, .field.is-error textarea { border-color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-radius: 999px;
  padding: .7rem 1.3rem;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  transition: transform .3s var(--ease-ios), box-shadow .3s, background-color .3s, color .3s, border-color .3s;
}
.btn:active { transform: scale(.96); }
.btn .ico { width: 1em; height: 1em; }
.btn-brand { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-brand:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-ghost { background: var(--secondary); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-fg); }
.btn-danger-ghost { background: rgba(204, 75, 55, .08); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(204, 75, 55, .15); }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem .9rem; font-size: .8125rem; }
.btn[disabled] { opacity: .6; pointer-events: none; }

.btn-spinner {
  display: none;
  width: 1em; height: 1em;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════ SHELL ═══════════════ */
.admin-shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; }
.admin-shell[hidden] { display: none; }

.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--dark);
  color: rgba(255, 255, 255, .78);
  padding: 1.5rem 1rem;
  z-index: 40;
}
.admin-side-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .5rem .75rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  margin-bottom: 1rem;
}
.admin-side-brand img { height: 2.5rem; width: auto; object-fit: contain; }
.admin-side-brand span { font-size: .75rem; line-height: 1.35; color: rgba(255, 255, 255, .6); }
.admin-side-brand b { color: #fff; font-weight: 600; }

.admin-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .75rem .875rem;
  border-radius: .875rem;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .65);
  text-align: left;
  transition: background-color .3s, color .3s, transform .3s var(--ease-ios);
}
.admin-nav-link .ico { width: 1.15rem; height: 1.15rem; }
.admin-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.admin-nav-link:active { transform: scale(.97); }
.admin-nav-link.is-active { color: #fff; background: rgba(204, 104, 5, .22); }
.badge {
  margin-left: auto;
  min-width: 1.4rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .6875rem;
  font-weight: 700;
  text-align: center;
}

.admin-side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 1rem; display: flex; flex-direction: column; gap: .25rem; }
.admin-side-link {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .6rem .875rem;
  border-radius: .875rem;
  font-size: .8125rem;
  color: rgba(255, 255, 255, .5);
  transition: color .3s, background-color .3s;
}
.admin-side-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.admin-side-link .ico { width: 1.05rem; height: 1.05rem; }
.admin-user { margin: .75rem .875rem 0; font-size: .6875rem; color: rgba(255, 255, 255, .35); }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1.5rem;
  background: rgba(246, 245, 243, .86);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.admin-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}
.live-dot {
  margin-left: auto;
  width: .625rem; height: .625rem;
  border-radius: 999px;
  background: #b3b3b3;
  box-shadow: 0 0 0 0 rgba(79, 157, 105, .5);
}
.live-dot.is-live {
  background: var(--ok);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 157, 105, .45); }
  70% { box-shadow: 0 0 0 9px rgba(79, 157, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 157, 105, 0); }
}
.admin-burger { display: none; }

.admin-views { padding: 1.5rem; flex: 1; }
.admin-view { display: none; animation: viewIn .45s var(--ease-ios); }
.admin-view.is-active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.25rem;
}
.search {
  flex: 1;
  min-width: 12rem;
  max-width: 22rem;
  font: inherit;
  padding: .65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(45, 45, 45, .12);
  background: #fff;
  color: var(--ink);
  transition: border-color .25s, box-shadow .25s;
}
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }

/* ═══════════════ DASHBOARD ═══════════════ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.375rem;
  transition: transform .4s var(--ease-ios), box-shadow .4s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-ios-lg); }
.stat-card-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--accent-fg);
  flex: none;
}
.stat-card-ico .ico { width: 1.3rem; height: 1.3rem; }
.stat-card-value { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 700; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card-label { font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 1024px) { .dash-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.dash-panel h3 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
}
.dash-list { display: flex; flex-direction: column; }
.dash-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .8rem .25rem;
  border-top: 1px solid var(--border);
  font-size: .875rem;
}
.dash-item:first-child { border-top: 0; }
.dash-item-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: .75rem;
  background: var(--secondary);
  color: var(--ink-soft);
  flex: none;
}
.dash-item-ico .ico { width: 1rem; height: 1rem; }
.dash-item-ico.is-new { background: var(--accent); color: var(--accent-fg); }
.dash-item-body { min-width: 0; flex: 1; }
.dash-item-nombre { font-weight: 600; color: var(--ink); }
.dash-item-msg {
  color: var(--muted);
  font-size: .8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-item-fecha { flex: none; font-size: .75rem; color: var(--muted); }
.dash-status { list-style: none; margin: 0; padding: 0; }
.dash-status li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .25rem;
  border-top: 1px solid var(--border);
  font-size: .875rem;
}
.dash-status li:first-child { border-top: 0; }
.dash-status span { color: var(--muted); }
.dash-status b { color: var(--ink); font-weight: 600; }
.vacio {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
}
.vacio .ico { width: 2rem; height: 2rem; margin: 0 auto .75rem; opacity: .4; }

/* ═══════════════ TABLAS ═══════════════ */
.table-wrap {
  background: var(--card);
  border: 1px solid rgba(45, 45, 45, .06);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-ios);
  overflow: auto;
  max-height: 70vh;
}
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  position: sticky;
  top: 0;
  background: rgba(246, 245, 243, .96);
  backdrop-filter: blur(8px);
  text-align: left;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .8rem 1.125rem;
  border-bottom: 1px solid rgba(45, 45, 45, .05);
  vertical-align: middle;
}
.table tbody tr { transition: background-color .25s; }
.table tbody tr:hover { background: rgba(250, 243, 234, .5); }
.table tbody tr:last-child td { border-bottom: 0; }

.celda-principal { display: flex; align-items: center; gap: .875rem; min-width: 0; }
.celda-miniatura {
  width: 2.75rem; height: 2.75rem;
  border-radius: .75rem;
  overflow: hidden;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-fg);
  flex: none;
}
.celda-miniatura img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.celda-miniatura.logo { width: 3.5rem; height: 3.5rem; border-radius: .875rem; }
.celda-miniatura.logo img { object-fit: contain; padding: .375rem; }
.celda-miniatura.logo .ico { width: 1.5rem; height: 1.5rem; }
.celda-miniatura .ico { width: 1.1rem; height: 1.1rem; }
.celda-titulo { font-weight: 600; color: var(--ink); }
.celda-sub { font-size: .75rem; color: var(--muted); }
.celda-texto { color: var(--ink-soft); max-width: 22rem; }
.celda-acciones { display: flex; gap: .375rem; white-space: nowrap; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: .75rem;
  background: var(--secondary);
  color: var(--ink-soft);
  transition: background-color .25s, color .25s, transform .25s var(--ease-ios);
}
.icon-btn:hover { background: var(--accent); color: var(--accent-fg); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.icon-danger:hover { background: rgba(204, 75, 55, .12); color: var(--danger); }
.icon-btn .ico { width: 1rem; height: 1rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .6875rem;
  font-weight: 600;
  background: var(--secondary);
  color: var(--ink-soft);
}
.chip-ok { background: rgba(79, 157, 105, .12); color: var(--ok); }
.chip-off { background: rgba(138, 138, 138, .14); color: var(--muted); }
.chip-brand { background: var(--accent); color: var(--accent-fg); }
.chip .ico { width: .75rem; height: .75rem; }

/* ═══════════════ MODAL CRUD ═══════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity .35s var(--ease-ios), visibility .35s;
}
.modal.is-open { visibility: visible; opacity: 1; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 21, 19, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  width: min(100%, 34rem);
  max-height: min(92vh, 50rem);
  overflow: auto;
  transform: translateY(22px) scale(.97);
  transition: transform .45s var(--ease-spring);
}
.modal.is-open .modal-panel { transform: none; }
.modal-close {
  position: absolute;
  top: .875rem; right: .875rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem; height: 2.375rem;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--ink);
  transition: transform .3s var(--ease-ios);
}
.modal-close:hover { transform: rotate(90deg); }
.modal-close .ico { width: 1rem; height: 1rem; }
.modal-title {
  margin: 0 0 1.125rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}
.crud-form { display: flex; flex-direction: column; gap: 1rem; }
.crud-actions { display: flex; justify-content: flex-end; gap: .625rem; margin-top: .375rem; }

/* ═══════════════ UPLOADER ═══════════════ */
.uploader {
  display: flex;
  flex-direction: column;
  gap: .625rem;
}
.dropzone {
  position: relative;
  border: 1.5px dashed rgba(45, 45, 45, .18);
  border-radius: 1rem;
  background: var(--secondary);
  overflow: hidden;
  transition: border-color .3s, background-color .3s, transform .3s var(--ease-ios);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 9.5rem;
}
.dropzone:hover { border-color: rgba(204, 104, 5, .45); }
.dropzone.is-over { border-color: var(--brand); background: var(--accent); transform: scale(1.015); }
.dropzone.is-loading { pointer-events: none; opacity: .7; }
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: .8125rem;
  text-align: center;
}
.dropzone-inner .ico { width: 1.75rem; height: 1.75rem; color: var(--accent-fg); opacity: .75; }
.dropzone-inner b { color: var(--ink-soft); font-weight: 600; }
.dropzone-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: 14rem;
  background:
    linear-gradient(45deg, rgba(45, 45, 45, .04) 25%, transparent 25%, transparent 75%, rgba(45, 45, 45, .04) 75%),
    linear-gradient(45deg, rgba(45, 45, 45, .04) 25%, transparent 25%, transparent 75%, rgba(45, 45, 45, .04) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone-preview.cont-cuadrado { aspect-ratio: 1 / 1; }
.dropzone-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(45, 45, 45, .18));
  transition: transform .5s var(--ease-ios);
}
.dropzone-preview:hover img { transform: scale(1.03); }
.dropzone-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  background: rgba(22, 21, 19, .55);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .3s;
}
.dropzone:hover .dropzone-overlay { opacity: 1; }
.dropzone-overlay .ico { width: 1.35rem; height: 1.35rem; }
.dropzone-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .75);
}
.dropzone-spinner::after {
  content: '';
  width: 1.75rem; height: 1.75rem;
  border: 3px solid rgba(204, 104, 5, .25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.uploader-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.uploader-hint { font-size: .75rem; color: var(--muted); margin: 0; }
.uploader-hint b { color: var(--accent-fg); }

/* Galería de fotos del estudio (selección rápida) */
.galeria-fotos { display: flex; flex-wrap: wrap; gap: .5rem; }
.galeria-foto {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: .75rem;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: var(--secondary);
  transition: border-color .25s, transform .25s var(--ease-ios);
}
.galeria-foto img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.galeria-foto:hover { transform: translateY(-2px); }
.galeria-foto.is-selected { border-color: var(--brand); }

/* ═══════════ Selector visual de iconos de servicio ═══════════ */
.icon-picker {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  border: 1.5px solid var(--line, rgba(45, 45, 45, .12));
  border-radius: 1rem;
  background: rgba(255, 255, 255, .6);
  padding: .625rem;
}
.icon-picker-buscar {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1.5px solid rgba(45, 45, 45, .14);
  border-radius: .75rem;
  background: #fff;
  padding: .45rem .7rem;
  color: var(--muted);
}
.icon-picker-buscar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.icon-picker-buscar .ico { width: 1rem; height: 1rem; flex: none; }
.icon-picker-buscar input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: .875rem;
  color: var(--ink);
}
.icon-picker-buscar input::-webkit-search-cancel-button { display: none; }
.icon-picker-limpiar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem; height: 1.4rem;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--ink-soft);
  padding: 0;
  cursor: pointer;
}
.icon-picker-limpiar .ico { width: .7rem; height: .7rem; }
.icon-picker-limpiar:hover { background: var(--accent); color: var(--accent-fg); }

.icon-picker-scroll {
  max-height: 15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  padding-right: .125rem;
}
.icon-picker-cat-titulo {
  margin: 0 0 .375rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: .5rem;
}
.icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .55rem .25rem .45rem;
  border: 1.5px solid rgba(45, 45, 45, .1);
  border-radius: .8rem;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease-ios), box-shadow .2s;
}
.icon-tile:hover {
  border-color: var(--brand-light);
  background: var(--accent);
  transform: translateY(-1px);
}
.icon-tile-img .ico { width: 1.5rem; height: 1.5rem; color: var(--ink); }
.icon-tile-txt {
  font-size: .68rem;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-tile.is-selected {
  border-color: var(--brand);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.icon-tile.is-selected .icon-tile-img .ico { color: var(--brand-dark); }
.icon-tile.is-selected .icon-tile-txt { color: var(--brand-dark); font-weight: 700; }

/* Estado deshabilitado (hay icono personalizado activo) */
.icon-picker.is-disabled .icon-picker-scroll { opacity: .45; pointer-events: none; filter: saturate(.4); }
.icon-picker.is-disabled .icon-tile { cursor: not-allowed; }
.icon-picker.is-disabled .icon-picker-buscar { opacity: .55; pointer-events: none; }

@media (max-width: 640px) {
  .icon-picker-grid { grid-template-columns: repeat(auto-fill, minmax(4.1rem, 1fr)); }
  .icon-picker-scroll { max-height: 13rem; }
}

/* ═══════════════ MENSAJES ═══════════════ */
.mensajes-list { display: flex; flex-direction: column; gap: .875rem; }
.mensaje-card {
  display: flex;
  gap: 1.125rem;
  padding: 1.25rem 1.375rem;
  transition: box-shadow .4s, transform .4s var(--ease-ios);
}
.mensaje-card:hover { box-shadow: var(--shadow-ios-lg); transform: translateY(-2px); }
.mensaje-card.is-no-leido { border-left: 4px solid var(--brand); }
.mensaje-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: .875rem;
  background: var(--secondary);
  color: var(--ink-soft);
  flex: none;
}
.mensaje-card.is-no-leido .mensaje-ico { background: var(--accent); color: var(--accent-fg); }
.mensaje-ico .ico { width: 1.15rem; height: 1.15rem; }
.mensaje-body { flex: 1; min-width: 0; }
.mensaje-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .375rem .875rem; margin-bottom: .375rem; }
.mensaje-nombre { font-weight: 700; color: var(--ink); }
.mensaje-email { font-size: .8125rem; color: var(--brand); }
.mensaje-fecha { margin-left: auto; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.mensaje-asunto { margin: 0 0 .375rem; font-size: .875rem; font-weight: 600; color: var(--ink-soft); }
.mensaje-texto { margin: 0; font-size: .875rem; line-height: 1.7; color: var(--ink-soft); white-space: pre-line; }
.mensaje-acciones { display: flex; gap: .5rem; margin-top: .875rem; flex-wrap: wrap; }

/* ═══════════════ CONFIG ═══════════════ */
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.config-item { display: flex; flex-direction: column; gap: .75rem; }
.config-item .field { gap: .375rem; }
.config-item textarea { min-height: 5.5rem; }
.config-item .crud-actions { margin: 0; }
.config-item.is-dirty { border-color: rgba(204, 104, 5, .35); }
.config-item.is-dirty::after {
  content: '';
  position: absolute;
  top: .8rem; right: .8rem;
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: var(--brand);
}
.config-item { position: relative; }

/* ── Tarjeta del brochure (PDF) ── */
.brochure-card { grid-column: 1 / -1; }
.brochure-drop {
  position: relative;
  border: 1.5px dashed rgba(45, 45, 45, .18);
  border-radius: 1rem;
  background: var(--secondary);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  cursor: pointer;
  transition: border-color .3s, background-color .3s, transform .3s var(--ease-ios);
}
.brochure-drop:hover { border-color: rgba(204, 104, 5, .45); }
.brochure-drop.is-over { border-color: var(--brand); background: var(--accent); transform: scale(1.01); }
.brochure-drop.is-loading { pointer-events: none; opacity: .7; }
.brochure-file { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.brochure-file > .ico { width: 2rem; height: 2rem; color: var(--accent-fg); flex: none; }
.brochure-file-txt { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.brochure-file-txt b {
  font-size: .9rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brochure-file-txt span { font-size: .78rem; color: var(--muted); }
.brochure-empty { display: flex; align-items: center; gap: .9rem; color: var(--muted); }
.brochure-empty .ico { width: 1.9rem; height: 1.9rem; color: var(--accent-fg); opacity: .7; flex: none; }
.brochure-empty span { font-size: .82rem; line-height: 1.45; }
.brochure-card .crud-actions { flex-wrap: wrap; }

/* ── Tarjeta de notificaciones por correo ── */
.correo-card { grid-column: 1 / -1; }
.correo-head { display: flex; align-items: flex-start; gap: .875rem; }
.correo-head-ico {
  flex: none;
  width: 2.5rem; height: 2.5rem;
  border-radius: .75rem;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
}
.correo-head-ico .ico { width: 1.2rem; height: 1.2rem; }
.correo-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--ink); }
.correo-desc { margin: .3rem 0 0; font-size: .8125rem; color: var(--muted); line-height: 1.55; }
.correo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: .875rem 1rem;
}
.correo-tip {
  margin: 0;
  font-size: .75rem;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--secondary);
  border-radius: .625rem;
  padding: .625rem .8rem;
}
.correo-card .crud-actions { flex-wrap: wrap; }

/* ── Tarjeta del logotipo del estudio ── */
.logo-card { grid-column: 1 / -1; }
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin: .35rem 0 .6rem;
}
.logo-slot { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.logo-slot-titulo {
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .02em;
}
.logo-drop {
  position: relative;
  border: 1.5px dashed rgba(45, 45, 45, .18);
  border-radius: 1rem;
  background: #161513; /* fondo oscuro: así se ve la versión clara del logo */
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.1rem;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .3s, transform .3s var(--ease-ios);
}
.logo-drop-claro {
  background: #FAF9F7; /* fondo claro: así se ve la versión color del logo */
  border-color: rgba(45, 45, 45, .22);
}
.logo-drop:hover { border-color: rgba(204, 104, 5, .55); }
.logo-drop.is-over { border-color: var(--brand); transform: scale(1.01); }
.logo-drop.is-loading { pointer-events: none; opacity: .7; }
.logo-prev {
  max-width: 100%;
  max-height: 76px;
  object-fit: contain;
  display: block;
}
.logo-prev-tag {
  position: absolute;
  right: .55rem;
  bottom: .45rem;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .18rem .5rem;
  border-radius: 999px;
  background: rgba(127, 127, 127, .28);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.logo-drop-claro .logo-prev-tag { background: rgba(45, 45, 45, .12); color: var(--ink); }
.logo-slot .field-hint { margin: 0; }
.logo-slot .crud-actions { margin-top: auto; flex-wrap: wrap; }

/* ═══════════════ SELECT ESTILO MESSENGER iOS ═══════════════ */
.select-ios { position: relative; display: block; width: 100%; }
.select-ios-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  min-height: 2.75rem;
  text-align: left;
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(45, 45, 45, .12);
  border-radius: .875rem;
  padding: .62rem .95rem;
  transition: border-color .25s, box-shadow .25s, background-color .25s;
}
.select-ios-trigger:hover:not([disabled]) { border-color: rgba(45, 45, 45, .25); }
.select-ios-trigger:focus-visible,
.select-ios.is-open .select-ios-trigger {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}
.select-ios-trigger[disabled] { opacity: .55; cursor: not-allowed; }
.select-ios-value {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select-ios-chev { width: 1.05em; height: 1.05em; color: var(--muted); flex: none; transition: transform .35s var(--ease-spring); }
.select-ios.is-open .select-ios-chev { transform: rotate(180deg); color: var(--brand); }

.select-ios-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + .5rem);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(45, 45, 45, .08);
  border-radius: 1.125rem;
  box-shadow: var(--shadow-ios-lg);
  padding: .375rem;
  max-height: 17rem;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity .22s var(--ease-ios), transform .32s var(--ease-spring);
}
.select-ios.is-up .select-ios-menu {
  top: auto;
  bottom: calc(100% + .5rem);
  transform-origin: bottom center;
  transform: translateY(8px) scale(.97);
}
.select-ios.is-open .select-ios-menu {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.select-ios-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  text-align: left;
  font-size: .9rem;
  color: var(--ink);
  padding: .62rem .8rem;
  border-radius: .75rem;
  transition: background-color .18s;
}
.select-ios-opt:hover, .select-ios-opt.is-cursor { background: rgba(45, 45, 45, .055); }
.select-ios-opt-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.select-ios-opt.is-selected { color: var(--brand-dark); font-weight: 600; }
.select-ios-check {
  width: 1em; height: 1em;
  color: var(--brand);
  flex: none;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .2s, transform .28s var(--ease-spring);
}
.select-ios-opt.is-selected .select-ios-check { opacity: 1; transform: scale(1); }
.select-ios-native { position: absolute; opacity: 0; pointer-events: none; }

/* ═══════════════ TOASTS ═══════════════ */
.toast-region {
  position: fixed;
  z-index: 100;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: .625rem;
  width: min(92vw, 26rem);
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.125rem;
  border-radius: 1rem;
  background: rgba(26, 26, 26, .92);
  color: #fff;
  font-size: .875rem;
  line-height: 1.5;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  backdrop-filter: blur(16px);
  animation: toastIn .5s var(--ease-spring);
}
.toast.is-out { animation: toastOut .35s var(--ease-ios) forwards; }
.toast .ico { width: 1.2rem; height: 1.2rem; }
.toast-ok .ico { color: #7dd8a0; }
.toast-error .ico { color: #f2937f; }
.toast-info .ico { color: var(--brand-light); }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 17rem);
    transform: translateX(-100%);
    transition: transform .45s var(--ease-ios);
    box-shadow: 0 0 60px rgba(0, 0, 0, .35);
  }
  .admin-side.is-open { transform: none; }
  .admin-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 2.5rem; height: 2.5rem;
    border-radius: 999px;
    border: 1px solid rgba(45, 45, 45, .14);
  }
  .admin-burger span { width: 1rem; height: 2px; border-radius: 2px; background: var(--ink); }
  .admin-burger.is-open span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .admin-burger.is-open span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  .admin-views { padding: 1rem; }
  .admin-topbar { padding: 1rem; }
}

/* ═══════════════════ MODAL RECORTE DE IMÁGENES ═══════════════════ */
.modal-crop { width: min(100%, 36rem); display: flex; flex-direction: column; gap: .875rem; }
.crop-sub { margin: -.375rem 0 0; font-size: .8125rem; line-height: 1.5; color: var(--muted); }

.crop-stage {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background:
    linear-gradient(45deg, rgba(45, 45, 45, .05) 25%, transparent 25%, transparent 75%, rgba(45, 45, 45, .05) 75%),
    linear-gradient(45deg, rgba(45, 45, 45, .05) 25%, transparent 25%, transparent 75%, rgba(45, 45, 45, .05) 75%),
    var(--secondary);
  background-size: 18px 18px, 18px 18px, auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.crop-stage img { width: 100%; display: block; pointer-events: none; }

.crop-box {
  position: absolute;
  border: 1.5px solid #fff;
  border-radius: .375rem;
  box-shadow: 0 0 0 9999px rgba(22, 21, 19, .58);
  cursor: grab;
  touch-action: none;
}
.crop-box:active { cursor: grabbing; }
.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255, 255, 255, .38) calc(33.33% - .5px), rgba(255, 255, 255, .38) calc(33.33% + .5px), transparent calc(33.33% + .5px)),
    linear-gradient(to right, transparent calc(66.66% - .5px), rgba(255, 255, 255, .38) calc(66.66% - .5px), rgba(255, 255, 255, .38) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255, 255, 255, .38) calc(33.33% - .5px), rgba(255, 255, 255, .38) calc(33.33% + .5px), transparent calc(33.33% + .5px)),
    linear-gradient(to bottom, transparent calc(66.66% - .5px), rgba(255, 255, 255, .38) calc(66.66% - .5px), rgba(255, 255, 255, .38) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.crop-handle {
  position: absolute;
  width: 1.05rem; height: 1.05rem;
  border-radius: .3rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(22, 21, 19, .4), 0 0 0 1.5px var(--brand);
  touch-action: none;
  z-index: 2;
}
.crop-handle[data-h="nw"] { top: -.55rem; left: -.55rem; cursor: nwse-resize; }
.crop-handle[data-h="ne"] { top: -.55rem; right: -.55rem; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { bottom: -.55rem; left: -.55rem; cursor: nesw-resize; }
.crop-handle[data-h="se"] { bottom: -.55rem; right: -.55rem; cursor: nwse-resize; }

.crop-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.crop-chips[hidden] { display: none; }
.crop-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid rgba(45, 45, 45, .14);
  background: #fff;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all .3s var(--ease-ios);
}
.crop-chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.crop-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.crop-chip .ico { width: .85rem; height: .85rem; }

.crop-actions { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }
.crop-flex { flex: 1; }
.crop-info { flex: 0 1 auto; min-width: 0; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.crop-info.is-pequenna { color: #b45309; }

@media (max-width: 560px) {
  .modal-crop { width: 100%; }
  .crop-actions .btn { flex: 1; justify-content: center; }
  .crop-actions .crop-flex { display: none; }
  .crop-info { width: 100%; order: -1; text-align: center; }
}
