/* =====================================================================
   DISEÑO DEL DOSSIER · interfaz del editor (prefijo ed-)
   Mismos tokens que styles.css de la web.
   ===================================================================== */
.ed-body {
  --ink: #0e0e0f; --ink-2: #3a3a3e; --muted: #6c6c71; --line: #e6e5e2; --soft: #f4f3f0;
  --lima: #8bc148; --verde: #007044; --bosque: #053e23; --verde-soft: #eef6e4; --danger: #b42318;
  margin: 0; height: 100vh; overflow: hidden; background: #e9e8e4;
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif; font-size: 14px; line-height: 1.5; color: var(--ink);
}
:where(.ed-body) :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ed-app { display: grid; grid-template-columns: 400px 1fr; grid-template-rows: 64px 1fr; height: 100vh; }

/* ---------- barra superior */
.ed-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.ed-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.ed-brand strong { display: block; font-weight: 800; letter-spacing: .08em; font-size: 15px; line-height: 1.1; }
.ed-brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.ed-brand__mark { width: 28px; height: 28px; border-radius: 8px; flex: none; background:
  linear-gradient(var(--lima), var(--lima)) 6px 6px / 7px 7px no-repeat,
  linear-gradient(#fff, #fff) 15px 6px / 7px 7px no-repeat,
  linear-gradient(#fff, #fff) 6px 15px / 7px 7px no-repeat,
  linear-gradient(#fff, #fff) 15px 15px / 7px 7px no-repeat, var(--ink); }
.ed-estado { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.ed-estado::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--lima); }
.ed-estado.is-pend::before { background: #e0a43a; }
.ed-top__acc { margin-left: auto; display: flex; gap: 8px; align-items: center; position: relative; }

.ed-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; background: none; }
.ed-btn--dark { background: var(--ink); color: #fff; padding-right: 5px; }
.ed-btn--dark:hover { background: #2a2a2e; }
.ed-btn__dot { width: 30px; height: 30px; border-radius: 50%; background: var(--lima) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23053e23' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 4v12M6 11l6 6 6-6M5 20h14'/%3E%3C/svg%3E") center / 15px no-repeat; }
.ed-btn--outline { background: #fff; border-color: #cfcfcc; color: var(--ink); }
.ed-btn--outline:hover { border-color: var(--ink); }
.ed-btn--ghost { color: var(--ink-2); }
.ed-btn--ghost:hover { background: var(--soft); }
.ed-btn--sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.ed-btn--accent { background: var(--verde); color: #fff; }
.ed-btn--accent:hover { background: var(--bosque); }
.ed-btn--danger { color: var(--danger); }
.ed-btn[disabled] { opacity: .5; cursor: not-allowed; }

.ed-menu { position: absolute; top: 48px; right: 230px; width: 340px; background: #fff; border-radius: 16px; box-shadow: 0 2px 6px rgba(14,14,15,.06), 0 24px 48px -20px rgba(14,14,15,.35); border: 1px solid var(--line); padding: 8px; z-index: 20; }
.ed-menu > button, .ed-menu > label { display: grid; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; }
.ed-menu > button:hover, .ed-menu > label:hover { background: var(--soft); }
.ed-menu strong { font-size: 13.5px; }
.ed-menu span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.ed-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.ed-menu__peligro strong { color: var(--danger); }

/* ---------- panel */
.ed-panel { background: #fff; border-right: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.ed-tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ed-tabs button { border: 0; background: none; padding: 10px 11px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ed-tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--verde); }
.ed-panel__body { overflow-y: auto; padding: 18px 20px 60px; }

.ed-h { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.ed-h2 { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.ed-h2::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--verde); }
.ed-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.ed-field { display: grid; gap: 5px; margin-bottom: 12px; }
.ed-field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.ed-field > span em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.ed-field input[type=text], .ed-field input[type=url], .ed-field input[type=email], .ed-field input[type=tel], .ed-field textarea, .ed-field select {
  width: 100%; box-sizing: border-box; border: 1px solid #d9d8d4; border-radius: 10px; padding: 9px 11px; background: #fff; font-size: 13.5px; line-height: 1.45;
}
.ed-field textarea { resize: vertical; min-height: 64px; }
.ed-field input:focus, .ed-field textarea:focus, .ed-field select:focus { outline: 2px solid var(--verde); outline-offset: 0; border-color: transparent; }
.ed-field input::placeholder, .ed-field textarea::placeholder { color: #a3a3a7; }
.ed-field .ed-hered { font-size: 11.5px; color: var(--verde); }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ed-check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; margin: 6px 0 12px; cursor: pointer; }
.ed-check input { margin-top: 3px; accent-color: var(--verde); }
.ed-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fff; }
.ed-box--soft { background: var(--soft); border-color: transparent; }
.ed-box__t { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.ed-aviso { background: #fff7e8; border: 1px solid #f3d9a6; color: #7a4b00; border-radius: 12px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }
.ed-ok { background: var(--verde-soft); color: var(--bosque); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }

/* ---------- fotos */
.ed-slot { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; transition: box-shadow .2s, border-color .2s; }
.ed-slot.is-activo { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0,112,68,.15); }
.ed-slot__img { width: 112px; height: 84px; border-radius: 10px; background: #26262a center / cover no-repeat; position: relative; overflow: hidden; }
.ed-slot__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-slot__img--vacio { background: repeating-linear-gradient(-45deg, #f2f1ee 0 8px, #e9e8e4 8px 16px); }
.ed-slot__t { font-weight: 700; font-size: 13px; line-height: 1.3; }
.ed-slot__s { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.ed-slot__acc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ed-slot__acc label { cursor: pointer; }
.ed-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-top: 6px; }
.ed-badge--ok { background: var(--verde-soft); color: var(--bosque); }
.ed-badge--med { background: #fff4dc; color: #7a4b00; }
.ed-badge--bajo { background: #fde8e6; color: var(--danger); }
.ed-badge--web { background: var(--soft); color: var(--ink-2); }
.ed-foco { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.ed-foco input { accent-color: var(--verde); width: 100%; }
.ed-galeria { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.ed-galeria button { border: 2px solid transparent; border-radius: 8px; padding: 0; aspect-ratio: 4 / 3; overflow: hidden; cursor: pointer; background: #26262a; }
.ed-galeria button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-galeria button[aria-pressed='true'] { border-color: var(--verde); }
.ed-drop { border: 2px dashed #cfcfcc; border-radius: 14px; padding: 16px; text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.ed-drop.is-over { border-color: var(--verde); background: var(--verde-soft); color: var(--bosque); }

/* ---------- textos */
.ed-sel { position: sticky; top: -18px; background: #fff; padding: 4px 0 12px; z-index: 2; }
.ed-item { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin: 0 0 14px; }
.ed-item__t { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .06em; margin-bottom: 6px; }
.ed-mini { border: 0; background: none; color: var(--danger); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.ed-mini:hover { background: #fde8e6; }

/* ---------- vista previa */
.ed-preview { overflow: auto; position: relative; min-width: 0; }
.ed-preview__bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: rgba(233,232,228,.92); backdrop-filter: blur(8px); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ed-zoom { display: flex; gap: 4px; }
.ed-zoom button { border: 1px solid #cfcfcc; background: #fff; border-radius: 99px; min-width: 32px; height: 30px; padding: 0 10px; cursor: pointer; font-weight: 700; font-size: 12.5px; }
.ed-paginas { padding: 30px 28px 60px; display: flex; flex-wrap: wrap; gap: 28px 24px; justify-content: center; align-content: flex-start; }
.ed-hoja { position: relative; }
.ed-hoja__n { position: absolute; top: -20px; left: 0; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.ed-paginas .page { box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 40px -22px rgba(0,0,0,.45); cursor: pointer; }
.ed-paginas .page.is-activa { outline: 3px solid var(--verde); outline-offset: 2mm; }
.ed-paginas .foto[data-slot] { cursor: pointer; }
.ed-paginas .foto[data-slot]::before { content: 'Cambiar foto'; position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 2mm 4mm; border-radius: 99px; background: rgba(255,255,255,.95); color: var(--ink); font-size: 8pt; font-weight: 700; opacity: 0; transition: opacity .15s; pointer-events: none; }
.ed-paginas .foto[data-slot]:hover::before { opacity: 1; }
.ed-paginas .foto[data-slot]:hover { outline: .6mm solid var(--lima); outline-offset: -.6mm; }
.ed-paginas a { pointer-events: none; }

.ed-impresion { display: none; }

/* ---------- avisos */
.ed-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: 13.5px; font-weight: 600; z-index: 50; box-shadow: 0 12px 32px -12px rgba(0,0,0,.5); }
.ed-modal { position: fixed; inset: 0; background: rgba(14,14,15,.45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.ed-modal[hidden] { display: none; }
.ed-modal__card { background: #fff; border-radius: 22px; padding: 26px; width: min(480px, 100%); box-shadow: 0 30px 60px -30px rgba(0,0,0,.5); }
.ed-modal__card h2 { margin: 0 0 8px; font-size: 21px; letter-spacing: -.03em; font-weight: 700; line-height: 1.15; }
.ed-modal__card p { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.ed-modal__card ol { margin: 0 0 14px; padding-left: 20px; font-size: 14px; display: grid; gap: 4px; list-style: decimal; }
.ed-modal__acc { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.ed-cargando { position: fixed; inset: 0; background: rgba(255,255,255,.85); display: grid; place-items: center; z-index: 70; font-weight: 700; font-size: 15px; }

@media (max-width: 900px) {
  .ed-body { height: auto; overflow: auto; }
  .ed-app { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; }
  .ed-top { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .ed-top__acc { width: 100%; flex-wrap: wrap; }
  .ed-menu { right: 0; top: 46px; width: min(340px, calc(100vw - 32px)); }
  .ed-panel { border-right: 0; }
  .ed-panel__body { max-height: none; }
  .ed-paginas { padding: 6px 16px 40px; }
}

/* ---------- impresión: solo el dossier a tamaño real */
@media print {
  .ed-body { background: #fff; height: auto; overflow: visible; }
  .ed-app, .ed-toast, .ed-modal, .ed-cargando { display: none !important; }
  .ed-impresion { display: block !important; }
  .ed-impresion .page { box-shadow: none; outline: 0; }
}

/* ---------- selector Empresas / Particulares */
.ed-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); gap: 2px; }
.ed-switch a { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); }
.ed-switch a[aria-current='true'] { background: var(--ink); color: #fff; }
.ed-switch a:not([aria-current='true']):hover { color: var(--ink); }

/* Mientras se comprueba la sesión de administración (js/guardia.js) */
.guardia body { visibility: hidden; }
