/* Alinea Signature — panel/dashboard shared styles */

:root {
    --ink: #02261e;
    --ink-deep: #011a15;
    --ink-rgb: 2, 38, 30;
    --muted: #3d5c54;
    --lime: #dafc92;
    --teal: #89c9c9;
    --on-accent: #02261e;
    --bg: #F2F7F9;
    --panel: rgba(255, 255, 255, 0.72);
    --panel-solid: #ffffff;
    --panel-border: rgba(2, 38, 30, 0.08);
    --field: rgba(255, 255, 255, 0.88);
    --field-border: rgba(2, 38, 30, 0.12);
    --tile: rgba(2, 38, 30, 0.045);
    --tile-hover: rgba(2, 38, 30, 0.06);
    --nav-active: rgba(2, 38, 30, 0.07);
    --menu: #ffffff;
    --error: #b42318;
    --error-bg: rgba(180, 35, 24, 0.08);
    --success: #157347;
    --success-bg: rgba(21, 115, 71, 0.1);
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Vanguard CF", "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e8f4f0;
    --ink-deep: #f4faf7;
    --ink-rgb: 232, 244, 240;
    --muted: #9bb5ae;
    --bg: #0b1412;
    --panel: rgba(12, 22, 20, 0.62);
    --panel-solid: #101b18;
    --panel-border: rgba(232, 244, 240, 0.12);
    --field: rgba(8, 16, 14, 0.72);
    --field-border: rgba(232, 244, 240, 0.14);
    --tile: rgba(232, 244, 240, 0.06);
    --tile-hover: rgba(232, 244, 240, 0.08);
    --nav-active: rgba(232, 244, 240, 0.1);
    --menu: #121c1a;
    --error: #ff8a80;
    --error-bg: rgba(255, 138, 128, 0.12);
    --success: #7ee2b0;
    --success-bg: rgba(126, 226, 176, 0.12);
}

@font-face {
    font-family: "Vanguard CF";
    src: url("/fonts/Vanguard-CF/Demo_Fonts/Fontspring-DEMO-vanguardcf-medium.otf") format("opentype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vanguard CF";
    src: url("/fonts/Vanguard-CF/Demo_Fonts/Fontspring-DEMO-vanguardcf-bold.otf") format("opentype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

html {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 38%, transparent) transparent;
}

body {
    min-height: 100svh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 280ms var(--ease), color 280ms var(--ease);
}

button,
a,
input {
    font-family: inherit;
}

button {
    appearance: none;
    border: 0;
    background: none;
    cursor: pointer;
    color: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

.sky {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 12% 8%, color-mix(in srgb, var(--teal) 22%, transparent) 0%, transparent 52%),
        radial-gradient(120% 90% at 92% 96%, color-mix(in srgb, var(--lime) 18%, transparent) 0%, transparent 55%);
}

[hidden] {
    display: none !important;
}

/* ---------- App shell ---------- */

.app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 100svh;
}

.app[data-app] {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 420ms var(--ease), transform 520ms var(--ease);
}

.app[data-app].is-ready {
    opacity: 1;
    transform: none;
}

.app.is-sidebar-closed .sidebar {
    width: 0;
    border-right-width: 0;
    pointer-events: none;
}

/* ---------- Sidebar ---------- */

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    width: 280px;
    min-width: 0;
    height: 100svh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(28px) saturate(1.25);
    -webkit-backdrop-filter: blur(28px) saturate(1.25);
    transition: width 260ms var(--ease), border-right-width 260ms var(--ease);
}

.sidebar-head,
.nav,
.sidebar-footer {
    width: 280px;
    box-sizing: border-box;
}

.sidebar-head {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--panel-border);
}

.sidebar-close {
    display: flex;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin-right: 12px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--muted);
}

.sidebar-close:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.sidebar-close svg {
    width: 18px;
    height: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 28px 10px 28px 22px;
    color: var(--ink);
}

.brand img {
    width: 34px;
    height: 28px;
    object-fit: contain;
}

.brand .theme-logo-light {
    display: block;
}

.brand .theme-logo-dark {
    display: none;
}

html[data-theme="dark"] .brand .theme-logo-light {
    display: none;
}

html[data-theme="dark"] .brand .theme-logo-dark {
    display: block;
}

.brand-word {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 15.5px;
    letter-spacing: -0.035em;
    line-height: 1;
}

.brand-word strong {
    font-weight: 700;
}

.nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 28px 16px 24px;
}

.nav-cluster {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    margin: 0 10px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    transition: color 150ms ease, background-color 150ms ease;
}

.nav-link:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.nav-link.is-active {
    color: var(--ink);
    background: color-mix(in srgb, var(--lime) 42%, transparent);
    font-weight: 600;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Group (expandable) */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group + .nav-group {
    margin-top: 4px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    width: 100%;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    transition: color 150ms ease, background-color 150ms ease;
}

.nav-group-header:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.nav-group.is-active > .nav-group-header {
    color: var(--ink);
}

.nav-group-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 10px 4px 10px 12px;
    color: inherit;
    font-weight: inherit;
}

.nav-group-header svg.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-group-header .nav-group-name {
    flex: 1;
}

.nav-chevron {
    width: 28px;
    height: 28px;
    margin-right: 6px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform 200ms var(--ease), background-color 150ms ease;
}

.nav-chevron:hover {
    background: var(--tile);
    color: var(--ink);
}

.nav-chevron svg {
    width: 14px;
    height: 14px;
}

.nav-group.is-open .nav-chevron {
    transform: rotate(90deg);
}

.nav-sub {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    transition: grid-template-rows 240ms var(--ease);
}

.nav-group.is-open .nav-sub {
    grid-template-rows: 1fr;
}

.nav-sub-inner {
    min-height: 0;
    overflow: hidden;
}

.nav-sub-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 8px 8px 21px;
    padding: 2px 0 2px 10px;
    border-left: 1px solid var(--panel-border);
}

.nav-sub .nav-link {
    padding: 8px 12px;
    font-size: 13.5px;
    font-weight: 500;
}

.nav-sub .nav-link.is-active {
    background: color-mix(in srgb, var(--lime) 42%, transparent);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--panel-border);
}

.sidebar-lang {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 14px;
    background: var(--tile);
    border: 1px solid var(--panel-border);
}

.sidebar-lang-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    color: var(--muted);
}

.sidebar-lang-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-lang button {
    flex: 1;
    min-width: 0;
    padding: 8px 8px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 550;
    letter-spacing: -0.01em;
    color: var(--muted);
    text-align: center;
    transition: color 150ms ease, background-color 150ms ease;
}

.sidebar-lang button:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.sidebar-lang button.is-active {
    color: var(--ink);
    background: color-mix(in srgb, var(--lime) 42%, transparent);
    font-weight: 650;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--tile);
    border: 1px solid var(--panel-border);
}

.sidebar-footer .btn-danger {
    padding: 10px 12px;
}

.avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--lime), var(--teal));
    color: var(--on-accent);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.user-chip .avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.user-chip-text {
    min-width: 0;
}

.user-chip-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chip-email {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-danger {
    color: var(--error);
}

.btn-danger:hover {
    background: var(--error-bg);
}

/* ---------- Main ---------- */

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px clamp(16px, 4vw, 40px);
    border-bottom: 1px solid var(--panel-border);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.menu-toggle {
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--muted);
}

.menu-toggle:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.app.is-sidebar-closed .menu-toggle {
    color: var(--ink);
    background: var(--tile);
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
}

/* En escritorio el menú ya está a la vista: las tres rayas solo sirven para volver a abrirlo. */
@media (min-width: 861px) {
    .app:not(.is-sidebar-closed) .menu-toggle {
        display: none;
    }
}

.topbar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.theme-toggle {
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--muted);
    transition: color 180ms ease, background-color 180ms ease;
}

.theme-toggle:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    display: none;
}

html[data-theme="light"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
    display: block;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: clamp(22px, 4vw, 40px) clamp(16px, 4vw, 40px) 64px;
}

html:has(.loading:not([hidden])) {
    overflow: hidden;
}

.loading {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    place-content: center;
    gap: 22px;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    transition: opacity 440ms var(--ease), visibility 440ms;
    will-change: opacity;
}

.loading.is-leaving {
    opacity: 0;
    visibility: hidden;
}

.loading.is-entering {
    animation: loading-screen-in 240ms var(--ease) both;
}

.loading-stage {
    position: relative;
    width: min(72vw, 360px);
    aspect-ratio: 920 / 160;
    display: grid;
    place-items: center;
}

.loading-glow {
    display: none;
}

.loading-logo-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    animation: loading-logo-in 780ms var(--ease) both;
}

.loading-logo-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("/brand/alinea-signature-logo.svg") center / contain no-repeat;
}

html[data-theme="dark"] .loading-logo-wrap::before {
    background-image: url("/brand/alinea-signature-logo-inverse.png");
}

.loading-logo {
    display: none;
}

.loading-sheen {
    display: none;
}

.loading-label {
    margin: 0;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
    animation: loading-label-in 640ms var(--ease) 180ms both;
}

@keyframes loading-logo-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
        clip-path: inset(0 100% 0 0);
    }

    to {
        opacity: 1;
        transform: none;
        clip-path: inset(0);
    }
}

@keyframes loading-label-in {
    from {
        opacity: 0;
        transform: translateY(6px);
        letter-spacing: 0.36em;
    }

    to {
        opacity: 1;
        transform: none;
        letter-spacing: 0.22em;
    }
}

@keyframes loading-screen-in {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app[data-app],
    .loading,
    .loading-logo-wrap,
    .loading-label {
        animation: none;
        transition: none;
    }
}

.view {
    animation: rise 420ms var(--ease) both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.view-head {
    margin-bottom: 26px;
}

.view-kicker {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.view-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1;
}

.view-sub {
    margin: 12px 0 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 56ch;
}

/* ---------- Cards & forms ---------- */

.card {
    padding: 24px;
    border-radius: 20px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
}

.card + .card {
    margin-top: 20px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.card-desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* Línea destacada del próximo cobro (fecha + importe) en Facturación. */
.billing-next {
    margin-top: 12px;
    padding: 10px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--ink);
    background: color-mix(in srgb, var(--teal) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--teal) 40%, transparent);
}

html[data-theme="dark"] .billing-next {
    background: color-mix(in srgb, var(--teal) 22%, var(--panel-solid));
    border-color: color-mix(in srgb, var(--teal) 48%, transparent);
}

