/* Nexus — dual theme (light default + dark tokens). */

.nx-page {
    --nx-text: #3a4550;
    --nx-heading: #1a2129;
    --nx-muted: #6b7785;
    --nx-surface: #ffffff;
    --nx-surface-2: #f4f6f8;
    --nx-border: #dde3ea;
    --nx-input: #ffffff;
    --nx-hover: #eef1f4;
    --nx-deep: #e8ecf1;
    --nx-shadow: rgba(0, 0, 0, 0.08);
    --nx-accent: #f99b1d;
    --nx-danger: #e0043f;
    --nx-ok: #1a8a5c;
    --nx-warn: #c47a12;
    --nx-info: #3a6b8c;
    --nx-user-bg: #fff6e8;
    --nx-me: #1a2129;
    padding-bottom: 48px;
    color: var(--nx-text);
}

html[data-theme="dark"] .nx-page {
    --nx-text: #c8d0d8;
    --nx-heading: #e8ecef;
    --nx-muted: #9aa7b5;
    --nx-surface: #151b22;
    --nx-surface-2: #1a2129;
    --nx-border: #2a3440;
    --nx-input: #0e1217;
    --nx-hover: #1f2730;
    --nx-deep: #0e1217;
    --nx-shadow: rgba(0, 0, 0, 0.35);
    --nx-user-bg: #2a2218;
    --nx-me: #e8ecef;
}

.nx-page .container,
.nx-shell {
    max-width: 1120px;
}

.nx-page h1,
.nx-page h2,
.nx-page h3 {
    color: var(--nx-heading);
}

.nx-hero {
    margin: 20px 0 18px;
}

.nx-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nx-accent);
    font-weight: 700;
}

.nx-hero h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.nx-tagline {
    margin: 6px 0 0;
    color: var(--nx-muted);
}

.nx-plan-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--nx-border);
    background: var(--nx-surface-2);
    color: var(--nx-heading);
}

.nx-plan-badge--pro,
.nx-plan-badge--proplus {
    border-color: var(--nx-accent);
    color: #1a2129;
    background: var(--nx-accent);
}

.nx-onboard,
.nx-card,
.nx-banner {
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px var(--nx-shadow);
}

.nx-onboard {
    padding: 28px 24px;
}

.nx-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-left: 4px solid var(--nx-accent);
}

.nx-banner p {
    margin: 0;
}

.nx-banner-kicker {
    font-weight: 700;
    color: var(--nx-heading);
}

.nx-banner-body {
    color: var(--nx-muted);
    margin-top: 4px !important;
}

.nx-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.nx-chat {
    display: flex;
    flex-direction: column;
    min-height: 520px;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px var(--nx-shadow);
}

.nx-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 560px;
}

.nx-empty {
    margin: auto;
    text-align: center;
    color: var(--nx-muted);
    max-width: 360px;
}

.nx-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}

.nx-tips {
    flex-shrink: 0;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    background: var(--nx-surface-2);
}

.nx-tips-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nx-tips-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--nx-heading);
}

.nx-tips > .nx-muted {
    margin: 8px 0 0;
    font-size: 13px;
}

.nx-tips .nx-prompts {
    justify-content: flex-start;
    margin-top: 10px;
}

.nx-transcript-end {
    height: 1px;
    width: 100%;
    flex-shrink: 0;
}

.nx-chip {
    border: 1px solid var(--nx-border);
    background: var(--nx-surface-2);
    color: var(--nx-heading);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.nx-chip:hover,
.nx-chip:focus-visible {
    border-color: var(--nx-accent);
    outline: none;
}

.nx-bubble {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.45;
}

.nx-bubble--user {
    align-self: flex-end;
    background: var(--nx-user-bg);
    color: var(--nx-me);
    border: 1px solid var(--nx-border);
}

.nx-bubble--assistant {
    align-self: flex-start;
    background: var(--nx-surface-2);
    border: 1px solid var(--nx-border);
}

.nx-bubble p {
    margin: 0;
    white-space: pre-wrap;
}

.nx-caret {
    display: inline-block;
    width: 2px;
    height: 0.95em;
    margin-left: 2px;
    vertical-align: -0.12em;
    background: var(--nx-accent);
    animation: nx-caret 0.9s step-end infinite;
}

@keyframes nx-caret {
    50% { opacity: 0; }
}

.nx-insights,
.nx-recos {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nx-insight {
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--nx-surface);
}

.nx-insight h3,
.nx-side-insight h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.nx-insight p,
.nx-side-insight p {
    margin: 0;
    font-size: 13px;
    color: var(--nx-muted);
}

.nx-sev {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--nx-info);
}

