/* ==========================================================================
   KeyWorld Catálogos — Sistema de diseño
   Tema claro / oscuro mediante [data-theme] en <html>
   ========================================================================== */

:root {
    --brand-a: #6D5EF6;
    --brand-b: #22B8CF;

    --bg: #F5F6FA;
    --bg-grad-1: rgba(109, 94, 246, .10);
    --bg-grad-2: rgba(34, 184, 207, .08);
    --surface: #FFFFFF;
    --surface-2: #F1F3F8;
    --surface-3: #E8EBF3;
    --border: #E3E6EE;
    --border-strong: #CDD2DE;
    --text: #0E1222;
    --text-2: #3A4157;
    --muted: #6A7289;

    --primary: #5B4CF0;
    --primary-hover: #4A3BE0;
    --primary-soft: rgba(91, 76, 240, .10);
    --primary-ring: rgba(91, 76, 240, .28);
    --on-primary: #FFFFFF;

    --success: #12A150;
    --success-soft: rgba(18, 161, 80, .11);
    --warning: #C77A06;
    --warning-soft: rgba(217, 140, 6, .13);
    --danger: #E0294A;
    --danger-soft: rgba(224, 41, 74, .10);
    --info: #0B8FB3;
    --info-soft: rgba(11, 143, 179, .11);
    --gold: #C9971A;
    --gold-soft: rgba(201, 151, 26, .14);
    --whatsapp: #1FAF56;

    --shadow-xs: 0 1px 2px rgba(16, 20, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 20, 40, .06), 0 1px 2px rgba(16, 20, 40, .04);
    --shadow-md: 0 8px 24px -8px rgba(16, 20, 40, .14), 0 2px 6px rgba(16, 20, 40, .05);
    --shadow-lg: 0 24px 60px -16px rgba(16, 20, 40, .25);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --sidebar-w: 268px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0A0C14;
    --bg-grad-1: rgba(109, 94, 246, .16);
    --bg-grad-2: rgba(34, 184, 207, .09);
    --surface: #12151F;
    --surface-2: #181C28;
    --surface-3: #212636;
    --border: #232838;
    --border-strong: #323A50;
    --text: #EDF0F7;
    --text-2: #C3C9D8;
    --muted: #8A92A8;

    --primary: #8B7FFF;
    --primary-hover: #9D93FF;
    --primary-soft: rgba(139, 127, 255, .14);
    --primary-ring: rgba(139, 127, 255, .35);
    --on-primary: #0B0B1A;

    --success: #3DDC84;
    --success-soft: rgba(61, 220, 132, .12);
    --warning: #F5B341;
    --warning-soft: rgba(245, 179, 65, .13);
    --danger: #FF5C7A;
    --danger-soft: rgba(255, 92, 122, .12);
    --info: #4CC9F0;
    --info-soft: rgba(76, 201, 240, .12);
    --gold: #F2C14E;
    --gold-soft: rgba(242, 193, 78, .14);
    --whatsapp: #2BD46A;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .75);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 0% -10%, var(--bg-grad-1), transparent 60%),
        radial-gradient(700px 500px at 100% 0%, var(--bg-grad-2), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--primary-soft); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; font-weight: 750; }
.icon { flex-shrink: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 999; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Tema: íconos del toggle ---------- */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline-flex; }
.theme-toggle .icon { transition: transform .5s var(--ease); }
.theme-toggle:hover .icon { transform: rotate(-25deg); }

