/* Nexurai — estilo tipo chat, responsive, safe-area */
:root {
    --nx-bg: #0d1117;
    --nx-surface: #161b22;
    --nx-surface-2: #21262d;
    --nx-border: #30363d;
    --nx-text: #e6edf3;
    --nx-muted: #8b949e;
    --nx-accent: #22d3ee;
    --nx-accent-dim: #0891b2;
    --nx-user-bubble: #1f6feb;
    --nx-assistant-bubble: #21262d;
    --nx-danger: #f85149;
    --nx-radius: 12px;
    --nx-radius-sm: 10px;
    --nx-font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --nx-topbar-h: 56px;
    --nx-composer-min-h: 52px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.nx-body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--nx-font);
    background: var(--nx-bg);
    color: var(--nx-text);
    line-height: 1.5;
    padding:
        max(env(safe-area-inset-top), 12px)
        max(env(safe-area-inset-right), 16px)
        max(env(safe-area-inset-bottom), 12px)
        max(env(safe-area-inset-left), 16px);
}

.nx-skip {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.nx-skip:focus {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 10000;
    width: auto;
    height: auto;
    padding: 12px 16px;
    background: var(--nx-accent);
    color: #001018;
    border-radius: var(--nx-radius-sm);
    font-weight: 600;
}

.nx-muted {
    color: var(--nx-muted);
    font-size: 0.95rem;
}

/* Topbar */
.nx-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--nx-bg) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nx-border);
    padding-top: env(safe-area-inset-top);
}

.nx-topbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--nx-topbar-h);
    padding: 8px 0;
}

.nx-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--nx-text);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nx-brand__mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 0 16px color-mix(in srgb, var(--nx-accent) 28%, transparent);
}

.nx-brand__text {
    font-size: 1.15rem;
}

.nx-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-sm);
    background: var(--nx-surface);
    cursor: pointer;
}

.nx-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: var(--nx-text);
    border-radius: 1px;
}

.nx-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nx-nav a {
    color: var(--nx-muted);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--nx-radius-sm);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.nx-nav a:hover,
.nx-nav a:focus-visible {
    color: var(--nx-text);
    background: var(--nx-surface-2);
    outline: none;
}

@media (max-width: 768px) {
    .nx-nav-toggle {
        display: inline-flex;
    }

    .nx-nav {
        display: none;
        position: absolute;
        right: max(env(safe-area-inset-right), 0px);
        left: max(env(safe-area-inset-left), 0px);
        top: calc(var(--nx-topbar-h) + env(safe-area-inset-top));
        flex-direction: column;
        background: var(--nx-surface);
        border: 1px solid var(--nx-border);
        border-radius: var(--nx-radius);
        padding: 8px;
        margin: 8px 16px 0;
    }

    .nx-nav.is-open {
        display: flex;
    }

    .nx-nav a {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Layout */
#nx-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 0 48px;
    width: 100%;
}

.nx-hero {
    padding: 32px 0 24px;
}

.nx-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.nx-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid var(--nx-border);
    background: var(--nx-surface);
    color: var(--nx-text);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.nx-btn:focus-visible {
    outline: 2px solid var(--nx-accent);
    outline-offset: 2px;
}

.nx-btn--primary {
    background: linear-gradient(135deg, var(--nx-accent-dim), var(--nx-accent));
    border-color: transparent;
    color: #041016;
}

.nx-btn--primary:hover {
    filter: brightness(1.06);
}

.nx-btn--ghost {
    background: transparent;
}

.nx-card {
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: 20px;
}

.nx-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

/* Inicio — presentación */
.nx-home {
    padding-bottom: 56px;
}

.nx-home-hero {
    text-align: center;
    padding: clamp(1.5rem, 4vw, 3rem) 0 1.5rem;
    max-width: 38rem;
    margin: 0 auto;
}

.nx-home-hero h1 {
    font-size: clamp(1.85rem, 5vw, 2.65rem);
    line-height: 1.15;
    margin: 0 0 1rem;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, var(--nx-text) 0%, var(--nx-accent) 55%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nx-home-lead {
    margin: 0;
    font-size: clamp(1rem, 2.4vw, 1.15rem);
    line-height: 1.65;
    color: var(--nx-muted);
}

.nx-home-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 1.35rem 0 0;
    padding: 0;
    list-style: none;
}

.nx-home-badge {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--nx-border);
    background: var(--nx-surface);
    color: var(--nx-muted);
}

