/* Cotizo — panel */

body.app { background: var(--paper); }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

/* Barra lateral */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
}
.side .brand { padding: 0 10px; }
.side .btn-primary { margin: 0 4px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 15px;
}
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.nav a.active { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-family: var(--display); font-weight: 600; font-size: 15px;
}
.side-user .who { min-width: 0; font-size: 14px; line-height: 1.3; }
.side-user .who b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.demo-flag {
  margin: 0 4px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px dashed var(--warn);
  background: var(--warn-soft);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}

/* Contenido */
.main { min-width: 0; padding: 36px 44px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: 34px; letter-spacing: -0.03em; }
.page-head p { margin-top: 6px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 22px; }
.card h2 { font-size: 20px; }

/* Cifras */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 28px; border-top: 1px solid var(--ink); }
.stat { padding: 18px 20px 4px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--line); }
.stat .label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat { min-width: 0; }
.stat .value { display: block; margin-top: 8px; font-family: var(--display); font-weight: 600; font-size: clamp(20px, 2.3vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; line-height: 1.1; }
.stat .foot { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.stat.alert .value { color: var(--danger); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--paper-2); }
.table .r { text-align: right; }
.table .doc-num { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.table .client { font-weight: 500; }
.table .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h3 { font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.empty .btn { margin-top: 18px; }

/* Filtros */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  font: 500 14px var(--sans); color: var(--muted); cursor: pointer;
}
.tabs button:hover { color: var(--ink); background: var(--paper-2); }
.tabs button.on { background: var(--ink); color: var(--paper); }
.search { width: 240px; height: 34px; }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.editor-form { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-pick label { position: relative; }
.type-pick input { position: absolute; opacity: 0; }
.type-pick span {
  display: block; padding: 12px 12px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--card); text-align: center; font-size: 14px; font-weight: 500; cursor: pointer;
}
.type-pick input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.type-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.items { display: grid; gap: 10px; }
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 130px 32px;
  gap: 8px;
  align-items: start;
}
.item-row .input { height: 40px; }
.item-row .qty, .item-row .price { text-align: right; font-family: var(--mono); font-size: 14px; }
.item-head { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.item-head span:nth-child(2), .item-head span:nth-child(3) { text-align: right; }
.icon-btn {
  width: 32px; height: 40px; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
.add-item { justify-self: start; }

.totals-box { display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--r); background: var(--paper-2); font-size: 14.5px; }
.totals-box div { display: flex; justify-content: space-between; gap: 12px; }
.totals-box .grand { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line-strong); font-family: var(--display); font-weight: 600; font-size: 22px; }

.section-label { font-family: var(--display); font-weight: 600; font-size: 18px; margin-bottom: -6px; }

.preview-col { position: sticky; top: 24px; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); }

