/* ============================================================
   Placas — UI de producto
   Estética: taller gráfico. Tinta + amarillo señalador.
   La interfaz es neutra a propósito: el color lo pone la
   marca de cada cliente en su placa.
   ============================================================ */

:root {
  --ink: #15171C;
  --ink-soft: #3C4048;
  --paper: #F1F2EE;
  --surface: #FFFFFF;
  --line: #D8DAD3;
  --accent: #F2B705;
  --accent-ink: #8a6a00;
  --danger: #C23B22;
  --ok: #2E7D4F;
  --radius: 6px;
  --font: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

/* mesa de trabajo punteada para el área de preview */
.stage-wrap {
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 28px;
  display: flex;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
}

/* ---------------- marca de producto ---------------- */
.brand-mark {
  font-weight: 900;
  font-stretch: 110%;
  letter-spacing: -0.02em;
  font-size: 30px;
  text-transform: uppercase;
}
.brand-mark::after {
  content: '■';
  color: var(--accent);
  margin-left: 4px;
  font-size: 0.55em;
  vertical-align: 0.35em;
}
.brand-mark--sm { font-size: 19px; }

/* ---------------- login ---------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}
.login-sub { color: var(--ink-soft); margin: 6px 0 24px; }

/* ---------------- topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.quota-pill {
  font-size: 12.5px;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--ink-soft);
}

.tabs { display: flex; gap: 4px; }
.tab {
  font: inherit;
  font-weight: 600;
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
}
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------------- layout ---------------- */
.layout { max-width: 880px; margin: 0 auto; padding: 28px 18px 80px; }
.panel-title { font-size: 24px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.01em; }
.panel-help { color: var(--ink-soft); margin: 0 0 22px; }

.panel-create {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 26px;
}

textarea, input[type="text"], input[type="email"],
input[type="password"], input:not([type]) {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  margin-top: 6px;
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--ink); outline-offset: 0; }

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; }
.field { margin-bottom: 16px; }
.field-label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.field-row { display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0; }

/* segmented */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--ink-soft);
  border: none;
  padding: 9px 16px;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: none; }
.seg button.is-active { background: var(--ink); color: #fff; }
.seg--formats { margin-bottom: 16px; flex-wrap: wrap; }

/* ---------------- botones ---------------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ---------------- workbench ---------------- */
.workbench { margin-top: 4px; }
.workbench-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
#stage { line-height: 0; }

.copy-editor {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.copy-editor summary { font-weight: 700; cursor: pointer; font-size: 13.5px; }
.copy-editor label { margin-top: 12px; }

/* ---------------- historial ---------------- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
}
.history-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { font-size: 12.5px; color: var(--ink-soft); }
.empty { color: var(--ink-soft); }

/* ---------------- marca ---------------- */
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .brand-grid { grid-template-columns: 1fr; } }

.logo-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13.5px;
  padding: 14px;
}
.logo-drop:hover { border-color: var(--ink); }
.logo-drop img { max-height: 80px; max-width: 100%; }

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 8px;
}
.color-row input[type="color"] {
  width: 42px; height: 30px; border: none; padding: 0;
  background: none; cursor: pointer;
}

/* ---------------- mensajes ---------------- */
.form-error { color: var(--danger); font-weight: 600; font-size: 13.5px; margin-top: 10px; }
.form-ok { color: var(--ok); font-weight: 600; font-size: 13.5px; margin-top: 10px; }

/* ---------------- overlay suspendido ---------------- */
.suspended-overlay[hidden] { display: none !important; }
.suspended-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(21, 23, 28, 0.86);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.suspended-card {
  background: var(--surface);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  text-align: center;
}

/* ---------------- admin ---------------- */
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 11px 13px;
  border-bottom: 1px solid var(--line); font-size: 13.5px; }
.admin-table th { font-weight: 700; background: var(--paper); }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.status-active { background: var(--ok); }
.status-suspended { background: var(--danger); }
.status-trial { background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ============================================================
   v2 — Biblioteca de fotos, controles de diseño, tipografías
   ============================================================ */

.field-hint { font-weight: 400; color: var(--ink-soft); text-transform: none; }

/* --- grilla de fotos --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.3;
  padding: 0;
}
.photo-tile:hover { border-color: var(--ink); }
.photo-tile.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.photo-tile--img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.photo-tile--add { border-style: dashed; color: var(--accent-ink); }
.photo-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: rgba(21,23,28,0.75); color: #fff;
  font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-del:hover { background: var(--danger); }

/* --- controles de diseño en workbench --- */
.design-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.dc-block { min-width: 260px; flex: 1; }
.dc-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.dc-row input[type="range"] { flex: 1; accent-color: var(--ink); min-width: 90px; }
.slider-val {
  font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  min-width: 38px; text-align: right;
}
.seg--sm button { padding: 7px 12px; font-size: 12.5px; }

/* grilla 3x2 de posición de logo */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  grid-template-rows: repeat(2, 26px);
  gap: 3px;
}
.pos-grid button {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  padding: 0;
}
.pos-grid button::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--ink-soft);
}
.pos-grid button[data-val="tl"]::after { top: 3px; left: 3px; }
.pos-grid button[data-val="tc"]::after { top: 3px; left: 50%; transform: translateX(-50%); }
.pos-grid button[data-val="tr"]::after { top: 3px; right: 3px; }
.pos-grid button[data-val="bl"]::after { bottom: 3px; left: 3px; }
.pos-grid button[data-val="bc"]::after { bottom: 3px; left: 50%; transform: translateX(-50%); }
.pos-grid button[data-val="br"]::after { bottom: 3px; right: 3px; }
.pos-grid button:hover { border-color: var(--ink); }
.pos-grid button.is-active { border-color: var(--accent); background: rgba(242,183,5,0.14); }
.pos-grid button.is-active::after { background: var(--accent-ink); }