/* Asientos de equipo (miembros extra) en la tarjeta de facturación */
.billing-seats {
    margin-top: 14px;
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--ink) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.billing-seats-label {
    font-weight: 600;
    color: var(--ink);
}

.billing-seats-members {
    color: var(--muted);
    font-size: 13.5px;
}

.billing-seats-stepper {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
    background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.seat-step {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.seat-step:hover:not(:disabled) {
    background: color-mix(in srgb, var(--teal) 22%, transparent);
}

.seat-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.seat-step-val {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    color: var(--ink);
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.profile-hero .avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.profile-hero-info {
    min-width: 0;
    flex: 1;
}

/* Avatar clicable con superposición de cámara */
.avatar-edit {
    padding: 0;
    cursor: pointer;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(2, 38, 30, 0.5);
    opacity: 0;
    transition: opacity 150ms ease;
}

.avatar-overlay svg {
    width: 22px;
    height: 22px;
}

.avatar-edit:hover .avatar-overlay,
.avatar-edit:focus-visible .avatar-overlay,
.avatar-edit.is-busy .avatar-overlay {
    opacity: 1;
}

.avatar-edit.is-busy {
    cursor: default;
}

.profile-hero-photo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-sm {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.btn-secondary.is-busy {
    opacity: 0.6;
    cursor: default;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.profile-hero-name {
    margin: 0;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.profile-hero-email {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-label {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.field-control {
    position: relative;
}

.input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--field-border);
    background: var(--field);
    color: var(--ink);
    font-size: 14px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--teal) 70%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}

.input[type="password"] {
    padding-right: 46px;
}

.input.is-locked {
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--tile);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--muted);
}

.password-toggle:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.password-toggle svg {
    width: 17px;
    height: 17px;
}

.field-hint {
    font-size: 11.5px;
    color: var(--muted);
}

.form-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.form-msg {
    font-size: 13px;
    font-weight: 500;
    min-height: 18px;
}

.form-msg.is-error {
    color: var(--error);
}

.form-msg.is-success {
    color: var(--success);
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
    transition: background-color 150ms ease, transform 150ms var(--ease), color 150ms ease, opacity 150ms ease;
}

.btn-primary {
    background: var(--lime);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--teal);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn-secondary {
    background: var(--tile);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--tile-hover);
}

.btn-primary svg,
.btn-secondary svg {
    width: 16px;
    height: 16px;
}

.meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.meta-item {
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--tile);
}

.meta-label {
    margin: 0 0 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.meta-value {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.plan-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--lime) 45%, transparent);
    color: var(--ink);
}

/* ---------- Subview switching ---------- */

.subview {
    animation: rise 360ms var(--ease) both;
}

/* ---------- Templates ---------- */

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
    transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.tpl-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.12);
}

.tpl-preview {
    padding: 22px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--teal) 14%, transparent), transparent 70%);
    border-bottom: 1px solid var(--panel-border);
}

.sig {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-radius: 14px;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.sig-copy {
    flex: 1;
    min-width: 0;
}

.sig-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--lime), var(--teal));
}

.sig-line {
    height: 8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--ink) 16%, transparent);
    margin-bottom: 6px;
}

.sig-line.name {
    width: 60%;
    height: 10px;
    background: color-mix(in srgb, var(--ink) 42%, transparent);
}

.sig-line.role {
    width: 42%;
}

.sig-line.contact {
    width: 74%;
    margin-bottom: 0;
}

.tpl-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px 20px;
    flex: 1;
}

.tpl-name {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.tpl-desc {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    flex: 1;
}

.tpl-foot {
    display: flex;
    align-items: center;
    margin-top: 6px;
}

.lock-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--tile);
}

.lock-tag svg {
    width: 11px;
    height: 11px;
}

/* ---------- Empty / coming soon ---------- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 44px 24px;
    gap: 14px;
}

.empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--tile);
    color: var(--muted);
}

.empty-icon svg {
    width: 26px;
    height: 26px;
}

.empty-title {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.empty-text {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.55;
    max-width: 44ch;
}

.soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--lime) 28%, transparent);
    border: 1px solid color-mix(in srgb, var(--lime) 42%, transparent);
    color: var(--ink);
}

.soon-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6b8f2a;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--lime) 70%, transparent);
    animation: soon-pulse 2.2s var(--ease) infinite;
}

html[data-theme="dark"] .soon-dot {
    background: var(--lime);
}

@keyframes soon-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--lime) 55%, transparent);
    }

    50% {
        box-shadow: 0 0 0 6px transparent;
    }
}

/* Hero "próximamente" — Plantillas / Marketing */
.soon-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 48px 44px;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
}

.soon-hero-glow {
    position: absolute;
    inset: -28% -18% auto auto;
    width: min(720px, 80%);
    height: min(520px, 90%);
    background:
        radial-gradient(closest-side, color-mix(in srgb, var(--lime) 38%, transparent), transparent 72%),
        radial-gradient(closest-side at 18% 86%, color-mix(in srgb, var(--teal) 26%, transparent), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

html[data-theme="dark"] .soon-hero-glow {
    background:
        radial-gradient(closest-side, color-mix(in srgb, var(--lime) 22%, transparent), transparent 72%),
        radial-gradient(closest-side at 18% 86%, color-mix(in srgb, var(--teal) 20%, transparent), transparent 70%);
}

.soon-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
    gap: 48px;
    align-items: center;
}

.soon-hero-copy {
    min-width: 0;
}

.soon-hero-title {
    margin: 20px 0 0;
    font-family: var(--font-display);
    font-size: clamp(40px, 6.4vw, 68px);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 0.92;
}

.soon-hero-text {
    margin: 18px 0 0;
    max-width: 38ch;
    font-size: 15px;
    line-height: 1.55;
    color: var(--muted);
}

.soon-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.soon-hero-meta li {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}

html[data-theme="dark"] .soon-hero-meta li {
    background: color-mix(in srgb, var(--ink) 8%, transparent);
    border-color: color-mix(in srgb, var(--ink) 12%, transparent);
}

.soon-hero-stage {
    position: relative;
    width: 100%;
    min-height: 228px;
}

.soon-sig {
    width: 100%;
}

.soon-sig .sig {
    padding: 20px 18px;
}

.soon-sig-back {
    position: absolute;
    inset: 22px -10px auto 36px;
    opacity: 0.42;
    transform: rotate(3.6deg) scale(0.94);
    filter: blur(0.3px);
    pointer-events: none;
}

.soon-sig-front {
    position: relative;
    transform: rotate(-2.4deg);
    filter: drop-shadow(0 18px 36px rgba(2, 38, 30, 0.12));
}

.soon-sig-front::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(
        110deg,
        transparent 28%,
        color-mix(in srgb, var(--lime) 32%, transparent) 48%,
        transparent 64%
    );
    background-size: 220% 100%;
    animation: soon-sheen 6.2s ease-in-out infinite;
    pointer-events: none;
}

html[data-theme="dark"] .soon-sig-front {
    filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
}

@keyframes soon-sheen {
    0% {
        background-position: 130% 0;
    }

    100% {
        background-position: -30% 0;
    }
}

.soon-sig-icons {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.soon-sig-icons span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--teal) 55%, var(--ink) 20%);
    opacity: 0.72;
}

.soon-sig-icons span:nth-child(2) {
    background: color-mix(in srgb, var(--lime) 60%, var(--ink) 15%);
}

.soon-sig-icons span:nth-child(3) {
    background: color-mix(in srgb, var(--teal) 40%, transparent);
}

@media (max-width: 820px) {
    .soon-hero {
        padding: 36px 22px 40px;
    }

    .soon-hero-inner {
        grid-template-columns: 1fr;
        gap: 36px;
        justify-items: center;
        text-align: center;
    }

    .soon-hero-text {
        margin-left: auto;
        margin-right: auto;
    }

    .soon-hero-meta {
        justify-content: center;
    }

    .soon-hero-stage {
        width: min(100%, 360px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .soon-dot,
    .soon-sig-front::after {
        animation: none;
    }
}

/* ---------- Team roster ---------- */

.roster {
    display: flex;
    flex-direction: column;
}

.roster-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--panel-border);
}

.roster-row:last-child {
    border-bottom: 0;
}

.roster-row .avatar {
    width: 40px;
    height: 40px;
    font-size: 15px;
}

.roster-name {
    font-size: 14px;
    font-weight: 600;
}

.roster-role {
    font-size: 12.5px;
    color: var(--muted);
}

.roster-badge {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--tile);
    color: var(--muted);
}

.roster-badge.owner {
    background: color-mix(in srgb, var(--lime) 45%, transparent);
    color: var(--ink);
}

.roster-main {
    min-width: 0;
    flex: 1;
}

.roster-name,
.roster-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.roster-act {
    padding: 6px 12px;
    font-size: 12.5px;
}

