:root {
    /* Core color tokens */
    --color-bg: #090f1f;
    --color-surface: #111827;
    --color-surface-2: #182033;
    --color-surface-3: #1f2937;
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    --color-border: #2f3a4d;
    --color-accent: #f97316;
    --color-accent-soft: rgba(249, 115, 22, 0.18);
    --color-danger-soft: rgba(239, 68, 68, 0.15);

    /* Typography tokens */
    --font-family-base: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-size-100: 12px;
    --font-size-200: 13px;
    --font-size-300: 14px;
    --font-size-500: 16px;
    --font-size-700: 20px;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --line-height-base: 1.45;

    /* Spacing tokens */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;

    /* Radius, shadow, motion */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.2);
    --duration-fast: 140ms;
    --duration-base: 220ms;
    --ease-standard: cubic-bezier(0.2, 0.65, 0.2, 1);

    /* Layout */
    --header-height: 60px;
    --footer-height: 28px;
    --sidebar-width: 244px;
    --sidebar-width-collapsed: 84px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-300);
    line-height: var(--line-height-base);
    background:
        radial-gradient(1200px 380px at -5% -12%, rgba(249, 115, 22, 0.08), transparent 60%),
        var(--color-bg);
    color: var(--color-text);
}

.app-shell {
    display: grid;
    grid-template-rows: var(--header-height) 1fr var(--footer-height);
    height: 100vh;
    min-height: 0;
}

.shell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 var(--space-4);
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.shell-header-left,
.shell-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.shell-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.shell-brand strong {
    font-size: var(--font-size-500);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.shell-version-badge {
    font-size: var(--font-size-100);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.2px;
    color: #ffd7bf;
    border: 1px solid rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.14);
    border-radius: 999px;
    padding: 2px 8px;
}

.shell-brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.shell-icon-btn,
.shell-btn-secondary {
    border: 1px solid var(--color-border);
    background: var(--color-surface-3);
    color: var(--color-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-200);
    transition:
        transform var(--duration-fast) var(--ease-standard),
        border-color var(--duration-fast) var(--ease-standard),
        background-color var(--duration-fast) var(--ease-standard),
        box-shadow var(--duration-fast) var(--ease-standard);
}

.shell-icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 15px;
    line-height: 1;
}

.shell-btn-secondary {
    padding: 8px 12px;
    font-weight: var(--font-weight-medium);
}

.shell-icon-btn:hover,
.shell-btn-secondary:hover {
    transform: translateY(-1px);
    border-color: #415068;
    background: #253047;
}

.shell-icon-btn:active,
.shell-btn-secondary:active {
    transform: translateY(0);
}

