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

:root {
  --bg:        #F2F2F0;
  --surface:   #FFFFFF;
  --border:    #E8E8E8;
  --border2:   #D4D4D4;
  --text:      #1A1A1A;
  --text2:     #666666;
  --text3:     #AAAAAA;
  --accent:    #E53935;
  --accent2:   #B71C1C;
  --indigo:    #4F46E5;
  --green:     #16A34A;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow:    0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 150ms ease;
  --font:      'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* Typography */
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p  { font-size: 14px; line-height: 1.6; color: var(--text2); }

/* Utility */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

/* Inputs */
.input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--text); }
textarea.input { resize: vertical; min-height: 64px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-dark  { background: var(--text);    color: #fff; }
.btn-dark:not(:disabled):hover  { opacity: 0.85; }
.btn-white { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-white:not(:disabled):hover { background: var(--bg); }
.btn-red   { background: var(--accent);  color: #fff; }
.btn-red:not(:disabled):hover   { background: var(--accent2); }
.btn-indigo{ background: var(--indigo);  color: #fff; }
.btn-indigo:not(:disabled):hover{ opacity: 0.9; }
.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-xs  { padding: 4px 9px;  font-size: 11px; border-radius: 6px; }
.btn-icon{ padding: 8px; border-radius: var(--radius-sm); }

/* Accent dots */
.ac-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 100ms;
  flex-shrink: 0;
}
.ac-dot:hover { transform: scale(1.14); }
.ac-dot.selected { border-color: var(--text); }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(0,0,0,0.1);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
.spinner-white {
  border-color: rgba(255,255,255,0.25);
  border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Range slider */
input[type=range] {
  width: 100%;
  accent-color: var(--text);
  height: 4px;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.chip-indigo { background: #EEF2FF; color: var(--indigo); }
.chip-green  { background: #DCFCE7; color: var(--green); }
.chip-gray   { background: var(--bg); color: var(--text2); border: 1px solid var(--border); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.toast.error   { background: var(--accent); }
.toast.success { background: var(--green); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Photo upload area */
.upload-area {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text3);
  transition: all var(--transition);
  font-size: 13px;
}
.upload-area:hover { border-color: var(--text2); background: var(--bg); }
.upload-area.has-file { border-style: solid; border-color: var(--text); padding: 0; overflow: hidden; }

/* Canvas preview */
.canvas-preview {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: block;
  width: 100%;
}

/* Responsive layout */
.two-col {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

.sticky-preview { position: sticky; top: 68px; }
@media (max-width: 900px) {
  .sticky-preview { position: static; order: -1; }
}

/* Nav responsive */
@media(max-width:700px){
  .nav-label { display: none; }
  .two-col { grid-template-columns: 1fr !important; }
}

/* Page containers */
.page { padding: 0; }
.section-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }

/* Style buttons (poll/post templates) */
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-btn { padding: 11px 8px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); text-align: center; font-family: var(--font); transition: all var(--transition); }
.style-btn:hover { border-color: var(--border2); }
.style-btn.on { border-color: var(--text); background: var(--text); color: #fff; }
.style-btn .si { font-size: 20px; display: block; margin-bottom: 4px; }
.style-btn .sn { font-size: 12px; font-weight: 600; }
.style-btn .sd { font-size: 10px; opacity: .55; margin-top: 2px; }

/* Count buttons */
.count-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.count-btn { min-width: 60px; padding: 9px 6px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); text-align: center; font-family: var(--font); transition: all var(--transition); }
.count-btn.on { border-color: var(--text); background: var(--text); color: #fff; }
.count-btn .cnt { font-size: 20px; font-weight: 700; display: block; }
.count-btn .lbl2 { font-size: 10px; opacity: .65; }

/* Site chips */
.site-chip { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all var(--transition); font-size: 14px; font-weight: 500; }
.site-chip:hover { border-color: var(--text); }
.site-chip.active { border-color: var(--text); background: var(--text); color: #fff; }
.site-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
.site-chip.active .dot { background: #fff; }

/* Candidate row */
.cand-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px; background: var(--bg); border-radius: var(--radius); margin-bottom: 7px; border: 1px solid var(--border); }
.cand-photo { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--border); cursor: pointer; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--border2); transition: all var(--transition); }
.cand-photo:hover { border-color: var(--text2); }
.cand-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cand-num { width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }

/* Tpl cards */
.tpl-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.tpl-card { border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all .18s; }
.tpl-card:hover { transform: scale(1.02); }
.tpl-card.on { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.tpl-card canvas { display: block; width: 100%; }
.tpl-label { padding: 6px; background: var(--surface); text-align: center; font-size: 10px; font-weight: 500; color: var(--text2); border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-card.on .tpl-label { background: var(--text); color: #fff; }

/* Photo search modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; width: 100%; max-width: 520px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.photo-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; overflow-y: auto; flex: 1; margin-top: 10px; }
@media(max-width:480px){ .photo-grid { grid-template-columns: repeat(2,1fr); } }
.photo-item { border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; border: 2.5px solid transparent; transition: all .15s; aspect-ratio: 1; }
.photo-item:hover { border-color: var(--text); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Logo config */
.logo-pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.logo-pos-btn { padding: 5px 6px; font-size: 10px; border: 1.5px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--surface); font-family: var(--font); color: var(--text2); transition: all .15s; text-align: center; }
.logo-pos-btn.on { border-color: var(--text); background: var(--text); color: #fff; }

/* Format buttons */
.fmt-row { display: flex; gap: 6px; }
.fmt-btn { flex: 1; padding: 8px 4px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); font-size: 11px; text-align: center; font-family: var(--font); color: var(--text2); transition: all .15s; }
.fmt-btn.on { border-color: var(--text); color: var(--text); font-weight: 600; background: var(--bg); }

/* Copy textarea */
.copy-text { width: 100%; border: none; outline: none; font-size: 13px; font-family: var(--font); line-height: 1.7; resize: none; color: var(--text); min-height: 130px; }
.hashtag { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: #EEF2FF; color: var(--indigo); cursor: pointer; transition: all .15s; border: none; font-family: var(--font); }
.hashtag.off { background: var(--bg); color: var(--text3); text-decoration: line-through; }

/* Pregunta AI btn */
.ai-btn { position: absolute; right: 8px; top: 8px; padding: 4px 9px; background: #EEF2FF; color: var(--indigo); border: none; border-radius: 6px; font-size: 11px; font-weight: 500; cursor: pointer; font-family: var(--font); display: flex; align-items: center; gap: 3px; }
.ai-btn:hover { background: #E0E7FF; }
.pregunta-wrap { position: relative; }
.pregunta-wrap textarea { padding-right: 84px; }

/* Image Library */
.img-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
  max-height: 480px;
}
@media(max-width:480px){ .img-lib-grid { grid-template-columns: repeat(3,1fr); } }