.roster-act-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.roster-act-del:hover {
    background: color-mix(in srgb, #dc2626 12%, transparent);
    color: #dc2626;
}

/* ---------- Admin ---------- */

.content-wide {
    max-width: 1080px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.admin-stat-num {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.admin-stat-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.admin-search svg {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--muted);
    pointer-events: none;
}

.admin-search .input {
    padding-left: 40px;
}

.table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--panel-border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--panel-border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background-color 120ms ease;
}

.data-table tbody tr:hover {
    background: var(--tile);
}

.cell-user-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cell-user .avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.cell-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cell-user-name {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-weight: 600;
}

.cell-user-email {
    display: none;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.admin-tag {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    background: color-mix(in srgb, var(--lime) 45%, transparent);
    color: var(--ink);
}

.cell-email {
    color: var(--muted);
    overflow-wrap: anywhere;
    word-break: normal;
}

/* En escritorio el correo va en una sola línea (sin cortarse); si es muy
   largo, la tabla hace scroll horizontal gracias a .table-wrap. */
.users-table td.cell-email {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.cell-email-text {
    vertical-align: middle;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 8px;
    color: var(--muted);
    opacity: 0;
    transition: color 150ms ease, background-color 150ms ease, opacity 150ms ease;
}

.btn-copy svg {
    width: 15px;
    height: 15px;
}

.data-table tbody tr:hover .btn-copy,
.btn-copy:focus-visible {
    opacity: 1;
}

.btn-copy:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.btn-copy.is-copied {
    opacity: 1;
    color: var(--success);
}

.users-table .cell-joined,
.users-table .cell-seen {
    white-space: nowrap;
    color: var(--muted);
}

.cell-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.cell-error {
    text-align: center;
    color: var(--error);
    padding: 24px 12px !important;
}

.admin-empty {
    margin: 24px 0 4px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.col-actions,
.cell-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--muted);
    transition: color 150ms ease, background-color 150ms ease;
}

.btn-icon-danger:hover {
    color: var(--error);
    background: var(--error-bg);
}

.btn-icon-danger svg {
    width: 17px;
    height: 17px;
}

/* Etiqueta "Pro (gratis)" junto al nombre en el listado de usuarios. */
.pro-tag {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    background: color-mix(in srgb, var(--lime) 22%, transparent);
    color: var(--ink);
    border: 1px solid color-mix(in srgb, var(--lime) 60%, transparent);
}

/* Botón para conceder/retirar el acceso Pro gratis (estrella). */
.btn-icon-pro {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--muted);
    transition: color 150ms ease, background-color 150ms ease;
}

.btn-icon-pro:hover {
    color: var(--ink);
    background: var(--tile-hover);
}

.btn-icon-pro.is-active {
    color: color-mix(in srgb, var(--lime) 70%, var(--ink));
}

.btn-icon-pro.is-active svg {
    fill: color-mix(in srgb, var(--lime) 45%, transparent);
}

.btn-icon-pro svg {
    width: 17px;
    height: 17px;
}

.users-table-wrap {
    container-type: inline-size;
    container-name: users-table;
}

@container users-table (max-width: 920px) {
    .users-table .col-ip,
    .users-table .col-sessions,
    .users-table .cell-id,
    .users-table .cell-sessions {
        display: none;
    }
}

@container users-table (max-width: 680px) {
    .users-table {
        font-size: 13.5px;
    }

    .users-table thead {
        display: none;
    }

    .users-table,
    .users-table tbody {
        display: block;
        width: 100%;
    }

    .users-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .users-table tbody tr {
        position: relative;
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 12px;
        row-gap: 2px;
        padding: 14px 12px 10px;
        border: 1px solid var(--panel-border);
        border-radius: 16px;
        background: color-mix(in srgb, var(--panel-solid) 72%, transparent);
    }

    .users-table tbody tr:hover {
        background: color-mix(in srgb, var(--panel-solid) 72%, transparent);
    }

    .users-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .users-table tbody td {
        min-width: 0;
        padding: 8px 0;
        border-bottom: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .users-table tbody td::before {
        content: attr(data-label);
        font-size: 10.5px;
        font-weight: 650;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--muted);
        line-height: 1.3;
    }

    .users-table tbody td.cell-user {
        grid-column: 1 / -1;
        display: block;
        padding: 0 36px 12px 0;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--panel-border);
    }

    .users-table tbody td.cell-user::before {
        content: none;
    }

    .users-table .cell-user-email {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 3px;
    }

    .users-table .cell-user-email .cell-email-text {
        overflow-wrap: anywhere;
    }

    .users-table .cell-user-email .btn-copy {
        opacity: 1;
    }

    .users-table tbody td.cell-email {
        display: none;
    }

    .users-table tbody td.cell-id,
    .users-table tbody td.cell-sessions {
        display: flex;
    }

    .users-table tbody td.cell-joined,
    .users-table tbody td.cell-seen {
        white-space: normal;
    }

    .users-table tbody td.cell-id {
        overflow-wrap: anywhere;
        white-space: normal;
        font-size: 12px;
    }

    .users-table tbody td.cell-actions {
        position: absolute;
        top: 8px;
        right: 6px;
        grid-column: 1 / -1;
        width: auto;
        height: 0;
        padding: 0;
        overflow: visible;
        display: block;
        text-align: right;
    }

    .users-table tbody td.cell-actions::before {
        content: none;
    }
}

@media (max-width: 860px) {
    body[data-section="admin"] .card {
        padding: 16px 14px;
    }

    .admin-search {
        min-width: 0;
        max-width: none;
        width: 100%;
        flex: 1 1 100%;
    }
}

/* ---------- Mobile drawer ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms var(--ease);
}

.backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 860px) {
    .app,
    .app.is-sidebar-closed {
        grid-template-columns: 1fr;
    }

    .sidebar,
    .app.is-sidebar-closed .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 50;
        width: 280px;
        max-width: 86vw;
        border-right-width: 1px;
        pointer-events: auto;
        transform: translateX(-100%);
        transition: transform 260ms var(--ease);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    }

    .sidebar.is-open {
        transform: none;
    }

    .app:has(.sidebar.is-open) .menu-toggle {
        display: none;
    }

    .sidebar-head,
    .nav,
    .sidebar-footer {
        width: 100%;
        max-width: 86vw;
    }
}

@media (prefers-reduced-motion: reduce) {

    .view,
    .subview,
    .sidebar,
    .nav-sub,
    .backdrop {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Selector de planes (facturación) ---------- */
.plan-period-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.pp-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 12%, transparent);
    border: 1px solid var(--panel-border);
}

.pp-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pp-btn.is-active {
    background: var(--panel-solid, #fff);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .pp-btn.is-active {
    background: color-mix(in srgb, var(--ink) 14%, var(--panel-solid));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.pp-save {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--teal, var(--lime));
    background: color-mix(in srgb, var(--teal, var(--lime)) 16%, transparent);
    padding: 4px 10px;
    border-radius: 999px;
}

html[data-theme="dark"] .pp-save {
    color: var(--on-accent);
    background: var(--lime);
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.plan-option {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    background: color-mix(in srgb, var(--panel-solid) 60%, transparent);
}

.plan-option.is-current {
    border-color: color-mix(in srgb, var(--lime) 60%, var(--panel-border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--lime) 45%, transparent);
}

.plan-option-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.plan-option-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

.plan-option-badge {
    flex: none;
}

.plan-option-desc {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
    min-height: 18px;
}

.plan-option-price {
    margin: 14px 0 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.plan-option-amount {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.plan-option-period {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.plan-option-vat {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.plan-option-features {
    list-style: none;
    margin: 16px 0 20px;
    padding: 0;
    display: grid;
    gap: 10px;
    flex: 1 1 auto;
}

.plan-option-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--ink);
}

.plan-option-features li svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
    color: var(--teal, var(--lime));
}

/* GIF de "Insignia de verificación" junto al texto (plan Pro). */
.plan-feat-verify {
    width: 18px;
    height: 18px;
    margin-left: 6px;
    vertical-align: -4px;
}

.plan-option-cta {
    margin-top: auto;
    text-align: center;
    text-decoration: none;
}

.plan-option-cta.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* Enlace en línea (p. ej. "Ver factura" en la tabla de pagos). */
.link-inline {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}

.link-inline:hover {
  text-decoration: underline;
}

/* ---------- Modal de confirmación ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 430px;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    transform: translateY(10px) scale(0.98);
    transition: transform 0.2s ease;
}

.modal-overlay.is-open .modal-card {
    transform: none;
}

.modal-title {
    margin: 0 0 10px;
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
}

.modal-msg {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    min-width: 120px;
    justify-content: center;
}

/* Botón de confirmación destructiva (rojo sólido, sólo dentro del modal) */
.modal-actions .btn-primary.btn-danger {
    background: var(--error);
    color: #fff;
}

.modal-actions .btn-primary.btn-danger:hover {
    background: color-mix(in srgb, var(--error) 85%, #000);
}

/* ---------- Toasts ---------- */
.toast-wrap {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: grid;
    gap: 10px;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast {
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    color: var(--ink);
    padding: 13px 20px;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: none;
}

.toast.is-success {
    border-color: color-mix(in srgb, var(--success) 55%, var(--panel-border));
}

.toast.is-success::before {
    content: "✓ ";
    color: var(--success);
    font-weight: 700;
}

.toast.is-error {
    border-color: color-mix(in srgb, var(--error) 55%, var(--panel-border));
}

.toast.is-error::before {
    content: "! ";
    color: var(--error);
    font-weight: 700;
}

/* ---------- Pro lock (Team-only features) ---------- */

/* Enlace de la barra lateral bloqueado */
.nav-sub .nav-link.is-locked {
    color: color-mix(in srgb, var(--muted) 82%, transparent);
    cursor: pointer;
}

.nav-sub .nav-link.is-locked:hover {
    color: var(--ink);
}

.nav-sub .nav-link.is-locked > span:first-child {
    opacity: 0.85;
}

.nav-lock {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding-left: 8px;
    color: color-mix(in srgb, var(--muted) 85%, transparent);
}

.nav-lock svg {
    width: 13px;
    height: 13px;
}

.nav-link.is-locked:hover .nav-lock {
    color: var(--ink);
}

/* Distintivo "Plan Team" */
.pro-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: color-mix(in srgb, var(--lime) 45%, transparent);
    color: var(--ink);
    width: max-content;
}

.pro-lock-badge svg {
    width: 13px;
    height: 13px;
}

/* Tarjeta inline que sustituye la subvista bloqueada */
.pro-lock-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 48px 32px;
}

.pro-lock-panel-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--lime) 32%, transparent);
    color: var(--ink);
    margin-bottom: 2px;
}

.pro-lock-panel-icon svg {
    width: 28px;
    height: 28px;
}

.pro-lock-panel-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
}

.pro-lock-panel-text {
    margin: 0;
    max-width: 440px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
}

.pro-lock-panel .btn-primary {
    margin-top: 6px;
}

/* Modal / widget de mejora */
.pro-lock-card {
    text-align: center;
}

.pro-lock-card .pro-lock-badge {
    margin: 0 auto 14px;
}

.pro-lock-card .modal-actions {
    justify-content: center;
}

/* ---------- Editor de firmas (Fundador) — estilo "firma definitiva" ---------- */

/* Acento teal propio del editor (independiente del tema del panel). */
.app [data-subview="fundador"],
.app [data-subview="miembros"] {
    --fsig-accent: #0f766e;
    --fsig-accent-hover: #0c5e58;
    --fsig-accent-soft: #e6f4f2;
    --fsig-line: var(--panel-border);
    --fsig-ink: var(--ink);
    --fsig-muted: var(--muted);
}