/* ---------- Botones ---------- */
.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--text);
    --btn-bd: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 42px; padding: .55rem 1.05rem;
    border-radius: var(--radius);
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg); color: var(--btn-fg);
    font-weight: 650; font-size: .92rem; white-space: nowrap;
    transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s, color .2s;
    text-decoration: none; user-select: none;
}
.btn:hover { color: var(--btn-fg); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary {
    --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent;
    box-shadow: 0 6px 18px -8px var(--primary);
}
.btn-primary:hover { --btn-bg: var(--primary-hover); border-color: transparent; box-shadow: 0 10px 24px -10px var(--primary); }
.btn-gradient {
    --btn-fg: #fff; --btn-bd: transparent;
    background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
    box-shadow: 0 10px 26px -10px var(--brand-a);
}
.btn-gradient:hover { filter: brightness(1.06); border-color: transparent; }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary); --btn-bd: transparent; }
.btn-soft:hover { border-color: transparent; background: color-mix(in srgb, var(--primary) 18%, transparent); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger-solid { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn-whatsapp { --btn-bg: var(--whatsapp); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 8px 20px -10px var(--whatsapp); }
.btn-whatsapp:hover { filter: brightness(1.06); color: #fff; border-color: transparent; }
.btn-sm { min-height: 34px; padding: .35rem .75rem; font-size: .84rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: .8rem 1.5rem; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 40px; width: 40px; padding: 0; }
.btn-icon.btn-sm { min-height: 34px; width: 34px; }
.btn .spinner { width: 16px; height: 16px; }

.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.label { font-size: .85rem; font-weight: 650; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.label .opt { font-weight: 500; color: var(--muted); font-size: .78rem; }
.hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea {
    width: 100%; min-height: 44px; padding: .6rem .9rem;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font-size: .95rem; transition: border-color .2s, box-shadow .2s, background .2s;
    -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
    padding-right: 2.3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238A92A8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .8rem center;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .75; }
.input.mono { letter-spacing: .04em; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon {
    display: flex; align-items: center; padding: 0 .85rem;
    background: var(--surface-2); border: 1px solid var(--border); border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius); color: var(--muted); font-weight: 600; font-size: .9rem;
}
.input-group .input { border-radius: 0 var(--radius) var(--radius) 0; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 2.6rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.field-status { font-size: .8rem; font-weight: 600; min-height: 1.1em; }
.field-status.ok { color: var(--success); }
.field-status.bad { color: var(--danger); }

/* Color picker */
.color-field { display: flex; align-items: center; gap: .65rem; padding: .35rem .45rem .35rem .35rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.color-field input[type=color] { width: 40px; height: 34px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; }
.color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.color-field .mono { font-size: .85rem; color: var(--text-2); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; font-weight: 600; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--primary-ring); }

/* Segmented / radio cards */
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 9px; font-weight: 650; font-size: .86rem; color: var(--muted); cursor: pointer; transition: all .2s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); }

.choice-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice .choice-body {
    display: flex; flex-direction: column; gap: .15rem; padding: .8rem .9rem;
    border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface);
    cursor: pointer; transition: all .2s;
}
.choice .choice-body strong { font-size: .95rem; }
.choice .choice-body small { color: var(--muted); font-size: .78rem; }
.choice input:checked + .choice-body { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--primary); }

/* Dropzone / subida de imagen con vista previa */
.dropzone {
    position: relative; display: flex; align-items: center; gap: 1rem; padding: .9rem;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
    transition: border-color .2s, background .2s; cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-preview {
    width: 76px; height: 76px; border-radius: 14px; flex-shrink: 0; overflow: hidden;
    background: var(--surface-3); display: grid; place-items: center; color: var(--muted);
}
.dropzone-preview img { width: 100%; height: 100%; object-fit: cover; }
.dropzone.round .dropzone-preview { border-radius: 50%; }
.dropzone.wide .dropzone-preview { width: 140px; height: 70px; }
.dropzone-text strong { display: block; font-size: .92rem; }
.dropzone-text small { color: var(--muted); font-size: .8rem; }

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.35rem; }
@media (min-width: 768px) { .card-pad { padding: 1.6rem; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 1.02rem; display: flex; align-items: center; gap: .55rem; }
.card-head p { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.card-body { padding: 1.35rem; }
.card-foot { padding: 1rem 1.35rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.section-title { font-size: 1.05rem; margin-bottom: .9rem; display: flex; align-items: center; gap: .5rem; }

.icon-tile {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--primary-soft); color: var(--primary);
}
.icon-tile.success { background: var(--success-soft); color: var(--success); }
.icon-tile.warning { background: var(--warning-soft); color: var(--warning); }
.icon-tile.danger { background: var(--danger-soft); color: var(--danger); }
.icon-tile.info { background: var(--info-soft); color: var(--info); }
.icon-tile.gold { background: var(--gold-soft); color: var(--gold); }

/* Stats */
.stats { display: grid; gap: .9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .8rem; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { color: var(--muted); font-size: .84rem; font-weight: 600; }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .2rem .6rem; border-radius: 99px;
    font-size: .74rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
    background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; font-weight: 600; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.vbadge { display: inline-flex; vertical-align: middle; line-height: 0; }
.vbadge-blue { color: #1D9BF0; }
.vbadge-gold { color: #E3A008; }
.vbadge-gold svg { filter: drop-shadow(0 1px 2px rgba(227, 160, 8, .45)); }

/* ---------- Avatar ---------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--surface-3); color: var(--text-2); font-weight: 750; font-size: .9rem;
    object-fit: cover;
}
.avatar-sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-brand { background: linear-gradient(135deg, var(--brand-a), var(--brand-b)); color: #fff; }
.avatar-square { border-radius: 12px; }

/* ---------- Tablas (se convierten en tarjetas en móvil) ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
    text-align: left; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: .8rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: .35rem; justify-content: flex-end; }
.table .col-check { width: 44px; }
.table tr.is-selected { background: var(--primary-soft) !important; }
.cell-main { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cell-main strong { display: block; font-weight: 650; }
.cell-main small { display: block; color: var(--muted); font-size: .8rem; }
.thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex-shrink: 0; display: grid; place-items: center; color: var(--muted); }

/* Las tablas pasan a tarjetas según el ancho de su tarjeta contenedora */
.card:has(.table.responsive) { container-type: inline-size; }
@container (max-width: 900px) {
    .table.responsive thead { display: none; }
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
    .table.responsive tr { padding: .85rem 1rem; border-bottom: 1px solid var(--border); position: relative; }
    .table.responsive tbody tr:last-child { border-bottom: 0; }
    .table.responsive td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    .table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
    .table.responsive td.td-main { display: block; padding-bottom: .5rem; }
    .table.responsive td.col-check { position: absolute; top: .85rem; right: 1rem; width: auto; padding: 0; }
    .table.responsive .actions { justify-content: flex-start; padding-top: .35rem; }
}
@supports not (container-type: inline-size) {
@media (max-width: 720px) {
    .table.responsive thead { display: none; }
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
    .table.responsive tr { padding: .85rem 1rem; border-bottom: 1px solid var(--border); position: relative; }
    .table.responsive tbody tr:last-child { border-bottom: 0; }
    .table.responsive td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    .table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
    .table.responsive td.td-main { display: block; padding-bottom: .5rem; }
    .table.responsive td.col-check { position: absolute; top: .85rem; right: 1rem; width: auto; padding: 0; }
    .table.responsive .actions { justify-content: flex-start; padding-top: .35rem; }
}
}

/* Checkbox */
.check { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* ---------- Código / pines ---------- */
.code-pill {
    display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .4rem .3rem .65rem;
    border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border);
    font-family: var(--mono); font-size: .84rem; font-weight: 600; letter-spacing: .02em; color: var(--text);
    cursor: pointer; transition: border-color .2s, background .2s; max-width: 100%;
}
.code-pill:hover { border-color: var(--primary); background: var(--primary-soft); }
.code-pill .code-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-pill .icon { color: var(--muted); }
.code-pill.copied { border-color: var(--success); background: var(--success-soft); }
.code-pill.copied .icon { color: var(--success); }
.code-pill.is-used { opacity: .55; text-decoration: line-through; text-decoration-thickness: 1px; }

.codes-box {
    width: 100%; min-height: 160px; max-height: 340px; resize: vertical;
    font-family: var(--mono); font-size: .88rem; line-height: 1.75; letter-spacing: .03em;
    padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); white-space: pre; overflow: auto;
}
.codes-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }

.batch-result {
    border: 1px solid color-mix(in srgb, var(--success) 40%, var(--border));
    background: linear-gradient(180deg, var(--success-soft), transparent 70%), var(--surface);
}

/* ---------- Alerts ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--radius); font-size: .9rem; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert strong { color: inherit; }
.alert p { color: var(--text-2); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; z-index: 3000; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
@media (min-width: 768px) { .toast-stack { left: auto; right: 1.5rem; bottom: 1.5rem; transform: none; } }
.toast {
    display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; pointer-events: auto;
    background: var(--text); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg);
    font-weight: 600; font-size: .9rem; animation: toastIn .35s var(--ease);
}
.toast .toast-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.toast.success .toast-ic { background: var(--success); color: #fff; }
.toast.error .toast-ic { background: var(--danger); color: #fff; }
.toast.info .toast-ic { background: var(--primary); color: #fff; }
.toast.is-leaving { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Modal / diálogo ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; display: none; align-items: flex-end; justify-content: center; padding: 0; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 8, 18, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s; }
.modal-panel {
    position: relative; width: 100%; max-height: 92vh; overflow: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    animation: sheetUp .35s var(--ease);
}
@media (min-width: 640px) {
    .modal { align-items: center; padding: 1.5rem; }
    .modal-panel { max-width: 460px; border-radius: 22px; animation: pop .3s var(--ease); }
}
.modal-panel .modal-body { padding: 1.5rem; }
.modal-panel .modal-actions { display: flex; gap: .6rem; justify-content: flex-end; padding: 0 1.5rem 1.5rem; flex-wrap: wrap; }
.modal-panel .modal-actions .btn { flex: 1; }
@media (min-width: 640px) { .modal-panel .modal-actions .btn { flex: 0 0 auto; } }
.modal-close { position: absolute; top: .8rem; right: .8rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.96) translateY(10px); opacity: 0; } }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .empty-ic { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.empty h3 { color: var(--text); font-size: 1.05rem; margin-bottom: .3rem; }
.empty p { font-size: .9rem; max-width: 360px; margin: 0 auto 1.1rem; }

/* ---------- Utilidades ---------- */
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.stack-sm { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row-wrap { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-main-side { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1100px) { .grid-main-side { grid-template-columns: minmax(0, 1fr) 360px; } }
.text-sm { font-size: .86rem; }
.text-xs { font-size: .78rem; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hide-sm { display: none; }
@media (min-width: 720px) { .hide-sm { display: initial; } .show-sm-only { display: none !important; } }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }

/* ==========================================================================
   Panel (sidebar + topbar)
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; height: 100vh; position: sticky; top: 0;
    display: flex; flex-direction: column; gap: 1rem; padding: 1.1rem .9rem;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    overflow-y: auto; z-index: 60;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: .2rem .35rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.06rem; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { font-size: .72rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .1em; }
.sidebar-close { display: none; }

.sidebar-store {
    display: flex; align-items: center; gap: .65rem; padding: .65rem .7rem;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; color: var(--text);
    transition: border-color .2s;
}
.sidebar-store:hover { border-color: var(--primary); color: var(--text); }
.sidebar-store-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-store-text strong { font-size: .88rem; display: flex; align-items: center; gap: .25rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-store-text small { color: var(--muted); font-size: .76rem; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: .9rem .75rem .4rem; }
.nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem;
    border-radius: 11px; color: var(--text-2); font-weight: 600; font-size: .92rem;
    position: relative; transition: background .15s, color .15s;
}
.nav-link .icon { color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-link.is-active .icon { color: var(--primary); }
.nav-link.is-active::before { content: ''; position: absolute; left: -.9rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: .9rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .2rem .25rem; }
.user-chip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-chip-text strong { font-size: .86rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-chip-text small { font-size: .74rem; color: var(--muted); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem 1.75rem; min-height: 70px;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.28rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .45rem; }
.menu-btn { display: none; }
.content { padding: 1.75rem 2rem; width: 100%; max-width: 1600px; margin: 0 auto; animation: contentIn .45s var(--ease); }
@keyframes contentIn { from { opacity: 0; transform: translateY(6px); } }

.drawer-backdrop { display: none; }

@media (max-width: 960px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100%;
        transform: translateX(-105%); transition: transform .35s var(--ease);
        background: var(--surface); box-shadow: var(--shadow-lg); width: min(300px, 86vw);
    }
    body.drawer-open .sidebar { transform: none; }
    .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(6, 8, 18, .5); opacity: 0; pointer-events: none; transition: opacity .3s; }
    body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
    body.drawer-open { overflow: hidden; }
    .sidebar-close { display: inline-flex; }
    .menu-btn { display: inline-flex; margin-left: -.4rem; }
    .topbar { padding: .65rem 1rem; min-height: 60px; }
    .topbar-title h1 { font-size: 1.08rem; }
    .topbar-title p { display: none; }
    .content { padding: 1rem 1rem 2.5rem; }
    .topbar-actions .btn-label { display: none; }
}

/* ---------- Página: inicio de tienda ---------- */
.hero-card {
    position: relative; overflow: hidden; border-radius: var(--radius-xl);
    padding: 1.5rem; color: #fff;
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(255, 255, 255, .18), transparent 60%),
        linear-gradient(135deg, var(--brand-a), #4338CA 55%, #0E7490);
    box-shadow: 0 20px 50px -20px var(--brand-a);
}
.hero-card::after {
    content: ''; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
    border: 40px solid rgba(255, 255, 255, .07);
}
@media (min-width: 768px) { .hero-card { padding: 2rem 2.2rem; } }
.hero-card h2 { font-size: 1.45rem; margin-bottom: .35rem; }
.hero-card p { opacity: .85; font-size: .92rem; max-width: 520px; }
.hero-card .link-box {
    margin-top: 1.2rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    position: relative; z-index: 1;
}
.hero-card .link-url {
    flex: 1; min-width: 220px; display: flex; align-items: center; gap: .55rem;
    padding: .65rem .9rem; border-radius: 12px; background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22); font-family: var(--mono); font-size: .86rem; overflow: hidden;
}
.hero-card .link-url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-on-dark { --btn-bg: #fff; --btn-fg: #1E1B4B; --btn-bd: transparent; }
.btn-on-dark:hover { --btn-fg: #1E1B4B; filter: brightness(.96); border-color: transparent; }
.btn-glass { --btn-bg: rgba(255, 255, 255, .14); --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, .25); }
.btn-glass:hover { --btn-fg: #fff; background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .35); }

.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-a), var(--brand-b)); transition: width .8s var(--ease); }
.meter.warning > span { background: linear-gradient(90deg, #F59E0B, #F97316); }
.meter.danger > span { background: linear-gradient(90deg, #F43F5E, #E11D48); }

.big-number { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }

.checklist { display: flex; flex-direction: column; gap: .3rem; }
.checklist a { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 12px; color: var(--text); font-weight: 600; font-size: .9rem; }
.checklist a:hover { background: var(--surface-2); color: var(--text); }
.checklist .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; color: transparent; }
.checklist .done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .done span.t { color: var(--muted); text-decoration: line-through; }

/* Distribuidores */
.dist-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.dist-card { display: flex; flex-direction: column; gap: .9rem; padding: 1.15rem; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.dist-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.dist-head { display: flex; align-items: center; gap: .8rem; }
.dist-logo { width: 52px; height: 52px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 6px; flex-shrink: 0; }
.dist-logo.is-initials { display: grid; place-items: center; padding: 0; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand-a), var(--brand-b)); border: 0; }
.dist-name { font-weight: 750; font-size: 1rem; display: flex; align-items: center; gap: .35rem; }
.dist-meta { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .3rem; }
.dist-note { font-size: .85rem; color: var(--text-2); background: var(--surface-2); padding: .55rem .7rem; border-radius: 10px; }
.dist-actions { display: flex; gap: .5rem; margin-top: auto; }
.dist-actions .btn { flex: 1; }
.dist-actions .btn-icon { flex: 0 0 auto; }
.verified-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 750; color: var(--success); background: var(--success-soft); padding: .12rem .45rem; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* Cola de sincronización */
.sync-bar { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); font-size: .88rem; font-weight: 600; }
.sync-bar .meter { flex: 1; }
.row-status { font-size: .76rem; font-weight: 700; display: inline-flex; align-items: center; gap: .3rem; }
.row-status.updated { color: var(--success); }
.row-status.unchanged { color: var(--muted); }
.row-status.error { color: var(--danger); }
.row-status.skipped { color: var(--warning); }
.row-status.working { color: var(--primary); }
tr.is-syncing { background: var(--primary-soft); }

/* Toolbar de tablas */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1; min-width: 200px; }
.selection-bar {
    position: sticky; bottom: 1rem; z-index: 30; margin-top: 1rem;
    display: none; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .7rem .8rem .7rem 1.1rem; border-radius: 16px; background: var(--text); color: var(--bg);
    box-shadow: var(--shadow-lg); animation: sheetUp .3s var(--ease);
}
.selection-bar.is-visible { display: flex; }
.selection-bar strong { flex: 1; font-size: .9rem; }
.selection-bar .btn { --btn-bg: rgba(127, 127, 127, .18); --btn-fg: var(--bg); --btn-bd: transparent; }
.selection-bar .btn:hover { --btn-fg: var(--bg); background: rgba(127, 127, 127, .3); }

.pagination { display: flex; gap: .35rem; align-items: center; justify-content: center; padding: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 .6rem; display: inline-grid; place-items: center; border-radius: 10px; font-weight: 650; font-size: .86rem; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .is-current { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Producto en lista (admin) */
.product-row-price { font-weight: 750; }
.product-row-old { color: var(--muted); text-decoration: line-through; font-size: .8rem; margin-left: .35rem; }

/* Estrellas */
.stars { display: inline-flex; gap: 1px; color: #F5B301; }
.stars .off { color: var(--surface-3); }

/* ==========================================================================
   Autenticación
   ========================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .auth-page { grid-template-columns: 1.05fr 1fr; } }
.auth-aside {
    display: none; position: relative; overflow: hidden; padding: 3rem; color: #fff;
    background:
        radial-gradient(700px 400px at 10% 10%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(150deg, #4C3FE0 0%, #3730A3 45%, #0E7490 100%);
}
@media (min-width: 1000px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside .brand { color: #fff; }
.auth-aside .brand-text small { color: rgba(255, 255, 255, .7); }
.auth-aside h2 { font-size: 2.3rem; max-width: 460px; letter-spacing: -.035em; }
.auth-aside p { opacity: .8; max-width: 420px; margin-top: .8rem; }
.auth-aside .orb { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); }
.auth-features { display: grid; gap: .75rem; max-width: 420px; }
.auth-features div { display: flex; gap: .75rem; align-items: center; padding: .75rem .9rem; border-radius: 14px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px); font-weight: 600; font-size: .9rem; }
.auth-main { display: flex; flex-direction: column; padding: 1.25rem; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 0; }
.auth-form { width: 100%; max-width: 420px; }
.auth-form h1 { font-size: 1.8rem; letter-spacing: -.03em; }
.auth-form .lead { color: var(--muted); margin: .4rem 0 1.75rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 1.5rem; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 3rem; }
.pass-wrap button { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); }

/* ==========================================================================
   Landing
   ========================================================================== */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 75%, transparent);
    backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .container { padding: 0 1.5rem; } }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }
.site-nav { display: flex; align-items: center; gap: .4rem; }
.site-nav .nav-a { color: var(--text-2); font-weight: 600; font-size: .92rem; padding: .5rem .75rem; border-radius: 10px; }
.site-nav .nav-a:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 760px) { .site-nav .nav-a { display: none; } }

.hero { padding: 4.5rem 0 3rem; text-align: center; position: relative; }
@media (min-width: 768px) { .hero { padding: 6.5rem 0 4rem; } }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem .35rem .4rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; font-weight: 650; color: var(--text-2); box-shadow: var(--shadow-xs); }
.eyebrow b { background: var(--primary-soft); color: var(--primary); padding: .1rem .5rem; border-radius: 99px; font-size: .74rem; }
.hero h1 { font-size: clamp(2.3rem, 6.5vw, 4.4rem); letter-spacing: -.045em; line-height: 1.04; margin: 1.3rem auto 1.1rem; max-width: 900px; font-weight: 800; }
.grad-text { background: linear-gradient(120deg, var(--brand-a), var(--brand-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1rem, 2vw, 1.18rem); color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

.mockup { margin: 3.5rem auto 0; max-width: 980px; position: relative; }
.mockup-frame { border-radius: 22px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.mockup-bar { display: flex; align-items: center; gap: .4rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mockup-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.mockup-bar span { margin-left: .75rem; font-family: var(--mono); font-size: .76rem; color: var(--muted); background: var(--surface); padding: .2rem .7rem; border-radius: 8px; border: 1px solid var(--border); }
.mockup-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; padding: 1rem; text-align: left; }
@media (min-width: 700px) { .mockup-body { grid-template-columns: repeat(4, 1fr); padding: 1.25rem; } }
.mock-card { border-radius: 14px; border: 1px solid var(--border); overflow: hidden; background: var(--surface); }
.mock-img { aspect-ratio: 1; background: linear-gradient(135deg, var(--c1), var(--c2)); display: grid; place-items: center; color: rgba(255, 255, 255, .9); }
.mock-info { padding: .6rem .7rem; }
.mock-info b { display: block; font-size: .82rem; }
.mock-info span { font-size: .8rem; color: var(--primary); font-weight: 750; }
.float-badge { position: absolute; display: none; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-weight: 650; font-size: .85rem; animation: floaty 5s ease-in-out infinite; }
@media (min-width: 900px) { .float-badge { display: flex; } }
@keyframes floaty { 50% { transform: translateY(-8px); } }

.section { padding: 4rem 0; }
@media (min-width: 768px) { .section { padding: 5.5rem 0; } }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 2.5rem; }
.section-head .kicker { color: var(--primary); font-weight: 750; font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.035em; margin: .5rem 0 .7rem; }
.section-head p { color: var(--muted); }
.features { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 1.5rem; }
.feature h3 { font-size: 1.08rem; margin: 1rem 0 .4rem; }
.feature p { color: var(--muted); font-size: .92rem; }
.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: s; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { padding: 1.5rem; position: relative; }
.step::before { counter-increment: s; content: counter(s, decimal-leading-zero); font-family: var(--mono); font-weight: 600; color: var(--primary); font-size: .9rem; }
.step h3 { margin: .6rem 0 .35rem; font-size: 1.05rem; }
.step p { color: var(--muted); font-size: .9rem; }
.cta-band { border-radius: var(--radius-xl); padding: 2.5rem 1.5rem; text-align: center; color: #fff; background: linear-gradient(135deg, var(--brand-a), #3730A3 60%, #0E7490); box-shadow: 0 30px 60px -30px var(--brand-a); }
.cta-band h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.03em; }
.cta-band p { opacity: .85; margin: .6rem auto 1.5rem; max-width: 520px; }
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--muted); font-size: .88rem; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ==========================================================================
   Página de error / no disponible
   ========================================================================== */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; text-align: center; }
.center-page .card { max-width: 460px; padding: 2.5rem 2rem; }
.center-page h1 { font-size: 1.5rem; margin: 1rem 0 .5rem; }
.center-page p { color: var(--muted); margin-bottom: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (min-width: 1000px) { .auth-brand-m { visibility: hidden; } }

/* ==========================================================================
   Rendimiento: fluidez en móviles y equipos modestos
   ========================================================================== */
html { -webkit-tap-highlight-color: transparent; }
button, a, .p-card, .cat-chip, label { touch-action: manipulation; }
@media (max-width: 960px), (hover: none) {
    /* El fondo fijo y los desenfoques grandes provocan tirones al hacer scroll en móviles */
    body { background-attachment: scroll; }
    .sidebar, .modal-backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .modal-backdrop { background: rgba(6, 8, 18, .62); }
    .topbar, .site-header { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
    .card:hover, .dist-card:hover { transform: none; }
}
@media (hover: none) {
    .btn:hover { border-color: var(--btn-bd); }
}

.gen-first { }
@media (max-width: 1099px) { .gen-first { order: -1; } }