/* --- selector visual de tipografías --- */
.font-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.font-grid button {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  padding: 12px 6px 9px;
  text-align: center;
  font: inherit;
}
.font-grid button:hover { border-color: var(--ink); }
.font-grid button.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.font-sample { display: block; font-size: 26px; line-height: 1.1; color: var(--ink); }
.font-name {
  display: block; margin-top: 5px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft);
}
.font-sample--moderna    { font-family: 'Archivo', sans-serif; font-weight: 800; }
.font-sample--clasica    { font-family: 'Lora', serif; font-weight: 700; }
.font-sample--condensada { font-family: 'Oswald', sans-serif; font-weight: 600; }
.font-sample--elegante   { font-family: 'Cormorant Garamond', serif; font-weight: 500; }
.font-sample--editorial  { font-family: 'Playfair Display', serif; font-weight: 700; }
.font-sample--geometrica { font-family: 'Montserrat', sans-serif; font-weight: 800; }

/* canvas del preview */
#stage { display: block; max-width: 100%; border-radius: 4px; box-shadow: 0 6px 28px rgba(21,23,28,0.18); }

/* v3 — arrastre de encuadre y compresión */
#stage { cursor: grab; touch-action: none; }
#stage.is-dragging { cursor: grabbing; }
.photo-tile--add.is-busy { opacity: 0.5; pointer-events: none; }
.drag-hint {
  font-size: 12px; color: var(--ink-soft);
  margin: 8px 0 0; text-align: center;
}

/* --- sugeridor de paletas desde el logo --- */
.palette-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.palette-card {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 96px;
  font: inherit;
}
.palette-card:hover { border-color: var(--ink); }
.palette-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.palette-title { font-weight: 800; font-size: 15px; line-height: 1.1; }
.palette-cta {
  align-self: flex-start;
  font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.palette-name {
  margin-top: auto;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0.75;
}

/* ============================================================
   v6 — Planificador, modal cambio de clave, upgrade card
   ============================================================ */

/* Modal genérico */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(21,23,28,0.82);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  background: var(--surface);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px; width: 100%;
}
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card p  { margin: 0 0 20px; color: var(--ink-soft); }

/* Upgrade card (plan bloqueado) */
.upgrade-card {
  max-width: 480px; margin: 60px auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 40px 32px;
}
.upgrade-icon { font-size: 40px; margin-bottom: 14px; }
.upgrade-card h2 { margin: 0 0 12px; font-size: 22px; }
.upgrade-card p  { margin: 0 0 12px; color: var(--ink-soft); line-height: 1.55; }
.upgrade-price { font-size: 13px; }
.upgrade-price strong { color: var(--ink); }

/* Plan semanal */
.plan-week-title {
  font-size: 18px; font-weight: 800;
  margin: 24px 0 16px;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.plan-card-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-dia  { font-weight: 800; font-size: 14px; }
.plan-hora { font-size: 12px; color: var(--ink-soft); }
.plan-badges { margin-left: auto; display: flex; gap: 4px; }
.badge {
  font-size: 11px; font-weight: 700;
  background: var(--paper); color: var(--ink-soft);
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line);
}
.plan-tema   { font-size: 13px; color: var(--ink-soft); font-style: italic; }
.plan-copy   { display: flex; flex-direction: column; gap: 3px; }
.plan-titulo { font-size: 16px; font-weight: 800; line-height: 1.2; }
.plan-sub    { font-size: 13px; color: var(--ink-soft); }
.plan-usar   { align-self: flex-start; margin-top: 4px; }

/* config email en admin */
.email-badge {
  display: inline-block;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  background: var(--ok); color: #fff;
}
.email-badge.failed { background: var(--danger); }

/* v7 — upgrade contact button */
.upgrade-card .btn {
  margin-top: 18px;
  text-decoration: none;
  display: inline-block;
}

/* ====== Captions por red social ====== */
.caption-section {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.caption-title {
  font-size: 14px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); margin: 0 0 12px;
}
.caption-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
}
.caption-tab {
  font: inherit; font-size: 13px; font-weight: 700;
  background: var(--paper); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 14px; cursor: pointer;
}
.caption-tab.is-active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.caption-body {
  font-size: 14px; line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 12px;
  min-height: 80px;
}
.caption-copied {
  font-size: 13px; font-weight: 700;
  color: var(--ok); margin-left: 10px;
}