/* Hoja de vista previa (imita el PDF) */
.sheet {
  --a: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 210 / 297;
  padding: 7% 7.5%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-paper);
  color: #3b3b35;
  font-size: 10.5px;
  line-height: 1.45;
}
.sheet.font-times { font-family: "Times New Roman", Georgia, serif; }
.sheet.font-courier { font-family: "Courier New", ui-monospace, monospace; }
.sheet b { color: #181816; }
.sheet-head { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet.pos-right .sheet-head { flex-direction: row-reverse; }
.sheet.pos-right .sheet-title { text-align: left; }
.sheet.pos-center .sheet-head { flex-direction: column; align-items: center; text-align: center; }
.sheet.pos-center .sheet-title { text-align: center; }

.sheet-logo {
  --s: 44px;
  flex: none;
  width: var(--s); height: var(--s);
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--a);
  color: #fff;
  font-weight: 600;
  font-size: calc(var(--s) * .45);
}
.sheet-logo.size-s { --s: 34px; }
.sheet-logo.size-l { --s: 58px; }
.sheet-logo.shape-square { border-radius: 22%; }
.sheet-logo.shape-original { border-radius: 0; background: transparent; }
.sheet-logo.shape-original:not(:has(img)) { background: var(--a); border-radius: 22%; }
.sheet-logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.sheet-logo.shape-original img { object-fit: contain; background: transparent; }

.sheet-title { text-align: right; }
.sheet-title h3 { font-size: 21px; letter-spacing: -0.03em; color: #181816; }
.sheet-title .mono { font-size: 10px; color: #8a8a80; }
.sheet-meta { margin-top: 6px; color: #8a8a80; font-size: 9.5px; }
.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0 14px; }
.sheet-parties > div { line-height: 1.5; }
.sheet-parties .to { padding: 10px 12px; margin: -10px 0 0; border-radius: 4px; background: #f6f5f1; }
.sheet-parties small { display: block; font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a8a80; }
.sheet-parties b { font-size: 11.5px; }
.sheet-project { margin-bottom: 8px; font-weight: 600; font-size: 12px; color: #181816; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet th { padding: 6px 8px; text-align: left; font-size: 8px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #fff; background: var(--a); }
.sheet td { padding: 6px 8px; border-bottom: 1px solid #ebe9e1; vertical-align: top; }
.sheet .r { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 9.5px; }
.sheet .empty-row { padding: 14px 8px; color: #aaa89e; }
.sheet-totals { width: 54%; margin: 12px 0 0 auto; display: grid; gap: 3px; }
.sheet-totals div { display: flex; justify-content: space-between; gap: 8px; }
.sheet-totals .grand { margin: 4px 0 2px; padding-top: 6px; border-top: 1.5px solid #181816; font-size: 13px; font-weight: 700; color: #181816; }
.sheet-totals .strong { color: #181816; font-weight: 600; }
.sheet-notes { margin-top: auto; padding-top: 12px; display: grid; gap: 7px; font-size: 9.5px; }
.sheet-notes small { display: block; font-size: 7.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a8a80; }
.sheet-sign { display: grid; gap: 2px; width: 46%; }
.sheet-sign img { height: 38px; width: auto; max-width: 100%; object-fit: contain; object-position: left; }
.sheet-sign span { padding-top: 3px; border-top: 1px solid #181816; color: #8a8a80; font-size: 9px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 7px; border-top: 1px solid #ebe9e1; font-size: 8px; color: #aaa89e; }
.sheet-wm {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 800 44px var(--sans);
  letter-spacing: .02em;
  color: rgba(24, 24, 22, .06);
  transform: rotate(-32deg);
  pointer-events: none;
  white-space: nowrap;
}

/* Plantilla clásica */
.sheet.tpl-classic::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--a); }

/* Plantilla moderna: franja de color arriba */
.sheet.tpl-modern { padding-top: 0; }
.sheet.tpl-modern .sheet-head {
  margin: 0 -11% 4px;
  padding: 7% 11% 6%;
  background: var(--a);
  color: #fff;
}
.sheet.tpl-modern .sheet-head .sheet-logo { background: #fff; color: var(--a); }
.sheet.tpl-modern .sheet-title h3 { color: #fff; }
.sheet.tpl-modern .sheet-title .mono, .sheet.tpl-modern .sheet-meta { color: rgba(255,255,255,.75); }
.sheet.tpl-modern .sheet-parties .to { background: transparent; padding: 0; margin: 0; }
.sheet.tpl-modern th { background: transparent; color: var(--a); border-bottom: 2px solid var(--a); padding-left: 0; }
.sheet.tpl-modern td { border-bottom: 0; padding-left: 0; }
.sheet.tpl-modern tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--a) 6%, #fff); }
.sheet.tpl-modern .sheet-totals .grand { border: 0; padding: 6px 8px; border-radius: 4px; background: var(--a); color: #fff; }

/* Plantilla minimal: casi sin color */
.sheet.tpl-minimal .sheet-title small { display: block; font-size: 8.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--a); }
.sheet.tpl-minimal .sheet-title h3 { font-weight: 400; font-size: 20px; }
.sheet.tpl-minimal .sheet-parties .to { background: transparent; padding: 0; margin: 0; }
.sheet.tpl-minimal .sheet-parties small, .sheet.tpl-minimal .sheet-notes small { color: var(--a); }
.sheet.tpl-minimal th { background: transparent; color: #8a8a80; border-bottom: 1px solid #181816; padding-left: 0; }
.sheet.tpl-minimal td { padding-left: 0; }
.sheet.tpl-minimal .sheet-totals .grand { border-top-color: var(--a); color: var(--a); }

/* Ajustes */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding: 28px 0; border-top: 1px solid var(--line); }
.settings:first-of-type { border-top: 1px solid var(--ink); }
.settings h2 { font-size: 20px; }
.settings > div:first-child p { margin-top: 6px; font-size: 14px; color: var(--muted); }
.settings-body { display: grid; gap: 14px; max-width: 620px; }
.swatch-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch-pick button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.swatch-pick button.on { box-shadow: 0 0 0 2px var(--ink); }
.logo-drop { display: flex; align-items: center; gap: 16px; }


/* Modal */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(28, 27, 24, .38);
  display: grid; place-items: center;
  padding: 16px;
}
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border-radius: var(--r-lg); padding: 28px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); }
.modal h2 { font-size: 24px; margin-bottom: 20px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.mobile-top { display: none; }

/* Responsive */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 1fr; }
  .preview-col { position: static; max-width: 560px; }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .settings { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30;
    padding: 10px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line);
  }
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; font-size: 11.5px; color: var(--muted); text-decoration: none; }
  .mobile-nav a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
  .mobile-nav a.active { color: var(--accent); }
  .main { padding: 22px 16px 96px; }
  .page-head h1 { font-size: 28px; }
  .search { width: 100%; }
  .table .hide-sm { display: none; }
  .table th, .table td { padding: 12px 10px; }
}
@media (min-width: 821px) { .mobile-nav { display: none; } }
@media (max-width: 520px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stat, .stat + .stat { padding-left: 0; border-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line); }
  .item-row { grid-template-columns: minmax(0, 1fr) 56px 32px; }
  .item-row .price { grid-column: 1 / 3; }
  .item-head { display: none; }
  .type-pick { grid-template-columns: 1fr; }
  .modal { padding: 22px; }
}

/* ── Animaciones del panel ─────────── */
.view-enter > * { animation: fade-up .5s var(--ease) both; }
.view-enter > *:nth-child(2) { animation-delay: .06s; }
.view-enter > *:nth-child(3) { animation-delay: .12s; }
.view-enter > *:nth-child(n+4) { animation-delay: .18s; }
.table tbody tr { animation: fade-up .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + .15s); }
.modal-back { animation: fade-in .2s ease both; }
.modal { animation: pop .35s var(--ease) both; }
.sheet { transition: box-shadow .3s; }
.item-row.added { animation: fade-up .35s var(--ease) both; }
.side-tools { display: flex; align-items: center; gap: 8px; margin: 0 4px; }
.side-tools span { font-size: 13px; color: var(--muted); }
.mobile-top .right { display: flex; align-items: center; gap: 8px; }
.nav a { transition: background .2s, color .2s; }
.nav a svg { transition: transform .3s var(--ease); }
.nav a:hover svg { transform: translateX(2px); }

/* ═════════════════════════════════════════════
   Funciones por plan
   ═════════════════════════════════════════════ */

.text-link { padding: 0; border: 0; background: none; color: var(--accent); font: 500 13.5px var(--sans); text-decoration: none; cursor: pointer; }
.text-link:hover { text-decoration: underline; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.btn.danger { color: var(--danger); margin-right: auto; }
.btn .i-lock, .lock-pill .i-lock { width: 12px; height: 12px; }

/* Etiqueta de candado */
.i-lock { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font: 600 11px var(--sans);
  letter-spacing: 0;
  text-transform: none;
  vertical-align: middle;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s;
}
.lock-pill:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--warn) 22%, transparent); }
.btn .lock-pill { margin: 0 2px 0 -4px; }
.btn[disabled]:has(.lock-pill) { opacity: 1; cursor: default; color: var(--muted); }
.btn[disabled] .lock-pill { cursor: pointer; pointer-events: auto; }
.is-locked > span:not(.lock-pill), .is-locked .label { color: var(--muted); }
.is-locked input:disabled, .is-locked select:disabled { opacity: .55; cursor: not-allowed; }