.nx-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 1.75rem;
}

.nx-home-section {
    margin-top: clamp(2.5rem, 6vw, 3.75rem);
}

.nx-home-section h2 {
    text-align: center;
    font-size: clamp(1.2rem, 3vw, 1.45rem);
    font-weight: 700;
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.nx-home-section .nx-home-sub {
    text-align: center;
    color: var(--nx-muted);
    font-size: 0.95rem;
    max-width: 32rem;
    margin: 0 auto 1.5rem;
    line-height: 1.55;
}

.nx-home-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.nx-home-benefits .nx-card {
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nx-home-benefits .nx-card:hover {
    border-color: color-mix(in srgb, var(--nx-accent) 45%, var(--nx-border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--nx-accent) 12%, transparent);
}

.nx-benefit-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.35;
}

.nx-benefit-title span[aria-hidden="true"] {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--nx-accent) 18%, var(--nx-surface-2));
    border: 1px solid color-mix(in srgb, var(--nx-accent) 35%, var(--nx-border));
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.nx-home-benefits .nx-muted {
    margin: 0;
    line-height: 1.55;
}

/* Chat layout */
.nx-chat-page {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--nx-topbar-h) - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
}

.nx-chat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.nx-chat-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--nx-muted);
    cursor: pointer;
    min-height: 44px;
    padding: 4px 8px;
    border-radius: var(--nx-radius-sm);
}

.nx-chat-toolbar label:focus-within {
    outline: 2px solid var(--nx-accent);
    outline-offset: 2px;
}

.nx-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px 4px 120px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.nx-msg {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.nx-msg--user {
    flex-direction: row-reverse;
}

.nx-msg__avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--nx-surface-2);
    border: 1px solid var(--nx-border);
}

.nx-msg--user .nx-msg__avatar {
    background: color-mix(in srgb, var(--nx-user-bubble) 35%, var(--nx-surface));
}

.nx-msg__bubble {
    max-width: min(100%, 720px);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--nx-border);
    background: var(--nx-assistant-bubble);
    white-space: pre-wrap;
    word-break: break-word;
}

.nx-msg--user .nx-msg__bubble {
    background: color-mix(in srgb, var(--nx-user-bubble) 22%, var(--nx-surface));
    border-color: color-mix(in srgb, var(--nx-user-bubble) 45%, var(--nx-border));
}

.nx-msg__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.nx-msg__actions button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--nx-border);
    background: var(--nx-bg);
    color: var(--nx-muted);
    cursor: pointer;
}

.nx-msg__actions button:hover {
    color: var(--nx-text);
}

.nx-msg img.nx-inline-img {
    max-width: 100%;
    border-radius: var(--nx-radius-sm);
    margin-top: 8px;
    display: block;
}

.nx-composer-wrap {
    position: sticky;
    bottom: 0;
    padding-bottom: max(env(safe-area-inset-bottom), 4px);
    margin-top: auto;
    background: linear-gradient(to top, var(--nx-bg) 70%, transparent);
}

.nx-composer {
    border: 1px solid var(--nx-border);
    border-radius: 20px;
    background: var(--nx-surface);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nx-composer__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nx-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--nx-border);
}

.nx-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nx-thumb button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.nx-composer__row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.nx-composer textarea {
    flex: 1;
    min-height: var(--nx-composer-min-h);
    max-height: 200px;
    resize: none;
    border: none;
    background: transparent;
    color: var(--nx-text);
    font: inherit;
    padding: 12px 8px;
    line-height: 1.45;
}

.nx-composer textarea:focus {
    outline: none;
}

.nx-composer__side {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nx-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--nx-border);
    background: var(--nx-surface-2);
    color: var(--nx-text);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.nx-icon-btn:hover {
    border-color: var(--nx-accent);
}

.nx-icon-btn svg {
    width: 22px;
    height: 22px;
}

