/* Mesa: papel frío, tinta azul marino y un rotulador amarillo que marca lo
   que espera tu decisión. Poppins para la herramienta, Lora para lo que escribes. */

@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/fonts/Lora-Variable.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --papel: #edf0f4;
  --hoja: #ffffff;
  --tinta: #14213d;
  --suave: #56617a;
  --raya: #cfd6e0;
  --rotulador: #ffc53d;
  --programado: #2a5bd7;
  --publicado: #17764f;
  --fallo: #b3261e;
  --ui: "Poppins", system-ui, sans-serif;
  --texto: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 15px/1.5 var(--ui);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2.1rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; line-height: 1.3; font-weight: 700; }
a { color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.suave { color: var(--suave); }
.salto { position: absolute; left: -999px; }
.salto:focus { left: 12px; top: 12px; background: var(--hoja); padding: 8px 12px; z-index: 10; }

:focus-visible { outline: 3px solid var(--programado); outline-offset: 2px; }

/* ---------- estructura ---------- */

.marco { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.lateral {
  background: var(--tinta);
  color: #fff;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.nombre { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; text-decoration: none; }
.nombre::after { content: ""; display: block; width: 34px; height: 5px; background: var(--rotulador); margin-top: 6px; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a {
  text-decoration: none;
  padding: 9px 12px;
  margin: 0 -12px;
  color: #c9d2e3;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lateral nav a:hover { color: #fff; }
.lateral nav a[aria-current="page"] { color: var(--tinta); background: var(--rotulador); }
.cuenta { font-size: 0.8rem; background: #fff; color: var(--tinta); padding: 0 7px; border-radius: 10px; font-weight: 700; }
.salir { margin-top: auto; color: #9fabc2; text-align: left; }
.lateral :focus-visible { outline-color: #fff; }

main#vista { padding: 44px clamp(20px, 5vw, 64px) 120px; max-width: 1180px; width: 100%; outline: none; }

/* ---------- controles ---------- */

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }

.principal, .secundario {
  border: 2px solid var(--tinta);
  padding: 10px 20px;
  font-weight: 700;
  border-radius: 3px;
}
.principal { background: var(--rotulador); }
.principal:hover:not(:disabled) { background: #ffb400; }
.secundario { background: transparent; font-weight: 500; }
.secundario:hover:not(:disabled) { background: var(--hoja); }
.enlace { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.enlace.peligro { color: var(--fallo); }
.armado { background: var(--tinta); color: #fff; }

label, .etiqueta { display: block; font-weight: 500; margin-bottom: 6px; }
.ayuda { color: var(--suave); font-size: 0.87rem; margin-top: 6px; max-width: 62ch; }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea, select {
  width: 100%;
  background: var(--hoja);
  border: 1px solid var(--raya);
  border-bottom: 2px solid var(--tinta);
  border-radius: 2px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 84px; display: block; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-bottom: 5px solid var(--rotulador); padding-bottom: 7px; }
.escrito { font-family: var(--texto); font-size: 1.06rem; line-height: 1.6; }

.banda {
  border-left: 5px solid var(--rotulador);
  background: var(--hoja);
  padding: 12px 16px;
  margin-bottom: 14px;
  max-width: 78ch;
}
.banda.mal { border-left-color: var(--fallo); white-space: pre-line; }
.banda.bien { border-left-color: var(--publicado); }

/* ---------- sellos de estado ---------- */

.sello {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 9px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.sello.borrador { color: var(--tinta); background: var(--rotulador); border-color: var(--tinta); }
.sello.programado { color: var(--programado); }
.sello.publicado { color: var(--publicado); }
.sello.fallo { color: var(--fallo); }
.sello.saliendo { color: var(--suave); }

/* ---------- nuevo post ---------- */

.nuevo { max-width: 780px; }
.nuevo h1 { margin-bottom: 22px; }
.idea {
  font-family: var(--texto);
  font-size: 1.45rem;
  line-height: 1.45;
  min-height: 150px;
  padding: 18px 20px;
  border: 0;
  border-bottom: 3px solid var(--tinta);
}
.idea::placeholder { color: #8d97ab; }
.campo { margin-top: 22px; }
.redes { display: flex; flex-wrap: wrap; gap: 8px; }
.red {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--hoja);
  border: 1px solid var(--raya);
  padding: 7px 14px 7px 10px;
  border-radius: 3px;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}
.red:has(input:checked) { border-color: var(--tinta); box-shadow: inset 0 -4px 0 var(--rotulador); }
.red input { accent-color: var(--tinta); width: 16px; height: 16px; margin: 0; }
.red .sin { color: var(--suave); font-weight: 400; font-size: 0.85rem; }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }

.progreso { height: 4px; background: var(--raya); overflow: hidden; margin-top: 18px; }
.progreso::before { content: ""; display: block; height: 100%; width: 35%; background: var(--tinta); animation: pasa 1.3s ease-in-out infinite; }
@keyframes pasa { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.temas { list-style: none; padding: 0; margin: 30px 0 0; border-top: 2px solid var(--tinta); }
.temas li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--raya); }
.temas h3 { font-family: var(--texto); font-size: 1.18rem; font-weight: 600; line-height: 1.35; }
.temas p { grid-column: 1; color: var(--suave); max-width: 64ch; }
.temas button { grid-row: 1 / span 2; grid-column: 2; }

/* ---------- lista de posts ---------- */

.filtros { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 20px 0 6px; }
.filtros button { background: none; border: 0; padding: 6px 0; font-weight: 500; color: var(--suave); border-bottom: 4px solid transparent; }
.filtros button[aria-pressed="true"] { color: var(--tinta); border-bottom-color: var(--rotulador); }
.lista { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--tinta); }
.lista a {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 6px;
  border-bottom: 1px solid var(--raya);
  text-decoration: none;
}
.lista a:hover { background: var(--hoja); }
.lista img, .lista .hueco { width: 56px; height: 70px; object-fit: cover; background: var(--raya); }
.lista h3 { font-family: var(--texto); font-size: 1.12rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.lista .meta { color: var(--suave); font-size: 0.87rem; margin-top: 3px; }
.vacio { padding: 44px 0; max-width: 52ch; }
.vacio p { margin-bottom: 16px; }

/* ---------- editor ---------- */

.cabecera { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin: 14px 0 26px; }
.cabecera textarea.titulo {
  flex: 1 1 320px;
  font: 700 1.7rem/1.2 var(--ui);
  letter-spacing: -0.02em;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
  min-height: 0;
  resize: none;
  overflow: hidden;
}
.cabecera textarea.titulo:hover { border-bottom-color: var(--raya); }
.cabecera textarea.titulo:focus-visible { border-bottom: 4px solid var(--rotulador); padding-bottom: 2px; }
.guardado { color: var(--suave); font-size: 0.85rem; min-width: 8ch; }

.editor { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 44px; align-items: start; }
.lamina { position: sticky; top: 24px; }
.lamina img { width: 100%; aspect-ratio: 4 / 5; background: var(--raya); border: 1px solid var(--raya); }
.lamina.apagada img { opacity: 0.3; }
.lamina .campo { margin-top: 14px; }
.lamina textarea { min-height: 0; resize: none; overflow: hidden; }
.interruptor { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 12px 0 0; cursor: pointer; }
.interruptor input { width: 16px; height: 16px; accent-color: var(--tinta); margin: 0; }

.destinos { border-top: 2px solid var(--tinta); }
.destino { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; padding: 20px 0; border-bottom: 1px solid var(--raya); }
.destino.apagado .cuerpo { opacity: 0.4; }
.margen h2 { margin-bottom: 2px; }
.margen .quien { color: var(--suave); font-size: 0.85rem; overflow-wrap: anywhere; }
.margen .conteo { font-size: 0.85rem; margin-top: 8px; font-variant-numeric: tabular-nums; }
.margen .conteo.pasado { color: var(--fallo); font-weight: 700; }
.cuerpo textarea { border: 0; border-left: 3px solid var(--raya); border-radius: 0; background: transparent; padding: 2px 0 2px 18px; resize: none; overflow: hidden; min-height: 3em; }
.cuerpo textarea:focus-visible { border-bottom: 0; border-left: 3px solid var(--rotulador); padding: 2px 0 2px 18px; background: var(--hoja); }
.cuerpo .fijo { white-space: pre-wrap; border-left: 3px solid var(--publicado); padding-left: 18px; overflow-wrap: anywhere; }
.cuerpo .nota { font-size: 0.87rem; margin-top: 10px; }
.cuerpo .nota.mal { color: var(--fallo); }

.cambios { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 26px; }
.cambios label { grid-column: 1 / -1; margin: 0; }

.salida {
  position: sticky;
  bottom: 0;
  background: var(--papel);
  border-top: 2px solid var(--tinta);
  margin-top: 34px;
  padding: 16px 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}
.salida .hora { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.salida .hora input { width: auto; min-width: 0; max-width: 100%; }
.salida .fin { margin-left: auto; }

/* ---------- cuentas y marca ---------- */

.bloques { display: grid; gap: 0; border-top: 2px solid var(--tinta); margin-top: 24px; max-width: 860px; }
.bloque { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--raya); }
.bloque .cuentas { list-style: none; padding: 0; margin: 0 0 14px; }
.bloque .cuentas li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 6px 0; }
.bloque .cuentas strong { font-weight: 500; }
.bloque code { font: 0.85rem/1.4 ui-monospace, Menlo, Consolas, monospace; background: var(--hoja); padding: 2px 6px; overflow-wrap: anywhere; }

.ficha { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 48px; align-items: start; margin-top: 24px; }
.ficha form { max-width: 640px; }
.ficha .campo:first-child { margin-top: 0; }
.colores { display: flex; flex-wrap: wrap; gap: 18px; }
.colores label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.colores input { width: 44px; height: 34px; padding: 0; border: 1px solid var(--tinta); background: none; }
.muestra { position: sticky; top: 24px; }
.muestra .cartel { aspect-ratio: 4 / 5; padding: 8%; display: flex; flex-direction: column; font-family: var(--ui); }
.muestra .cartel .rotulo { display: flex; align-items: center; gap: 6px; }
.muestra .cartel b { font-weight: 700; font-size: 0.8rem; }
.muestra .cartel img { max-height: 22px; max-width: 60%; }
.muestra .cartel .rotulo img + b { font-size: 0.9rem; }
.muestra .cartel i { display: block; width: 34px; height: 4px; margin: auto 0 10px; }
.muestra .cartel strong { font-weight: 700; font-size: 1.55rem; line-height: 1.15; margin-bottom: auto; }
.muestra .cartel small { font-size: 0.7rem; opacity: 0.75; font-weight: 500; }

/* ---------- avisos ---------- */

#aviso { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; pointer-events: none; }
#aviso div { background: var(--tinta); color: #fff; padding: 10px 18px; border-radius: 3px; border-bottom: 4px solid var(--rotulador); max-width: min(92vw, 560px); white-space: pre-line; }
#aviso div.mal { border-bottom-color: var(--fallo); }

/* ---------- entrada ---------- */

.entrada { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.entrada main { width: min(100%, 360px); }
.entrada h1::after { content: ""; display: block; width: 48px; height: 7px; background: var(--rotulador); margin-top: 8px; }
.entrada form { margin-top: 30px; display: grid; gap: 12px; }
.entrada label { margin: 0; }
.entrada .fallo { color: var(--fallo); }

/* ---------- pantallas estrechas ---------- */

@media (max-width: 900px) {
  .marco { grid-template-columns: minmax(0, 1fr); }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 14px 20px; }
  .nombre::after { display: none; }
  .lateral nav { flex-direction: row; flex-wrap: wrap; gap: 4px 6px; }
  .lateral nav a { margin: 0; gap: 8px; }
  .salir { margin: 0 0 0 auto; }
  main#vista { padding-top: 28px; }
  h1 { font-size: 1.7rem; }
  .editor, .ficha { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .lamina, .muestra { position: static; max-width: 300px; }
  .destino { grid-template-columns: 1fr; gap: 10px; }
  .margen { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
  .margen .conteo { margin: 0; }
  .bloque { grid-template-columns: 1fr; gap: 10px; }
  .temas li { grid-template-columns: 1fr; }
  .temas button { grid-row: auto; grid-column: 1; justify-self: start; }
  .idea { font-size: 1.2rem; }
  .lista a { grid-template-columns: 44px minmax(0, 1fr); }
  .lista a .sello { grid-column: 2; justify-self: start; }
  .lista img, .lista .hueco { width: 44px; height: 55px; }
  .salida { position: static; }
  .salida .fin { margin-left: 0; }
  .cabecera textarea.titulo { font-size: 1.35rem; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .progreso::before { animation: none; width: 100%; opacity: 0.5; }
}