.nx-sev--strength { background: var(--nx-ok); }
.nx-sev--warning { background: var(--nx-warn); }
.nx-sev--critical { background: var(--nx-danger); }
.nx-sev--info { background: var(--nx-info); }

.nx-evidence-toggle {
    margin-top: 8px;
    border: 0;
    background: none;
    color: var(--nx-accent);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.nx-evidence {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: var(--nx-deep);
    border-radius: 8px;
    font-size: 13px;
}

.nx-evidence dt {
    font-weight: 600;
    color: var(--nx-heading);
}

.nx-evidence dd {
    margin: 0 0 6px;
    color: var(--nx-muted);
}

.nx-composer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--nx-border);
    background: var(--nx-surface-2);
    border-radius: 0 0 10px 10px;
}

.nx-composer textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--nx-input);
    color: var(--nx-text);
    font: inherit;
}

.nx-composer textarea:focus {
    outline: 2px solid rgba(249, 155, 29, 0.45);
    border-color: var(--nx-accent);
}

.nx-btn {
    border: 1px solid var(--nx-border);
    background: var(--nx-surface);
    color: var(--nx-heading);
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
}

.nx-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nx-btn--accent {
    background: var(--nx-accent);
    border-color: var(--nx-accent);
    color: #1a2129;
}

.nx-btn--ghost {
    background: transparent;
    font-size: 13px;
    padding: 4px 8px;
}

.nx-btn--danger {
    color: var(--nx-danger);
    border-color: transparent;
    background: transparent;
}

.nx-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nx-card {
    padding: 14px;
}

.nx-card h2 {
    margin: 0 0 10px;
    font-size: 15px;
}

.nx-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--nx-deep);
    overflow: hidden;
    margin: 8px 0 6px;
}

.nx-progress > span {
    display: block;
    height: 100%;
    background: var(--nx-accent);
}

.nx-focus {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--nx-muted);
}

.nx-side-insight {
    padding: 8px 0;
    border-top: 1px solid var(--nx-border);
}

.nx-side-insight:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.nx-side-actions {
    margin-top: 8px;
}

.nx-muted {
    color: var(--nx-muted);
    font-size: 13px;
}

.nx-reason {
    margin-top: 8px !important;
    word-break: break-word;
}

.nx-analyzing-wrap {
    align-self: flex-start;
    max-width: min(92%, 28rem);
}

.nx-analyzing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--nx-text, inherit);
    font-style: normal;
    font-weight: 600;
}

.nx-analyzing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--nx-accent);
    animation: nx-pulse 1s ease-in-out infinite;
}

.nx-status-log {
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--nx-muted);
}

.nx-status-log li {
    padding: 1px 0 1px 15px;
    opacity: 0.8;
}

.nx-status-log li::before {
    content: "✓ ";
    margin-left: -15px;
    color: var(--nx-accent);
}

@keyframes nx-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 860px) {
    .nx-grid {
        grid-template-columns: 1fr;
    }

    .nx-chat {
        min-height: 420px;
    }
}

.nx-hero-actions {
    margin-top: 14px;
}

.nx-grid--dashboard {
    grid-template-columns: minmax(0, 1fr) 300px;
}

.nx-hero-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nx-usage {
    margin-bottom: 18px;
}

.nx-plans {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 8px 0 10px;
}

.nx-plan-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px var(--nx-shadow);
}

.nx-plan-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nx-plan-card h2 {
    margin: 0;
    font-size: 18px;
    color: var(--nx-heading);
}

.nx-plan-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--nx-text);
    font-size: 14px;
    line-height: 1.5;
}

.nx-plan-card .nx-btn {
    margin-top: auto;
    text-align: center;
    text-decoration: none;
}

.nx-plan-card--highlight {
    border-color: var(--nx-accent);
    box-shadow: 0 0 0 1px rgba(249, 155, 29, 0.35);
}

.nx-plan-card--current {
    background: var(--nx-surface-2);
}

.nx-plan-current {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1a2129;
    background: var(--nx-accent);
    border-radius: 999px;
    padding: 2px 8px;
}

.nx-plans-note {
    margin: 0 0 22px;
}

@media (max-width: 860px) {
    .nx-plans {
        grid-template-columns: 1fr;
    }
}

.nx-card--chat-teaser {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-height: 220px;
}

.nx-focus-bar {
    flex-shrink: 0;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--nx-border);
}

.nx-focus-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--nx-muted);
    margin-bottom: 6px;
}

.nx-focus-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nx-focus-input {
    flex: 1;
    min-width: 160px;
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--nx-input);
    color: var(--nx-text);
    font: inherit;
}

.nx-focus-hint {
    margin: 8px 0 0;
}

.nx-focus-error {
    margin: 6px 0 0;
    color: var(--nx-danger);
    font-size: 13px;
}