.nx-send {
    min-width: 48px;
    min-height: 48px;
    border-radius: 14px;
    border: none;
    background: var(--nx-accent);
    color: #041016;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.nx-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nx-typing {
    font-size: 0.9rem;
    color: var(--nx-muted);
    padding: 0 8px 8px;
}

.nx-error {
    color: var(--nx-danger);
    font-size: 0.9rem;
    padding: 8px 4px 0;
}

/* Chat modern UI overrides */
.nx-body.nx-chat-only .nx-footer {
    display: none;
}

.nx-body.nx-chat-only #nx-main.nx-chat-layout {
    max-width: 1280px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.nx-body.nx-chat-only .nx-chat-app {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 14px;
    min-height: calc(100dvh - var(--nx-topbar-h) - 54px);
}

.nx-body.nx-chat-only .nx-chat-app__sidebar {
    border: 1px solid color-mix(in srgb, var(--nx-border) 90%, #364156);
    border-radius: 16px;
    background: color-mix(in srgb, #111827 80%, var(--nx-surface));
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100%;
}

.nx-body.nx-chat-only .nx-chat-app__sidebar-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.nx-body.nx-chat-only .nx-chat-app__new-btn,
.nx-body.nx-chat-only .nx-chat-app__settings-btn {
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--nx-border);
    background: color-mix(in srgb, var(--nx-surface-2) 86%, #0f172a);
    color: var(--nx-text);
    padding: 0 12px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nx-body.nx-chat-only .nx-chat-app__new-btn:hover,
.nx-body.nx-chat-only .nx-chat-app__settings-btn:hover {
    border-color: color-mix(in srgb, var(--nx-accent) 46%, var(--nx-border));
}

.nx-body.nx-chat-only .nx-chat-app__sidebar-title {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--nx-muted) 86%, #9ca3af);
    padding: 2px 4px;
}

.nx-body.nx-chat-only .nx-conversation-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}

.nx-body.nx-chat-only .nx-conversation-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    color: var(--nx-muted);
    border-radius: 10px;
    min-height: 38px;
    padding: 8px 10px;
    cursor: pointer;
    font: inherit;
    line-height: 1.3;
}