/* Plan en la barra lateral */
.plan-card {
  margin: 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  display: grid;
  gap: 10px;
  font-size: 13px;
}
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-top span { color: var(--muted); font-size: 12px; }
.pc-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .8s var(--ease); }
.meter-bar.full i { background: var(--danger); }
.nav a { position: relative; }
.nav-lock { margin-left: auto; color: var(--muted); display: inline-flex; }
.nav-lock .i-lock { width: 14px; height: 14px; }

.plan-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--paper-2); color: var(--ink-2);
}
.plan-chip .i-lock { width: 12px; height: 12px; }
.plan-chip.plan-esencial { background: var(--accent-soft); color: var(--accent); }
.plan-chip.plan-pro { background: #f6e7a8; color: #4d3d05; }
.plan-chip.plan-negocio { background: var(--info-soft); color: var(--info); }
.plan-chip.plan-premium { background: #e9e2ff; color: #4a32b3; }
:root[data-theme-resolved="dark"] .plan-chip.plan-pro { background: #3b3312; color: #f2d86a; }
:root[data-theme-resolved="dark"] .plan-chip.plan-premium { background: #2a2245; color: #c4b2ff; }

/* Aviso de mejora en el resumen */
.upsell {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--accent-soft), transparent 80%);
}
.upsell b { display: block; }
.upsell span { color: var(--ink-2); font-size: 14px; }
.tag-partial { background: var(--warn-soft); color: var(--warn); }

/* Editor: bloques y opciones */
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head .section-label { margin: 0; }
.item-row { grid-template-columns: minmax(0, 1fr) 72px 130px 32px; }
.item-row .disc-col { display: none; }
.item-row.with-disc { grid-template-columns: minmax(0, 1fr) 64px 120px 64px 32px; }
.item-row.with-disc .disc-col { display: block; }
.item-head.with-disc span.disc-col { display: block; text-align: right; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i {
  position: relative; width: 34px; height: 20px; flex: none;
  border-radius: 999px; background: var(--line-strong);
  transition: background .25s;
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .3s var(--ease);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.is-locked { cursor: default; }

.options {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
}
.options summary {
  display: grid; gap: 2px;
  padding: 16px 44px 16px 18px;
  list-style: none; cursor: pointer; position: relative;
}
.options summary::-webkit-details-marker { display: none; }
.options summary span { font-weight: 600; letter-spacing: -0.02em; }
.options summary small { color: var(--muted); font-size: 13px; }
.options summary::after { content: "+"; position: absolute; right: 18px; top: 16px; font-size: 22px; font-weight: 300; color: var(--muted); transition: transform .3s var(--ease); }
.options[open] summary::after { transform: rotate(45deg); }
.options-body { display: grid; gap: 16px; padding: 0 18px 18px; animation: fade-up .4s var(--ease) both; }

.tpl-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl { position: relative; display: grid; gap: 6px; cursor: pointer; }
.tpl input { position: absolute; opacity: 0; }
.tpl-thumb {
  position: relative; display: block; aspect-ratio: 4 / 5;
  border: 1.5px solid var(--line-strong); border-radius: 8px;
  background: #fff; overflow: hidden;
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s;
}
.tpl:hover .tpl-thumb { transform: translateY(-2px); box-shadow: var(--shadow-paper); }
.tpl input:checked + .tpl-thumb { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl input:focus-visible + .tpl-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.tpl-thumb i { position: absolute; left: 14%; right: 14%; height: 6%; border-radius: 2px; background: #e6e4dc; }
.tpl-thumb i:nth-child(1) { top: 10%; width: 22%; right: auto; height: 14%; border-radius: 50%; background: var(--accent); }
.tpl-thumb i:nth-child(2) { top: 36%; background: var(--accent); }
.tpl-thumb i:nth-child(3) { top: 48%; }
.tpl-thumb i:nth-child(4) { top: 58%; right: 40%; }
.tpl-thumb.tpl-classic::before { content: ""; position: absolute; inset: 0 0 auto; height: 4%; background: var(--accent); }
.tpl-thumb.tpl-modern i:nth-child(1) { top: 0; left: 0; right: 0; width: auto; height: 28%; border-radius: 0; }
.tpl-thumb.tpl-modern i:nth-child(2) { background: transparent; border-bottom: 2px solid var(--accent); border-radius: 0; }
.tpl-thumb.tpl-minimal i:nth-child(1) { width: 12%; height: 9%; background: #cfccc0; }
.tpl-thumb.tpl-minimal i:nth-child(2) { height: 1.5%; background: #161714; }
.tpl-name { display: flex; align-items: center; flex-wrap: wrap; font-size: 13px; font-weight: 500; }
.tpl.is-locked { cursor: default; }
.tpl.is-locked .tpl-thumb { opacity: .55; filter: grayscale(.6); }
.type-pick label.is-locked span { color: var(--muted); cursor: default; }

.totals-box .sub { color: var(--muted); font-size: 13.5px; }
.payments { display: grid; gap: 6px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.payments .section-label { margin: 0 0 4px; font-size: 15px; }
.pay-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); }
.pay-row.total { padding-top: 6px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }

/* Modales */
.modal-back.closing { animation: fade-in .18s ease reverse both; }
.modal.wide { max-width: 720px; }
.modal .hint { display: block; }
.pick-list { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.pick {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--ink); font: 500 14.5px var(--sans); text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}
.pick:hover { border-color: var(--accent); background: var(--accent-soft); }
.pick.picked { animation: pop .35s var(--ease); }
.pick .num { color: var(--ink-2); font-size: 13.5px; }

.upgrade { display: grid; gap: 14px; }
.upgrade .plan-chip { justify-self: start; }
.upgrade h2 { margin: 0; font-size: 26px; letter-spacing: -0.04em; }
.up-cycle { display: inline-flex; justify-self: start; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); }
.up-cycle button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 500 13.5px var(--sans); cursor: pointer; }
.up-cycle button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.up-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.up-price b { font-size: 34px; font-weight: 650; letter-spacing: -0.04em; }
.up-price span { color: var(--muted); font-size: 14px; }
.up-list { list-style: none; margin: 0; padding: 14px 0 0; display: grid; gap: 8px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.up-list li { position: relative; padding-left: 24px; }
.up-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.upgrade .actions { margin-top: 6px; }
.up-note { font-size: 12.5px; color: var(--muted); text-align: center; }

/* Páginas bloqueadas */
.locked-page { position: relative; min-height: 380px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--card); }
.locked-preview { padding: 24px; filter: blur(5px); opacity: .55; pointer-events: none; user-select: none; }
.locked-cta {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 24px; text-align: center;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--card) 92%, transparent) 30%, transparent 75%);
}
.locked-cta h2 { font-size: 26px; letter-spacing: -0.04em; }
.locked-cta p { max-width: 30em; color: var(--ink-2); }
.fake-chart { display: flex; align-items: flex-end; gap: 18px; height: 300px; padding: 20px; }
.fake-chart i { flex: 1; border-radius: 6px 6px 0 0; background: var(--accent); }

/* Reportes */
.report-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.report-grid h2 { font-size: 18px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.legend .l1, .bar-pair .b1 { background: color-mix(in srgb, var(--accent) 35%, var(--paper-2)); }
.legend .l2, .bar-pair .b2 { background: var(--accent); }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 240px; margin-top: 20px; }
.bar-col { display: grid; grid-template-rows: 1fr auto; gap: 8px; text-align: center; font-size: 12.5px; color: var(--muted); }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bar-pair i { width: 36%; max-width: 26px; height: var(--h); min-height: 2px; border-radius: 5px 5px 0 0; transform-origin: bottom; animation: grow .9s var(--ease) both; }
.bar-pair .b2 { animation-delay: .12s; }
@keyframes grow { from { transform: scaleY(0); } }
.top-list { display: grid; gap: 14px; margin-top: 18px; }
.top-row { display: grid; gap: 6px; font-size: 14px; animation: fade-up .5s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }

/* Ajustes */
.current-plan { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.current-plan p { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-plan { display: grid; gap: 6px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); transition: border-color .2s, transform .25s var(--ease); }
.mini-plan:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.mini-plan.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mini-plan .num { font-size: 18px; font-weight: 600; }
.mini-plan small { font-size: 12px; color: var(--muted); font-weight: 400; }
.mini-plan .btn { margin-top: 4px; }

.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.brand-preview { position: sticky; top: 24px; }
.brand-preview .sheet { font-size: 7px; padding: 8% 8%; }
.brand-preview .sheet-title h3 { font-size: 14px; }
.brand-preview .sheet-logo { --s: 30px; }
.brand-preview .sheet-logo.size-s { --s: 22px; }
.brand-preview .sheet-logo.size-l { --s: 40px; }
.brand-preview .sheet-wm { font-size: 26px; }
.brand-preview .sheet-sign img { height: 24px; }

.logo-drop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev { --s: 64px; font-size: 26px; }
.logo-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo-btns .btn.disabled { opacity: .5; pointer-events: none; }
.segs { display: inline-flex; flex-wrap: wrap; gap: 0; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-2); justify-self: start; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 14px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 500; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg.is-locked span { cursor: default; opacity: .6; }
.custom-color { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line-strong); display: grid; place-items: center; color: var(--muted); cursor: pointer; overflow: hidden; }
.custom-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.custom-color.is-locked { opacity: .5; cursor: default; }
.custom-color.is-locked input { cursor: not-allowed; }
.sign-box { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--card); overflow: hidden; }
#sign-pad { display: block; width: 100%; height: auto; aspect-ratio: 520 / 150; touch-action: none; cursor: crosshair; background: repeating-linear-gradient(transparent 0 74%, var(--line) 74% 75%, transparent 75% 100%); }
.is-locked #sign-pad { cursor: not-allowed; opacity: .5; }
.sign-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); }
.data-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.data-row:last-child { border-bottom: 0; }
.data-row b { display: block; font-weight: 500; }
.save-bar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 560px; margin: 12px auto 0; padding: 10px 10px 10px 18px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
  box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .35s var(--ease);
  font-size: 14px;
}
.save-bar.show { opacity: 1; transform: none; pointer-events: auto; }

