/* Atelier · interfaz */
:root {
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --ink: #16161A;
  --ink-2: #3A3A40;
  --muted: #7A7A80;
  --line: rgba(22, 22, 26, .08);
  --line-2: rgba(22, 22, 26, .14);
  --gold: #D9A15B;
  --ok: #2F8F5B;
  --danger: #C2412D;
  --r: 22px;
  --r-sm: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 18px calc(110px + var(--safe-b)); }

/* barra superior */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 244, 240, .82); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.top.scrolled { border-bottom-color: var(--line); }
.top-in { max-width: 720px; margin: 0 auto; height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.brandmark { font-family: var(--serif); font-size: 27px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 2px; padding-left: 6px; }
.brandmark i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); display: inline-block; }
.top-title { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; color: var(--ink); }
.icon-btn:active { background: var(--line); }

/* tipografía */
.h-display { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.02; letter-spacing: -.015em; margin: 26px 0 6px; }
.h-display em { font-style: italic; color: var(--ink-2); }
.lead { color: var(--muted); font-size: 16px; margin: 0 0 22px; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05; margin: 6px 0 4px; letter-spacing: -.01em; }
.h3 { font-weight: 650; font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* botones */
.btn { height: 50px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s, opacity .2s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-soft { background: rgba(22,22,26,.06); color: var(--ink); }
.btn-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line-2); }
.btn-danger { background: rgba(194,65,45,.1); color: var(--danger); }
.btn-sm { height: 38px; padding: 0 15px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.link { color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }

/* tarjetas */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 14px; }
.stack > * + * { margin-top: 14px; }