/* Botones teal (primario y fantasma) */
.btn-teal,
.btn-ghost-teal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}
.btn-teal svg,
.btn-ghost-teal svg {
    width: 16px;
    height: 16px;
}
.btn-teal:active,
.btn-ghost-teal:active {
    transform: translateY(1px);
}
.btn-teal {
    background: var(--fsig-accent, #0f766e);
    color: #fff;
    border: 1px solid transparent;
}
.btn-teal:hover {
    background: var(--fsig-accent-hover, #0c5e58);
}
.btn-teal:disabled {
    opacity: 0.55;
    cursor: default;
}
.btn-ghost-teal {
    background: var(--panel-solid);
    color: var(--ink);
    border: 1px solid var(--field-border);
}
.btn-ghost-teal:hover {
    background: var(--tile);
}

/* Tarjetas base */
.fsig-card {
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: var(--panel);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.06);
}
.fsig-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0;
}
.fsig-section-title svg {
    width: 15px;
    height: 15px;
}

/* Galería de modelos: dos columnas (estático + animado), con datos de ejemplo */
.fsig-models {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.fsig-model {
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}
.fsig-model.is-pro {
    border-color: color-mix(in srgb, var(--fsig-accent) 35%, var(--panel-border));
}
.fsig-model-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--panel-border);
}
.fsig-model-head-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.fsig-model-index {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--fsig-accent-soft);
    color: var(--fsig-accent);
    font-weight: 700;
    font-size: 13px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.fsig-model-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}
.fsig-model-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}
.fsig-model-edit {
    min-height: 40px;
    padding: 0 16px;
    flex-shrink: 0;
}
/* Pie de tarjeta: botones debajo de la vista previa */
.fsig-model-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--panel-border);
}
.fsig-model-view {
    min-height: 40px;
    padding: 0 14px;
    flex-shrink: 0;
}
.fsig-model-stage {
    padding: 18px;
    background: #fff;
    overflow-x: auto;
    position: relative;
}
.fsig-model-prev,
.fsig-preview {
    display: inline-block;
    width: max-content;
    max-width: none;
}
/* En la galería las firmas se reducen para caber en dos columnas */
.fsig-model-prev {
    zoom: 0.62;
}

/* Vista previa del logo animado: destello sutil, con una pausa amplia entre
   recorridos. El GIF generado replica este acabado dentro del correo. */
.fsig-logo-anim {
    position: relative;
    display: inline-block;
    overflow: hidden;
    vertical-align: middle;
    line-height: 0;
}
.fsig-logo-anim::after {
    content: "";
    position: absolute;
    top: -35%;
    bottom: -35%;
    left: -40%;
    width: 22%;
    transform: skewX(-18deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    animation: fsig-logo-sheen 4.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}
img.fsig-anim-logo {
    opacity: 1;
}
@keyframes fsig-logo-sheen {
    0%, 19% {
        left: -40%;
        opacity: 0;
    }
    23% {
        opacity: 1;
    }
    45% {
        left: 115%;
        opacity: 1;
    }
    49%, 100% {
        left: 115%;
        opacity: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    img.fsig-anim-logo,
    .fsig-logo-anim::after {
        animation: none;
    }
    img.fsig-anim-logo {
        opacity: 1;
    }
}

/* Insignia "plan superior" en la cabecera de la tarjeta animada */
.fsig-pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--fsig-accent);
    background: var(--fsig-accent-soft);
}
.fsig-pro-badge svg {
    width: 14px;
    height: 14px;
}

/* Capa de bloqueo sobre la vista previa animada */
.fsig-pro-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 20px;
    background: color-mix(in srgb, var(--panel) 72%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.fsig-pro-overlay-ic {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--fsig-accent-soft);
    color: var(--fsig-accent);
}
.fsig-pro-overlay-ic svg {
    width: 22px;
    height: 22px;
}
.fsig-pro-overlay p {
    margin: 0;
    max-width: 260px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-pro-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* Modal "Visualizar": firma animada a tamaño real */
.fsig-view-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 30, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.fsig-view-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.fsig-view-card {
    width: min(760px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}
.fsig-view-overlay.is-open .fsig-view-card {
    transform: none;
}
.fsig-view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 700;
    color: var(--ink);
}
.fsig-view-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
}
.fsig-view-close:hover {
    color: var(--ink);
}
.fsig-view-body {
    padding: 28px;
    background: #fff;
    overflow: auto;
}
.fsig-view-prev {
    display: inline-block;
    width: max-content;
    max-width: none;
}

/* Modal de recorte del logo */
.fsig-crop-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 30, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}
.fsig-crop-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.fsig-crop-card {
    width: min(680px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}
.fsig-crop-overlay.is-open .fsig-crop-card {
    transform: none;
}
.fsig-crop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 700;
    color: var(--ink);
}
.fsig-crop-body {
    padding: 18px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    background: #f3f5f7;
}
html[data-theme="dark"] .fsig-crop-body {
    background: #0c1513;
}
.fsig-crop-hint {
    margin: 0;
    align-self: flex-start;
    font-size: 12.5px;
    color: var(--muted);
}
.fsig-crop-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
    touch-action: none;
}
.fsig-crop-stage img {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    user-select: none;
    -webkit-user-drag: none;
}
.fsig-crop-box {
    position: absolute;
    box-sizing: border-box;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
}
/* Previsualización de máscara circular (foto de perfil circular). */
.fsig-crop-box.is-round {
    border-radius: 50%;
}
.fsig-crop-h {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 1px solid var(--fsig-accent, #0f766e);
    border-radius: 3px;
}
/* Esquinas */
.fsig-crop-h[data-h="nw"] { top: -8px; left: -8px; cursor: nwse-resize; }
.fsig-crop-h[data-h="ne"] { top: -8px; right: -8px; cursor: nesw-resize; }
.fsig-crop-h[data-h="sw"] { bottom: -8px; left: -8px; cursor: nesw-resize; }
.fsig-crop-h[data-h="se"] { bottom: -8px; right: -8px; cursor: nwse-resize; }
/* Laterales (centrados en cada borde) */
.fsig-crop-h[data-h="n"] { top: -8px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.fsig-crop-h[data-h="s"] { bottom: -8px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.fsig-crop-h[data-h="w"] { left: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.fsig-crop-h[data-h="e"] { right: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.fsig-crop-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--panel-border);
}
.fsig-crop-foot-main {
    display: flex;
    gap: 10px;
}

/* Barra superior del editor (volver + diseño actual) */
.fsig-editor-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.fsig-back {
    min-height: 40px;
    padding: 0 16px;
}
.fsig-editing-label {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.fsig-editing-kicker {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}
.fsig-editing-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

/* En edición, el contenido usa todo el ancho disponible (el panel
   centra el resto de páginas en 880px). Mismo tratamiento para la
   firma de un miembro del equipo. */
.content:has([data-subview="fundador"]:not([hidden]) [data-view="editor"]:not([hidden])),
.content:has([data-members-view="editor"]:not([hidden])) {
    max-width: none;
    padding-inline: clamp(16px, 2vw, 28px);
}
.content:has([data-subview="fundador"]:not([hidden]) [data-view="editor"]:not([hidden])) .view-head,
.content:has([data-members-view="editor"]:not([hidden]) [data-view="editor"]:not([hidden])) .view-head {
    display: none;
}

[data-view="editor"] .fsig-card {
    overflow: visible;
}

/* Cuerpo del editor: formulario con aire | vista previa a tamaño real */
.fsig-body {
    display: grid;
    grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
    gap: 0;
    align-items: start;
}
.fsig-editor {
    padding: 28px 28px 36px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.fsig-preview-col {
    border-left: 1px solid var(--panel-border);
    background: var(--tile);
    padding: 28px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
    position: sticky;
    top: 64px;
    max-height: calc(100svh - 80px);
    overflow: auto;
}

/* Secciones del formulario */
.fsig-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.fsig-section[hidden] {
    display: none;
}
.fsig-section + .fsig-section {
    margin-top: 8px;
    padding-top: 28px;
    border-top: 1px solid var(--panel-border);
}
.fsig-section .fsig-section-title {
    margin-bottom: 2px;
}

.fsig-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
}
.fsig-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fsig-field > span {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-field input:not([type="color"]):not([type="range"]),
.fsig-field textarea,
.fsig-field select {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--field);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fsig-field textarea {
    min-height: 64px;
    resize: vertical;
    line-height: 1.45;
}
.fsig-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.fsig-field input::placeholder,
.fsig-field textarea::placeholder {
    color: color-mix(in srgb, var(--muted) 70%, transparent);
}
.fsig-field input:focus,
.fsig-field textarea:focus,
.fsig-field select:focus {
    outline: none;
    border-color: var(--fsig-accent);
    box-shadow: 0 0 0 3px var(--fsig-accent-soft);
}
.fsig-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
}
.fsig-extra-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fsig-extra-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fsig-extra-item input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--field);
}
.fsig-extra-item input:focus {
    outline: none;
    border-color: var(--fsig-accent);
    box-shadow: 0 0 0 3px var(--fsig-accent-soft);
}
.fsig-extra-del {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
}
.fsig-extra-del:hover {
    color: var(--error, #b42318);
    background: var(--error-bg, rgba(180, 35, 24, 0.08));
}
.fsig-add-line {
    align-self: flex-start;
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
}

/* Botones CTA del editor */
.fsig-btns {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.fsig-btn-card {
    padding: 16px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--tile);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}
.fsig-btn-card:has(.fsig-icon-dd.is-open) {
    z-index: 3;
}
.fsig-btn-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fsig-btn-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.fsig-btn-card-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 650;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fsig-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}
.fsig-field-color input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 4px;
    cursor: pointer;
    background: var(--field);
}

/* Desplegable de iconos (el <select> nativo no puede mostrar SVG) */
.fsig-icon-dd {
    position: relative;
}
.fsig-icon-dd-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 32px 6px 8px;
    border: 1px solid var(--field-border);
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background-color: var(--field);
    cursor: pointer;
    text-align: left;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.fsig-icon-dd-btn:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 28%, transparent);
}
.fsig-icon-dd-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fsig-icon-chip {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #ffffff;
    border: 1px solid rgba(2, 38, 30, 0.1);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.fsig-icon-chip img {
    width: 16px;
    height: 16px;
    display: block;
}
.fsig-icon-dd-menu {
    position: absolute;
    z-index: 20;
    left: 0;
    right: auto;
    top: calc(100% + 4px);
    width: 280px;
    max-width: calc(100vw - 48px);
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--menu);
    box-shadow: 0 12px 32px rgba(2, 38, 30, 0.16);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}