.nx-body.nx-chat-only .nx-conversation-item:hover {
    color: var(--nx-text);
    background: color-mix(in srgb, var(--nx-surface-2) 88%, #0f172a);
}

.nx-body.nx-chat-only .nx-conversation-item.is-active {
    color: var(--nx-text);
    border-color: color-mix(in srgb, var(--nx-accent) 44%, var(--nx-border));
    background: color-mix(in srgb, var(--nx-accent) 14%, var(--nx-surface-2));
}

.nx-body.nx-chat-only .nx-chat-app__main {
    border: 1px solid color-mix(in srgb, var(--nx-border) 88%, #364156);
    border-radius: 16px;
    background:
        radial-gradient(900px 280px at 50% -12%, color-mix(in srgb, var(--nx-accent) 14%, transparent), transparent 62%),
        color-mix(in srgb, #0b1220 68%, var(--nx-bg));
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-height: 100%;
}

.nx-body.nx-chat-only .nx-chat-app__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.nx-body.nx-chat-only .nx-chat-app__header h1 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}

.nx-body.nx-chat-only .nx-chat-app__header .nx-muted {
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.nx-body.nx-chat-only .nx-chat-conv-select {
    display: none;
}

.nx-body.nx-chat-only .nx-chat-log {
    border: 1px solid color-mix(in srgb, var(--nx-border) 82%, #2e3b52);
    border-radius: 14px;
    background: color-mix(in srgb, var(--nx-surface) 96%, #0b1220);
    padding: 14px 10px 126px;
    flex: 1;
}

.nx-body.nx-chat-only .nx-composer-wrap {
    background: linear-gradient(to top, color-mix(in srgb, #0b1220 88%, transparent), transparent);
    padding-top: 10px;
}

.nx-body.nx-chat-only .nx-composer {
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--nx-border) 86%, #374151);
}

.nx-body.nx-chat-only .nx-composer textarea {
    min-height: 52px;
}

@media (max-width: 980px) {
    .nx-body.nx-chat-only .nx-chat-app {
        grid-template-columns: 1fr;
    }

    .nx-body.nx-chat-only .nx-chat-app__sidebar {
        min-height: auto;
    }

    .nx-body.nx-chat-only .nx-chat-app__header {
        align-items: center;
    }

    .nx-body.nx-chat-only .nx-chat-conv-select {
        display: block;
        width: min(320px, 100%);
        min-height: 40px;
        border-radius: 10px;
        border: 1px solid var(--nx-border);
        background: color-mix(in srgb, var(--nx-surface) 88%, #0f172a);
        color: var(--nx-text);
        padding: 0 10px;
        font: inherit;
    }

    .nx-body.nx-chat-only .nx-conversation-list {
        display: none;
    }

    .nx-body.nx-chat-only .nx-chat-app__sidebar-title {
        display: none;
    }
}

.nx-chat-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.nx-chat-sidebar {
    border: 1px solid color-mix(in srgb, var(--nx-border) 88%, #3a4658);
    border-radius: 18px;
    background: color-mix(in srgb, var(--nx-surface) 94%, #0d1219);
    padding: 12px;
    min-height: calc(100dvh - var(--nx-topbar-h) - 74px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nx-chat-sidebar__top {
    display: grid;
    gap: 8px;
}

.nx-conversation-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 3px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nx-conversation-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    color: var(--nx-muted);
    border-radius: 10px;
    min-height: 40px;
    padding: 9px 10px;
    cursor: pointer;
    font: inherit;
    line-height: 1.3;
}

.nx-conversation-item:hover {
    background: color-mix(in srgb, var(--nx-surface-2) 88%, #111a27);
    color: var(--nx-text);
}

.nx-conversation-item.is-active {
    background: color-mix(in srgb, var(--nx-accent) 14%, var(--nx-surface-2));
    border-color: color-mix(in srgb, var(--nx-accent) 42%, var(--nx-border));
    color: var(--nx-text);
}

.nx-chat-page {
    max-width: 100%;
    background:
        radial-gradient(1200px 360px at 50% -12%, color-mix(in srgb, var(--nx-accent) 18%, transparent), transparent 62%),
        var(--nx-bg);
    border: 1px solid color-mix(in srgb, var(--nx-border) 86%, #39465a);
    border-radius: 18px;
    padding: 14px;
}

.nx-chat-intro {
    margin-bottom: 14px;
}

.nx-chat-intro h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2.8vw, 1.7rem);
    letter-spacing: -0.02em;
}

.nx-chat-intro .nx-muted {
    margin: 8px 0 0;
}

.nx-chat-toolbar {
    gap: 10px;
    margin-bottom: 8px;
}

.nx-chat-conv-select {
    display: none;
    min-height: 42px;
    min-width: 220px;
    max-width: min(420px, 100%);
    border-radius: 12px;
    border: 1px solid var(--nx-border);
    background: color-mix(in srgb, var(--nx-surface) 86%, #0b0f14);
    color: var(--nx-text);
    padding: 0 12px;
    font: inherit;
}

.nx-chat-toolbar__btn {
    min-height: 42px;
    padding-inline: 16px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--nx-surface) 86%, #0b0f14);
}

.nx-chat-log {
    border: 1px solid color-mix(in srgb, var(--nx-border) 85%, #2d3748);
    border-radius: 20px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--nx-surface) 94%, #10151d), color-mix(in srgb, var(--nx-surface) 98%, #0d1117));
    padding: 16px 10px 132px;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent);
}

.nx-msg {
    margin-bottom: 18px;
}

.nx-msg__avatar {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
    border-radius: 11px;
}

.nx-msg__bubble {
    border-radius: 18px;
    padding: 13px 16px;
    font-size: 0.98rem;
    line-height: 1.52;
}

.nx-msg:not(.nx-msg--user) .nx-msg__bubble {
    border-color: color-mix(in srgb, var(--nx-accent) 18%, var(--nx-border));
    background: color-mix(in srgb, var(--nx-assistant-bubble) 92%, #0f1724);
}

.nx-msg--user .nx-msg__bubble {
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--nx-user-bubble) 30%, var(--nx-surface)) 0%,
        color-mix(in srgb, var(--nx-user-bubble) 16%, var(--nx-surface)) 100%
    );
}

.nx-msg__actions {
    margin-top: 7px;
}

.nx-msg__actions button {
    min-height: 34px;
    font-size: 0.8rem;
}

.nx-composer-wrap {
    padding-top: 12px;
    background: linear-gradient(to top, var(--nx-bg) 76%, rgba(13, 17, 23, 0.22));
}

.nx-composer {
    border: 1px solid color-mix(in srgb, var(--nx-border) 82%, #3b4557);
    border-radius: 18px;
    background: color-mix(in srgb, var(--nx-surface) 95%, #0f141d);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
    gap: 10px;
}

.nx-composer:focus-within {
    border-color: color-mix(in srgb, var(--nx-accent) 58%, var(--nx-border));
    box-shadow:
        0 0 0 3px color-mix(in srgb, var(--nx-accent) 16%, transparent),
        0 10px 24px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

.nx-composer__row {
    align-items: stretch;
    gap: 10px;
}

.nx-composer textarea {
    min-height: 56px;
    padding: 14px 10px;
    font-size: 1rem;
}

.nx-composer textarea::placeholder {
    color: color-mix(in srgb, var(--nx-muted) 86%, #9aa4b2);
}

.nx-icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--nx-surface-2) 92%, #0f1520);
}

.nx-send {
    min-width: 52px;
    min-height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--nx-accent-dim), var(--nx-accent));
    box-shadow: 0 8px 18px color-mix(in srgb, var(--nx-accent) 28%, transparent);
}

.nx-send:not(:disabled):hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.nx-composer__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 14px;
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--nx-muted) 84%, #9aa4b2);
    padding: 0 4px 2px;
}

@media (max-width: 768px) {
    .nx-chat-layout {
        grid-template-columns: 1fr;
    }

    .nx-chat-sidebar {
        min-height: auto;
        order: 2;
    }

    .nx-chat-page {
        max-width: 100%;
        order: 1;
    }

    .nx-chat-log {
        border-radius: 16px;
        padding: 12px 8px 126px;
    }

    .nx-chat-toolbar__btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .nx-chat-conv-select {
        display: block;
        width: 100%;
    }

    .nx-conversation-list {
        display: none;
    }

    .nx-composer {
        border-radius: 16px;
        padding: 9px 10px;
    }

    .nx-composer textarea {
        min-height: 52px;
        padding-inline: 8px;
    }

    .nx-icon-btn {
        width: 44px;
        height: 44px;
    }

    .nx-send {
        min-width: 48px;
        min-height: 48px;
    }
}

/* Forms (ajustes) */
.nx-form {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nx-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.nx-field input,
.nx-field textarea,
.nx-field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: var(--nx-radius-sm);
    border: 1px solid var(--nx-border);
    background: var(--nx-surface);
    color: var(--nx-text);
    font: inherit;
}

.nx-field textarea {
    min-height: 100px;
    resize: vertical;
}

.nx-field small {
    display: block;
    margin-top: 6px;
    color: var(--nx-muted);
}

/* Legal / prose */
.nx-prose h2 {
    margin-top: 2rem;
    font-size: 1.2rem;
}

.nx-prose ul {
    padding-left: 1.25rem;
}

/* Footer */
.nx-footer {
    margin-top: auto;
    border-top: 1px solid var(--nx-border);
    padding: 32px 0 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.nx-footer__grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.nx-footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nx-footer__links a {
    color: var(--nx-accent);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.nx-footer__copy {
    text-align: center;
    color: var(--nx-muted);
    font-size: 0.85rem;
    margin-top: 24px;
}

/* Utility */
.nx-hidden {
    display: none !important;
}

/* GPT-like complete redesign for chat page */
.nx-body.nx-chat-only {
    padding: 0;
    overflow: hidden;
    background: #0b1020;
}

.nx-body.nx-chat-only .nx-topbar,
.nx-body.nx-chat-only .nx-footer {
    display: none;
}

.nx-body.nx-chat-only #nx-main.nx-chat-layout {
    max-width: none;
    padding: 0;
    height: 100dvh;
}

.nx-body.nx-chat-only .cgpt-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    height: 100%;
}

.nx-body.nx-chat-only .cgpt-sidebar {
    background: #111827;
    border-right: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 10px;
}

.nx-body.nx-chat-only .cgpt-sidebar__top {
    display: grid;
    gap: 8px;
}

.nx-body.nx-chat-only .cgpt-btn {
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #e5e7eb;
    font: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    cursor: pointer;
}

.nx-body.nx-chat-only .cgpt-btn:hover {
    background: #253247;
    border-color: #4b5563;
}

.nx-body.nx-chat-only .cgpt-sidebar__label {
    color: #9ca3af;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 4px;
}

.nx-body.nx-chat-only .nx-conversation-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding-right: 3px;
}

.nx-body.nx-chat-only .nx-conversation-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #9ca3af;
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    cursor: pointer;
}

.nx-body.nx-chat-only .nx-conversation-item:hover {
    background: #1f2937;
    color: #f3f4f6;
}

.nx-body.nx-chat-only .nx-conversation-item.is-active {
    background: #243246;
    border-color: #3b82f6;
    color: #f9fafb;
}

.nx-body.nx-chat-only .cgpt-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0b1020;
}

.nx-body.nx-chat-only .cgpt-main__header {
    height: 56px;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px;
    background: #0b1020;
}

.nx-body.nx-chat-only .cgpt-main__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e5e7eb;
}

.nx-body.nx-chat-only .cgpt-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2);
}