.shell-icon-btn:focus-visible,
.shell-btn-secondary:focus-visible,
.shell-nav a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.shell-user-pill {
    max-width: min(32vw, 360px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(24, 32, 51, 0.85);
    font-size: var(--font-size-200);
}

.shell-user-pill.status-online {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(22, 163, 74, 0.14);
}

.shell-user-pill.status-warning {
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(180, 83, 9, 0.14);
}

.shell-user-pill.status-offline {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(185, 28, 28, 0.14);
}

.shell-integrations-pill {
    font-size: var(--font-size-200);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(24, 32, 51, 0.85);
    white-space: nowrap;
}

.shell-integrations-pill.status-online {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(22, 163, 74, 0.14);
}

.shell-integrations-pill.status-offline {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(185, 28, 28, 0.14);
}

.shell-integrations-pill.status-warning {
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(180, 83, 9, 0.14);
}

.shell-main {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 0;
    transition: grid-template-columns var(--duration-base) var(--ease-standard);
}

.shell-legal-footer {
    height: var(--footer-height);
    min-height: var(--footer-height);
    max-height: var(--footer-height);
    padding: 0 var(--space-4);
    overflow: hidden;
}

.shell-legal-footer.di-legal-footer--compact {
    margin-top: 0;
    padding: 0 var(--space-4);
    /* borda mais sutil que --color-border padrão para não competir com o header */
    border-top: 1px solid rgba(47, 58, 77, 0.6);
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    /* tom base do footer: muted, não herda o #cbd5e1 do legal-runtime.js */
    color: var(--color-text-muted);
    font-size: 10px;
    letter-spacing: 0.01em;
    opacity: 0.82;
}

.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact {
    width: 100%;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}

.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact-copy,
.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact-links {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nome da empresa: ligeiramente mais visível que o texto corrido, mas sem ser branco */
.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact-copy strong {
    color: #a8b5c4;
    font-weight: var(--font-weight-medium);
}

/* Links: azul dessaturado — identificável mas harmonioso com o fundo escuro */
.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact-links a {
    color: #6b9ec7;
    font-size: 10px;
    text-decoration: none;
}

.shell-legal-footer.di-legal-footer--compact .di-legal-footer-compact-links a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.shell-legal-footer.di-legal-footer--compact .di-legal-language span {
    display: none;
}

/* Botão de idioma: tom neutro, sem destaque agressivo */
.shell-legal-footer.di-legal-footer--compact .di-legal-language button {
    padding: 2px 6px;
    font-size: 9px;
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--color-text-muted);
    background: transparent;
}

.shell-legal-footer.di-legal-footer--compact .di-legal-language button.is-active {
    border-color: rgba(249, 115, 22, 0.38);
    background: rgba(249, 115, 22, 0.1);
    color: #d1d9e0;
}

.app-shell.is-sidebar-collapsed .shell-main {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

.shell-sidebar {
    border-right: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(12, 19, 33, 0.96));
    padding: var(--space-3);
    overflow-y: auto;
}

.shell-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.shell-nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    background: transparent;
    font-size: var(--font-size-300);
    font-weight: var(--font-weight-medium);
    position: relative;
    transition:
        transform var(--duration-fast) var(--ease-standard),
        border-color var(--duration-fast) var(--ease-standard),
        background-color var(--duration-fast) var(--ease-standard),
        color var(--duration-fast) var(--ease-standard);
}

.shell-nav a::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    margin-right: 10px;
    background: #4b5563;
    transition: background-color var(--duration-fast) var(--ease-standard);
}

.shell-nav a:hover {
    transform: translateX(2px);
    border-color: var(--color-border);
    background: rgba(31, 41, 55, 0.66);
}

.shell-nav a.active {
    color: #ffffff;
    border-color: #394863;
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.08));
}

.shell-nav a.active::before {
    background: var(--color-accent);
}

.app-shell.is-sidebar-collapsed .shell-nav a {
    justify-content: center;
    padding-inline: 8px;
    font-size: 0;
}

.app-shell.is-sidebar-collapsed .shell-nav a::before {
    content: attr(data-short);
    width: auto;
    height: auto;
    margin-right: 0;
    border-radius: 999px;
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--font-size-100);
    font-weight: var(--font-weight-semibold);
    padding: 4px 6px;
    letter-spacing: 0.2px;
}

.app-shell.is-sidebar-collapsed .shell-nav a.active::before {
    color: #fff;
    border-color: rgba(249, 115, 22, 0.5);
    background: var(--color-accent-soft);
}

.shell-content {
    overflow: auto;
    padding: var(--space-4);
    background: linear-gradient(180deg, rgba(9, 15, 31, 0.45), rgba(9, 15, 31, 0.2));
    /* Necessário para que height: 100% em filhos (legacy-shell-card) funcione
       corretamente dentro de grid cells em todos os browsers */
    min-height: 0;
}

.view-card {
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(15, 22, 36, 0.95));
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
}

.legacy-shell-card {
    display: flex;
    flex-direction: column;
    /* gap removido: o iframe deve preencher tudo abaixo do header,
       sem espaço fantasma entre legacy-shell-header e legacy-shell-frame */
    gap: 0;
    /* Ocupa toda a altura disponível no .shell-content (grid cell com 1fr) */
    height: 100%;
    min-height: 0;
}

.legacy-shell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    /* Colapso suave via grid-template-rows (sem max-height fixo) */
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows var(--duration-base) var(--ease-standard);
    overflow: hidden;
}

.legacy-shell-header > .legacy-shell-header-inner {
    /* Wrapper interno: permite que overflow:hidden no pai funcione */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 0;
    overflow: hidden;
    padding: var(--space-3) 0;
}

.legacy-shell-card.is-header-collapsed .legacy-shell-header {
    grid-template-rows: 0fr;
}