.fsig-icon-dd-menu[hidden] {
    display: none;
}
.fsig-icon-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.fsig-icon-opt:hover,
.fsig-icon-opt.is-active {
    background: var(--nav-active);
}
.fsig-icon-opt span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fsig-icon-mode {
    display: inline-flex;
    align-self: flex-start;
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--field-border);
    border-radius: 9px;
    background: var(--field);
}
.fsig-icon-mode-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 7px;
    cursor: pointer;
}
.fsig-icon-mode-btn.is-active {
    background: var(--tile-hover);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(2, 38, 30, 0.08);
}

/* Subidas de imagen: una fila por archivo, para que no queden apretadas */
.fsig-uploads {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fsig-upload {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 16px;
    align-items: center;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--tile) 65%, transparent);
}
.fsig-upload[hidden] {
    display: none;
}
.fsig-upload-prev {
    width: 96px;
    height: 72px;
    border: 1px dashed var(--field-border);
    border-radius: 10px;
    background: var(--field);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.fsig-upload-prev.is-round {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    justify-self: center;
}
.fsig-upload-prev img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.fsig-upload-prev.is-round img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fsig-upload-ph {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: color-mix(in srgb, var(--muted) 75%, transparent);
}
.fsig-upload-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.fsig-upload-btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12.5px;
    border-radius: 9px;
}
.fsig-upload-btn.is-busy {
    opacity: 0.6;
    pointer-events: none;
}
.fsig-upload-btn svg {
    width: 14px;
    height: 14px;
}
.fsig-upload-remove {
    font-size: 12px;
    font-weight: 600;
    color: var(--error);
    background: none;
    cursor: pointer;
}
.fsig-upload-remove:hover {
    text-decoration: underline;
}

/* Toggles (interruptores) */
.fsig-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fsig-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--tile) 55%, transparent);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.fsig-toggle:hover {
    background: var(--tile);
}
.fsig-toggle[hidden] {
    display: none;
}
.fsig-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.fsig-toggle-text b {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-toggle-text small {
    font-size: 12px;
    color: var(--muted);
}
.fsig-toggle input {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 40%, transparent);
    position: relative;
    cursor: pointer;
    transition: background 0.18s ease;
    flex-shrink: 0;
    margin-left: auto;
}
.fsig-toggle input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}
.fsig-toggle input:checked {
    background: var(--fsig-accent);
}
.fsig-toggle input:checked::after {
    transform: translateX(18px);
}

/* Sliders */
.fsig-ctrl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 2px 0 4px;
}
.fsig-ctrl[hidden] {
    display: none;
}
.fsig-ctrl span {
    grid-column: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-ctrl output {
    grid-column: 2;
    font-size: 12px;
    font-weight: 700;
    color: var(--fsig-accent);
    background: var(--fsig-accent-soft);
    padding: 2px 9px;
    border-radius: 999px;
    min-width: 48px;
    text-align: center;
}
.fsig-ctrl input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    height: 4px;
    accent-color: var(--fsig-accent);
    cursor: pointer;
}

/* Forma de la foto de perfil (control segmentado) */
.fsig-shape {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.fsig-shape-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    background: var(--field);
}
.fsig-seg button {
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}
.fsig-seg button:hover {
    color: var(--ink);
}
.fsig-seg button.is-active {
    color: #fff;
    background: var(--fsig-accent, #0f766e);
}

/* Vista previa */
.fsig-preview-head {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    flex-shrink: 0;
}
.fsig-preview-wrap {
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 36px 40px;
    overflow: auto;
    min-height: 180px;
    flex: 1;
}
.fsig-preview {
    display: block;
    width: max-content;
    max-width: none;
}
.fsig-preview img {
    max-width: none;
}
.fsig-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.fsig-actions .btn-teal,
.fsig-actions .btn-ghost-teal {
    flex: 1;
    min-width: 130px;
}

/* Aviso fijo bajo los botones: recordar reañadir la firma en Gmail cuando se
   reemplaza una imagen (la anterior deja de servirse). */
.fsig-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--error-bg);
    border: 1px solid color-mix(in srgb, var(--error) 45%, var(--panel-border));
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.4;
    font-weight: 500;
}
.fsig-notice[hidden] {
    display: none;
}
.fsig-notice-ico {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--error);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
}
.fsig-notice-text {
    flex: 1;
}

/* Indicador del peso estimado de la firma en el correo (bajo los botones). */
.fsig-weight {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--tile);
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--muted);
}
.fsig-weight.is-good {
    border-left-color: var(--success);
}
.fsig-weight.is-medium {
    border-left-color: #0f766e;
}
.fsig-weight.is-heavy {
    border-left-color: #c8860b;
}
.fsig-weight-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.fsig-weight-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.fsig-weight-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.fsig-weight.is-good .fsig-weight-value {
    color: var(--success);
}
.fsig-weight.is-medium .fsig-weight-value {
    color: #0f766e;
}
.fsig-weight.is-heavy .fsig-weight-value {
    color: #c8860b;
}
.fsig-weight-hint {
    margin-top: 4px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--muted);
}
.fsig-weight-hint:empty {
    display: none;
}
html[data-theme="dark"] .fsig-weight.is-medium,
html[data-theme="dark"] .fsig-weight.is-medium .fsig-weight-value {
    border-left-color: #4fd1c5;
    color: #4fd1c5;
}
html[data-theme="dark"] .fsig-weight.is-heavy,
html[data-theme="dark"] .fsig-weight.is-heavy .fsig-weight-value {
    border-left-color: #e6b862;
    color: #e6b862;
}

.fsig-error {
    color: var(--error);
    font-size: 14px;
    padding: 20px;
}

@media (max-width: 1000px) {
    .fsig-models {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .fsig-body {
        grid-template-columns: 1fr;
    }
    .fsig-preview-col {
        position: static;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--panel-border);
    }
}
@media (max-width: 620px) {
    .fsig-upload {
        grid-template-columns: 72px minmax(0, 1fr);
        padding: 10px;
    }
    .fsig-upload-prev,
    .fsig-upload-prev.is-round {
        width: 72px;
        height: 72px;
    }
    .fsig-grid-2 {
        grid-template-columns: 1fr;
    }
    .fsig-btn-row {
        grid-template-columns: 1fr;
    }
    .fsig-model-head {
        flex-wrap: wrap;
    }
    .fsig-model-foot .fsig-model-edit,
    .fsig-model-foot .fsig-model-view {
        flex: 1;
    }
}

/* ---------- Analytics dashboard ---------- */

.content:has([data-subview="rendimiento"]:not([hidden])) {
    max-width: 1280px;
}

.an-view-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 28px;
    flex-wrap: wrap;
}

.an-view-copy {
    min-width: 0;
    flex: 1 1 260px;
}

.an-view-filters {
    flex: 0 0 auto;
    margin-bottom: 2px;
}

.an-wrap {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.an-wrap.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 180ms var(--ease);
}

.an-wrap > .card + .card,
.an-tiles > .card + .card,
.an-grid > .card + .card {
    margin-top: 0;
}

.an-filters-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.an-select {
    appearance: none;
    -webkit-appearance: none;
    max-width: 220px;
    padding: 9px 34px 9px 14px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background-color: var(--panel);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%237a938d' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    color: var(--ink);
    font: 600 12.5px/1 var(--font);
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    transition: box-shadow 150ms ease, border-color 150ms ease;
}

.an-select:hover {
    border-color: color-mix(in srgb, var(--teal) 40%, var(--panel-border));
}

.an-select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 28%, transparent);
}

.an-seg {
    display: inline-flex;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 4px;
    gap: 2px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.an-seg button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: 600 12.5px/1 var(--font);
    letter-spacing: -0.01em;
    padding: 8px 13px;
    border-radius: 10px;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
    white-space: nowrap;
}

.an-seg button:hover {
    color: var(--ink);
}

.an-seg button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 28%, transparent);
}

.an-seg button.is-active {
    background: var(--panel-solid);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--panel-border);
}

html[data-theme="dark"] .an-seg button.is-active {
    background: color-mix(in srgb, var(--lime) 16%, var(--panel-solid));
}

.an-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.an-tile {
    position: relative;
    overflow: hidden;
    padding: 18px 20px 16px;
    border-radius: 20px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 118px;
    transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.an-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.09);
}

.an-tile.is-featured {
    background:
        radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--lime) 34%, transparent) 0%, transparent 58%),
        var(--panel);
}

.an-tile-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.an-tile-label {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 6px;
}

.an-tile-ico {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--teal) 26%, transparent);
    color: var(--ink);
}

.an-tile-ico svg {
    width: 16px;
    height: 16px;
}

.an-tile-ico img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.an-tile-ico.is-brand {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--panel-border);
}

.an-tile-value {
    font-family: var(--font);
    font-size: clamp(24px, 2.2vw, 30px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.an-tile-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
}

.an-tile-sub {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--muted);
}

.an-spark {
    width: 92px;
    height: 30px;
    color: #0f766e;
    flex-shrink: 0;
}

html[data-theme="dark"] .an-spark {
    color: var(--lime);
}

.an-grid {
    display: grid;
    gap: 16px;
}

.an-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.an-card .card-head {
    margin-bottom: 16px;
}

.an-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.an-card-ico {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--tile);
    color: var(--muted);
}

.an-card-ico svg {
    width: 15px;
    height: 15px;
}

.an-card-meta {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.an-mapcard {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 0.85fr);
    gap: 8px 20px;
    align-items: stretch;
}

.an-map-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.an-map,
#an-map.an-map,
#an-map.jvm-container {
    width: 100%;
    height: 68vh !important;
    min-height: 520px;
    max-height: 720px;
    border-radius: 14px;
    overflow: hidden;
    background:
        radial-gradient(80% 70% at 50% 45%, color-mix(in srgb, var(--teal) 10%, transparent), transparent 70%);
}

.an-map .jvm-container,
#an-map.jvm-container {
    width: 100% !important;
    height: 68vh !important;
    min-height: 520px;
    max-height: 720px;
    background: transparent !important;
}

/* El tooltip de jsVectorMap se inserta en document.body, no dentro del mapa.
   .app tiene z-index: 1, así que sin un z-index alto queda detrás. */
body > .jvm-tooltip,
.jvm-tooltip {
    z-index: 40 !important;
    padding: 7px 11px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: var(--ink) !important;
    color: var(--bg) !important;
    font-family: var(--font) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22) !important;
    pointer-events: none;
}

