/* Voploo ADS — "pliego de sellos": stone paper, ink rail, gold postmark reserved for the
   primary action and the approved state. State colors are fixed codes, never ornament. */
:root {
  --stone: #eeede9;
  --paper: #f8f7f3;
  --paper-2: #f2f0ea;
  --ink: #1c1a17;
  --ink-2: #3d3a34;
  --muted: #655d50;
  --line: #dcd8cd;
  --line-2: #c9c3b5;
  --gold: #b8923f;
  --gold-deep: #8a6a24;
  --gold-soft: #efe4c8;
  --on-gold: #1c1a17;
  --rail-text: #d9d3c4;
  --rail-dim: #9b9384;

  /* state codes */
  --st-work: #3a5a86;   --st-work-bg: #e3e9f2;
  --st-ok: #2f6b55;     --st-ok-bg: #dfece5;
  --st-review: #8a5a0a; --st-review-bg: #f5e8cc;
  --st-error: #a3312a;  --st-error-bg: #f6dfdc;

  --radius: 4px;
  --radius-sm: 6px;
  /* perforated rule: the sheet's tear line, used instead of plain borders between sections */
  --perf: radial-gradient(circle 1.6px, var(--line-2) 95%, transparent) 0 0 / 10px 4px repeat-x;
  --shadow-sheet: 0 1px 2px rgba(28, 26, 23, 0.06), 0 4px 14px rgba(28, 26, 23, 0.05);
  --font-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rail-w: 248px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
  accent-color: var(--gold-deep);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--stone); color: var(--ink);
  font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: var(--gold); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 750; line-height: 1.15; }
h2 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 0.95rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 0.875rem; }
.tnum, td.num, th.num, .pill, .usage { font-variant-numeric: tabular-nums; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 24px;
  background: var(--ink); color: var(--rail-text); padding: 22px 14px 18px;
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; color: #fff; padding: 0 10px; white-space: nowrap; }
.brand b { color: var(--gold); font-weight: 800; font-stretch: 85%; letter-spacing: 0.04em; margin-left: 2px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--rail-text); text-decoration: none; font-weight: 550; font-size: 0.94rem;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.09); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.nav a[aria-current="page"] svg { color: var(--gold); }
.rail-foot { margin-top: auto; display: grid; gap: 12px; padding: 0 10px; }
.usage { font-size: 0.8rem; color: var(--rail-dim); line-height: 1.45; }
.usage strong { display: block; color: var(--rail-text); font-weight: 600; font-size: 0.86rem; }
.rail .btn-quiet { color: var(--rail-text); border-color: rgba(255, 255, 255, 0.14); background: transparent; justify-self: start; }
.rail .btn-quiet:hover { background: rgba(255, 255, 255, 0.06); }
.topbar { display: none; }
.work { min-width: 0; }
main { max-width: 1160px; margin: 0 auto; padding: 32px 32px 64px; display: grid; gap: 20px; align-content: start; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 4px; }
.page-head > div { flex: 1 1 22rem; min-width: 0; }
.page-head p { color: var(--muted); max-width: 62ch; margin-top: 6px; }

