/* =============================================================================
   NAVAN - Portal de Importação
   CSS Design System
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables
   ----------------------------------------------------------------------------- */
:root {
    /* Colors - Deep Ocean Theme */
    --color-primary: #0f4c75;
    --color-primary-light: #1b6ca8;
    --color-primary-dark: #0a3454;
    --color-secondary: #3282b8;
    --color-accent: #bbe1fa;
    
    /* Semantic Colors */
    --color-success: #059669;
    --color-success-bg: #d1fae5;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-info: #0284c7;
    --color-info-bg: #e0f2fe;
    
    /* Neutrals */
    --color-bg: #f8fafc;
    --color-bg-alt: #ffffff;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    /* rotulo micro em caixa alta - 7.58:1 sobre branco (WCAG AA) */
    --color-text-label: #475569;

    /* Pares de badge - bg/fg, todos >= 4.5:1 (WCAG AA) */
    --badge-neutro-bg: #f1f5f9;   --badge-neutro-fg: #475569;   /* 6.92 */
    --badge-info-bg: #dbeafe;     --badge-info-fg: #1d4ed8;     /* 5.49 */
    --badge-atencao-bg: #fef3c7;  --badge-atencao-fg: #92400e;  /* 6.37 */
    --badge-indigo-bg: #e0e7ff;   --badge-indigo-fg: #4338ca;   /* 6.41 */
    --badge-sucesso-bg: #d1fae5;  --badge-sucesso-fg: #047857;  /* 4.84 */
    --badge-perigo-bg: #fee2e2;   --badge-perigo-fg: #b91c1c;   /* 5.30 */
    --badge-roxo-bg: #f3e8ff;     --badge-roxo-fg: #6d28d9;     /* 6.02 */
    --badge-ciano-bg: #cffafe;    --badge-ciano-fg: #0e7490;    /* 4.79 */
    --badge-teal-bg: #ccfbf1;     --badge-teal-fg: #0f766e;     /* 4.86 */
    --badge-ambar-bg: #fef9c3;    --badge-ambar-fg: #a16207;    /* 4.58 */

    /* Sidebar */
    /* Sidebar clara - mesma gramatica do .section-pills: um TRILHO contido
       (--sidebar-bg, levemente mais escuro que a pagina) com o item ativo
       ELEVADO sobre ele em superficie branca. Razoes medidas com
       core/tests/contraste.py: inativo 6.92, ativo 9.09, logo 14.97. */
    --sidebar-bg: #dde7f0;
    --sidebar-text: #475569;
    --sidebar-text-active: #0f4c75;
    --sidebar-hover: rgba(15, 76, 117, 0.07);
    --sidebar-active: #ffffff;
    --sidebar-border: #c9d8e6;

    /* Typography */
    --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --header-height: 70px;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --border-radius-sm: 6px;
    
    /* Shadows - desfoque largo de proposito: sombra apertada (blur 2px) cola
       o cartao na pagina e a massa de branco vira continua. Com o desfoque
       maior o cartao levanta e o --color-bg aparece ENTRE os cartoes. */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* -----------------------------------------------------------------------------
   Reset & Base
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

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

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* -----------------------------------------------------------------------------
   Layout
   ----------------------------------------------------------------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: width 0.2s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

.content-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-body {
    flex: 1;
    padding: 1.5rem 2rem 2rem;
}

/* -----------------------------------------------------------------------------
   Sidebar
   ----------------------------------------------------------------------------- */
.sidebar-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--color-surface);
    border-radius: 6px;
    color: var(--sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--color-border-light);
    color: var(--sidebar-text-active);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0.875rem 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.sidebar.collapsed .logo {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.logo img {
    display: block;
    flex-shrink: 0;
    max-height: 52px;
    max-width: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.logo-text {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.025em;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sidebar-text);
    padding: 0 0.75rem;
    margin-bottom: 0.1875rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    transition: all var(--transition-fast);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-item span:not(.badge) {
    transition: opacity 0.15s ease;
    overflow: hidden;
}

/* Collapsed state */
.sidebar.collapsed .nav-label {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.5rem;
    gap: 0;
}

.sidebar.collapsed .nav-item span:not(.badge) {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.5625rem;
}

/* Tooltip on collapsed items */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed-width) - 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 0.875rem 0.5rem;
    gap: 0;
}

.sidebar.collapsed .user-info {
    flex: 0;
}