/* inicio */
.new-cta { display: flex; align-items: center; gap: 16px; background: var(--ink); color: #fff; border-radius: var(--r); padding: 20px 20px; width: 100%; text-align: left; box-shadow: 0 12px 30px rgba(22,22,26,.18); }
.new-cta .plus { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 26px; flex: none; }
.new-cta b { display: block; font-size: 17px; }
.new-cta span { font-size: 14px; opacity: .7; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.brand-tile { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.brand-tile .art { aspect-ratio: 1 / .8; display: grid; place-items: center; padding: 18px; background: #FAFAF8; }
.brand-tile .art svg { max-height: 100%; width: auto; max-width: 100%; }
.brand-tile .art .ph { font-family: var(--serif); font-size: 46px; color: var(--muted); }
.brand-tile .meta { padding: 12px 14px 14px; }
.brand-tile .meta b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch-strip { display: flex; height: 6px; }
.swatch-strip i { flex: 1; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* nueva marca */
.big-input { width: 100%; border: 0; background: transparent; outline: none; resize: none; font-family: var(--serif); font-size: 27px; line-height: 1.2; min-height: 210px; padding: 0; color: var(--ink); }
.big-input::placeholder { color: #B9B8B3; }
.field { display: block; }
.field label, .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: var(--r-sm); padding: 13px 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,22,26,.07); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* cadena de agentes */
.chain { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 2px; margin: 10px -18px 0; padding-left: 18px; padding-right: 18px; }
.chain::-webkit-scrollbar { display: none; }
.step { flex: none; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 6px; border-radius: 999px; background: rgba(22,22,26,.05); color: var(--muted); font-size: 14px; font-weight: 600; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #fff; color: var(--muted); }
.step.done { color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.step.done .n { background: var(--ink); color: #fff; }
.step.now { color: var(--ink); background: #fff; box-shadow: 0 0 0 1.5px var(--ink); }
.step.now .n { background: var(--gold); color: #fff; }

.section { margin-top: 34px; scroll-margin-top: 70px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.agent-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.agent-tag .av { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; }

/* trabajando */
.working { display: flex; gap: 14px; align-items: center; padding: 22px 20px; }
.working .orb { width: 46px; height: 46px; border-radius: 50%; flex: none; background: conic-gradient(from 0deg, var(--gold), #E9D8BF, var(--ink), var(--gold)); animation: spin 1.6s linear infinite; position: relative; }
.working .orb::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.working b { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #EEE 0%, #F7F7F7 50%, #EEE 100%); background-size: 200% 100%; animation: sh 1.3s infinite; margin-top: 10px; }
@keyframes sh { to { background-position: -200% 0; } }

/* estrategia */
.kv { border-top: 1px solid var(--line); padding: 13px 0; }
.kv:first-of-type { border-top: 0; }
.kv .k { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.kv ul { margin: 4px 0 0; padding-left: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border-radius: 999px; background: rgba(22,22,26,.06); font-size: 14px; font-weight: 500; }
button.chip.on, .chip.on { background: var(--ink); color: #fff; }
.quote { font-family: var(--serif); font-size: 26px; line-height: 1.15; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* caminos */
.rail { display: flex; align-items: flex-start; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -18px; padding: 4px 18px 16px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: center; flex: none; width: min(86vw, 520px); }
.dir { background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.dir.chosen { box-shadow: 0 0 0 2.5px var(--ink), var(--shadow); }
.dir .board { position: relative; aspect-ratio: 1 / .78; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; }
.dir .board .pat { position: absolute; inset: 0 0 auto auto; width: 46%; height: 46%; border-bottom-left-radius: 120px; overflow: hidden; }
.dir .board .pat svg { width: 100%; height: 100%; }
.dir .board .nm { position: relative; font-size: 46px; line-height: .95; word-break: break-word; }
.dir .board .lm { position: relative; font-size: 15px; margin-top: 10px; opacity: .85; max-width: 80%; }
.dir .board .badge { position: absolute; top: 16px; left: 16px; background: rgba(255,255,255,.9); color: var(--ink); font-size: 12.5px; font-weight: 700; height: 28px; padding: 0 11px; border-radius: 999px; display: flex; align-items: center; gap: 5px; }
.palette { display: flex; height: 54px; }
.palette i { flex: 1; position: relative; }
.dir .body { padding: 18px 20px 20px; }
.dir .body .t { font-family: var(--serif); font-size: 28px; line-height: 1.05; }
.typo-line { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.typo-line b { display: block; color: var(--ink); font-size: 19px; font-weight: 500; }
.rail-dots { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
.rail-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; display: none; }
.more.open { display: block; }

/* logos */
.logo-card { background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; }
.logo-card.chosen { box-shadow: 0 0 0 2.5px var(--ink), var(--shadow); }
.logo-stage { background: #fff; display: grid; place-items: center; padding: 34px 26px; min-height: 210px; }
.logo-stage svg { max-height: 150px; width: auto; max-width: 100%; }
.logo-variants { display: grid; grid-template-columns: 1fr 1fr; }
.logo-variants div { display: grid; place-items: center; padding: 18px; height: 110px; }
.logo-variants svg { max-height: 64px; width: auto; max-width: 100%; }
.logo-card .body { padding: 16px 20px 20px; }

/* manual */
.manual-hero { border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.manual-hero .lg { padding: 40px 26px; display: grid; place-items: center; }
.manual-hero .lg svg { max-height: 160px; width: auto; max-width: 100%; }
.manual-hero .es { padding: 22px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sw { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.sw .c { height: 84px; padding: 10px; display: flex; align-items: flex-end; font-size: 12px; font-weight: 700; }
.sw .i { padding: 10px 12px; font-size: 12.5px; line-height: 1.35; }
.sw .i b { display: block; font-size: 14px; }
.specimen { padding: 18px 0; border-top: 1px solid var(--line); }
.specimen:first-child { border-top: 0; }
.specimen .big { font-size: 44px; line-height: 1.05; }
.pat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pat-grid > div { border-radius: 16px; overflow: hidden; aspect-ratio: 1.6; }
.pat-grid svg { width: 100%; height: 100%; }
.lv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lv-grid > div { border-radius: 16px; display: grid; place-items: center; padding: 18px; aspect-ratio: 1.5; border: 1px solid var(--line); }
.lv-grid svg { max-height: 70px; width: auto; max-width: 100%; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dos > div { border-radius: 16px; padding: 14px; font-size: 14px; }
.dos ul { margin: 6px 0 0; padding-left: 18px; }
.dos .yes { background: rgba(47,143,91,.08); }
.dos .no { background: rgba(194,65,45,.07); }
.copy-ex { border-left: 3px solid var(--gold); padding: 4px 0 4px 12px; margin: 12px 0; }
.copy-ex small { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; }

/* hoja inferior (sheet) */
.scrim { position: fixed; inset: 0; background: rgba(10,10,14,.32); z-index: 50; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--bg); border-radius: 26px 26px 0 0; max-height: 92vh; display: flex; flex-direction: column; animation: up .28s cubic-bezier(.2,.8,.2,1); max-width: 720px; margin: 0 auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px 20px; }
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 650; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; }
.sheet-body { overflow-y: auto; padding: 6px 20px 20px; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--bg); }
.sheet-foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* editor de logo */
.ed-preview { position: sticky; top: 0; z-index: 2; background: #fff; border-radius: 20px; display: grid; place-items: center; padding: 24px; min-height: 170px; box-shadow: var(--shadow); margin-bottom: 16px; }
.ed-preview svg { max-height: 130px; width: auto; max-width: 100%; }
.ed-group { margin-bottom: 18px; }
.sym-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sym-grid button { aspect-ratio: 1; border-radius: 12px; background: #fff; padding: 8px; border: 1.5px solid transparent; }
.sym-grid button.on { border-color: var(--ink); }
.font-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.font-list button { text-align: left; background: #fff; border-radius: 12px; padding: 10px 14px; border: 1.5px solid transparent; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.font-list button.on { border-color: var(--ink); }
.font-list .fs { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-list .fn { font-size: 11.5px; color: var(--muted); flex: none; }
.color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.color-row .lbl { width: 74px; margin: 0; flex: none; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; }
.dot { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); position: relative; }
.dot.on::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--ink); }
input[type=color] { width: 32px; height: 32px; border: 0; padding: 0; background: none; border-radius: 50%; overflow: hidden; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 50%; }
input[type=range] { width: 100%; accent-color: var(--ink); }

/* editor de paleta */
.pal-row { display: grid; grid-template-columns: 40px 1fr 30px; gap: 8px; align-items: start; background: #fff; border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.pal-row .inp-s { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; font-size: 14.5px; }
.pal-row .two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }

/* acceso */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 360px; text-align: center; }
.login .brandmark { justify-content: center; font-size: 52px; margin-bottom: 6px; }
.code-input { text-align: center; font-size: 22px; letter-spacing: .3em; height: 58px; }

#toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 80; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }

.fab-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 18px calc(14px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 60%, rgba(245,244,240,0)); z-index: 15; }
.fab-bar .in { max-width: 720px; margin: 0 auto; }

@media (min-width: 700px) {
  .h-display { font-size: 58px; }
  .brand-grid { grid-template-columns: repeat(3, 1fr); }
  .sym-grid { grid-template-columns: repeat(8, 1fr); }
}

/* impresión del manual */
@media print {
  body { background: #fff; }
  .top, .chain, .no-print, .fab-bar, #toast, .actions, .section:not(#sec-manual) { display: none !important; }
  .more { display: block !important; }
  .card, .manual-hero { box-shadow: none; border: 1px solid #eee; break-inside: avoid; }
  .wrap { padding: 0; max-width: none; }
  .print-page { break-before: page; }
}