/* ---------- sheets & sections ---------- */
.sheet { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sheet); padding: 20px; display: grid; gap: 16px; min-width: 0; }
.sheet > header { display: grid; gap: 4px; }
.sheet .split { background: var(--perf); padding-top: 18px; display: grid; gap: 12px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px; align-items: end; }
.brand-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.brand-form .span2 { grid-column: span 2; }
@media (max-width: 1180px) and (min-width: 1024px), (max-width: 860px) { .brand-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- form controls ---------- */
label { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); min-width: 0; }
.tour-form { display: grid; gap: 12px; }
textarea { font: 0.92rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; resize: vertical; min-height: 104px; }
input, select, textarea {
  font: inherit; font-size: 0.95rem; color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 9px 11px; min-height: 42px; min-width: 0; width: 100%;
  transition: border-color 140ms, box-shadow 140ms;
}
input::placeholder { color: #8a8273; }
input:hover, select:hover, textarea:hover { border-color: #b3ac9c; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(184, 146, 63, 0.22); }
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
input[type=file] { padding: 7px; background: var(--paper-2); font-size: 0.85rem; color: transparent; } /* the preview / status line says what was picked */
input[type=file]::file-selector-button { font: inherit; font-weight: 600; color: var(--ink); border: 1px solid var(--line-2); background: #fff; border-radius: 6px; padding: 5px 10px; margin-right: 10px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--gold-deep); }
.check { display: flex; flex-direction: row; gap: 10px; align-items: center; font-size: 0.94rem; font-weight: 500; color: var(--ink); cursor: pointer; }

/* toggle chips (platforms, formats, budget mode) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; flex-direction: row; align-items: center; gap: 8px; padding: 9px 14px 9px 12px; min-height: 42px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font-size: 0.9rem; font-weight: 550; color: var(--ink); cursor: pointer; transition: background 140ms, border-color 140ms; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: background 140ms, border-color 140ms; }
.chip .tick svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.chip:has(input:checked) { border-color: var(--ink); background: var(--paper-2); }
.chip:has(input:checked) .tick { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:has(input:checked) .tick svg { opacity: 1; }
.chip:has(input:focus-visible) { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

/* buttons */
button, .btn {
  font: inherit; font-size: 0.92rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 140ms, border-color 140ms, transform 120ms;
}
button:hover, .btn:hover { border-color: #a9a291; background: var(--paper-2); }
button:active, .btn:active { transform: translateY(1px); }
button svg.i, .btn svg.i { width: 18px; height: 18px; }
.primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.primary:hover { background: #c79f4b; border-color: #c79f4b; }
.danger { color: var(--st-error); }
.danger:hover { background: var(--st-error-bg); border-color: #d9a9a3; }
.btn-quiet { background: transparent; }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* pills: fixed state code */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.generating, .pill.rendering { background: var(--st-work-bg); color: var(--st-work); border-color: transparent; }
.pill.generating::before, .pill.rendering::before { animation: pulse 1.4s ease-in-out infinite; }
.pill.ready, .pill.on { background: var(--st-ok-bg); color: var(--st-ok); border-color: transparent; }
.pill.error, .pill.off { background: var(--st-error-bg); color: var(--st-error); border-color: transparent; }
.pill.review { background: var(--st-review-bg); color: var(--st-review); border-color: transparent; }
.pill.approved { background: var(--gold-soft); color: var(--gold-deep); border-color: transparent; }
@keyframes pulse { 50% { opacity: 0.25; } }

.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(28, 26, 23, 0.18); }

/* tables */
.scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.scroll th, .scroll td { white-space: nowrap; }
.scroll :is(th, td):first-child { position: sticky; left: 0; background: var(--paper); z-index: 1; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
tfoot th { color: var(--ink); font-size: 0.92rem; border-bottom: 0; }
td.num, th.num { text-align: right; }
td input { width: 110px; margin-left: auto; text-align: right; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Webs ---------- */
.site { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sheet); }
.site > summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 14px 18px; cursor: pointer; border-radius: var(--radius); }
.site > summary::-webkit-details-marker { display: none; }
.site > summary:hover { background: var(--paper-2); }
.site[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.site .logo-box { width: 48px; height: 48px; border-radius: 9px; display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(28, 26, 23, 0.12); }
.site .logo-box img { max-width: 80%; max-height: 80%; object-fit: contain; }
.site .title { display: grid; gap: 2px; min-width: 0; }
.site .title strong { font-family: var(--font-display); font-size: 1rem; }
.site .title span { color: var(--muted); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site .media-link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); }
.media-section { scroll-margin-top: 80px; }
.site .chev { transition: transform 200ms var(--ease-out); color: var(--muted); }
.site[open] .chev { transform: rotate(90deg); }
.site-body { padding: 18px; display: grid; gap: 22px; }
.site-body > section { display: grid; gap: 12px; }
.site-body > section + section { background: var(--perf); padding-top: 22px; }
.logo-pick { display: flex; gap: 8px; align-items: center; }
.logo-pick input { flex: 1; }
.logo-preview { height: 42px; width: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.media-item { display: grid; gap: 6px; }
.media-item video, .media-item img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: var(--ink); }
.media-item .row { justify-content: space-between; }
.media-item button { min-height: 34px; padding: 4px 10px; font-size: 0.82rem; }
audio.track { height: 36px; width: min(320px, 60vw); display: block; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; background: var(--paper-2); }

/* ---------- Anuncios: the sheet of stamps ---------- */
.campaign { display: grid; gap: 14px; }
.campaign + .campaign { background: var(--perf); padding-top: 28px; }
.campaign-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.campaign-head h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.campaign-head .meta { color: var(--muted); font-size: 0.84rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.add-formats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--paper-2); }
.add-formats .chip { min-height: 36px; padding: 6px 12px 6px 10px; font-size: 0.85rem; }
.add-formats button { min-height: 36px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.88rem; }
.callout.error { background: var(--st-error-bg); color: var(--st-error); }
.callout.review { background: var(--st-review-bg); color: var(--st-review); }
.callout ul { margin: 4px 0 0; padding-left: 18px; }

.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.stamp-wrap { filter: drop-shadow(0 1px 1px rgba(28, 26, 23, 0.14)) drop-shadow(0 6px 14px rgba(28, 26, 23, 0.07)); }
/* Perforated edge: holes punched only in the padding ring; the content box stays solid. */
.stamp {
  --hole: 4px; --pitch: 13px;
  position: relative; background: var(--paper); padding: 9px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle var(--hole) at center, transparent 96%, #000 100%) 0 0 / var(--pitch) var(--pitch) round;
  mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle var(--hole) at center, transparent 96%, #000 100%) 0 0 / var(--pitch) var(--pitch) round;
}
.stamp-inner { border: 1px solid var(--line); background: var(--paper); display: grid; gap: 10px; padding: 10px 10px 12px; }
.stamp-media { position: relative; background: var(--ink); border-radius: 3px; overflow: hidden; aspect-ratio: 9 / 16; display: grid; place-items: center; }
.stamp-media.sq { aspect-ratio: 1 / 1; }
.stamp-media video, .stamp-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stamp-media .empty { color: var(--rail-dim); font-size: 0.85rem; padding: 16px; text-align: center; }
.fmt-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.fmt-switch button { min-height: 30px; padding: 3px 9px; font-size: 0.76rem; font-weight: 600; border-radius: 6px; color: var(--muted); }
.fmt-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.stamp-copy { display: grid; gap: 4px; }
/* face value: the variant number printed on the stamp */
.denom { position: absolute; left: 8px; bottom: 8px; font: 800 1.1rem/1 var(--font-display); font-stretch: 70%; background: var(--paper); color: var(--ink); padding: 3px 7px; border-radius: 3px; pointer-events: none; }
.stamp-media:has(video) .denom { bottom: auto; top: 8px; }
.stamp-copy strong { font-family: var(--font-display); font-size: 0.98rem; line-height: 1.25; }
.stamp details { font-size: 0.84rem; }
.stamp summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.stamp pre { white-space: pre-wrap; font: 0.8rem/1.5 var(--font-body); background: var(--paper-2); border: 1px solid var(--line); padding: 10px; border-radius: 6px; margin: 8px 0 0; max-height: 260px; overflow: auto; }
.stamp .actions button { flex: 1; min-height: 38px; }
.stamp-wrap.discarded .stamp-media { filter: grayscale(1) contrast(0.9); opacity: 0.55; }
.stamp-wrap.discarded .stamp-copy { opacity: 0.6; }

/* the postmark — the one authored motion */
.postmark { position: absolute; top: 8px; right: 6px; width: 46%; max-width: 128px; color: var(--gold); pointer-events: none; transform: rotate(-14deg); mix-blend-mode: multiply; filter: drop-shadow(0 0 0.5px rgba(138, 106, 36, 0.6)); }
.stamp-media .postmark { mix-blend-mode: normal; color: var(--gold); opacity: 0.95; }
.postmark svg { width: 100%; height: auto; display: block; overflow: visible; }
.postmark text { font-family: var(--font-display); font-stretch: 70%; font-weight: 800; fill: currentColor; }
.postmark.fresh { animation: stamp-in 420ms var(--ease-out) both; }
@keyframes stamp-in { from { transform: rotate(-24deg) scale(1.6); opacity: 0; filter: blur(2px); } to { transform: rotate(-14deg) scale(1); opacity: 0.95; filter: blur(0); } }

/* ---------- empty & login ---------- */
.empty-state { display: grid; gap: 10px; justify-items: start; padding: 28px; }
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(400px, 100%); }
.login .stamp { --hole: 5px; --pitch: 15px; padding: 11px; }
.login-form { display: grid; gap: 16px; padding: 26px 24px 24px; border: 1px solid var(--line); }
.login .brand { color: var(--ink); padding: 0; font-size: 1.6rem; }
.login .brand b { color: var(--gold-deep); }
.form-error { color: var(--st-error); font-size: 0.88rem; }
.form-error:empty { display: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 9px; font-weight: 550; font-size: 0.9rem; box-shadow: 0 8px 24px rgba(28, 26, 23, 0.25); max-width: calc(100vw - 32px); animation: toast-in 260ms var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  :root { --rail-w: 84px; }
  .rail { padding: 18px 10px; align-items: center; }
  .brand { font-size: 0; padding: 0; }
  .brand::first-letter { font-size: 1.4rem; }
  .brand b { font-size: 0.72rem; margin: 0; display: block; text-align: center; }
  .nav a { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: 0.7rem; width: 64px; text-align: center; }
  .rail-foot { padding: 0; justify-items: center; }
  .usage { display: none; }
  .rail .btn-quiet { font-size: 0; gap: 0; padding: 9px; }
  main { padding: 26px 24px 56px; }
}
@media (max-width: 639px) {
  .shell { display: block; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--ink); }
  .topbar .brand { font-size: 1.1rem; padding: 0; }
  .topbar .brand::first-letter { font-size: inherit; }
  .topbar .brand b { display: inline; font-size: inherit; margin-left: 2px; }
  .topbar button { min-height: 36px; padding: 6px 10px; color: var(--rail-text); background: transparent; border-color: rgba(255, 255, 255, 0.16); }
  .rail { position: fixed; inset: auto 0 0 0; top: auto; height: auto; z-index: 30; flex-direction: row; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 0; box-shadow: 0 -6px 18px rgba(28, 26, 23, 0.18); }
  .rail > .brand, .rail-foot { display: none; }
  .nav { display: grid; grid-template-columns: repeat(6, 1fr); width: 100%; gap: 0; }
  .nav a { width: auto; padding: 7px 2px; font-size: 0.66rem; letter-spacing: -0.01em; min-height: 52px; }
  main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .sheet { padding: 16px; }
  .site > summary { grid-template-columns: auto minmax(0, 1fr) auto; padding: 12px 14px; gap: 12px; }
  .site > summary .pill { display: none; }
  .site-body { padding: 14px; }
  .stamps { grid-template-columns: 1fr; }
  /* ad + Aprobar visible together between the two bars; contain keeps the ad's text uncut */
  .stamp-media:not(.sq) { aspect-ratio: auto; height: min(56svh, 520px); }
  .stamp-media:not(.sq) :is(video, img) { object-fit: contain; }
  .site .title span { white-space: normal; }
  .page-head > .btn, .page-head > button { width: 100%; }
  input, select { font-size: 16px; } /* no zoom on iOS focus */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (min-width: 640px) and (max-width: 1023px) { .stamps { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