.legacy-shell-collapse-btn {
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    background: var(--color-surface-3);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    line-height: 1;
    transition:
        color var(--duration-fast) var(--ease-standard),
        border-color var(--duration-fast) var(--ease-standard);
}

.legacy-shell-collapse-btn:hover {
    color: var(--color-text);
    border-color: var(--color-accent);
}

/* Quando colapsado, o botão de toggle flutua sobre o iframe */
.legacy-shell-card.is-header-collapsed .legacy-shell-frame {
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}

.legacy-shell-header h3 {
    margin: 0 0 4px;
    font-size: var(--font-size-500);
}

.legacy-open-full {
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.legacy-shell-frame {
    /* Flex fill: ocupa todo o espaço restante do .legacy-shell-card
       após o .legacy-shell-header. O truque "height: 0 + flex: 1"
       é necessário porque iframes ignoram min-height de containers pai. */
    flex: 1;
    min-height: 0;
    height: 0;
    width: 100%;
    display: block;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #0d1424;
}

.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-3);
}

.integration-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: rgba(24, 32, 51, 0.55);
}

.integration-status {
    font-size: var(--font-size-200);
    margin-bottom: var(--space-2);
}

.integration-status.online {
    color: #86efac;
}

.integration-status.configured {
    color: #fcd34d;
}

.integration-status.offline {
    color: #fca5a5;
}

.integration-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.di-view-header {
    margin-bottom: var(--space-3);
}

.di-tabs {
    display: flex;
    gap: 6px;
    margin: 14px 0 12px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(24, 32, 51, 0.45);
    width: fit-content;
}

.di-tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: var(--font-size-200);
    cursor: pointer;
    transition:
        background-color var(--duration-fast) var(--ease-standard),
        border-color var(--duration-fast) var(--ease-standard),
        color var(--duration-fast) var(--ease-standard);
}

.di-tab[aria-selected="true"] {
    color: var(--color-text);
    border-color: rgba(249, 115, 22, 0.55);
    background: rgba(249, 115, 22, 0.12);
}

.di-feedback {
    margin: 8px 0 12px;
    padding: 10px 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(17, 24, 39, 0.5);
}

.di-feedback.is-error {
    border-style: solid;
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
}

.di-feedback.is-ok {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.07);
    color: #bbf7d0;
}

.di-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.di-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: rgba(24, 32, 51, 0.45);
}

.di-row-title {
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.2px;
}

.di-row-sub {
    margin-top: 4px;
    font-size: var(--font-size-100);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.di-dot {
    opacity: 0.7;
}

.di-row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.di-row-btn {
    padding: 8px 10px;
    font-size: var(--font-size-200);
}

.di-row-btn-primary {
    border-color: rgba(34, 197, 94, 0.55);
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.96), rgba(13, 148, 136, 0.92));
    color: #ecfdf5;
    box-shadow: 0 10px 24px rgba(13, 148, 136, 0.18);
}

.di-row-btn-primary:hover {
    border-color: rgba(134, 239, 172, 0.75);
}

.di-row-deribit {
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 34%),
        rgba(24, 32, 51, 0.52);
}

.di-legacy-details {
    margin-top: 10px;
}

.di-legacy-details summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: var(--font-size-100);
}

.di-legacy-body {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    font-size: var(--font-size-100);
}

.di-legacy-actions {
    justify-content: flex-start;
}

.di-row.is-busy {
    opacity: 0.9;
}

.di-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border-radius: 999px;
    border: 2px solid rgba(156, 163, 175, 0.35);
    border-top-color: rgba(249, 115, 22, 0.9);
    animation: di-spin 900ms linear infinite;
    vertical-align: -2px;
}

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

.di-row-msg {
    margin-top: 8px;
    font-size: var(--font-size-100);
    color: var(--color-text-muted);
}

.di-row-msg.is-error {
    color: #fca5a5;
}

.di-row-msg.is-ok {
    color: #bbf7d0;
}

.di-status-pill {
    font-size: var(--font-size-100);
    font-weight: var(--font-weight-semibold);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 8px;
    background: rgba(17, 24, 39, 0.45);
    color: var(--color-text-muted);
}