.jvm-tooltip.active {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.jvm-tooltip img {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.an-map .jvm-zoom-btn {
    background: var(--panel-solid) !important;
    color: var(--ink) !important;
    border: 1px solid var(--panel-border) !important;
    border-radius: 8px !important;
    width: 26px !important;
    height: 26px !important;
    line-height: 24px !important;
    font-size: 14px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.an-map .jvm-zoom-btn:hover {
    background: var(--tile-hover) !important;
}

.an-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.an-legend-bar {
    height: 6px;
    width: 120px;
    border-radius: 99px;
    background: linear-gradient(90deg, #cfe8e4, #0d4a42);
}

html[data-theme="dark"] .an-legend-bar {
    background: linear-gradient(90deg, #7ed4cb, #dafc92);
}

.an-clist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 720px;
    overflow: auto;
    padding: 2px 4px 2px 2px;
    border-left: 1px solid var(--panel-border);
    padding-left: 16px;
    scrollbar-width: thin;
}

.an-crow {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 11px;
    isolation: isolate;
}

.an-crow-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 11px;
    background: color-mix(in srgb, var(--teal) 18%, transparent);
    z-index: -1;
}

.an-crow:hover .an-crow-fill {
    background: color-mix(in srgb, var(--teal) 28%, transparent);
}

.an-rank {
    width: 18px;
    font-size: 11px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    text-align: right;
}

.an-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    display: block;
    box-shadow: 0 0 0 1px var(--panel-border);
}

.an-tile-ico .an-flag {
    width: 22px;
    height: 16px;
}

.an-cname {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.an-cval {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.an-cpct {
    width: 36px;
    text-align: right;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.an-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.an-brow {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.an-bhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.an-bhead .an-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 99px;
    margin-right: 8px;
    vertical-align: middle;
}

.an-type-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
}

.an-bval {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.an-bmeta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.an-bpct {
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    min-width: 34px;
    text-align: right;
}

.an-btrack {
    height: 7px;
    border-radius: 99px;
    background: var(--tile);
    overflow: hidden;
}

.an-bfill {
    height: 100%;
    border-radius: 99px;
    transition: width 500ms var(--ease);
}

.an-chart-wrap {
    position: relative;
}

.an-ymax {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.an-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 196px;
    padding: 22px 2px 0;
    border-bottom: 1px solid var(--panel-border);
    background-image: repeating-linear-gradient(
        to top,
        transparent 0,
        transparent calc(25% - 1px),
        color-mix(in srgb, var(--ink) 6%, transparent) calc(25% - 1px),
        color-mix(in srgb, var(--ink) 6%, transparent) 25%
    );
    background-origin: content-box;
}

.an-cbar {
    flex: 1;
    min-width: 0;
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, #5aa8a4 0%, color-mix(in srgb, var(--teal) 55%, transparent) 100%);
    transition: height 400ms var(--ease), filter 150ms ease;
    position: relative;
    cursor: default;
}

.an-cbar:hover {
    filter: brightness(1.08);
}

.an-cbar.is-zero {
    background: var(--tile);
    filter: none;
}

.an-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    z-index: 3;
    padding: 6px 9px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--bg);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: -0.01em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transition: opacity 120ms ease;
}

.an-cbar:hover .an-tip {
    opacity: 1;
}

.an-cbar:first-child .an-tip {
    left: 0;
    transform: none;
}

.an-cbar:last-child .an-tip {
    left: auto;
    right: 0;
    transform: none;
}

.an-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}

.an-note {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

.an-skel,
.an-skel-block {
    border-radius: 20px;
    background: linear-gradient(
        100deg,
        var(--tile) 20%,
        var(--tile-hover) 40%,
        var(--tile) 60%
    );
    background-size: 200% 100%;
    animation: an-shimmer 1.35s ease infinite;
    border: 1px solid var(--panel-border);
}

.an-skel {
    min-height: 118px;
}

.an-skel-block {
    min-height: 220px;
}

@keyframes an-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .an-skel,
    .an-skel-block,
    .an-bfill,
    .an-cbar,
    .an-tile {
        animation: none;
        transition: none;
    }
}

@media (max-width: 980px) {
    .an-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .an-grid-3 {
        grid-template-columns: 1fr;
    }

    .an-mapcard {
        grid-template-columns: 1fr;
    }

    .an-clist {
        border-left: 0;
        border-top: 1px solid var(--panel-border);
        padding-left: 0;
        padding-top: 14px;
        margin-top: 4px;
        max-height: 420px;
    }

    .an-map,
    #an-map.an-map,
    #an-map.jvm-container,
    .an-map .jvm-container {
        height: 58vh !important;
        min-height: 380px;
        max-height: 480px;
    }
}

@media (max-width: 560px) {
    .an-tiles {
        grid-template-columns: 1fr;
    }

    .an-view-filters {
        width: 100%;
    }

    .an-filters-row {
        width: 100%;
    }

    .an-select {
        width: 100%;
        max-width: none;
    }

    .an-seg {
        width: 100%;
        overflow-x: auto;
    }

    .an-seg button {
        flex: 1;
        text-align: center;
        padding: 8px 8px;
    }

    .an-tile-value {
        font-size: 30px;
    }
}

/* ---------- Tutorial ---------- */

.tutorial-client-mark {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-top: 2px;
    object-fit: contain;
}

.tutorial-video {
    overflow: hidden;
    border-radius: 14px;
    background: #0b1412;
    border: 1px solid var(--panel-border);
}

.tutorial-video video {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(72vh, 560px);
    background: #0b1412;
}

.tutorial-steps {
    counter-reset: tutorial-step;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tutorial-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
}

.tutorial-steps li::before {
    counter-increment: tutorial-step;
    content: counter(tutorial-step);
    display: flex;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--lime) 55%, transparent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 700;
}

.tutorial-actions {
    margin-top: 22px;
}

/* ---------- Animated profile photo (Pro) ---------- */

.pa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
    gap: 20px;
    align-items: start;
}

/* Cuando la función se bloquea (Starter / sin plan) sustituimos las columnas
   interactivas por la tarjeta de upgrade, que ocupa todo el ancho. */
.pa-layout.is-locked {
    display: block;
}

.pa-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.pa-preview-card {
    position: sticky;
    top: 20px;
}

/* Upload dropzone */
.pa-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 30px 22px;
    border-radius: 16px;
    border: 1.5px dashed var(--field-border);
    background: var(--tile);
    cursor: pointer;
    transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.pa-drop:hover,
.pa-drop:focus-within,
.pa-drop.is-drag {
    border-color: color-mix(in srgb, var(--teal) 60%, transparent);
    background: var(--tile-hover);
}

.pa-drop-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    color: var(--ink);
    background: color-mix(in srgb, var(--teal) 20%, transparent);
}

.pa-drop-icon svg {
    width: 22px;
    height: 22px;
}

.pa-drop-cta {
    pointer-events: none;
}

.pa-drop-hint {
    margin: 0;
    max-width: 34ch;
}

/* Effect grid */
.pa-fx-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pa-fx-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 10px;
    border-radius: 14px;
    border: 1.5px solid var(--panel-border);
    background: var(--tile);
    cursor: pointer;
    transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}

.pa-fx-tile:hover {
    background: var(--tile-hover);
}

.pa-fx-tile input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pa-fx-tile:has(input:checked) {
    border-color: color-mix(in srgb, var(--teal) 70%, transparent);
    background: color-mix(in srgb, var(--teal) 12%, transparent);
}

.pa-fx-tile:has(input:focus-visible) {
    outline: 2px solid color-mix(in srgb, var(--teal) 70%, transparent);
    outline-offset: 2px;
}

.pa-fx-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

/* Small circular swatches that hint at each effect */
.pa-fx-preview {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    overflow: hidden;
    background:
        radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--lime) 80%, transparent), transparent 60%),
        linear-gradient(135deg, var(--teal), var(--ink));
    box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.08);
}

.pa-fx-preview::after {
    content: "";
    position: absolute;
    inset: 0;
}

.pa-fx-tile:has(input:checked) .pa-fx-circle {
    animation: pa-pulse 2.4s var(--ease) infinite;
}

.pa-fx-tile:has(input:checked) .pa-fx-zoom {
    animation: pa-zoom 2.4s var(--ease) infinite;
}

.pa-fx-tile:has(input:checked) .pa-fx-waves::after {
    background: radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(255, 255, 255, 0.35) 42%, transparent 54%);
    animation: pa-waves 2.2s linear infinite;
}

.pa-fx-tile:has(input:checked) .pa-fx-flash::after {
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.75) 50%, transparent 60%);
    animation: pa-flash 2.2s var(--ease) infinite;
}

.pa-fx-tile:has(input:checked) .pa-fx-scanner::after {
    background: linear-gradient(to bottom, transparent 46%, rgba(218, 252, 146, 0.85) 50%, transparent 54%);
    animation: pa-scanner 2s linear infinite;
}

.pa-fx-tile:has(input:checked) .pa-fx-curtain::after {
    background: var(--panel-solid);
    animation: pa-curtain 2.4s var(--ease) infinite;
}

@keyframes pa-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes pa-zoom {
    0%, 100% { transform: scale(0.7); }
    50% { transform: scale(1); }
}

@keyframes pa-waves {
    0% { transform: scale(0.2); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes pa-flash {
    0% { transform: translateX(-120%); }
    45%, 100% { transform: translateX(120%); }
}

@keyframes pa-scanner {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

@keyframes pa-curtain {
    0% { clip-path: inset(0 0 0 0); }
    45% { clip-path: inset(0 0 0 100%); }
    55% { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

/* Preview */
.pa-preview-stage {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
}

.pa-preview-circle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(240px, 60vw);
    aspect-ratio: 1;
    border-radius: 999px;
    text-align: center;
    padding: 20px;
    color: var(--muted);
    background: var(--tile);
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

.pa-preview-circle img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pa-preview-circle.is-loading {
    opacity: 0.6;
}

.pa-preview-circle.is-loading::after {
    content: "";
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(var(--ink-rgb), 0.18);
    border-top-color: var(--ink);
    animation: pa-spin 720ms linear infinite;
}

@keyframes pa-spin {
    to { transform: rotate(360deg); }
}

.pa-preview-empty {
    font-size: 13px;
    line-height: 1.5;
    max-width: 22ch;
}

.pa-preview-msg {
    display: block;
    margin-top: 14px;
    text-align: center;
    min-height: 18px;
}

/* Botón "Mira cómo queda en Gmail" */
.pa-see-gmail {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 160ms var(--ease), border-color 160ms var(--ease);
}

.pa-see-gmail:hover {
    background: var(--tile-hover);
    border-color: color-mix(in srgb, var(--teal) 55%, transparent);
}

.pa-see-gmail:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    background: transparent;
    border-color: var(--panel-border);
}

.pa-gmail-hint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
}

.pa-gmail-mark {
    display: block;
}

/* ---------- Gmail preview modal ---------- */
/* Paleta clara fija: simula Gmail de forma realista en cualquier tema. */
.gmail-card {
    max-width: 560px;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(60, 64, 67, 0.16);
    color: #202124;
}

.gmail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f6f8fc;
    border-bottom: 1px solid #e4e7ec;
}

.gmail-tool-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #5f6368;
}

.gmail-tool-dots svg {
    width: 20px;
    height: 20px;
    padding: 8px;
    box-sizing: content-box;
    border-radius: 999px;
}

.gmail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    transition: background 140ms var(--ease);
}