.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn {
    display: none;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar span {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    color: var(--sidebar-text);
    font-size: 0.75rem;
}

.logout-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--badge-perigo-bg);
    color: var(--badge-perigo-fg);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.header-left {
    flex: 1;
    min-width: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* -----------------------------------------------------------------------------
   Messages
   ----------------------------------------------------------------------------- */
.messages-container {
    padding: 0 2rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.message-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.message-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.message-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.message-info {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.message-close {
    background: none;
    border: none;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.message-close:hover {
    opacity: 1;
}

.message-close svg {
    width: 16px;
    height: 16px;
}

/* Toast - alerta de novas notificações */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--color-primary, #1e3a5f);
    color: #fff;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 360px;
}

.toast.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification .toast-text {
    flex: 1;
    line-height: 1.4;
}

.toast-notification .toast-link {
    flex-shrink: 0;
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.toast-notification .toast-link:hover {
    opacity: 0.9;
}

/* Django Toasts Modifiers */
.toast.toast-django {
    padding-right: 2rem;
    position: relative;
    color: var(--color-text);
    background: var(--color-surface);
    border-left: 4px solid var(--color-border);
}

.toast.toast-success {
    border-left-color: var(--color-success);
}

.toast.toast-error {
    border-left-color: var(--color-danger);
}

.toast.toast-warning {
    border-left-color: var(--color-warning);
}

.toast.toast-info {
    border-left-color: var(--color-info);
}

.toast-close {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--color-text);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

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

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border-light);
    border-color: var(--color-text-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background: #b45309;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

.btn-block {
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Cards
   ----------------------------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-light);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.card-action {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-primary);
}

.card-action:hover {
    color: var(--color-primary-light);
}

.card-body {
    padding: 1.25rem;
}

/* -----------------------------------------------------------------------------
   Forms
   ----------------------------------------------------------------------------- */
.form-layout {
    max-width: 900px;
}

/* Padding para formulários diretamente dentro de .card (sem .card-body) */
.card > .form-layout {
    padding: 1.25rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group.col-span-2 {
    grid-column: span 2;
}

.form-group.col-span-3 {
    grid-column: span 3;
}

.form-group.col-span-4 {
    grid-column: span 4;
}

.form-group--actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.form-inline {
    display: inline;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-label);
}

/* Variante de .form-hint escondida por padrao: o JS de avaliar.html alterna
   qual dica aparece conforme a decisao selecionada. */
.form-hint-alt {
    display: none;
}

/* Marca de obrigatoriedade ao lado do label "Mensagem" em avaliar.html,
   escondida ate a decisao exigir justificativa. */
.message-required-mark {
    display: none;
    color: var(--color-danger);
}

.form-error {
    font-size: 0.75rem;
    color: var(--color-danger);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-light);
    margin-top: 1.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: 0.875rem;
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.input-wrapper .form-input {
    padding-left: 2.75rem;
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Section Pills
   Barra de navegacao sobre as secoes de um formulario longo. As pilulas
   ENVOLVEM os <details> das secoes, nao os substituem: sem JS o <summary>
   continua abrindo a secao normalmente.
   Sem overflow-x de proposito — flex-wrap e o mecanismo, o guia proibe
   rolagem lateral.
   ----------------------------------------------------------------------------- */
/* Uma secao = um cartao. Antes as cinco viviam dentro de um unico .card, e com
   a pilula abrindo so uma por vez o resultado era um cartao alto com uma secao
   visivel e quatro escondidas. Cada secao em seu proprio cartao da identidade
   visual a cada uma e espelha a barra de pilulas: uma pilula, um cartao. */
.form-section-card {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.form-section-card:last-of-type {
    margin-bottom: 1.25rem;
}

.simulation-form .form-actions {
    margin-top: 0;
}

/* O resumo de custos NAO gruda mais: e alto demais (grid de 7 cartoes) e comia
   o topo da tela. Quem gruda e a barra de pilulas, que e a navegacao de fato e
   ocupa uma faixa fina. No mobile nada disso vale: la o #custo-painel tem sticky
   proprio como barra colapsavel de 10vh (ver @media abaixo). */
@media (min-width: 769px) {
    /* A nav NAO pode viver dentro de um wrapper curto: sticky so gruda dentro
       dos limites do pai, e um pai que termina logo depois dela nao deixa
       espaco nenhum para grudar. Por isso ela e irma do painel, nao filha. */
    html:not(.nav-solta) .section-pills {
        position: sticky;
        top: 0;
        z-index: 200;
        /* Sem o fundo, o conteudo rolaria visivel atras da barra. */
        background: var(--color-bg);
        padding-top: 0.75rem;
        margin-top: -0.25rem;
    }
}

.section-pills {
    background: var(--color-border-light);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 0.375rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* --color-text-label (#475569), nao --color-text-secondary: sobre a trilha
   --color-border-light o secondary mede 4.34:1 e reprova o AA para 13px.
   O label mede 6.92:1. Medido com core.tests.contraste.razao_contraste. */
.section-pill {
    background: transparent;
    color: var(--color-text-label);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
}

.section-pill:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.section-pill.is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.section-pill:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   Tooltips
   ----------------------------------------------------------------------------- */
.nav-tooltip-trigger {
    position: relative;
    display: inline-block;
    cursor: help;
}

.nav-tooltip {
    position: absolute;
    z-index: 2000;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 12rem;
    max-width: 18rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    text-align: left;
    color: #f8fafc;
    background: #0f172a;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.nav-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #0f172a;
}

.nav-tooltip-trigger.is-active .nav-tooltip,
.nav-tooltip-trigger:hover .nav-tooltip,
.nav-tooltip-trigger:focus-visible .nav-tooltip {
    opacity: 1;
    visibility: visible;
}

.nav-tooltip.nav-tooltip--fixed {
    position: fixed;
    bottom: auto;
    transform: none;
    z-index: 9999;
}

.nav-tooltip.nav-tooltip--fixed::after {
    display: none;
}

.pendencias-table .nav-tooltip-trigger .nav-tooltip:not(.nav-tooltip--fixed) {
    bottom: auto;
    top: calc(100% + 8px);
    left: 0;
    transform: none;
}

.pendencias-table .nav-tooltip-trigger .nav-tooltip:not(.nav-tooltip--fixed)::after {
    top: auto;
    bottom: 100%;
    left: 1rem;
    transform: none;
    border-top-color: transparent;
    border-bottom-color: #0f172a;
}

/* -----------------------------------------------------------------------------
   Tables
   ----------------------------------------------------------------------------- */
.table-container {
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
    overflow-y: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-text-label);
    background: var(--color-border-light);
    white-space: nowrap;
}

.data-table td {
    font-size: 0.875rem;
    color: var(--color-text);
}

.data-table tbody tr:hover {
    background: var(--color-border-light);
}

/* Total Geral do comparativo (templates/simulacoes/comparar.html): a linha mais
   importante da tela precisa se distinguir das linhas de item. */
.data-table tbody tr.row-total td {
    background: var(--color-border-light);
    font-weight: 700;
    /* O Custo Total media 15px aqui contra 28px no detalhe.html: a mesma
       informacao, na tela feita para compara-la, pesava metade. Era o unico
       ponto onde o criterio 2 da fase 30 passava na letra e falhava no espirito
       -- ele era o mais pesado da tela so porque o resto era 14px. */
    font-size: 1.25rem;
    color: var(--color-text);
    border-top: 2px solid var(--color-primary);
    border-bottom: none;
}

/* O rotulo da linha nao cresce junto: quem tem que saltar e o valor. */
.data-table tbody tr.row-total td:first-child {
    font-size: 0.9375rem;
    color: var(--color-text-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Linha de fechamento: peso e borda superior separam o total das linhas de item. */
.data-table tfoot td {
    font-weight: 600;
    background: var(--color-bg);
    border-top: 2px solid var(--color-border);
}

.text-right {
    text-align: right;
}

.text-mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.micro-label {
    display: block;
    font-size: 0.625rem;      /* 10px */
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
    line-height: 1.4;
}

/* -----------------------------------------------------------------------------
   Status Badges
   ----------------------------------------------------------------------------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 999px;
}

.status-badge-icon {
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

/* Badge que acompanha um texto na mesma linha (celula de tabela, rotulo):
   menor e mais apertado para nao competir com o texto que qualifica. */
.status-badge-inline {
    margin-left: 0.5rem;
    padding: 2px 6px;
    font-size: 0.65rem;
}

.status-rascunho { background: var(--badge-neutro-bg); color: var(--badge-neutro-fg); }

.status-enviado,
.status-analise_info { background: var(--badge-info-bg); color: var(--badge-info-fg); }

.status-info_complementar { background: var(--badge-atencao-bg); color: var(--badge-atencao-fg); }

.status-simulacao_andamento,
.status-simulacao_enviada { background: var(--badge-indigo-bg); color: var(--badge-indigo-fg); }

.status-aprovado { background: var(--badge-sucesso-bg); color: var(--badge-sucesso-fg); }

.status-em_processo {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    color: #3730a3;
    font-weight: 600;
}

.status-concluido,
.status-liberado { background: var(--badge-sucesso-bg); color: var(--badge-sucesso-fg); }

/* status-reprovado: sem correspondencia em CHOICES hoje (migration 0008 renomeou
   para "cancelado") - CSS morto mantido, so retokenizado; remocao e outra fase */
.status-reprovado,
.status-cancelado { background: var(--badge-perigo-bg); color: var(--badge-perigo-fg); }

.status-alteracao { background: var(--badge-atencao-bg); color: var(--badge-atencao-fg); }

.status-aguardando-avaliacao {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-weight: 500;
}

.status-pre_embarque { background: var(--badge-roxo-bg); color: var(--badge-roxo-fg); }

.status-embarcado,
.status-transito { background: var(--badge-ciano-bg); color: var(--badge-ciano-fg); }

.status-chegada { background: var(--badge-teal-bg); color: var(--badge-teal-fg); }

.status-desembaraco { background: var(--badge-ambar-bg); color: var(--badge-ambar-fg); }

.status-entrega { background: var(--badge-sucesso-bg); color: var(--badge-sucesso-fg); }

/* Status Ativo/Inativo */
.status-ativo { background: var(--badge-sucesso-bg); color: var(--badge-sucesso-fg); }
.status-inativo { background: var(--badge-neutro-bg); color: var(--badge-neutro-fg); }

/* Urgency Badges */
.urgencia-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
}

.urgencia-baixa { background: var(--badge-neutro-bg); color: var(--badge-neutro-fg); }
.urgencia-media { background: var(--badge-info-bg); color: var(--badge-info-fg); }
.urgencia-alta { background: var(--badge-atencao-bg); color: var(--badge-atencao-fg); }
.urgencia-urgente { background: var(--badge-perigo-bg); color: var(--badge-perigo-fg); }

/* Canal Badges */
.canal-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
}

.canal-verde { background: var(--badge-sucesso-bg); color: var(--badge-sucesso-fg); }
.canal-amarelo { background: var(--badge-atencao-bg); color: var(--badge-atencao-fg); }
.canal-vermelho { background: var(--badge-perigo-bg); color: var(--badge-perigo-fg); }

/* -----------------------------------------------------------------------------
   Dashboard
   ----------------------------------------------------------------------------- */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-ptax-card {
    margin-bottom: 1.5rem;
}

.dashboard-ptax-body {
    padding: 1rem 1.5rem;
}

.dashboard-ptax-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-ptax-currencies {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dashboard-ptax-currency {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-ptax-badge {
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.dashboard-ptax-badge-dolar { background: linear-gradient(135deg, #0f4c75 0%, #3282b8 100%); }
.dashboard-ptax-badge-euro { background: linear-gradient(135deg, #1a5276 0%, #2e86c1 100%); }

.dashboard-ptax-error {
    color: #dc3545;
    font-size: 0.85rem;
}

.dashboard-ptax-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.dashboard-ptax-value {
    font-size: 1.35rem;
    font-weight: 700;
}

.dashboard-ptax-value-dolar { color: #0f4c75; }
.dashboard-ptax-value-euro { color: #1a5276; }

.dashboard-ptax-date {
    color: #6c757d;
    font-size: 0.8rem;
}

.dashboard-ptax-source {
    color: #6c757d;
    font-size: 0.85rem;
}

.badge-hidden {
    display: none;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

a.stat-card-link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(15, 76, 117, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon-blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon-green { background: #d1fae5; color: #059669; }
.stat-icon-yellow { background: #fef3c7; color: #b45309; }
.stat-icon-purple { background: #f3e8ff; color: #7c3aed; }

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
}

.dashboard-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

/* -----------------------------------------------------------------------------
   List Items
   ----------------------------------------------------------------------------- */
.list-items {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
}

.list-item:last-child {
    border-bottom: none;
}

a.list-item:hover {
    background: var(--color-bg);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-item-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-secondary);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    display: block;
    font-weight: 500;
    color: var(--color-text);
}

.list-item-subtitle {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.list-item-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* -----------------------------------------------------------------------------
   Empty State
   ----------------------------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    border-radius: var(--border-radius-lg);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.empty-state-sm {
    padding: 2rem 1rem;
}

.empty-state-sm svg {
    width: 48px;
    height: 48px;
}

.empty-state-lg {
    padding: 5rem 2rem;
}

.empty-state-lg svg {
    width: 80px;
    height: 80px;
    color: var(--color-primary-light);
    margin-bottom: 1.5rem;
}

.empty-state-lg h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state-lg p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.empty-state-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* -----------------------------------------------------------------------------
   Detail Layouts
   ----------------------------------------------------------------------------- */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Info List */
.info-list {
    display: flex;
    flex-direction: column;
}

.info-list-sm .info-item {
    padding: 0.625rem 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item.col-span-2 {
    flex-direction: column;
    gap: 0.375rem;
}

/* --color-text-label (7.58:1), nao --color-text-secondary (4.76:1). A fase 30
   roteou os rotulos para o token de maior contraste, mas .info-label ficou de
   fora -- e ele responde por 123 ocorrencias em 9 templates, todas as telas de
   detalhe do sistema. O ganho e o maior por linha de CSS da fase. */
.info-label {
    font-size: 0.8125rem;
    color: var(--color-text-label);
    flex-shrink: 0;
}

.info-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    text-align: right;
}

.info-item.col-span-2 .info-value {
    text-align: left;
}

.info-value.link {
    color: var(--color-primary);
}

.info-value.link:hover {
    text-decoration: underline;
}

.info-total {
    background: var(--color-bg);
    margin: 0 -1.25rem;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    border-radius: var(--border-radius);
    border-top: 2px solid var(--color-border);
}

.info-total .info-label,
.info-total .info-value {
    font-weight: 600;
    color: var(--color-text);
}

/* Cabecalho de bloco dentro de uma info-list: o rotulo vai em .micro-label e o
   valor e o subtotal daquele bloco. Borda superior separa do bloco anterior,
   borda inferior mais grossa amarra os itens que somam nele. */
.info-group {
    align-items: center;
    margin-top: 1rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 2px solid var(--color-border);
}

.info-group:first-child {
    margin-top: 0;
    border-top: none;
}

.info-group .info-value {
    font-weight: 700;
    color: var(--color-primary);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 2rem;
}

.info-grid .info-item {
    padding: 0.5rem 0;
}

.info-grid .info-item.col-span-2 {
    grid-column: span 2;
}

/* -----------------------------------------------------------------------------
   File List
   ----------------------------------------------------------------------------- */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--border-radius);
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

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

.file-name {
    display: block;
    font-weight: 500;
    color: var(--color-text);
}

.file-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: var(--color-bg);
    border-radius: var(--border-radius);
    text-align: center;
    transition: all var(--transition-fast);
}

.file-card:hover {
    background: var(--color-border-light);
}

.file-card-icon {
    width: 48px;
    height: 48px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.file-card-icon svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.file-card-name {
    display: block;
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.875rem;
}

.file-card-type {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Document Detail (GED) */
.document-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.document-preview-icon {
    width: 64px;
    height: 64px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-preview-icon svg {
    width: 28px;
    height: 28px;
    color: var(--color-primary);
}

.document-preview-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text);
    word-break: break-word;
}

.document-preview-meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.document-description {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

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

/* Document Vault (GED listing) */
.doc-vault-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1rem;
    padding: 0.625rem 0 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--color-surface, #fff);
}

.doc-vault-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.doc-vault-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
}

.doc-vault-sort-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
    white-space: nowrap;
}

.form-select-sm {
    padding: 0.25rem 1.75rem 0.25rem 0.625rem;
    font-size: 0.8125rem;
    height: auto;
}

.doc-vault-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

.doc-vault-check input {
    cursor: pointer;
}

.doc-vault-chip {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.1875rem 0.4375rem;
    border-radius: 9999px;
    background: var(--badge-neutro-bg);
    color: var(--badge-neutro-fg);
}

.doc-vault-toolbar-actions {
    display: flex;
    gap: 0.25rem;
}

.doc-vault-flags,
.doc-vault-section-flags {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.doc-vault-hidden-hint {
    margin: 0.25rem 0 0;
    padding-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.doc-vault {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Cada cliente e um cartao. O cabecalho ja tinha anatomia de cartao — nome,
   "N pastas · M documentos · atualizado ha X" e os badges de vencido/a vencer —
   mas era transparente, entao varios clientes viravam uma pilha indistinta.
   Cliente novo entra pelo {% for %} e vira cartao sozinho, sem trabalho.

   CARTAO SO NESTE NIVEL. A arvore de pastas dentro continua plana: cartao
   dentro de cartao e moldura dupla, o mesmo erro que o painel de resumo da
   simulacao tinha antes de 4949773. */
.doc-vault-client {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    margin-bottom: 0.75rem;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.doc-vault-client:hover {
    border-color: var(--color-border-hover, #cbd5e1);
    box-shadow: var(--shadow);
}

/* Aberto, o cartao ganha destaque: separa o que voce esta olhando da pilha. */
.doc-vault-client[open] {
    box-shadow: var(--shadow);
}

.doc-vault-client + .doc-vault-client {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border-light);
}

.doc-vault-client-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: transparent;
    border-radius: var(--border-radius-lg);
    transition: opacity var(--transition-fast);
}

.doc-vault-client-head::-webkit-details-marker {
    display: none;
}

.doc-vault-client-head:hover {
    opacity: 0.85;
}

.doc-vault-client[open] > .doc-vault-client-head {
    border-bottom: none;
}

.doc-vault-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.doc-vault-chevron svg {
    width: 1rem;
    height: 1rem;
    transition: transform var(--transition-fast);
}

.doc-vault-client[open] > .doc-vault-client-head .doc-vault-chevron svg {
    transform: rotate(90deg);
}

.doc-vault-client-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-vault-client-avatar svg {
    width: 1.125rem;
    height: 1.125rem;
}

.doc-vault-client-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.doc-vault-client-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-vault-client-meta {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
}

.doc-vault-client-body {
    /* Recuo a esquerda mantem a hierarquia visual da arvore; o padding lateral
       e inferior vem do cartao que agora envolve tudo. */
    padding: 0.25rem 1rem 0.875rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    background: transparent;
}

.doc-vault-section {
    background: transparent;
    border: none;
    border-radius: var(--border-radius-lg);
    overflow: visible;
}

.doc-vault-section-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.doc-vault-section-head::-webkit-details-marker {
    display: none;
}

.doc-vault-section-head:hover {
    background: var(--color-border-light);
}

.doc-vault-section-chevron {
    width: 1rem;
    height: 1rem;
}

.doc-vault-section-chevron svg {
    width: 0.875rem;
    height: 0.875rem;
}

.doc-vault-section[open] > .doc-vault-section-head .doc-vault-section-chevron svg {
    transform: rotate(90deg);
}

.doc-vault-section:not([open]) > .doc-vault-section-head {
    opacity: 0.9;
}

.doc-vault-section-solicitacao .doc-vault-section-icon {
    background: #e0e7ff;
    color: #3730a3;
}

.doc-vault-section-processo .doc-vault-section-icon {
    background: #fef3c7;
    color: #92400e;
}

.doc-vault-section-geral .doc-vault-section-icon {
    background: var(--color-border-light);
    color: var(--color-text-secondary);
}

.doc-vault-section-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-vault-section-icon svg {
    width: 1rem;
    height: 1rem;
}

.doc-vault-section-text {
    flex: 1;
    min-width: 0;
}

.doc-vault-section-title {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text);
}

.doc-vault-section-desc {
    font-weight: 400;
    color: var(--color-text-secondary);
}

.doc-vault-section-meta {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
    margin-top: 0.125rem;
}

.doc-vault-section-link {
    flex-shrink: 0;
}

/* Jornada = solicitação + processos aninhados */
.doc-vault-journey {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.doc-vault-journey > .doc-vault-section-head .doc-vault-section-chevron svg {
    transition: transform var(--transition-fast);
}

.doc-vault-journey[open] > .doc-vault-section-head .doc-vault-section-chevron svg {
    transform: rotate(90deg);
}

.doc-vault-journey-count {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.0625rem 0.375rem;
    border-radius: 999px;
    background: var(--color-border-light);
    color: var(--color-text-secondary);
    font-size: 0.6875rem;
    font-weight: 600;
    vertical-align: middle;
}

.doc-vault-journey-sep {
    color: var(--color-border);
    font-weight: 400;
    margin: 0 0.0625rem;
}

/* Status da jornada/processo em estilo outline para não competir com o código */
.status-badge.doc-vault-status {
    background: transparent;
    border: 1px solid currentColor;
    font-weight: 500;
}

/* Acessibilidade: foco visível por teclado nos cabeçalhos colapsáveis */
.doc-vault-client-head:focus-visible,
.doc-vault-section-head:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius);
}

a.doc-vault-file:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Modal de detalhe do documento — largura definida após .modal-content (seção Modal) */
body.modal-open {
    overflow: hidden;
}

.doc-detail-modal-head {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.doc-detail-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.doc-detail-modal-loading,
.doc-detail-modal-error {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* No modal: coluna única em telas estreitas; duas colunas quando há espaço */
.doc-detail-modal .detail-layout {
    grid-template-columns: 1fr;
    padding-bottom: 0;
    gap: 1rem;
    min-width: 0;
}

@media (min-width: 900px) {
    .doc-detail-modal .detail-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
        align-items: start;
    }
}

.doc-detail-modal .detail-main,
.doc-detail-modal .detail-sidebar {
    gap: 1rem;
    min-width: 0;
}

.doc-detail-modal .modal-body {
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
    flex: 1;
    min-height: 0;
}

.doc-detail-modal .info-grid {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .doc-detail-modal .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.doc-detail-modal .detail-sidebar {
    position: static;
    top: auto;
}

.doc-vault-journey-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.25rem 0 0.5rem 1.25rem;
    margin-left: 0.75rem;
    border-left: 1px solid var(--color-border-light);
}

/* Solicitação e processos lado a lado — pastas usam a largura disponível.
   Abrem/fecham junto com a jornada (não têm toggle próprio). */
.doc-vault-journey-body > .doc-vault-stage {
    flex: 1 1 280px;
    min-width: 0;
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    background: var(--color-surface, #fff);
    padding: 0.375rem;
}

.doc-vault-stage {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.doc-vault-stage-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
}

.doc-vault-stage-head-minimal {
    justify-content: flex-end;
    padding: 0 0.25rem 0.25rem;
}

/* Grade de arquivos: tiles de tamanho fixo (não esticam com a pasta) */
.doc-vault-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, 11rem);
    gap: 0.5rem;
    padding: 0.25rem 0 0.5rem 0;
    justify-content: start;
}

a.doc-vault-file {
    position: relative;
    width: 11rem;
    max-width: 11rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.625rem 0.5rem 0.5rem;
    gap: 0.375rem;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius);
    background: var(--color-bg);
    transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

a.doc-vault-file:hover {
    background: var(--color-border-light);
    border-color: var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

a.doc-vault-file .file-icon {
    width: 2.5rem;
    height: 2.5rem;
}

a.doc-vault-file .file-info {
    width: 100%;
    min-width: 0;
}

a.doc-vault-file .file-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    font-size: 0.8125rem;
    line-height: 1.25;
    transition: color var(--transition-fast);
}

a.doc-vault-file:hover .file-name {
    color: var(--color-primary);
}

a.doc-vault-file .file-meta {
    font-size: 0.6875rem;
    line-height: 1.3;
    margin-top: 0.125rem;
}

.doc-vault-file .file-meta .status-badge {
    margin-left: 0;
    margin-top: 0.125rem;
    vertical-align: middle;
    font-size: 0.625rem;
}

.doc-vault-dl {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    flex-shrink: 0;
    opacity: 0;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    padding: 0.25rem;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.08));
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.doc-vault-dl:hover {
    background: var(--color-border-light);
}

a.doc-vault-file:hover .doc-vault-dl,
a.doc-vault-file:focus-within .doc-vault-dl {
    opacity: 1;
}

@media (hover: none) {
    .doc-vault-dl {
        opacity: 1;
    }
}

/* -----------------------------------------------------------------------------
   Timeline
   ----------------------------------------------------------------------------- */
.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-left: 2px solid var(--color-border);
    margin-left: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.timeline-marker {
    position: absolute;
    left: -6px;
    top: 1.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    border: 2px solid var(--color-surface);
}

.timeline-comentario .timeline-marker { background: var(--color-info); }
.timeline-status .timeline-marker { background: var(--color-primary); }
.timeline-documento .timeline-marker { background: var(--color-success); }
.timeline-solicitacao_info .timeline-marker { background: var(--color-warning); }
.timeline-aprovado .timeline-marker { background: var(--color-success); }
.timeline-reprovado .timeline-marker,
.timeline-cancelado .timeline-marker { background: var(--color-danger); }
.timeline-alteracao .timeline-marker { background: var(--color-warning); }

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.timeline-author {
    font-weight: 500;
    color: var(--color-text);
}

.timeline-type {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

.timeline-body {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* -----------------------------------------------------------------------------
   Process Timeline
   ----------------------------------------------------------------------------- */
.process-timeline {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 1rem 0;
}

.process-timeline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-border);
    transform: translateY(-50%);
}

.process-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.step-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    transition: all var(--transition);
}

.process-step.active .step-marker {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.process-step.completed .step-marker {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-align: center;
}

.process-step.active .step-label {
    color: var(--color-primary);
}

.process-step.completed .step-label {
    color: var(--color-success);
}

/* -----------------------------------------------------------------------------
   Checklists
   ----------------------------------------------------------------------------- */
.checklists-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.checklist-section {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.checklist-section-atual {
    border-color: var(--color-primary, #0f4c75);
    box-shadow: 0 0 0 1px rgba(15, 76, 117, 0.12);
}

.checklist-section-passada {
    opacity: 0.92;
}

.checklist-section-futura {
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
}

.checklist-section-collapsible > summary {
    list-style: none;
    cursor: pointer;
}

.checklist-section-collapsible > summary::-webkit-details-marker {
    display: none;
}

.checklist-section-collapsible > summary.checklist-header-summary::after {
    content: '▸';
    margin-left: auto;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    transition: transform 150ms ease;
}

.checklist-section-collapsible[open] > summary.checklist-header-summary::after {
    transform: rotate(90deg);
}

.checklist-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.checklist-legend-item {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.checklist-legend-atual {
    background: rgba(15, 76, 117, 0.1);
    color: var(--color-primary, #0f4c75);
}

.checklist-legend-passada {
    background: #f1f5f9;
    color: #64748b;
}

.checklist-legend-futura {
    background: #f8fafc;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

.checklist-header-inner {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    width: 100%;
}

.checklist-header-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 10rem;
}

.checklist-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    margin-right: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 50%;
    background: var(--color-primary, #0f4c75);
    color: #fff;
    vertical-align: middle;
}

.checklist-section-futura .checklist-step-num,
.checklist-section-passada .checklist-step-num {
    background: #94a3b8;
}

.checklist-header-title h3 {
    margin: 0;
}

.checklist-header-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.checklist-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex-basis: 100%;
    margin-top: 0.25rem;
}

.checklist-count {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.checklist-count-ok {
    background: #d1fae5;
    color: #059669;
}

.checklist-count-pendente {
    background: #fef3c7;
    color: #b45309;
}

.checklist-fase-badge {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.checklist-fase-atual {
    background: rgba(15, 76, 117, 0.12);
    color: var(--color-primary, #0f4c75);
}

.checklist-fase-passada {
    background: #f1f5f9;
    color: #64748b;
}

.checklist-fase-futura {
    background: #fff;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

.checklist-fase-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
}

.checklist-item-futuro {
    opacity: 0.65;
}

.status-futuro {
    background: #f1f5f9;
    color: #94a3b8;
}

.checklist-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.checklist-section-atual .checklist-header {
    background: rgba(15, 76, 117, 0.04);
}

.checklist-section-collapsible:not([open]) .checklist-header {
    border-bottom: none;
}

.checklist-section-collapsible[open] .checklist-header {
    border-bottom: 1px solid var(--color-border);
}

.checklist-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    flex: 1;
}

.progress-bar {
    width: 120px;
    height: 6px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    transition: width var(--transition);
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 40px;
    text-align: right;
}

.checklist-items {
    padding: 0.5rem 0;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.checklist-item.completed {
    opacity: 0.6;
}

.checklist-toggle,
.checklist-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    padding: 0;
}

.checklist-toggle svg,
.checklist-status svg {
    width: 20px;
    height: 20px;
    color: var(--color-border);
}

.checklist-item.completed .checklist-toggle svg,
.checklist-item.completed .checklist-status svg {
    color: var(--color-success);
}

.checklist-item-content {
    flex: 1;
}

.checklist-item-name {
    display: block;
    font-weight: 500;
    color: var(--color-text);
}

.checklist-item.completed .checklist-item-name {
    text-decoration: line-through;
}

.checklist-item-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.checklist-item {
    flex-wrap: wrap;
    align-items: flex-start;
}

.checklist-item-highlight {
    background: #eff6ff;
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 2px #93c5fd;
}

.checklist-item-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.checklist-item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
}

.checklist-item-docs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.checklist-doc-chip {
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
}

.checklist-doc-chip-link {
    text-decoration: none;
    background: #e0e7ff;
    color: #3730a3;
}

.checklist-doc-chip-link:hover {
    background: #c7d2fe;
}

.checklist-doc-empty {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.checklist-item-source {
    display: block;
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 0.125rem;
}

.checklist-rejeicao {
    margin: 0.375rem 0 0;
    font-size: 0.75rem;
    color: #b45309;
}

.status-pendente { background: #fef3c7; color: #b45309; }
.status-aceito { background: #d1fae5; color: #059669; }
.status-rejeitado { background: #fee2e2; color: #dc2626; }

.badge-required {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-radius: 4px;
}

/* -----------------------------------------------------------------------------
   Simulation Summary
   ----------------------------------------------------------------------------- */
/* Painel invertido: o cartao e neutro (herda .card) e o degrade vive so no
   .summary-total — assim o Custo Total e o unico elemento com peso visual. */
/* O painel deixou de ser um cartao: cada metrica dentro dele JA e um cartao, e
   cartao dentro de cartao vira moldura dupla. Aqui ele volta a ser so um
   container transparente, e os cartoes de KPI flutuam sobre o fundo da pagina —
   e o padrao do guia. O .card do HTML fica no markup por contrato de teste. */
.simulation-summary {
    color: var(--color-text);
    background: transparent;
    border: none;
    box-shadow: none;
}

.simulation-summary .card-body {
    padding-left: 0;
    padding-right: 0;
}

.simulation-summary .card-header {
    border-bottom: none;
    padding-left: 0;
    padding-right: 0;

    border-color: var(--color-border-light);
}

.simulation-summary .card-title {
    color: var(--color-text);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

.summary-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Cada metrica em seu proprio cartao (padrao modal-kpi-compact-card do guia).
   Cabe aqui porque sao 7 numeros de destaque; NAO caberia na decomposicao do
   detalhe.html, onde 29 linhas viram 29 cartoezinhos e pioram a leitura. */
.summary-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem 0.875rem;
    box-shadow: var(--shadow-sm);
}

/* Sem opacity: opacidade sobre fundo claro derruba o contraste sem aparecer
   no medidor — a cor vem do token, medida. #475569/#ffffff = 7.58:1 */
/* Proporcao de cada componente no total. A barra so e honesta porque os cinco
   cards somam exatamente o Custo Total — invariante guardado por
   test_particao_do_painel_fecha. Sem esse teste, uma mudanca de formula faria a
   barra mentir em silencio, que e a patologia que este projeto ja pagou caro
   duas vezes (q08 e as excecoes tarifarias). */
.summary-share {
    display: block;
    margin-top: 0.375rem;
}

.summary-share-num {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-text-label);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.25rem;
}

.summary-share-bar {
    display: block;
    height: 4px;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}

.summary-share-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--color-primary);
    transition: width var(--transition);
}

.summary-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--color-text-label);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

/* #64748b/#ffffff = 4.76:1 */
.summary-sub {
    display: block;
    font-size: 0.6875rem;
    color: var(--color-text-secondary);
    margin-top: 0.125rem;
}

/* #64748b/#ffffff = 4.76:1 */
.summary-info {
    display: block;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--color-text-secondary);
}

.summary-total {
    border-color: transparent;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: #ffffff;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* #ffffff sobre o degrade: 12.87:1 no stop escuro, 9.09:1 no claro */
.summary-total .summary-label {
    color: #ffffff;
}

.summary-total .summary-value {
    color: #ffffff;
    font-size: 1.75rem;
}

/* Painel fixo de custos (#custo-painel, templates/simulacoes/form.html):
   densidade compacta deliberada, porque o painel fica grudado no topo enquanto
   o assessor rola um formulario longo. So tamanho e peso — a cor vem das
   regras acima. Mesma escopagem por id que o bloco @media do fim do arquivo. */
#custo-painel .summary-label {
    font-size: 0.75rem;
}

#custo-painel .summary-sub {
    font-size: 0.65rem;
    margin-top: 1px;
}

#custo-painel .summary-value {
    font-size: 0.9rem;
    font-weight: 600;
}

#custo-painel .summary-total .summary-label {
    font-size: 0.8rem;
}

#custo-painel .summary-total .summary-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.simulation-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.simulation-details-grid .card.col-span-2 {
    grid-column: span 2;
}

/* -----------------------------------------------------------------------------
   Detalhe da Simulacao — composicao do custo (fase 30)

   Tela do cliente. O Custo Total ja concentra o peso visual no painel de resumo
   (.summary-total); aqui o trabalho e deixar legivel o que soma no que, para
   quem nao conhece o sistema. Todas as cores abaixo foram medidas com
   core.tests.contraste.razao_contraste — a razao esta no comentario de cada uma.
   ----------------------------------------------------------------------------- */

/* Link dentro de um alerta: herda a cor do alerta (que ja passa AA no proprio
   fundo) e se distingue por sublinhado e peso, nao por cor. */
.alert-link {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* Cartao de cotacao PTAX: compara a taxa usada na simulacao com a do dia. */
.ptax-card {
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
    border-left: 4px solid var(--color-primary);
}

.ptax-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* #0f4c75 sobre o stop escuro do degrade (#e8f4f8): 8.10:1 */
.ptax-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
}

.ptax-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* #475569 sobre o stop escuro do degrade: 6.76:1.
   --color-text-secondary mede 4.24 aqui e reprovaria — por isso o token label. */
.ptax-data,
.ptax-meta-label {
    font-size: 0.875rem;
    color: var(--color-text-label);
}

.ptax-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.ptax-meta-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--color-primary);
}

/* #92400e sobre #fef3c7: 6.37:1 (mesma familia dos badges de atencao) */
.ptax-diff {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    background: var(--badge-atencao-bg);
    color: var(--badge-atencao-fg);
}

.ptax-diff-alta {
    color: var(--badge-perigo-fg);   /* #b91c1c sobre #fef3c7: 5.81:1 */
}

.ptax-diff-baixa {
    color: var(--badge-sucesso-fg);  /* #047857 sobre #fef3c7: 4.92:1 */
}

/* Variante do .ptax-card usada em avaliar.html: cotacao e aviso lado a lado. */
.ptax-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.ptax-card-main {
    flex: 1;
    min-width: 250px;
}

/* Aviso ao lado da cotacao: mesma familia de cor do .ptax-diff (badge-atencao),
   ja medida acima em 6.37:1. */
.ptax-warning {
    padding: 0.75rem 1rem;
    background: var(--badge-atencao-bg);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--color-warning);
    color: var(--badge-atencao-fg);
}

.ptax-warning-text {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Linhas de procedencia das aliquotas (badges de fonte do dado fiscal). */
.detalhe-procedencia {
    margin-bottom: 0.75rem;
}

.transparency-panel {
    margin-top: 0.5rem;
}

/* Anotacao curta ao lado de um rotulo ou dentro de uma celula (NCM, UF,
   data-base). #64748b sobre branco: 4.76:1 */
.detalhe-meta {
    margin-left: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* Nota de ressalva fiscal sobre a superficie do cartao. Nao usa .text-muted:
   #94a3b8 sobre branco mede 2.56:1 e reprova AA num texto que o cliente
   precisa ler. #64748b: 4.76:1 */
.detalhe-nota {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.detalhe-excecoes {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

.detalhe-excecoes-lista {
    margin: 0.25rem 0 0 0;
    padding-left: 1.2em;
}

.detalhe-excecoes-nota {
    margin-top: 0.375rem;
}

/* #b91c1c sobre o stop escuro do alert-info (#bfdbfe): 4.55:1.
   --color-warning (#d97706) media 2.24 no mesmo fundo e reprovava. */
.detalhe-excecao-condicionada {
    color: var(--badge-perigo-fg);
}

/* -----------------------------------------------------------------------------
   Evaluation Form
   ----------------------------------------------------------------------------- */
.evaluation-layout {
    max-width: 800px;
}

.decision-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.decision-option {
    cursor: pointer;
}

.decision-option input {
    display: none;
}

.decision-content {
    padding: 1.5rem;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    text-align: center;
    transition: all var(--transition);
}

.decision-option:hover .decision-content {
    border-color: var(--color-text-muted);
}

.decision-option input:checked + .decision-content {
    border-color: var(--color-primary);
    background: rgba(15, 76, 117, 0.05);
}

.decision-approve input:checked + .decision-content {
    border-color: var(--color-success);
    background: rgba(5, 150, 105, 0.05);
}

.decision-reject input:checked + .decision-content {
    border-color: var(--color-danger);
    background: rgba(220, 38, 38, 0.05);
}

.decision-changes input:checked + .decision-content {
    border-color: var(--color-warning);
    background: rgba(217, 119, 6, 0.05);
}

.decision-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decision-icon svg {
    width: 24px;
    height: 24px;
    color: var(--color-text-muted);
}

.decision-approve .decision-icon { background: var(--color-success-bg); }
.decision-approve .decision-icon svg { color: var(--color-success); }

.decision-reject .decision-icon { background: var(--color-danger-bg); }
.decision-reject .decision-icon svg { color: var(--color-danger); }

.decision-changes .decision-icon { background: var(--color-warning-bg); }
.decision-changes .decision-icon svg { color: var(--color-warning); }

.decision-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.decision-content p {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.decision-consequence {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    padding-top: 0.75rem;
    border-top: 1px dashed var(--color-border);
    margin-top: 0.5rem;
}

.decision-consequence svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.decision-approve input:checked + .decision-content .decision-consequence {
    color: var(--color-success);
}

.decision-changes input:checked + .decision-content .decision-consequence {
    color: var(--color-warning);
}

.decision-consequence-warning {
    color: #b45309;
}

.decision-reject input:checked + .decision-content .decision-consequence-warning {
    color: var(--color-danger);
}

/* -----------------------------------------------------------------------------
   Analysis
   ----------------------------------------------------------------------------- */
.analysis-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
}

.analysis-option-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.analysis-option-icon svg {
    width: 24px;
    height: 24px;
}

.analysis-option-accept .analysis-option-icon {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.analysis-option-request .analysis-option-icon {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.analysis-option-content {
    flex: 1;
}

.analysis-option-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.analysis-option-content p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.analysis-option-content .form-textarea {
    margin-bottom: 1rem;
}

/* -----------------------------------------------------------------------------
   Pagination
   ----------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
    border-top: 1px solid var(--color-border-light);
    margin-top: 1rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* -----------------------------------------------------------------------------
   Notifications
   ----------------------------------------------------------------------------- */
.notifications-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: var(--color-bg);
    margin: 0 -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon svg {
    width: 20px;
    height: 20px;
}

.notification-info .notification-icon { background: var(--color-info-bg); color: var(--color-info); }
.notification-acao .notification-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.notification-sucesso .notification-icon { background: var(--color-success-bg); color: var(--color-success); }
.notification-alerta .notification-icon { background: var(--color-danger-bg); color: var(--color-danger); }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

.notification-date {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
}

.notification-action {
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   Process Detail
   ----------------------------------------------------------------------------- */
.process-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.process-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.process-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.process-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
}

/* -----------------------------------------------------------------------------
   Dossie
   ----------------------------------------------------------------------------- */
.dossie-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dossie-summary .card-body {
    padding: 2rem;
}

.dossie-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

.dossie-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

/* -----------------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-content-lg {
    width: min(1280px, calc(100vw - 2.5rem));
    max-width: min(1280px, calc(100vw - 2.5rem));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: var(--border-radius);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

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

.modal-body {
    padding: 1.25rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* -----------------------------------------------------------------------------
   Comment Form
   ----------------------------------------------------------------------------- */
.comment-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
}

.comment-form .form-textarea {
    flex: 1;
    min-height: 80px;
}

/* -----------------------------------------------------------------------------
   Client Info Banner
   ----------------------------------------------------------------------------- */
.client-info-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--border-radius);
}

.client-info-banner svg {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
}

.client-info-banner strong {
    display: block;
    font-weight: 600;
    color: var(--color-text);
}

.client-info-banner span {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

/* -----------------------------------------------------------------------------
   Tax Row
   ----------------------------------------------------------------------------- */
.tax-row {
    margin-bottom: 1.5rem;
}

.tax-row:last-child {
    margin-bottom: 0;
}

.tax-row h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

/* -----------------------------------------------------------------------------
   Section Divider
   ----------------------------------------------------------------------------- */
.section-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 1.5rem 0;
}

.section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

/* -----------------------------------------------------------------------------
   Action Buttons
   ----------------------------------------------------------------------------- */
.action-buttons {
    display: flex;
    gap: .375rem;
}

/* -----------------------------------------------------------------------------
   List filter bar (checklists, pendências, GED)
   ----------------------------------------------------------------------------- */
.card-header--filter {
    display: block;
    padding: 0.625rem 1rem;
}

.list-filter-bar {
    width: 100%;
}

.list-filter-row {
    display: flex;
    align-items: flex-end;
    gap: 0.625rem;
}

.list-filter-fields {
    flex: 1;
    min-width: 0;
}

.list-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.625rem;
    align-items: flex-end;
}

.list-filter-grid .form-group {
    flex: 1 1 7.5rem;
    min-width: 7.5rem;
    max-width: 11rem;
    gap: 0.2rem;
}

.list-filter-grid .form-group.col-span-2 {
    flex: 2 1 12rem;
    min-width: 12rem;
    max-width: 20rem;
}

.list-filter-bar .form-group label {
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--color-text-label);
}

.list-filter-bar .form-input,
.list-filter-bar .form-select {
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
}

.list-filter-grid .form-group input[type="date"] {
    min-width: 8.5rem;
}

.list-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
    flex-shrink: 0;
    padding-bottom: 1px;
}

.list-filter-actions .btn {
    padding: 0.4375rem 0.75rem;
    font-size: 0.8125rem;
}

.list-filter-actions .btn svg {
    width: 15px;
    height: 15px;
}

@media (max-width: 768px) {
    .list-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .list-filter-grid .form-group,
    .list-filter-grid .form-group.col-span-2 {
        max-width: none;
        flex: 1 1 calc(50% - 0.5rem);
    }

    .list-filter-actions {
        justify-content: stretch;
    }

    .list-filter-actions .btn {
        flex: 1;
    }
}

/* -----------------------------------------------------------------------------
   Filter Form
   ----------------------------------------------------------------------------- */
.filter-form,
.search-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.filter-form .input-wrapper,
.search-form .input-wrapper {
    flex: 1;
    max-width: 300px;
}

.filter-form .form-select {
    width: auto;
}

/* Dropdown com checkboxes para filtro de status */
.filter-dropdown-checkboxes {
    position: relative;
}

.filter-dropdown-details {
    position: relative;
}

.filter-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem;
    min-width: 160px;
    font-size: 0.9375rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.filter-dropdown-trigger::-webkit-details-marker {
    display: none;
}

.filter-dropdown-trigger:hover {
    border-color: var(--color-primary);
}

.filter-dropdown-label {
    font-weight: 500;
}

.filter-dropdown-summary {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.filter-dropdown-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.filter-dropdown-details[open] .filter-dropdown-chevron {
    transform: rotate(180deg);
}

.filter-dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    padding: 0.5rem;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 4px;
}

.filter-checkbox-item:hover {
    background: var(--color-bg-alt);
}

.filter-checkbox-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--color-primary);
}

.filter-dropdown-clear {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-primary);
    background: none;
    border: none;
    border-top: 1px solid var(--color-border);
    cursor: pointer;
    text-align: left;
}

.filter-dropdown-clear:hover {
    text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   Auth Page
   ----------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.auth-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-secondary) 100%);
    overflow: hidden;
}

.auth-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.08) 0%, transparent 50%);
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo svg {
    width: 32px;
    height: 32px;
    stroke: white;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.025em;
}

.auth-header p {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-error-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-error-banner svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-light);
}

.auth-footer p {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .detail-layout,
    .process-content {
        grid-template-columns: 1fr;
    }
    
    .detail-sidebar,
    .process-sidebar {
        position: static;
    }
    
    .simulation-details-grid {
        grid-template-columns: 1fr;
    }
    
    .simulation-details-grid .card.col-span-2 {
        grid-column: span 1;
    }
    
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .summary-total {
        margin-top: 1rem;
        grid-column: span 3;
    }
    
    .decision-options {
        grid-template-columns: 1fr;
    }
    
    .dossie-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        padding: 1rem;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.col-span-2,
    .form-group.col-span-3,
    .form-group.col-span-4 {
        grid-column: span 1;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid .info-item.col-span-2 {
        grid-column: span 1;
    }
    
    .process-timeline {
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    
    .header-right {
        flex-wrap: wrap;
    }
    
    .filter-form,
    .search-form {
        flex-wrap: wrap;
    }
    
    .filter-form .input-wrapper,
    .search-form .input-wrapper {
        max-width: none;
        width: 100%;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary-total {
        grid-column: span 2;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------------------------
   Credential Alert (for new user creation)
   ----------------------------------------------------------------------------- */
.credential-alert {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #10b981;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.credential-alert-icon {
    width: 48px;
    height: 48px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.credential-alert-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.credential-alert-content {
    flex: 1;
}

.credential-alert-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 0.5rem;
}

.credential-alert-content > p {
    font-size: 0.875rem;
    color: #047857;
    margin-bottom: 1rem;
}

.credential-box {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.credential-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.credential-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    min-width: 60px;
}

.credential-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
}

.credential-hint {
    font-size: 0.75rem;
    color: #047857;
    font-style: italic;
}

/* -----------------------------------------------------------------------------
   Access Info Box (form)
   ----------------------------------------------------------------------------- */
.access-info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--color-info-bg);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.access-info-box svg {
    width: 20px;
    height: 20px;
    color: var(--color-info);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.access-info-box p {
    font-size: 0.875rem;
    color: var(--color-info);
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Checkbox Label
   ----------------------------------------------------------------------------- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* -----------------------------------------------------------------------------
   Notifications List (enhanced)
   ----------------------------------------------------------------------------- */
.notification-item {
    position: relative;
}

.notification-link {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    text-decoration: none;
    color: inherit;
    padding-right: 1rem;
}

.notification-link:hover .notification-title {
    color: var(--color-primary);
}

.notification-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.notification-action-form {
    display: inline-flex;
}

.notification-read-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-label);
    padding: 0.25rem 0.5rem;
}

.notification-read-badge svg {
    width: 14px;
    height: 14px;
}

.notifications-list .notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.15s ease;
}

.notifications-list .notification-item:hover {
    background: var(--color-bg-hover);
}

.notifications-list .notification-item:last-child {
    border-bottom: none;
}

.notifications-list .notification-item.unread {
    background: var(--color-info-bg);
}

.notifications-list .notification-item.unread:hover {
    background: #dbeafe;
}

/* -----------------------------------------------------------------------------
   Alert Boxes
   ----------------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

.alert svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert strong {
    display: block;
    margin-bottom: 0.25rem;
}

.alert p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
}

.alert-content {
    flex: 1;
}

.alert-content p {
    margin-top: 0.25rem;
}

/* -----------------------------------------------------------------------------
   Editable Mode Badge
   ----------------------------------------------------------------------------- */
.badge-editable {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid #3b82f6;
}

/* -----------------------------------------------------------------------------
   NCM Autocomplete Dropdown
   ----------------------------------------------------------------------------- */
.ncm-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 4px;
    list-style: none;
    margin: 0;
}

.ncm-autocomplete-dropdown::-webkit-scrollbar {
    width: 4px;
}
.ncm-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.ncm-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.1s ease;
    list-style: none;
}

.ncm-dropdown-item:hover,
.ncm-dropdown-item.highlighted {
    background: #eef4fb;
}

.ncm-item-code {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-primary-light);
    background: #e8f0f8;
    border: 1px solid #c9ddf0;
    padding: 2px 7px;
    border-radius: 5px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
    margin-top: 1px;
    white-space: nowrap;
}

.ncm-item-desc {
    font-size: 0.8125rem;
    color: var(--color-text);
    line-height: 1.45;
}

/* Itens de hierarquia (posição/subposição — drill-down, não NCM folha) */
.ncm-dropdown-item.is-hierarquia {
    opacity: 0.88;
}

.ncm-dropdown-item.is-hierarquia .ncm-item-code {
    color: var(--color-text-secondary);
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ncm-dropdown-item.is-hierarquia .ncm-item-desc {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
}

.ncm-item-drill {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    padding-left: 6px;
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.ncm-item-drill svg {
    width: 10px;
    height: 10px;
    opacity: 0.6;
}

/* -----------------------------------------------------------------------------
   Fixed Action Bar
   ----------------------------------------------------------------------------- */
.action-bar-fixed {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: white;
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    z-index: 100;
    transition: left 0.2s ease;
}

.action-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.action-bar-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.action-bar-info svg {
    width: 20px;
    height: 20px;
    color: var(--color-warning);
    flex-shrink: 0;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

/* Ajuste para o conteúdo não ficar atrás da barra fixa */
.detail-layout {
    padding-bottom: 5rem;
}

@media (max-width: 768px) {
    .action-bar-fixed {
        left: 0;
        padding: 1rem;
    }
    
    .action-bar-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .action-bar-info {
        text-align: center;
    }
    
    .action-bar-info svg {
        display: none;
    }
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-warning svg {
    color: #f59e0b;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #3b82f6;
    color: #1e40af;
}

.alert-info svg {
    color: #3b82f6;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #10b981;
    color: #065f46;
}

.alert-success svg {
    color: #10b981;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #ef4444;
    color: #991b1b;
}

.alert-danger svg {
    color: #ef4444;
}

/* -----------------------------------------------------------------------------
   Table Row Highlights
   ----------------------------------------------------------------------------- */
.row-highlight-warning {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.1) 0%, transparent 100%);
    border-left: 3px solid #f59e0b;
}

.row-highlight-warning:hover {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.05) 100%) !important;
}

.row-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    color: #f59e0b;
}

.row-indicator svg {
    width: 14px;
    height: 14px;
}

/* -----------------------------------------------------------------------------
   Status Stack (multiple badges)
   ----------------------------------------------------------------------------- */
.status-stack {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
}

.status-stack .status-badge {
    display: inline-flex;
    align-items: center;
}

/* Status alteracao badge styling */
.status-alteracao {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

/* -----------------------------------------------------------------------------
   Filter Checkbox
   ----------------------------------------------------------------------------- */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
}

.filter-checkbox:hover {
    border-color: var(--color-primary);
    background: var(--color-bg-hover);
}

.filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.filter-checkbox-label svg {
    width: 16px;
    height: 16px;
}

.filter-checkbox input[type="checkbox"]:checked + .filter-checkbox-label {
    color: var(--color-primary);
}

/* -----------------------------------------------------------------------------
   Form Validation Errors
   ----------------------------------------------------------------------------- */
.error-list {
    list-style: disc;
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

.error-list li {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.form-error-inline {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-error-inline svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.form-label-required {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.decision-options.has-error {
    border: 2px solid #dc2626;
    border-radius: var(--border-radius-lg);
    padding: 0.5rem;
    background: #fef2f2;
}

.decision-options.has-error .decision-option {
    background: white;
}

.form-group.has-error .form-input,
.form-group.has-error .form-textarea,
.form-group.has-error .form-select {
    border-color: #dc2626;
    background: #fef2f2;
}

.form-group.has-error .form-input:focus,
.form-group.has-error .form-textarea:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* -----------------------------------------------------------------------------
   Clickable Table Rows
   ----------------------------------------------------------------------------- */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.clickable-row:hover {
    background-color: var(--color-bg-hover) !important;
}

.clickable-row:active {
    transform: scale(0.995);
}

/* Indicador visual sutil que a linha é clicável */
.clickable-row td:first-child {
    position: relative;
}

.clickable-row:hover td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

/* =============================================================================
   Importacao de Legado (Phase 06)
   ============================================================================= */

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-lg);
    background: var(--color-bg);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}

.drop-zone.drag-over {
    border-color: var(--color-primary);
    background: #eff6ff;
    color: var(--color-primary);
}

.drop-zone.has-files {
    border-style: solid;
    border-width: 1px;
    border-color: var(--color-border);
    min-height: auto;
    padding: 1rem;
}

.drop-zone svg {
    width: 64px;
    height: 64px;
    color: var(--color-text-muted);
}

.drop-zone p {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}

.drop-zone .drop-zone-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
}

.step-indicator .step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-indicator .step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    border: 2px solid var(--color-border);
    color: var(--color-text-muted);
    background: var(--color-surface);
}

.step-indicator .step.current .step-circle {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.step-indicator .step.completed .step-circle {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.step-indicator .step-label {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.step-indicator .step.current .step-label {
    color: var(--color-text);
    font-weight: 700;
}

.step-indicator .step.completed .step-label {
    color: var(--color-text);
}

.step-indicator .step-connector {
    width: 48px;
    height: 2px;
    background: var(--color-border);
    margin: 0 0.5rem;
}

.step-indicator .step-connector.completed {
    background: var(--color-success);
}

/* File Row classification states */
.file-row {
    min-height: 48px;
    border-left: 3px solid transparent;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.file-row:hover {
    background: var(--color-bg);
}

.file-row.incomplete {
    border-left-color: var(--color-warning);
}

.file-row.complete {
    border-left-color: var(--color-success);
}

/* Folder Group */
.folder-group {
    margin-bottom: 1.5rem;
}

.folder-group .card-header {
    background: var(--color-bg);
}

/* Legado badge — shown on processo list for imported legacy processes */
.status-badge-legado {
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 700;
}

/* -----------------------------------------------------------------------------
   Form Submit Spinner
   ----------------------------------------------------------------------------- */
@keyframes navan-spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: navan-spin 0.65s linear infinite;
    vertical-align: middle;
    margin-right: 0.4em;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   PTAX / Exchange Rate Widget
   ----------------------------------------------------------------------------- */
.ptax-widget {
    margin-bottom: 1.5rem;
}

.ptax-widget .card-body {
    padding: 1rem 1.5rem;
}

.ptax-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.ptax-currencies {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ptax-currency {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ptax-currency-badge {
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
}

.ptax-currency-badge--usd {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.ptax-currency-badge--eur {
    background: linear-gradient(135deg, #1a5276 0%, #2e86c1 100%);
}

.ptax-value-group {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.ptax-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-primary);
}

.ptax-value--eur {
    color: #1a5276;
}

.ptax-date {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
}

.ptax-error {
    color: var(--color-danger);
    font-size: 0.85rem;
}

.ptax-source {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}


/* -----------------------------------------------------------------------------
   Stepper Component (Phase 12)
   ----------------------------------------------------------------------------- */
.stepper-wrapper {
    width: 100%;
    overflow-x: auto; /* Permite rolagem em telas muito pequenas */
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 800px; /* Garante que os passos nao fiquem esmagados */
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    transition: all var(--transition-slow);
    margin-bottom: 0.5rem;
}

.step-circle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    transition: all var(--transition-slow);
}

.step-line {
    flex: 1;
    height: 3px;
    background: var(--color-border);
    margin: 0 -5%;
    transform: translateY(-12px); /* Alinha com os circulos */
    z-index: 1;
    position: relative;
}

.step-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width var(--transition-slow);
}

/* Status Classes */
.step.active .step-circle {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 117, 0.15);
}

.step.active .step-label {
    color: var(--color-primary);
    font-weight: 700;
}

.step.completed .step-circle {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-color: transparent;
    color: white;
}

.step.completed .step-label {
    color: var(--color-text);
}

.step-line.filled::after {
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Chart Cards (Phase 13 - Dashboard Interativo)
   ----------------------------------------------------------------------------- */
.chart-card {
    min-height: 280px;
}

.chart-card .card-body {
    position: relative;
    height: 250px;
    padding: 1rem 1.25rem;
}

.chart-card-body-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-empty-state {
    padding: 2rem;
}

.chart-empty-text {
    color: #94a3b8;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------------------------
   Pendências documentais
   ----------------------------------------------------------------------------- */
.pendencias-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pendencias-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pendencias-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
}

.pendencias-stat-label {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.pendencias-stat-pendente .pendencias-stat-value { color: #b45309; }
.pendencias-stat-rejeitado .pendencias-stat-value { color: #dc2626; }
.pendencias-stat-urgente .pendencias-stat-value { color: #c2410c; }

.pendencias-grupo {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: visible;
}

.pendencias-grupo:last-child {
    margin-bottom: 0;
}

.pendencias-grupo-header {
    padding: 0.875rem 1rem;
    background: var(--color-bg-subtle);
    cursor: pointer;
    list-style: none;
}

.pendencias-grupo-header::-webkit-details-marker {
    display: none;
}

.pendencias-grupo-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pendencias-grupo-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    color: var(--color-text-muted);
}

.pendencias-grupo-desc {
    margin: 0.375rem 0 0;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.pendencias-grupo-rejeitado { border-color: #fecaca; }
.pendencias-grupo-critico { border-color: #fed7aa; }

.pendencia-prioridade-cell {
    overflow: visible;
    position: relative;
}

.pendencia-prioridade {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    cursor: help;
}

.pendencia-th-hint {
    cursor: help;
    border-bottom: 1px dotted var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.pendencia-prioridade-rejeitado { background: #fee2e2; color: #b91c1c; }
.pendencia-prioridade-critico { background: #ffedd5; color: #c2410c; }
.pendencia-prioridade-alto { background: #fef3c7; color: #b45309; }
.pendencia-prioridade-normal { background: #ecfdf5; color: #047857; }

.pendencias-table tbody tr.pendencia-row:hover {
    background: var(--color-bg-subtle);
}

.pendencia-doc-nome {
    display: block;
    margin-bottom: 0.125rem;
}

.pendencia-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pendencia-motivo {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: #b91c1c;
    font-style: italic;
}

.pendencia-idade {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--color-text-muted);
}

.pendencia-idade-alta { color: #b45309; }
.pendencia-idade-critica { color: #dc2626; }

.badge-doc {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-task {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    background: #f3e8ff;
    color: #7e22ce;
}

@media (max-width: 900px) {
    .pendencias-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .pendencias-stats {
        grid-template-columns: 1fr;
    }

    .pendencias-table th:nth-child(4),
    .pendencias-table td:nth-child(4) {
        display: none;
    }
}

/* ── Fase 24: UX Polish Simulação ── */

.simulation-form details.form-section-accordion {
    margin-bottom: 0;
    padding-bottom: 0;
    /* Folga para o scrollIntoView das pilulas nao parar com a secao escondida
       atras da regiao sticky. O valor vem MEDIDO do JS (--altura-sticky); o
       7rem e so o fallback de quando o JS nao rodou — e ai nao ha sticky. */
    scroll-margin-top: var(--altura-sticky, 7rem);
}

/* A MESMA folga nos campos. Quando a validacao HTML5 falha o browser rola o
   campo invalido ate o topo — e a barra de secoes, grudada em top: 0, sentava
   em cima dele. O usuario via a mensagem "Selecione um item da lista" sem
   conseguir descobrir ONDE, e o submit travava sem saida. */
.simulation-form input,
.simulation-form select,
.simulation-form textarea {
    scroll-margin-top: var(--altura-sticky, 7rem);
}

/* Marca o campo que travou o envio. O balao nativo some ao primeiro clique;
   isto fica ate o campo ser corrigido. */
.pendencia-lista {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.pendencia-lista li {
    margin-bottom: 0.1875rem;
}

.pendencia-secao {
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
}

.simulation-form .campo-invalido {
    outline: 2px solid var(--color-danger);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

.simulation-form details.form-section-accordion:last-of-type {
    border-bottom: none;
}

.simulation-form details.form-section-accordion > summary {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    padding-bottom: 0.5rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.simulation-form details.form-section-accordion > summary::-webkit-details-marker {
    display: none;
}

.simulation-form details.form-section-accordion > summary::after {
    content: "▸";
    transition: transform 0.15s ease;
}

.simulation-form details.form-section-accordion[open] > summary::after {
    transform: rotate(90deg);
}

.simulation-form details.form-section-accordion > summary:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

#ncm-excecao-info {
    border-left: 4px solid var(--color-warning);
    font-weight: 500;
}

.ncm-loading::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    border: 2px solid var(--color-border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: ncm-spin 0.6s linear infinite;
    pointer-events: none;
}

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

/* Painel resumo de custos: barra compacta expansível no mobile.
   Desktop (>768px) permanece com o comportamento sticky/pin existente. */
@media (max-width: 768px) {
    /* No mobile o painel TEM sticky proprio, como barra colapsavel de 10vh:
       e a unica forma de manter o total a vista numa tela estreita. No desktop
       ele nao gruda (quem gruda e a barra de pilulas) — sao comportamentos
       deliberadamente diferentes, nao inconsistencia. */
    #custo-painel {
        position: sticky;
        top: 0;
        z-index: 300;
        margin-bottom: 0;
        max-height: 10vh;
        overflow: hidden;
        border-radius: 0;
    }

    #custo-painel.painel-mobile-expandido {
        max-height: 90vh;
        overflow-y: auto;
    }

    #custo-painel .card-header {
        cursor: pointer;
    }

    #painel-total-mobile {
        display: inline !important;
    }

    #custo-painel .card-body {
        display: none;
    }

    #custo-painel.painel-mobile-expandido .card-body {
        display: block;
    }

    #custo-painel #btn-pin-painel {
        display: none;
    }
}


/* =============================================================================
   COR POR DOMINIO DE INFORMACAO  (B-23)
   -----------------------------------------------------------------------------
   O diagnostico: "usamos muito azul em todas as telas". As cores semanticas
   existiam mas viviam SO nos badges de status -- fora deles a interface era
   monocromatica, e nada distinguia um bloco de informacao do seguinte.

   A escolha, seguindo o guia: cor por TIPO DE INFORMACAO (tributo x despesa x
   logistica), nao por severidade. As duas semanticas na mesma tela confundem;
   severidade continua sendo assunto exclusivo dos badges de status.

   Cada dominio reusa um par --badge-* JA MEDIDO pela fase 30 (todos >= 4.5:1).
   Nenhuma cor nova entra no sistema sem lastro, e o teste de contraste segue
   valendo sobre os mesmos pares.

   A cor e ACENTO, nunca fundo de leitura: uma barra na lateral e o rotulo. O
   texto do formulario continua sobre branco, com o contraste que ja tinha.
   ========================================================================== */

.simulation-form #section-1,
.section-pill[aria-controls="section-1"] { --dominio-bg: var(--badge-info-bg);    --dominio-fg: var(--badge-info-fg); }
.simulation-form #section-2,
.section-pill[aria-controls="section-2"] { --dominio-bg: var(--badge-ambar-bg);   --dominio-fg: var(--badge-ambar-fg); }
.simulation-form #section-3,
.section-pill[aria-controls="section-3"] { --dominio-bg: var(--badge-roxo-bg);    --dominio-fg: var(--badge-roxo-fg); }
.simulation-form #section-4,
.section-pill[aria-controls="section-4"] { --dominio-bg: var(--badge-ciano-bg);   --dominio-fg: var(--badge-ciano-fg); }
.simulation-form #section-5,
.section-pill[aria-controls="section-5"] { --dominio-bg: var(--badge-teal-bg);    --dominio-fg: var(--badge-teal-fg); }

/* A barra lateral e o que separa um cartao de secao do seguinte sem moldura. */
.simulation-form details.form-section-accordion[id^="section-"] {
    border-left: 3px solid var(--dominio-fg, var(--color-border));
}

/* O titulo herda a cor do dominio; o peso ja vinha de antes. */
.simulation-form details.form-section-accordion[id^="section-"] > summary {
    color: var(--dominio-fg, var(--color-text));
}

/* Pilula ativa: assume a cor da secao que ela abre. E o elo que faz a barra de
   navegacao e o corpo do formulario falarem da mesma coisa. */
.section-pill.is-active[aria-controls^="section-"] {
    background: var(--dominio-bg, var(--color-surface));
    color: var(--dominio-fg, var(--color-primary));
    border-color: var(--dominio-fg, var(--color-border));
}

.section-pill[aria-controls^="section-"]:hover:not(.is-active) {
    background: var(--dominio-bg, var(--color-surface));
    color: var(--dominio-fg, var(--color-text));
}

/* -----------------------------------------------------------------------------
   O mesmo vocabulario na tela de leitura: o bloco de custo do detalhe.html usa
   o dominio correspondente ao do formulario. "Despesas Aduaneiras" e roxo nos
   dois lugares -- e essa correspondencia que faz o cliente reconhecer o bloco
   sem ler o rotulo inteiro.
   -------------------------------------------------------------------------- */
.info-group[data-dominio="valores"]   { --dominio-fg: var(--badge-info-fg); }
.info-group[data-dominio="tributos"]  { --dominio-fg: var(--badge-ambar-fg); }
.info-group[data-dominio="aduaneiras"]{ --dominio-fg: var(--badge-roxo-fg); }
.info-group[data-dominio="logistica"] { --dominio-fg: var(--badge-ciano-fg); }
.info-group[data-dominio="honorarios"]{ --dominio-fg: var(--badge-teal-fg); }

.info-group[data-dominio] .micro-label {
    color: var(--dominio-fg, var(--color-text-label));
}

.info-group[data-dominio] {
    border-top-color: var(--dominio-fg, var(--color-border));
}

/* -----------------------------------------------------------------------------
   Resumo lateral (processos, solicitacoes, documentos)
   -----------------------------------------------------------------------------
   O "Resumo" da lateral era uma pilha de pares rotulo/valor no mesmo tamanho e
   quase no mesmo peso: nada dizia ao olho onde parar. Recebe aqui o mesmo
   micro-rotulo que o detalhe da simulacao ja usava -- o tratamento que o
   CONTEXT da fase 30 chama de estrutural e que nao tinha chegado nestas telas.
   -------------------------------------------------------------------------- */
.info-list-sm .info-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
}

.info-list-sm .info-label {
    font-size: 0.625rem;          /* 10px, igual ao .micro-label */
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    line-height: 1.4;
}

/* Numero alinha por coluna: com tabular-nums os valores da pilha ficam com os
   digitos um sobre o outro, e a comparacao vertical passa a ser possivel. */
.info-list-sm .info-value {
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   STEPPER DAS 10 ETAPAS  (B-18)
   -----------------------------------------------------------------------------
   Ate a fase 30 este CSS vivia num <style> inline dentro do proprio componente,
   com o comentario "fallback para evitar cache" -- gambiarra da fase 12 que
   duplicava cada regra tambem como atributo style= no elemento. Sai daqui em
   diante do arquivo normal, versionado pelo WhiteNoise como todo o resto.

   O stepper deixou de ser decorativo (D-066): cada etapa alcancavel e um <a>.
   Isso muda o que o CSS precisa cobrir -- passa a existir hover, foco visivel e
   area de clique, que markup decorativo nao tinha.
   ========================================================================== */
.stepper-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.stepper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-width: 800px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.step {
    display: flex;
    position: relative;
    z-index: 2;
    flex: 1;
}

/* O alvo clicavel envolve circulo + rotulo: mirar num circulo de 36px e
   trabalho, e o rotulo abaixo dele descreve o destino melhor que o numero. */
.step-alvo {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: inherit;
}

a.step-alvo:hover .step-circle {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

a.step-alvo:hover .step-label {
    color: var(--color-primary);
}

a.step-alvo:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Etapa futura nao e link: o cursor diz isso antes do clique. */
.step-sem-destino {
    cursor: not-allowed;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    /* --color-text-label (7.58:1), nao --color-text-muted (2.56:1, B-17): o
       numero da etapa e texto e precisa ser legivel, nao sugerido. */
    color: var(--color-text-label);
    font-size: 0.875rem;
    transition: var(--transition-fast);
    margin-bottom: 0.5rem;
}

.step-circle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-label);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    transition: var(--transition-fast);
}

.step-line {
    flex: 1;
    height: 3px;
    background: var(--color-border);
    margin: 0 -5%;
    transform: translateY(-12px);
    z-index: 1;
    position: relative;
    list-style: none;
}

.step-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width 300ms ease;
}

.step-line.filled::after {
    width: 100%;
}

.step-atual .step-circle {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 117, 0.15);
}

.step-atual .step-label {
    color: var(--color-primary);
    font-weight: 700;
}

.step-completa .step-circle {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-color: transparent;
    color: #fff;
}

.step-completa .step-label {
    color: var(--color-text);
}

/* Ancora das etapas 4-9: elemento de altura zero cujo unico papel e dar ao
   scroll um ponto de parada que respeite o cabecalho grudado. */
.ancora-etapa {
    display: block;
    height: 0;
    scroll-margin-top: 7rem;
}

.checklist-section-collapsible[id^="checklist-etapa-"] {
    scroll-margin-top: 7rem;
}

/* A acao que avanca o processo, dentro do card da etapa. Separada do resto do
   cabecalho por uma borda: e a saida do card, nao mais um dado dele. */
.checklist-header-acao {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
}