.di-status-pill.tone-ok {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(22, 163, 74, 0.12);
}

.di-status-pill.tone-ok2 {
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.1);
}

.di-status-pill.tone-warn {
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(180, 83, 9, 0.12);
}

.di-status-pill.tone-danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(185, 28, 28, 0.12);
}

.di-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
}

.di-modal[hidden] {
    display: none;
}

.di-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.di-modal-card {
    position: relative;
    width: min(520px, 92vw);
    max-height: 84vh;
    overflow: auto;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: rgba(17, 24, 39, 0.96);
    box-shadow: var(--shadow-md);
}

.di-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

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

.di-field-label {
    font-size: var(--font-size-100);
    color: var(--color-text-muted);
}

.di-input {
    width: 100%;
    padding: 10px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #0f172a;
    color: var(--color-text);
    font-size: var(--font-size-300);
}

.di-input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.di-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

@media (max-width: 720px) {
    .di-row {
        flex-direction: column;
    }

    .di-row-actions {
        justify-content: flex-start;
    }

    .di-tabs {
        width: 100%;
    }
}

.view-card.view-state {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 72px;
}

.view-card.view-state::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--color-accent);
    box-shadow: 0 0 0 6px var(--color-accent-soft);
}

.view-card.view-state.is-error::before {
    background: #ef4444;
    box-shadow: 0 0 0 6px var(--color-danger-soft);
}

.muted {
    color: var(--color-text-muted);
}

@media (max-width: 920px) {
    .shell-header {
        padding-inline: var(--space-3);
    }

    .shell-main {
        grid-template-columns: 76px 1fr;
    }

    .shell-brand strong,
    .shell-user-pill {
        display: none;
    }

    .legacy-shell-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .shell-version-badge {
        display: none;
    }
}

/* =============================================
   Help Drawer
   ============================================= */

.shell-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
}

.shell-help-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.shell-help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 96vw);
    height: 100dvh;
    background: #111827;
    border-left: 1px solid #1e3a5f;
    z-index: 9901;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.7);
}

.shell-help-drawer.open {
    transform: translateX(0);
}

.shell-help-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 52px;
    border-bottom: 1px solid #1e3a5f;
    flex-shrink: 0;
    background: #0d1829;
}

.shell-help-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #e2e8f0;
    min-width: 0;
}

.shell-help-drawer-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-help-drawer-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-accent, #c9a227);
    color: #0d1117;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
}

/* Botão X — proeminente e inconfundível */
.shell-help-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #2d4a6a;
    background: #1a2f4a;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}