@media (max-width: 1100px) {
  .brand-layout { grid-template-columns: 1fr; }
  .brand-preview { position: static; max-width: 320px; }
  .report-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .item-row.with-disc { grid-template-columns: minmax(0, 1fr) 56px 32px; }
  .tpl-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .save-bar { border-radius: var(--r); bottom: 84px; }
}

/* ═════════════════════════════════════════════
   Agradecimiento al comprar un plan
   ═════════════════════════════════════════════ */

.celebrate {
  --c1: #1f5c43; --c2: #f2d86a;
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c1) 45%, #0b0c0b) 0%, rgba(8, 9, 8, .88) 70%);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.celebrate.plan-pro { --c1: #b8941c; --c2: #f2d86a; }
.celebrate.plan-negocio { --c1: #2f5687; --c2: #86ade0; }
.celebrate.plan-premium { --c1: #5b3fd0; --c2: #e8cd5a; }
.celebrate.show { opacity: 1; }
.celebrate.hide { opacity: 0; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cel-card {
  position: relative;
  width: 100%; max-width: 470px;
  max-height: calc(100vh - 32px); overflow: auto;
  padding: 36px 32px 28px;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.6), 0 0 0 1px color-mix(in srgb, var(--c2) 40%, transparent);
  transform: translateY(30px) scale(.94);
  opacity: 0;
  transition: transform .7s cubic-bezier(.2, 1.3, .3, 1), opacity .4s;
  transition-delay: .15s;
}
.celebrate.show .cel-card { transform: none; opacity: 1; }
.cel-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 120px;
  border-radius: 24px 24px 0 0;
  background: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--c2) 35%, transparent), transparent 70%);
  pointer-events: none;
}
.cel-badge { position: relative; width: 96px; height: 96px; margin: 0 auto 16px; }
.cel-badge::before {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--c1), var(--c2), var(--c1));
  filter: blur(14px); opacity: .55;
  animation: spin 6s linear infinite;
}
.cel-badge svg { position: relative; width: 100%; height: 100%; border-radius: 50%; background: var(--c1); }
.cel-badge .ring { fill: none; stroke: var(--c2); stroke-width: 4; stroke-dasharray: 327; stroke-dashoffset: 327; transform: rotate(-90deg); transform-origin: center; }
.cel-badge .check { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; }
.celebrate.show .ring { animation: draw 1s .45s var(--ease) forwards; }
.celebrate.show .check { animation: draw .55s 1.15s var(--ease) forwards; }
.celebrate.show .cel-badge { animation: pop .7s .3s var(--ease) both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.cel-kicker { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cel-card h2 { margin-top: 8px; font-size: clamp(28px, 6vw, 36px); line-height: 1.05; letter-spacing: -0.05em; }
.cel-card h2 span {
  background: linear-gradient(100deg, var(--c1), var(--c2), var(--c1));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shine 3s linear infinite;
}
@keyframes shine { to { background-position: -200% 0; } }
.cel-sub { margin: 12px auto 0; max-width: 30em; color: var(--ink-2); }
.cel-list { list-style: none; display: grid; gap: 8px; margin: 22px 0 24px; padding: 0; text-align: left; }
.cel-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--paper-2);
  font-size: 14.5px;
  opacity: 0; transform: translateX(-12px);
}
.celebrate.show .cel-list li { animation: slide-in .5s var(--ease) forwards; animation-delay: calc(1.3s + var(--i) * 110ms); }
@keyframes slide-in { to { opacity: 1; transform: none; } }
.cel-list li span { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--c1); color: #fff; font-size: 12px; font-weight: 700; }
.cel-go { width: 100%; --bg: var(--c1); --fg: #fff; --bd: var(--c1); }
.cel-go:hover { --bg: color-mix(in srgb, var(--c1) 85%, #000); --bd: var(--bg); transform: translateY(-1px); }
.cel-foot { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .cel-card { padding: 28px 20px 22px; } }
.pc-top { flex-wrap: wrap; }
.pc-top b { white-space: nowrap; }
.brand-preview .sheet th, .brand-preview .sheet td { padding: 4px 4px; }
.brand-preview .sheet .r { font-size: 6px; }
.brand-preview .sheet th { font-size: 5.5px; }
.brand-preview .sheet-parties b { font-size: 8px; }