.gmail-close:hover {
    background: rgba(60, 64, 67, 0.08);
}

.gmail-close svg {
    width: 20px;
    height: 20px;
}

.gmail-body-wrap {
    padding: 20px 24px 26px;
}

.gmail-subject-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.gmail-subject {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.3;
    color: #202124;
}

.gmail-chip {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e8f0fe;
    color: #1967d2;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.gmail-sender-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gmail-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    overflow: hidden;
    background: #dfe3e8;
}

.gmail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gmail-sender-info {
    flex: 1;
    min-width: 0;
}

.gmail-sender-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.gmail-sender-name {
    font-size: 14px;
    font-weight: 700;
    color: #202124;
}

.gmail-sender-email {
    font-size: 12.5px;
    color: #5f6368;
}

.gmail-meta {
    margin-top: 2px;
    font-size: 12.5px;
    color: #5f6368;
}

.gmail-star {
    flex-shrink: 0;
    color: #b8bcc2;
}

.gmail-star svg {
    width: 20px;
    height: 20px;
}

.gmail-message {
    margin-top: 22px;
    padding-top: 4px;
    font-size: 14px;
    line-height: 1.7;
    color: #3c4043;
}

.gmail-message p {
    margin: 0 0 14px;
}

.gmail-message p:last-child {
    margin-bottom: 0;
}

/* Ejemplos (arriba de la página): enviado + bandeja de entrada */
.pa-examples-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.pa-examples,
.pa-example,
.gmail-compose,
.gmail-inbox {
    min-width: 0;
    max-width: 100%;
}

.pa-example-label {
    margin: 0 0 8px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Con el menú lateral abierto, el contenido puede ser estrecho aunque la
   ventana siga siendo de escritorio. Apilamos antes de que las demos se
   compriman o sobresalgan de la tarjeta. */
@media (max-width: 1100px) {
    .pa-examples-grid {
        grid-template-columns: 1fr;
    }
}

/* Ventana de redacción (ejemplo "enviado") */
.gmail-compose {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    background: #ffffff;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.1);
}

.gmail-compose-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #404040;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

.gmail-compose-bar-icons {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: #cfcfcf;
}

.gmail-compose-bar-icons svg {
    width: 14px;
    height: 14px;
}

.gmail-compose-body {
    padding: 12px 16px 16px;
    color: #202124;
}

.gmail-compose-from {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef0f3;
}

.gmail-compose-from-info {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
}

.gmail-compose-from-info .gmail-inbox-sender,
.gmail-compose-from-info .gmail-sender-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-compose-field {
    display: flex;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #eef0f3;
    font-size: 13.5px;
    color: #5f6368;
    min-width: 0;
}

.gmail-compose-field > span:last-child {
    color: #202124;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-compose-subject {
    font-weight: 600;
    color: #202124;
}

.gmail-compose-message {
    margin: 14px 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #3c4043;
}

.gmail-send {
    display: inline-block;
    background: #1a73e8;
    color: #ffffff;
    border-radius: 999px;
    padding: 9px 24px;
    font-size: 14px;
    font-weight: 600;
}

/* Avatar de letra para los contactos SIN animación */
.gmail-avatar.is-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Bandeja de entrada (ejemplo "recibido") */
.gmail-inbox {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    background: #ffffff;
}

.gmail-inbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #202124;
    background: #f5f6f8;
    min-width: 0;
    overflow: hidden;
}

.gmail-inbox-row.is-unread {
    background: #ffffff;
}

.gmail-inbox-row + .gmail-inbox-row {
    border-top: 1px solid #eef0f3;
}

.gmail-inbox-row.is-unread .gmail-inbox-sender,
.gmail-inbox-row.is-unread .gmail-inbox-subject {
    font-weight: 700;
    color: #202124;
}

.gmail-inbox-row.is-unread .gmail-inbox-time {
    color: #1a73e8;
    font-weight: 600;
}

.gmail-avatar-sm {
    width: 40px;
    height: 40px;
}

.gmail-inbox-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gmail-inbox-sender {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
}

.gmail-inbox-line {
    display: block;
    font-size: 13.5px;
    color: #5f6368;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gmail-inbox-subject {
    color: #202124;
    font-weight: 400;
}

.gmail-inbox-snippet {
    color: #5f6368;
}

.gmail-inbox-subject + .gmail-inbox-snippet::before {
    content: " · ";
}

.gmail-inbox-time {
    flex-shrink: 0;
    font-size: 12px;
    color: #5f6368;
}

@media (max-width: 520px) {
    .pa-examples {
        padding: 18px;
    }

    .gmail-inbox-row {
        gap: 9px;
        padding: 10px 12px;
    }

    .gmail-avatar-sm {
        width: 34px;
        height: 34px;
    }

    .gmail-inbox-time {
        display: none;
    }

    .gmail-compose-body {
        padding: 10px 12px 14px;
    }
}

@media (max-width: 520px) {
    .gmail-subject {
        font-size: 18px;
    }

    .gmail-body-wrap {
        padding: 16px 18px 22px;
    }
}

.pa-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.pa-preview-actions .btn-primary,
.pa-preview-actions .btn-secondary {
    flex: 1 1 auto;
    justify-content: center;
}

@media (max-width: 860px) {
    .pa-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .pa-preview-card {
        position: static;
        order: -1;
    }
}

@media (max-width: 460px) {
    .pa-fx-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .pa-fx-preview,
    .pa-fx-preview::after {
        animation: none !important;
    }
}

/* ---------- Professional logo animation request (client) ---------- */
.lr-card {
    border: 1px solid color-mix(in srgb, var(--teal) 45%, var(--panel-border));
    background: linear-gradient(180deg, color-mix(in srgb, var(--lime) 12%, transparent), transparent);
}

.lr-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--lime);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.lr-form {
    margin-top: 16px;
}

.lr-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.lr-selected-name {
    font-size: 14px;
    color: var(--ink);
    font-weight: 500;
    word-break: break-all;
}

.lr-status {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lr-status-pending {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--tile);
    border: 1px solid var(--panel-border);
}

.lr-status-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 70%, transparent);
    animation: lr-pulse 1.8s var(--ease) infinite;
}

@keyframes lr-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 55%, transparent); }
    70% { box-shadow: 0 0 0 10px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.lr-status-title {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.lr-status-desc {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.lr-status-ready {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 16px;
    border-radius: 14px;
    background: var(--success-bg);
    border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
}

.lr-result {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--panel-border);
}

.lr-result img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lr-status-info {
    flex: 1 1 220px;
}

.lr-status-info .btn-primary {
    margin-top: 10px;
}

/* ---------- Logo requests (admin) ---------- */
.lr-admin-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}

.lr-admin-item {
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 16px;
    background: var(--panel-solid);
}

.lr-admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.lr-admin-who {
    display: flex;
    flex-direction: column;
}

.lr-admin-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.lr-admin-email {
    font-size: 13px;
    color: var(--muted);
    word-break: break-all;
}

.lr-admin-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.lr-admin-badge.is-pending {
    background: var(--error-bg);
    color: var(--error);
}

.lr-admin-badge.is-done {
    background: var(--success-bg);
    color: var(--success);
}

.lr-admin-body {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.lr-admin-media {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.lr-admin-media-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lr-admin-thumb {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--tile);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lr-admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lr-admin-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--panel-border);
    padding-top: 14px;
}

.lr-admin-date {
    font-size: 13px;
    color: var(--muted);
}

.lr-admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lr-admin-msg {
    display: block;
    margin-top: 8px;
}

/* ---------- Claim banner + scratch card ---------- */

.claim-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    max-width: min(440px, 48vw);
    margin: 0;
    padding: 0 5px 0 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--lime) 65%, var(--panel-border));
    background: color-mix(in srgb, var(--lime) 34%, var(--panel-solid));
    text-align: left;
}

.claim-banner:hover {
    background: color-mix(in srgb, var(--lime) 52%, var(--panel-solid));
}

.claim-banner-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--lime);
    color: var(--on-accent);
}

.claim-banner-mark svg {
    width: 15px;
    height: 15px;
}

.claim-banner-copy {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.claim-banner-title {
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.claim-banner-cta {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--on-accent);
    background: var(--lime);
    border-radius: 999px;
    padding: 6px 10px;
}

@media (max-width: 720px) {
    .claim-banner {
        max-width: none;
        padding-left: 5px;
    }

    .claim-banner-title {
        display: none;
    }
}

body.is-scratch-open {
    overflow: hidden;
}

.scratch-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    place-items: center;
    padding: 20px;
}

.scratch-modal.is-open {
    display: grid;
}

.scratch-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 18, 14, 0.62);
    backdrop-filter: blur(6px);
}

.scratch-dialog {
    position: relative;
    isolation: isolate;
    overflow: auto;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    padding: 28px 28px 22px;
    border-radius: 22px;
    background:
        radial-gradient(120% 70% at 50% -10%, rgba(218, 252, 146, 0.45), transparent 46%),
        radial-gradient(80% 50% at 100% 100%, rgba(137, 201, 201, 0.16), transparent 50%),
        linear-gradient(180deg, #fbfefb 0%, #eef4f1 100%);
    border: 1px solid rgba(2, 38, 30, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 30px 70px rgba(2, 18, 14, 0.22);
    color: var(--ink);
}

.print-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.58;
    pointer-events: none;
}

.scratch-dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(251, 254, 251, 0.28), rgba(238, 244, 241, 0.36));
}

.scratch-dialog > *:not(.print-bg) {
    position: relative;
    z-index: 2;
}

.scratch-dialog > .scratch-x {
    position: absolute;
    z-index: 3;
}