.shell-help-close-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.shell-help-close-btn:focus-visible {
    outline: 2px solid var(--color-accent, #c9a227);
    outline-offset: 2px;
}

.shell-help-lang-tabs {
    display: flex;
    padding: 10px 16px;
    border-bottom: 1px solid #1e3a5f;
    flex-shrink: 0;
    gap: 0;
}

.shell-help-lang-btn {
    background: transparent;
    border: 1px solid #2d4a6a;
    color: #64748b;
    padding: 5px 18px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shell-help-lang-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.shell-help-lang-btn:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}

.shell-help-lang-btn.active {
    background: var(--color-accent, #c9a227);
    color: #0d1117;
    border-color: var(--color-accent, #c9a227);
}

.shell-help-lang-btn:not(.active):hover {
    background: #1e3a5f;
    color: #e2e8f0;
    border-color: #2d4a6a;
}

.shell-help-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 40px;
    font-size: 0.825rem;
    line-height: 1.7;
    color: #cbd5e1;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.shell-help-drawer-body::-webkit-scrollbar {
    width: 4px;
}

.shell-help-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.shell-help-drawer-body::-webkit-scrollbar-thumb {
    background: #2d4a6a;
    border-radius: 2px;
}

.shell-help-drawer-body h1 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-accent, #c9a227);
    margin: 0 0 6px;
    line-height: 1.3;
}

.shell-help-drawer-body h2 {
    font-size: 0.8rem;
    font-weight: 700;
    color: #7dd3fc;
    margin: 22px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #1e3a5f;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.shell-help-drawer-body h3 {
    font-size: 0.825rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 14px 0 6px;
}

.shell-help-drawer-body p {
    margin: 0 0 10px;
    color: #94a3b8;
}

.shell-help-drawer-body ul,
.shell-help-drawer-body ol {
    margin: 6px 0 12px;
    padding-left: 16px;
}

.shell-help-drawer-body li {
    margin-bottom: 5px;
    color: #94a3b8;
}

.shell-help-drawer-body li::marker {
    color: var(--color-accent, #c9a227);
}

.shell-help-drawer-body strong {
    color: #e2e8f0;
    font-weight: 600;
}

.shell-help-drawer-body a {
    color: var(--color-accent, #c9a227);
    text-decoration: none;
}

.shell-help-drawer-body a:hover {
    text-decoration: underline;
}

.shell-help-drawer-body code {
    background: rgba(201, 162, 39, 0.1);
    color: #fcd34d;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.78em;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.shell-help-drawer-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 18px;
    font-size: 0.78em;
}

.shell-help-drawer-body th {
    background: #0d1829;
    color: #7dd3fc;
    text-align: left;
    padding: 7px 10px;
    border: 1px solid #1e3a5f;
    font-weight: 700;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.shell-help-drawer-body td {
    padding: 6px 10px;
    border: 1px solid #1e3a5f;
    color: #94a3b8;
    vertical-align: top;
    line-height: 1.5;
}

.shell-help-drawer-body tr:nth-child(even) td {
    background: rgba(13, 24, 41, 0.4);
}

.shell-help-drawer-body tr:hover td {
    background: rgba(30, 58, 95, 0.3);
    color: #cbd5e1;
}

.shell-help-faq-q {
    font-weight: 600;
    color: #e2e8f0;
    margin: 16px 0 4px;
    font-size: 0.825rem;
}

.shell-help-faq-q::before {
    content: 'P: ';
    color: var(--color-accent, #c9a227);
    font-weight: 700;
}

.shell-help-faq-a {
    color: #64748b;
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 2px solid var(--color-accent, #c9a227);
    background: rgba(201, 162, 39, 0.04);
    border-radius: 0 4px 4px 0;
}

.shell-help-loading {
    color: #475569;
    text-align: center;
    padding: 60px 0;
    font-size: 0.8rem;
}

.shell-help-badge-new {
    display: inline-block;
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 7px;
    letter-spacing: 0.06em;
    vertical-align: middle;
    margin-left: 6px;
}

/* Botão ? no header */
#shell-help-btn {
    font-weight: 800;
    font-size: 15px;
    color: #94a3b8;
}

#shell-help-btn:hover {
    border-color: var(--color-accent, #c9a227);
    color: var(--color-accent, #c9a227);
    background: rgba(201, 162, 39, 0.08);
}

@media (max-width: 920px) {
    .shell-help-drawer {
        width: 100vw;
    }
}

/* ── Shell Fullscreen Mode ───────────────────────────────────────────
   Ativado por toggleShellFullscreen(): esconde header, sidebar, footer
   e faz o iframe ocupar 100% do viewport sem navegacao de saida.
   ─────────────────────────────────────────────────────────────────── */
.app-shell.is-fullscreen {
    grid-template-rows: 1fr;
}

.app-shell.is-fullscreen .shell-header {
    display: none;
}

.app-shell.is-fullscreen .shell-sidebar {
    display: none;
}

.app-shell.is-fullscreen .shell-main {
    grid-template-columns: 1fr;
}

.app-shell.is-fullscreen .shell-content {
    padding: 0;
    background: #090f1f;
}

.app-shell.is-fullscreen .legacy-shell-header {
    grid-template-rows: 0fr;
}

.app-shell.is-fullscreen .legacy-shell-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.app-shell.is-fullscreen .legacy-shell-frame {
    border: none;
    border-radius: 0;
}

.app-shell.is-fullscreen .shell-legal-footer {
    display: none;
}

.shell-fullscreen-exit-btn {
    position: fixed;
    top: 10px;
    right: 14px;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #9ca3af;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 200ms ease, background 200ms ease, color 200ms ease;
}

.shell-fullscreen-exit-btn:hover {
    opacity: 1;
    background: rgba(31, 41, 55, 0.95);
    color: #f3f4f6;
    border-color: rgba(249, 115, 22, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