.nx-chat--embedded {
    min-height: 0;
    flex: 1;
    height: auto;
    box-shadow: none;
}

.nx-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.nx-drawer-root {
    pointer-events: none;
}

.nx-drawer-root--open {
    pointer-events: auto;
}

.nx-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10040;
}

.nx-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 100%);
    height: 100%;
    height: 100dvh;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    --nx-text: #3a4550;
    --nx-heading: #1a2129;
    --nx-muted: #6b7785;
    --nx-surface: #ffffff;
    --nx-surface-2: #f4f6f8;
    --nx-border: #dde3ea;
    --nx-input: #ffffff;
    --nx-accent: #f99b1d;
    --nx-danger: #e0043f;
    --nx-user-bg: #fff6e8;
    --nx-me: #1a2129;
    --nx-ok: #1a8a5c;
    --nx-warn: #c47a12;
    --nx-info: #3a6b8c;
    --nx-deep: #e8ecf1;
    background: #ffffff;
    background: var(--nx-surface);
    color: var(--nx-text);
    border-left: 1px solid var(--nx-border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.nx-drawer--open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
}

.nx-drawer--closed {
    visibility: hidden;
}

html[data-theme="dark"] .nx-drawer {
    --nx-surface: #151b22;
    --nx-surface-2: #1a2129;
    --nx-text: #c8d0d8;
    --nx-heading: #e8ecef;
    --nx-muted: #9aa7b5;
    --nx-border: #2a3440;
    --nx-input: #0e1217;
    --nx-accent: #f99b1d;
    --nx-danger: #e0043f;
    --nx-user-bg: #2a2218;
    --nx-me: #e8ecef;
    --nx-deep: #0e1217;
    background: #151b22;
    background: var(--nx-surface);
    color: var(--nx-text);
    border-left-color: var(--nx-border);
}

/* Isola botões do tema legado (button[type=submit] / border-radius 30px / overflow). */
.nx-drawer button,
.nx-chat-panel button {
    margin-top: 0;
    overflow: visible;
    text-transform: none;
    position: static;
    z-index: auto;
}

.nx-drawer .nx-btn,
.nx-chat-panel .nx-btn {
    border-radius: 8px;
    padding: 8px 14px !important;
    font-size: 14px !important;
    line-height: 1.3;
    font-weight: 600;
}

.nx-drawer .nx-btn--ghost,
.nx-chat-panel .nx-btn--ghost {
    padding: 4px 8px !important;
    font-size: 13px !important;
}

.nx-drawer .nx-btn--accent,
.nx-chat-panel .nx-btn--accent {
    background: #f99b1d;
    border: 1px solid #f99b1d;
    color: #1a2129;
    flex-shrink: 0;
    align-self: flex-end;
}

.nx-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--nx-border, #dde3ea);
    background: var(--nx-surface, #fff);
    flex-shrink: 0;
}

.nx-drawer-head h2 {
    margin: 0;
    font-size: 15px;
    color: var(--nx-heading, #1a2129);
}

.nx-drawer-close {
    border: 0;
    background: transparent;
    color: var(--nx-heading, #1a2129);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px !important;
}

.nx-drawer-body {
    flex: 1;
    min-height: 0;
    padding: 12px 14px 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--nx-surface, #fff);
}

.nx-drawer-body .nx-chat-panel {
    flex: 1;
    min-height: 0;
}

.nx-drawer-body .nx-chat--embedded {
    height: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--nx-surface, #fff);
    border: 1px solid var(--nx-border);
    border-radius: 10px;
}

.nx-drawer-body .nx-transcript {
    max-height: none;
    flex: 1;
    min-height: 0;
}

.nx-fab-host {
    position: fixed !important;
    right: 18px !important;
    bottom: 22px !important;
    top: auto !important;
    left: auto !important;
    z-index: 10030;
    width: auto !important;
    height: auto !important;
    max-width: 240px;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

button.nx-fab,
.nx-fab {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    inset: auto !important;
    z-index: 1;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 220px !important;
    max-height: 56px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 28px !important;
    padding: 12px 16px !important;
    background: #f99b1d !important;
    color: #1a2129 !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    overflow: visible !important;
    pointer-events: auto;
    box-sizing: border-box;
}

.nx-fab:hover,
.nx-fab:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

.nx-fab i {
    font-size: 16px;
    line-height: 1;
}

@media (max-width: 860px) {
    .nx-grid--dashboard {
        grid-template-columns: 1fr;
    }

    .nx-fab-host {
        max-width: 56px;
    }

    .nx-fab span {
        display: none;
    }

    button.nx-fab,
    .nx-fab {
        width: 52px !important;
        height: 52px !important;
        max-width: 52px !important;
        max-height: 52px !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }
}