.nx-body.nx-chat-only .nx-chat-conv-select {
    display: none;
}

.nx-body.nx-chat-only .nx-error {
    margin: 8px 16px 0;
}

.nx-body.nx-chat-only .nx-chat-log {
    flex: 1;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 18px clamp(14px, 4vw, 64px) 140px;
    box-shadow: none;
}

.nx-body.nx-chat-only .nx-msg {
    margin-bottom: 20px;
}

.nx-body.nx-chat-only .nx-msg__bubble {
    max-width: min(100%, 820px);
    border-radius: 16px;
}

.nx-body.nx-chat-only .nx-typing {
    padding: 0 clamp(14px, 4vw, 64px) 10px;
}

.nx-body.nx-chat-only .nx-composer-wrap {
    position: sticky;
    bottom: 0;
    margin-top: 0;
    background: linear-gradient(to top, #0b1020 72%, rgba(11, 16, 32, 0.2));
    padding: 10px clamp(14px, 4vw, 64px) max(env(safe-area-inset-bottom), 12px);
}

.nx-body.nx-chat-only .nx-composer {
    border-radius: 14px;
    border: 1px solid #374151;
    background: #111827;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.nx-body.nx-chat-only .nx-composer:focus-within {
    border-color: #3b82f6;
}

.nx-body.nx-chat-only .nx-composer textarea {
    min-height: 52px;
}

.nx-body.nx-chat-only .nx-icon-btn {
    background: #1f2937;
    border-color: #374151;
}

.nx-body.nx-chat-only .nx-send {
    background: #22d3ee;
    color: #0b1020;
}

@media (max-width: 960px) {
    .nx-body.nx-chat-only .cgpt-shell {
        grid-template-columns: 1fr;
    }

    .nx-body.nx-chat-only .cgpt-sidebar {
        border-right: none;
        border-bottom: 1px solid #1f2937;
        padding: 10px;
    }

    .nx-body.nx-chat-only .nx-conversation-list {
        display: none;
    }

    .nx-body.nx-chat-only .cgpt-sidebar__label {
        display: none;
    }

    .nx-body.nx-chat-only .cgpt-main__header {
        padding-inline: 10px;
    }

    .nx-body.nx-chat-only .nx-chat-conv-select {
        display: block;
        min-width: 150px;
        max-width: 58vw;
        min-height: 36px;
        border-radius: 8px;
        border: 1px solid #374151;
        background: #111827;
        color: #e5e7eb;
        font: inherit;
    }

    .nx-body.nx-chat-only .nx-chat-log {
        padding: 12px 10px 128px;
    }

    .nx-body.nx-chat-only .nx-composer-wrap {
        padding: 8px 10px max(env(safe-area-inset-bottom), 8px);
    }
}
