/* ==========================================================================
   MailSender — sistema de diseño
   Basado en el lenguaje visual de DESIGN-mobbin.md: lienzo blanco, tinta casi
   negra, escalera de grises en lugar de sombras, controles en forma de píldora,
   tarjetas de 24px y un único acento azul reservado para señales comerciales.
   Tipografía: Inter (variable) como sustituto de Saans — 652 / 456 / 300.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #141414;
  --ink-soft: #262626;
  --muted: #707070;
  --faint: #adadad;
  --canvas: #ffffff;
  --soft: #f3f3f3;
  --soft-2: #ebebeb;
  --field: #f0f0f0;
  --hair-soft: #f0f0f0;
  --hair: #e0e0e0;
  --accent: #0066ff;

  --r-sm: 16px;
  --r-md: 24px;
  --r-full: 9999px;

  --w-heading: 652;
  --w-text: 456;
  --w-light: 300;
  --w-semi: 600;

  --font: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 272px;
  --scrim: rgba(20, 20, 20, 0.45);
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: var(--w-text);
  line-height: 1.38;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg, iframe { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--hair); margin: 24px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: var(--ink); color: var(--canvas); }
.icon { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Tipografía ──────────────────────────────────────────────────────────── */
.t-display { font-size: clamp(44px, 8vw, 80px); font-weight: var(--w-heading); line-height: 1; }
.t-h1 { font-size: clamp(36px, 5.6vw, 56px); font-weight: var(--w-heading); line-height: 1; }
.t-h2 { font-size: clamp(30px, 4.4vw, 44px); font-weight: var(--w-heading); line-height: 1.13; }
.t-h3 { font-size: clamp(24px, 3.2vw, 32px); font-weight: var(--w-heading); line-height: 1.13; }
.t-h4 { font-size: 24px; font-weight: var(--w-heading); line-height: 1.25; }
.t-title { font-size: 20px; font-weight: var(--w-semi); line-height: 1.3; }
.t-lead { font-size: 20px; font-weight: var(--w-light); line-height: 1.38; }
.t-body { font-size: 16px; }
.t-sm { font-size: 14px; line-height: 1.43; }
.t-label { font-size: 12px; font-weight: var(--w-semi); line-height: 1.33; }
.t-cap { font-size: 12px; line-height: 1.33; }
.t-link { font-weight: var(--w-semi); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.semi { font-weight: var(--w-semi); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.underline, .prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hair); }
a.underline:hover, .prose a:hover { text-decoration-color: var(--ink); }
.link-muted { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link-muted:hover { color: var(--ink); }

/* ─── Utilidades de layout ────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.w-full { width: 100%; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.col-2 { grid-column: span 2; }
.inline { display: inline-flex; align-items: center; gap: 8px; }

/* ─── Botones (todo es una píldora) ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: var(--r-full);
  font-size: 15px; font-weight: var(--w-semi); line-height: 1; white-space: nowrap;
  background: var(--ink); color: var(--canvas);
  border: 1px solid var(--ink);
  transition: background .15s, border-color .15s, opacity .15s;
  user-select: none;
}
.btn:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .4; pointer-events: none; }
.btn-outline { background: var(--canvas); color: var(--ink); border-color: var(--hair); }
.btn-outline:hover { background: var(--soft); border-color: var(--hair); }
.btn-soft { background: var(--soft); color: var(--ink); border-color: var(--soft); }
.btn-soft:hover { background: var(--soft-2); border-color: var(--soft-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--soft); border-color: transparent; }
.btn-danger { background: var(--canvas); color: var(--ink); border: 1px dashed var(--ink); }
.btn-danger:hover { background: var(--ink); color: var(--canvas); border-style: solid; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-xs { height: 30px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 36px; height: 36px; }
.btn-icon.btn-xs { width: 30px; height: 30px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn .spinner, .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Formularios ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field, .field + .form-row, .form-row + .field, .form-row + .form-row { margin-top: 20px; }
.form-row > .field + .field { margin-top: 0; }
.label { font-size: 14px; font-weight: var(--w-semi); }
.label .opt { color: var(--muted); font-weight: var(--w-text); }
.help { font-size: 13px; color: var(--muted); line-height: 1.4; }
.field-error { font-size: 13px; color: var(--ink); font-weight: var(--w-semi); display: flex; gap: 6px; align-items: center; }
.field-error::before { content: ""; width: 6px; height: 6px; background: var(--ink); border-radius: 50%; flex: none; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.input, .select, .textarea {
  width: 100%;
  background: var(--field);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: 12px 16px;
  min-height: 48px;
  font-size: 16px;
  color: var(--ink);
  transition: border-color .12s, background .12s;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); background: var(--field); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }
.input[readonly] { color: var(--muted); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.55; min-height: 420px; tab-size: 2; white-space: pre; overflow: auto; }
.select {
  padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-sm, .select.input-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 14px; }
.select.input-sm { padding-right: 38px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 46px; }
.input-affix { display: flex; gap: 8px; }
input[type="file"].input { padding: 10px 14px; cursor: pointer; }
input[type="datetime-local"].input, input[type="date"].input { cursor: text; }

/* checkbox / radio / switch */
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 15px; line-height: 1.35; }
.check input { appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid #c8c8c8; border-radius: 6px; background: var(--canvas); display: grid; place-content: center; cursor: pointer; transition: background .12s, border-color .12s; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat; }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border-radius: 50%; background: var(--canvas); }
.check input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.check small { display: block; color: var(--muted); font-size: 13px; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { appearance: none; position: relative; flex: none; width: 46px; height: 28px; border-radius: var(--r-full); background: #d4d4d4; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--canvas); transition: transform .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch .sw-text { font-size: 15px; line-height: 1.3; }
.switch .sw-text small { display: block; color: var(--muted); font-size: 13px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--hair); background: var(--canvas); cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { background: var(--soft); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--canvas); }
.choice .check { pointer-events: none; }
.choice .c-title { font-weight: var(--w-semi); font-size: 15px; }
.choice .c-sub { font-size: 13px; color: var(--muted); }

/* ─── Tarjetas ────────────────────────────────────────────────────────────── */
.card { background: var(--canvas); border: 1px solid var(--hair-soft); border-radius: var(--r-md); padding: 24px; }
.card-soft { background: var(--soft); border-radius: var(--r-md); padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-head h2, .card-head h3 { font-size: 20px; font-weight: var(--w-semi); line-height: 1.3; }
.card-pad-sm { padding: 16px 20px; }
.card-link { display: block; transition: background .15s, border-color .15s; }
.card-link:hover { background: var(--soft); border-color: var(--soft); }
.divider { height: 1px; background: var(--hair); margin: 20px 0; border: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 20px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* Azulejos de icono (squircle 30%) */
.tile { width: 44px; height: 44px; border-radius: 30%; background: var(--soft); display: grid; place-content: center; color: var(--ink); flex: none; }
.tile-ink { background: var(--ink); color: var(--canvas); }
.tile-white { background: var(--canvas); border: 1px solid var(--hair-soft); }
.tile-sm { width: 32px; height: 32px; }
.tile-lg { width: 64px; height: 64px; }
.tile-xl { width: 96px; height: 96px; }

/* Estadística */
.stat { background: var(--soft); border-radius: var(--r-md); padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .s-label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .s-value { font-size: clamp(28px, 3.2vw, 40px); font-weight: var(--w-heading); line-height: 1.1; }
.stat .s-sub { font-size: 13px; color: var(--muted); }
.stat.stat-ink { background: var(--ink); color: var(--canvas); }
.stat.stat-ink .s-label, .stat.stat-ink .s-sub { color: #bdbdbd; }
.stat.stat-white { background: var(--canvas); border: 1px solid var(--hair-soft); }

/* ─── Insignias ───────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: var(--r-full); background: var(--soft); color: var(--ink); font-size: 12px; font-weight: var(--w-semi); white-space: nowrap; line-height: 1; }
.badge .icon { width: 13px; height: 13px; }
.badge-ink { background: var(--ink); color: var(--canvas); }
.badge-outline { background: var(--canvas); border: 1px solid var(--hair); }
.badge-dashed { background: var(--canvas); border: 1px dashed var(--ink); }
.badge-muted { color: var(--muted); }
.badge-accent { background: var(--accent); color: var(--canvas); }
.badge-overlay { background: rgba(115, 115, 115, 0.56); color: var(--canvas); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ─── Alertas / toasts ────────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--r-sm); background: var(--soft); font-size: 14px; line-height: 1.45; }
.alert .icon { margin-top: 1px; }
.alert-ink { background: var(--ink); color: var(--canvas); }
.alert-outline { background: var(--canvas); border: 1px solid var(--hair); }
.alert-dashed { background: var(--canvas); border: 1px dashed var(--ink); }
.alert strong { font-weight: var(--w-semi); }
.alert + .alert { margin-top: 12px; }

.toasts { position: fixed; z-index: 100; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-full); background: var(--ink); color: var(--canvas); font-size: 14px; font-weight: var(--w-semi); animation: toast-in .25s ease-out; max-width: 100%; }
.toast.toast-error { background: var(--canvas); color: var(--ink); border: 1px dashed var(--ink); }
.toast .toast-msg { overflow-wrap: anywhere; line-height: 1.35; }
.toast button { margin-left: 4px; opacity: .7; display: grid; place-content: center; }
.toast button:hover { opacity: 1; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ─── Tablas ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-card { border: 1px solid var(--hair-soft); border-radius: var(--r-md); overflow: hidden; background: var(--canvas); }
table.table th { background: var(--soft); text-align: left; padding: 12px 16px; font-size: 12px; font-weight: var(--w-semi); color: var(--muted); white-space: nowrap; }
table.table td { padding: 12px 16px; border-top: 1px solid var(--hair-soft); font-size: 14px; line-height: 1.43; vertical-align: middle; }
table.table tbody tr:first-child td { border-top: 0; }
table.table tbody tr:hover td { background: #fafafa; }
table.table .cell-main { font-weight: var(--w-semi); }
table.table .cell-sub { color: var(--muted); font-size: 13px; }
table.table .r { text-align: right; }
table.table .actions { text-align: right; white-space: nowrap; width: 1%; }
table.table input[type="checkbox"] { margin: 0; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--hair-soft); font-size: 14px; color: var(--muted); }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--canvas); display: grid; place-content: center; font-size: 13px; font-weight: var(--w-semi); flex: none; }
.avatar-soft { background: var(--soft); color: var(--ink); }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* ─── Control segmentado, pestañas y paginación ───────────────────────────── */
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--soft); border-radius: var(--r-full); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--r-full); font-size: 14px; font-weight: var(--w-semi); color: var(--muted); white-space: nowrap; transition: color .12s, background .12s; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg a.is-active, .seg button.is-active { background: var(--canvas); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 20, 20, .08); }
.seg .count { font-size: 12px; font-weight: var(--w-semi); color: var(--muted); }

.pager { display: flex; align-items: center; gap: 6px; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-full); display: inline-grid; place-content: center; font-size: 14px; font-weight: var(--w-semi); }
.pager a:hover { background: var(--soft); }
.pager .is-current { background: var(--ink); color: var(--canvas); }
.pager .is-gap { color: var(--faint); }

/* ─── Medidores y progreso ────────────────────────────────────────────────── */
.meter { height: 8px; border-radius: var(--r-full); background: #e6e6e6; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: var(--r-full); background: var(--ink); min-width: 0; transition: width .4s ease; }
.meter-lg { height: 12px; }
.meter.is-full > span { background: repeating-linear-gradient(135deg, var(--ink) 0 6px, #555 6px 12px); }
.progress { display: flex; height: 12px; border-radius: var(--r-full); background: #e6e6e6; overflow: hidden; gap: 2px; }
.progress > span { display: block; height: 100%; transition: width .5s ease; }
.progress .p-sent { background: var(--ink); }
.progress .p-fail { background: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 5px); background-color: #bdbdbd; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 8px; vertical-align: middle; background: var(--ink); }
.legend i.l-accent { background: var(--accent); }
.legend i.l-gray { background: #8f8f8f; }
.legend i.l-hatch { height: 10px; width: 14px; border-radius: 3px; background: repeating-linear-gradient(135deg, var(--ink) 0 2px, #fff 2px 4px); }
.legend i.l-sent { background: var(--ink); }

/* ─── Estados vacíos ──────────────────────────────────────────────────────── */
.empty { background: var(--soft); border-radius: var(--r-md); padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .tile { background: var(--canvas); }
.empty h3 { font-size: 20px; font-weight: var(--w-heading); }
.empty p { color: var(--muted); max-width: 440px; font-size: 15px; }
.empty .btn { margin-top: 8px; }

/* ─── Modal (dialog nativo) ───────────────────────────────────────────────── */
dialog.modal { border: 1px solid var(--hair); border-radius: var(--r-md); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--canvas); color: var(--ink); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .18s ease-out; }
dialog.modal::backdrop { background: var(--scrim); }
dialog.modal-wide { width: min(760px, calc(100vw - 32px)); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.modal-head h3 { font-size: 24px; font-weight: var(--w-heading); line-height: 1.25; }
.modal-body { padding: 18px 24px 8px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; }
.modal-body p + p { margin-top: 10px; }

/* ─── Menú desplegable ────────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: 6px; background: var(--canvas); border: 1px solid var(--hair); border-radius: var(--r-sm); }
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu.left { right: auto; left: 0; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px; font-weight: var(--w-semi); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--soft); }
.menu hr { margin: 6px 0; }

/* ─── Estructura de la app (sidebar + panel) ──────────────────────────────── */
body.app { background: var(--soft); min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 20px 16px 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; font-size: 20px; font-weight: var(--w-heading); }
.brand .tile { width: 40px; height: 40px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 12px; font-weight: var(--w-semi); color: var(--muted); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: var(--r-sm); font-size: 15px; font-weight: var(--w-semi); color: var(--ink-soft); transition: background .12s; }
.nav a:hover { background: rgba(20, 20, 20, .06); }
.nav a.is-active { background: var(--ink); color: var(--canvas); }
.nav a .n-badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.usage-card { background: var(--canvas); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.usage-card .u-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.usage-card .u-num { font-size: 13px; color: var(--muted); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: var(--r-full); }
.me .me-info { min-width: 0; flex: 1; }
.me .me-name { font-size: 14px; font-weight: var(--w-semi); line-height: 1.2; }
.me .me-mail { font-size: 12px; color: var(--muted); }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar); padding: 12px 12px 12px 0; }
.main { background: var(--canvas); border-radius: var(--r-md); min-height: calc(100vh - 24px); padding: 36px 44px 56px; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.page-head .ph-text { min-width: 0; }
.page-head .t-lead { margin-top: 10px; color: var(--muted); font-size: 18px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 14px; font-weight: var(--w-semi); }
.breadcrumb:hover { color: var(--ink); }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: 24px; font-weight: var(--w-heading); line-height: 1.25; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input-icon { flex: 1 1 240px; max-width: 360px; }
.filters .select { width: auto; min-width: 160px; }

/* Checklist de inicio */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.step { background: var(--soft); border-radius: var(--r-md); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.step .st-n { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-content: center; font-size: 13px; font-weight: var(--w-semi); }
.step.is-done .st-n { background: var(--ink); color: var(--canvas); }
.step .st-t { font-weight: var(--w-semi); font-size: 16px; }
.step .st-d { font-size: 13px; color: var(--muted); }

/* ─── Gráficas ────────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #ececec; stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .s-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .hit { fill: transparent; }
.chart .cursor { stroke: var(--ink); stroke-width: 1; opacity: 0; pointer-events: none; }
.chart .dot { stroke: var(--canvas); stroke-width: 2; opacity: 0; pointer-events: none; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--canvas); border-radius: 14px; padding: 10px 14px; font-size: 13px; line-height: 1.5; min-width: 150px; opacity: 0; transition: opacity .1s; white-space: nowrap; }
.chart-tip .tip-date { color: #bdbdbd; font-size: 12px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chart-tip .tip-row b { font-weight: var(--w-heading); font-size: 14px; }
.chart-tip .tip-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.chart-empty { height: 220px; display: grid; place-content: center; color: var(--muted); font-size: 14px; text-align: center; }

.hbar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr auto; align-items: center; gap: 14px; padding: 8px 0; font-size: 14px; }
.hbar .hb-track { height: 20px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.hbar .hb-fill { display: block; height: 100%; background: var(--ink); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .hb-fill.is-accent { background: var(--accent); }
.hbar .hb-fill.is-gray { background: #8f8f8f; }
.hbar .hb-val { font-weight: var(--w-semi); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }

/* ─── Plantillas (miniaturas) ─────────────────────────────────────────────── */
.thumb { display: block; width: 100%; position: relative; overflow: hidden; border-radius: var(--r-sm); background: var(--soft); aspect-ratio: 4 / 4.6; }
.thumb iframe { position: absolute; top: 0; left: 0; width: 640px; max-width: none; height: 900px; border: 0; background: #fff; transform-origin: 0 0; pointer-events: none; }
.thumb-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.tpl-card { display: flex; flex-direction: column; gap: 14px; padding: 14px; transition: background .15s; }
.tpl-card:hover { background: var(--soft); }
.tpl-card .tpl-meta { padding: 0 6px 4px; }

/* Editor */
.editor-bar { position: sticky; top: 0; z-index: 10; background: var(--canvas); padding: 4px 0 16px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-frame { border: 1px solid var(--hair); border-radius: var(--r-md); overflow: hidden; background: var(--canvas); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 12px; background: var(--soft); }
.editor-toolbar .tb-sep { width: 1px; height: 22px; background: var(--hair); margin: 0 6px; }
.tb-btn { height: 34px; min-width: 34px; padding: 0 9px; border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: var(--w-semi); }
.tb-btn:hover { background: var(--soft-2); }
.tb-btn.is-on { background: var(--ink); color: var(--canvas); }
.tb-select { height: 34px; border-radius: var(--r-full); background: var(--canvas); border: 0; padding: 0 28px 0 12px; font-size: 13px; font-weight: var(--w-semi); appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.editor-canvas { background: #ececec; padding: 0; }
.editor-canvas iframe { width: 100%; height: 640px; border: 0; background: #fff; display: block; }
.editor-canvas textarea { width: 100%; height: 640px; border: 0; padding: 16px; background: var(--ink); color: #eaeaea; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; resize: vertical; display: block; tab-size: 2; }
.editor-canvas textarea:focus { outline: none; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--r-full); background: var(--soft); font-size: 13px; font-weight: var(--w-semi); font-family: ui-monospace, Menlo, Consolas, monospace; cursor: pointer; border: 0; }
.chip:hover { background: var(--ink); color: var(--canvas); }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.starter { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--hair-soft); background: var(--canvas); text-align: left; transition: background .15s, border-color .15s; width: 100%; }
.starter:hover { background: var(--soft); border-color: var(--soft); }

/* Archivos */
.dropzone { border: 1.5px dashed #bdbdbd; border-radius: var(--r-md); padding: 36px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--canvas); transition: background .15s, border-color .15s; cursor: pointer; }
.dropzone:hover, .dropzone.is-over { background: var(--soft); border-color: var(--ink); }
.dropzone p { color: var(--muted); font-size: 14px; }
.file-card { display: flex; flex-direction: column; gap: 0; overflow: hidden; padding: 0; }
.file-card .f-preview { aspect-ratio: 16 / 10; background: var(--soft); display: grid; place-content: center; overflow: hidden; }
.file-card .f-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-card .f-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

/* Importador */
.map-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.5fr); gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--hair-soft); }
.map-row:first-child { border-top: 0; }
.map-sample { font-size: 13px; color: var(--muted); }
.map-sample div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Facturación */
.price { display: flex; align-items: baseline; gap: 6px; }
.price .p-amount { font-size: 44px; font-weight: var(--w-heading); line-height: 1.05; }
.price .p-per { font-size: 14px; color: var(--muted); }
.plan-card { display: flex; flex-direction: column; gap: 20px; padding: 28px; border-radius: var(--r-md); border: 1px solid var(--hair-soft); background: var(--canvas); }
.plan-card.is-featured { background: var(--soft); border-color: var(--soft); }
.plan-card .pc-name { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: var(--w-heading); }
.plan-card ul { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.plan-card li { display: flex; align-items: flex-start; gap: 10px; }
.plan-card li .icon { color: var(--muted); margin-top: 1px; }
.plan-card .btn { margin-top: auto; }

/* ─── Autenticación ───────────────────────────────────────────────────────── */
body.auth-body { background: var(--canvas); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100vh; padding: 12px; gap: 12px; }
.auth-form-side { display: flex; flex-direction: column; padding: 20px 32px 24px; }
.auth-form-wrap { margin: auto; width: 100%; max-width: 400px; padding: 32px 0; }
.auth-form-wrap h1 { font-size: 40px; font-weight: var(--w-heading); line-height: 1.1; }
.auth-form-wrap .t-lead { color: var(--muted); font-size: 18px; margin-top: 10px; }
.auth-side { background: var(--soft); border-radius: var(--r-md); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; min-height: 520px; }
.auth-side .a-copy { position: relative; z-index: 2; max-width: 480px; }
.auth-side .a-copy h2 { font-size: clamp(32px, 3.6vw, 48px); font-weight: var(--w-heading); line-height: 1.08; }
.auth-side .a-copy p { color: var(--muted); font-size: 18px; font-weight: var(--w-light); margin-top: 12px; }
.mock-stack { position: absolute; inset: 40px 40px auto 40px; height: 52%; }
.mock-card { position: absolute; width: min(320px, 72%); background: var(--canvas); border-radius: var(--r-md); padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--hair-soft); }
.mock-card.m1 { left: 4%; top: 6%; transform: rotate(-7deg); }
.mock-card.m2 { right: 2%; top: 20%; transform: rotate(5deg); z-index: 2; }
.mock-card.m3 { left: 22%; top: 52%; transform: rotate(-2deg); z-index: 3; }
.sk { height: 10px; border-radius: 5px; background: var(--soft); }
.sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.w40 { width: 40%; } .sk.dark { background: var(--ink); }
.mock-row { display: flex; align-items: center; gap: 10px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--hair); }

/* Página sencilla (instalador, errores, baja) */
body.plain { background: var(--soft); min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 32px 16px; }
.plain-card { background: var(--canvas); border-radius: var(--r-md); padding: 40px; width: 100%; max-width: 560px; margin: auto; }
.plain-card.wide { max-width: 760px; }
.req-list { display: flex; flex-direction: column; gap: 4px; }
.req { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--soft); font-size: 14px; }
.req .icon { flex: none; }
.req.is-bad { background: var(--canvas); border: 1px dashed var(--ink); }
.req.is-warn { color: var(--muted); }
.req small { margin-left: auto; color: var(--muted); }

/* ─── Sitio público (landing) ─────────────────────────────────────────────── */
body.site { background: var(--canvas); }
.nav-pill { position: sticky; top: 16px; z-index: 50; margin: 16px auto 0; width: min(980px, calc(100% - 24px)); height: 60px; padding: 0 8px 0 18px; border-radius: var(--r-full); background: var(--soft); display: flex; align-items: center; gap: 24px; }
.nav-pill .brand { padding: 0; font-size: 19px; }
.nav-pill .brand .tile { width: 34px; height: 34px; }
.nav-pill .np-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-pill .np-links a:not(.btn) { padding: 0 14px; height: 40px; display: inline-flex; align-items: center; border-radius: var(--r-full); font-weight: var(--w-semi); font-size: 15px; }
.nav-pill .np-links a:not(.btn):hover { background: rgba(20, 20, 20, .06); }
.container { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }
.container-narrow { width: min(820px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 96px 0 72px; text-align: center; }
.hero .t-lead { max-width: 640px; margin: 24px auto 0; color: var(--muted); }
.hero .btn-group { justify-content: center; margin-top: 36px; }
.hero-note { margin-top: 16px; font-size: 14px; color: var(--muted); }
.preview-frame { background: var(--soft); border-radius: var(--r-md); padding: 28px; margin-top: 24px; }
.preview-app { background: var(--canvas); border-radius: var(--r-md); padding: 28px; text-align: left; }
.section-lg { padding: 80px 0; }
.section-title { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section-title .t-lead { margin-top: 16px; color: var(--muted); }
.feature { background: var(--soft); border-radius: var(--r-md); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.feature h3 { font-size: 24px; font-weight: var(--w-heading); line-height: 1.25; }
.feature p { color: var(--muted); font-size: 16px; }
.marquee { overflow: hidden; padding: 24px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 56px; width: max-content; animation: marquee 38s linear infinite; }
.brand-chip { display: inline-flex; align-items: center; gap: 14px; font-size: 32px; font-weight: var(--w-heading); white-space: nowrap; }
@keyframes marquee { to { transform: translateX(-50%); } }
.faq { display: flex; flex-direction: column; gap: 12px; }
.faq details { background: var(--soft); border-radius: var(--r-sm); padding: 0 24px; }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; font-weight: var(--w-semi); }
.faq summary::-webkit-details-marker { display: none; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { color: var(--muted); padding: 0 0 22px; max-width: 640px; }
.cta-band { background: var(--soft); border-radius: var(--r-md); padding: 72px 24px; text-align: center; }
.site-footer { background: var(--ink); color: var(--canvas); border-radius: var(--r-md) var(--r-md) 0 0; padding: 72px 0 40px; margin-top: 96px; }
.site-footer .f-brand { font-size: clamp(48px, 9vw, 120px); font-weight: var(--w-heading); line-height: 1; }
.site-footer .f-tag { color: var(--faint); margin-top: 16px; font-size: 18px; font-weight: var(--w-light); }
.site-footer .f-cols { display: flex; gap: 64px; margin-top: 48px; flex-wrap: wrap; }
.site-footer .f-col { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.site-footer .f-col a { color: var(--faint); }
.site-footer .f-col a:hover, .site-footer .f-col a.em { color: var(--canvas); }
.site-footer .f-legal { margin-top: 56px; color: var(--faint); font-size: 13px; }

/* ─── Páginas de estado público (baja, errores) ───────────────────────────── */
.center-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  /* Maquetas de dos columnas definidas en línea → una columna */
  .grid[style*="grid-template-columns"]:not(.stats-row):not(.grid-auto):not(.grid-4) { grid-template-columns: 1fr !important; }
  aside[style*="sticky"] { position: static !important; }
  .main-wrap { margin-left: 0; padding: 0; }
  .main { border-radius: 0; padding: 24px 20px 48px; min-height: 100vh; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--soft); position: sticky; top: 0; z-index: 35; }
  .topbar .brand { padding: 0; font-size: 18px; }
  .topbar .brand .tile { width: 34px; height: 34px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; background: var(--soft); width: min(300px, 86vw); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 39; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; padding: 0; }
  .auth-side { display: none; }
  .auth-form-side { padding: 20px 20px 24px; }
}
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4, .form-row, .form-row.cols-3, .steps { grid-template-columns: 1fr; }
  .stats-row, .grid-4:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  .stat { padding: 16px; }
  .stat .s-value { font-size: 28px; }
  .col-2 { grid-column: auto; }
  .page-head { align-items: flex-start; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .map-row { grid-template-columns: 1fr; gap: 10px; }
  .hbar { grid-template-columns: 80px 1fr auto; }
  .plain-card { padding: 28px 22px; }
  .hero { padding: 56px 0 40px; }
  .section-lg { padding: 48px 0; }
  .nav-pill .np-links a:not(.btn):not(.keep) { display: none; }
  .cta-band { padding: 48px 20px; }
  .auth-form-wrap h1 { font-size: 34px; }
}
@media print {
  .sidebar, .topbar, .page-head .btn-group { display: none !important; }
  .main-wrap { margin: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