html[data-theme="dark"] .scratch-dialog {
    background:
        radial-gradient(120% 70% at 50% -10%, rgba(218, 252, 146, 0.14), transparent 48%),
        radial-gradient(80% 50% at 100% 100%, rgba(137, 201, 201, 0.08), transparent 52%),
        linear-gradient(180deg, #172421 0%, #0d1614 100%);
    border-color: rgba(232, 244, 240, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 30px 70px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .print-bg {
    opacity: 0.5;
}

html[data-theme="dark"] .scratch-dialog::before {
    background: linear-gradient(180deg, rgba(13, 22, 20, 0.34), rgba(13, 22, 20, 0.42));
}

@media (prefers-reduced-motion: reduce) {
    .print-bg {
        display: none;
    }
}

.scratch-dialog h2 {
    margin: 6px 0 8px;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.scratch-kicker {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.scratch-hint {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
}

.scratch-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--muted);
}

.scratch-x:hover {
    background: var(--tile-hover);
    color: var(--ink);
}

.print-stage {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.print-machine {
    position: relative;
    width: 304px;
}

.print-body {
    position: relative;
    padding: 13px 28px 0;
    border-radius: 14px 14px 5px 5px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 42%),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px 2px),
        linear-gradient(180deg, #f4f6f5 0%, #d7dfdc 72%, #c5cfcc 100%);
    border: 1px solid #aeb9b5;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -2px 0 rgba(2, 38, 30, 0.05),
        0 1px 0 #e7eeeb,
        0 8px 0 #b7c2be,
        0 9px 0 #8c9793,
        0 18px 28px rgba(2, 38, 30, 0.16);
}

.print-body::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 5px;
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), transparent);
    pointer-events: none;
}

.print-face {
    position: relative;
    display: grid;
    grid-template-columns: 8px 1fr auto 8px;
    align-items: center;
    gap: 8px;
    height: 22px;
    margin-bottom: 11px;
}

.print-brandplate {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.print-badge {
    width: 18px;
    height: 15px;
    flex: none;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
}

.print-screw {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background:
        linear-gradient(135deg, transparent 46%, #5e6a66 46% 54%, transparent 54%),
        radial-gradient(circle at 32% 28%, #fff, #c9d2ce 40%, #7e8b86);
    box-shadow:
        inset 0 0 0 0.5px rgba(2, 38, 30, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.85);
}

.print-mark {
    color: #1c2e29;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.print-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #f7f8f7, #9aa7a2 55%, #6d7a76);
    box-shadow:
        inset 0 1px 1px rgba(0, 0, 0, 0.35),
        0 0 0 2px rgba(2, 38, 30, 0.08);
    transition: background 200ms var(--ease), box-shadow 200ms var(--ease);
}

.print-machine.is-printing .print-led {
    background: radial-gradient(circle at 35% 30%, #f4ffe4, #b6ef62 42%, #6fbf2e);
    box-shadow:
        0 0 0 2px rgba(143, 212, 74, 0.28),
        0 0 10px rgba(143, 212, 74, 0.9);
}

.print-btn {
    display: block;
    width: 100%;
    height: 36px;
    border-radius: 7px;
    background: linear-gradient(180deg, #24584a 0%, #03382c 46%, #021c16 100%);
    color: #f4faf7;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow:
        0 0 0 1px rgba(2, 38, 30, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -2px 0 rgba(0, 0, 0, 0.35);
    transition: transform 140ms var(--ease);
}

.print-btn:hover {
    background: linear-gradient(180deg, #2c6a58 0%, #044233 46%, #021c16 100%);
}

.print-btn.is-pressed {
    transform: translateY(1px);
    box-shadow:
        0 0 0 1px rgba(2, 38, 30, 0.28),
        inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.print-mouth {
    position: relative;
    z-index: 2;
    width: 100%;
    margin-top: 12px;
    padding-top: 5px;
    border-radius: 2px 2px 1px 1px;
    background: linear-gradient(180deg, #f8faf9 0%, #d5ddda 55%, #9aa6a2 100%);
    box-shadow: inset 0 1px 0 #fff;
}

.print-slot {
    position: relative;
    height: 8px;
    margin: 0;
    border-radius: 1px 1px 0 0;
    background: linear-gradient(180deg, #050807, #1a2220 70%, #0c1211);
    box-shadow: inset 0 3px 4px rgba(0, 0, 0, 0.85);
}

.print-slot::before,
.print-slot::after {
    content: "";
    position: absolute;
    top: 1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #6a7672, #121816 70%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.print-slot::before { left: 5px; }
.print-slot::after { right: 5px; }

.print-out {
    position: relative;
    z-index: 1;
    margin: -6px 29px 0;
}

.print-paper {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    background: transparent;
    color: #1c1c1c;
    filter: drop-shadow(0 10px 14px rgba(2, 38, 30, 0.16));
    transform-origin: top center;
    transition: max-height 3.4s cubic-bezier(0.22, 0.7, 0.2, 1);
}

.print-machine.is-printing .print-paper {
    max-height: 520px;
    animation: paper-drift 3.4s cubic-bezier(0.22, 0.7, 0.2, 1);
}

.print-sheet {
    position: relative;
    padding-bottom: 2px;
    background:
        linear-gradient(180deg, rgba(40, 32, 18, 0.07), transparent 16px),
        repeating-linear-gradient(0deg, rgba(60, 48, 28, 0.028) 0 1px, transparent 1px 3px),
        linear-gradient(90deg, rgba(40, 32, 18, 0.05), transparent 8px, transparent calc(100% - 8px), rgba(40, 32, 18, 0.05)),
        #f6f3ec;
    box-shadow: inset 0 0 0 1px rgba(28, 24, 18, 0.05);
}

.print-line {
    margin: 0;
    padding: 0 18px;
    opacity: 0;
    transform: translateY(6px);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.print-logo {
    display: flex;
    justify-content: center;
    padding: 14px 16px 0;
}

.print-logo img {
    display: block;
    width: 168px;
    height: auto;
    mix-blend-mode: multiply;
}

.print-meta {
    margin-top: 8px;
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: #5e584f;
}

.print-rule {
    height: 0;
    margin: 10px 18px 0;
    padding: 0;
    border-top: 1px solid rgba(28, 24, 18, 0.18);
}

.print-kicker {
    margin-top: 10px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #2a2724;
}

.print-item {
    margin-top: 4px;
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #6a6258;
}

.print-code {
    position: relative;
    overflow: hidden;
    margin: 8px 18px 0;
    padding: 9px 8px 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #161616;
    border: 1px solid rgba(28, 24, 18, 0.2);
    background: rgba(255, 252, 247, 0.72);
}

.print-copied {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #14241c;
    color: #dafc92;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
}

.print-copied::before {
    content: "";
    width: 7px;
    height: 4px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg) translateY(-1px);
}

.print-code.is-copied .print-copied {
    animation: copied-sheet 1.45s cubic-bezier(0.22, 0.8, 0.28, 1);
}

@keyframes copied-sheet {
    0% { opacity: 0; transform: translateY(105%); }
    18% { opacity: 1; transform: translateY(0); }
    68% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-105%); }
}

.print-note {
    margin-top: 10px;
    padding: 0 20px;
    font-size: 9.5px;
    line-height: 1.5;
    text-align: center;
    text-wrap: balance;
    letter-spacing: 0.01em;
    color: #5c564e;
}

.print-bars {
    height: 26px;
    margin: 12px 32px 0;
    padding: 0;
    background: repeating-linear-gradient(
        90deg,
        #1a1a1a 0 1px,
        transparent 1px 2px,
        #1a1a1a 2px 4px,
        transparent 4px 7px,
        #1a1a1a 7px 8px,
        transparent 8px 10px,
        #1a1a1a 10px 13px,
        transparent 13px 14px,
        #1a1a1a 14px 15px,
        transparent 15px 18px
    );
}

.print-thanks {
    margin-top: 10px;
    padding-bottom: 10px;
    text-align: center;
    font-family: var(--font);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #6a6258;
}

.print-tear {
    height: 14px;
    background: #f6f3ec;
    -webkit-mask-image: radial-gradient(circle at 50% 14px, transparent 6.5px, #000 7px);
    mask-image: radial-gradient(circle at 50% 14px, transparent 6.5px, #000 7px);
    -webkit-mask-size: 15px 14px;
    mask-size: 15px 14px;
    -webkit-mask-repeat: repeat-x;
    mask-repeat: repeat-x;
}

.print-machine.is-printing .print-line {
    animation: print-line-in 0.38s cubic-bezier(0.22, 0.8, 0.28, 1) forwards;
    animation-delay: calc(0.2s + var(--i) * 0.26s);
}

@keyframes paper-drift {
    0% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes print-line-in {
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .print-paper,
    .print-machine.is-printing .print-paper,
    .print-machine.is-printing .print-line {
        animation: none;
        transition: none;
    }

    .print-machine.is-printing .print-paper {
        max-height: 520px;
    }

    .print-machine.is-printing .print-line {
        opacity: 1;
        transform: none;
    }

    .print-code.is-copied .print-copied,
    .print-actions .scratch-copy.is-copied {
        animation: none;
    }

    .print-code.is-copied .print-copied {
        opacity: 1;
        transform: none;
    }
}

.scratch-done {
    margin-top: 16px;
}

.scratch-done p {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

.scratch-done-actions {
    display: flex;
    gap: 8px;
}

.scratch-copy,
.scratch-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.scratch-copy {
    background: var(--ink);
    color: var(--lime);
}

html[data-theme="dark"] .scratch-copy {
    background: var(--lime);
    color: var(--on-accent);
}

.scratch-go {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--panel-border);
}

.scratch-go:hover {
    background: var(--tile);
}

.print-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 2px 18px 12px;
    padding: 0;
}

.print-actions .scratch-copy,
.print-actions .scratch-go {
    width: 100%;
    height: 32px;
    border-radius: 3px;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.print-actions .scratch-copy,
html[data-theme="dark"] .print-actions .scratch-copy {
    background: #14241c;
    color: #f4f0e8;
}

.print-actions .scratch-copy.is-copied {
    color: #dafc92;
    animation: copy-press 420ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.print-actions .scratch-go,
html[data-theme="dark"] .print-actions .scratch-go {
    background: transparent;
    color: #14241c;
    border: 1px solid rgba(28, 24, 18, 0.22);
}

.print-actions .scratch-go:hover {
    background: rgba(20, 36, 28, 0.05);
}

@keyframes copy-press {
    0% { transform: scale(1); }
    40% { transform: scale(0.975); }
    100% { transform: scale(1); }
}

