/* ==========================================================================
   QualiHUB — Design System Corporativo QMS
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-dark: #1e3a8a;

    --success: #10b981;
    --success-light: #ecfdf5;
    --success-dark: #065f46;

    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-dark: #92400e;

    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-dark: #991b1b;

    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --info-dark: #0369a1;

    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;

    --header-bg: #ffffff;
    --header-border: #e2e8f0;

    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --transition-speed: 0.2s;
}

/* Reset Básico */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* Estrutura do Shell Principal */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 40;
    transition: width var(--transition-speed);
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--ink-5);
    padding: 12px 12px 6px;
    letter-spacing: 0.5px;
}

/* Menus (grupos recolhíveis) e submenus */
.nav-group { margin-bottom: 4px; }

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--ink-6);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 10px 12px;
    text-align: left;
    text-transform: uppercase;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-group-toggle:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.nav-group-toggle:focus-visible { outline: 2px solid #60a5fa; outline-offset: -2px; }
.nav-group.has-active > .nav-group-toggle { color: #ffffff; }

.nav-group-label { flex: 1; min-width: 0; }

.nav-group-count {
    background: rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    color: var(--ink-7);
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 7px;
}

.nav-group-chevron { flex-shrink: 0; transition: transform var(--transition-speed); }
.nav-group-toggle[aria-expanded="true"] .nav-group-chevron { transform: rotate(180deg); }

/* Submenu animado: a altura anima via grid (0fr -> 1fr), sem medir pixels em JS */
.nav-submenu {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    transition: grid-template-rows 0.28s ease, opacity 0.2s ease, visibility 0s linear 0.28s;
}

.nav-submenu.open {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows 0.28s ease, opacity 0.24s ease 0.04s, visibility 0s;
}

.nav-submenu-inner {
    border-left: 1px solid rgba(148, 163, 184, 0.25);
    margin-left: 18px;
    min-height: 0;
    overflow: hidden;
    padding-left: 6px;
}

.nav-submenu.open .nav-submenu-inner { margin-bottom: 6px; margin-top: 2px; }

/* Sem animação na carga da página (estado inicial) e para quem prefere menos movimento */
.app-sidebar.no-anim .nav-submenu,
.app-sidebar.no-anim .nav-group-chevron { transition: none; }

@media (prefers-reduced-motion: reduce) {
    .nav-submenu, .nav-submenu.open, .nav-group-chevron { transition: none; }
}

.nav-subitem { font-size: 13px; padding: 8px 10px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
}

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

/* Área Central */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Header */
.app-header {
    height: 64px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 30;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Seletor de Empresa / Filial (Estilo ERP Senior: codemp / codfil) */
.company-selector-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    padding: 4px 10px;
    gap: 8px;
}

.company-selector-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ink-4);
    display: flex;
    align-items: center;
    gap: 4px;
}

.company-select {
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-1);
    outline: none;
    cursor: pointer;
}

/* Quality Score Badge no Header */
.quality-score-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ok-soft);
    border: 1px solid #bbf7d0;
    padding: 5px 12px;
    border-radius: var(--radius-full);
}

.quality-score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ok-ink);
    text-transform: uppercase;
}

.quality-score-value {
    font-size: 14px;
    font-weight: 800;
    color: var(--ok-ink);
}

/* Container de Conteúdo */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink-1);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Grids */
.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1280px) {
    .grid-cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .app-sidebar { display: none; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-cols-6 { grid-template-columns: 1fr; }
}

/* KPI Card */
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--ink-1);
    line-height: 1;
}

.kpi-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

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

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled, .btn.loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

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

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

.btn-secondary {
    background-color: var(--surface-2);
    color: var(--ink-3);
    border-color: var(--line-strong);
}

.btn-secondary:hover {
    background-color: var(--surface-3);
}

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

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-info { background: var(--info-light); color: var(--info-dark); }
.badge-neutral { background: var(--surface-2); color: var(--ink-4); }

/* Tabelas */
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
}

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

.table th {
    background: var(--surface-1);
    color: var(--ink-4);
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text-main);
}

.table tr:hover td {
    background: var(--surface-1);
}

/* Global Loader Overlay */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#global-loader.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: var(--surface);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    margin-top: 14px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

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

/* Modais */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 16px;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    width: 100%;
    max-width: 580px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease, max-width 0.2s ease, width 0.2s ease;
}

/* Modificadores Padronizados de Tamanho de Modal */
.modal-dialog.modal-sm { max-width: 440px !important; }
.modal-dialog.modal-md { max-width: 620px !important; }
.modal-dialog.modal-lg { max-width: 920px !important; width: 92vw !important; }
.modal-dialog.modal-xl {
    max-width: 1400px !important;
    width: 95vw !important;
    max-height: 94vh !important;
}
.modal-dialog.modal-2xl, .modal-dialog.modal-fullscreen {
    max-width: 1560px !important;
    width: 96vw !important;
    max-height: 96vh !important;
}

.modal-backdrop.active .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(94vh - 120px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface-1);
}

/* Toast Container */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--surface);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    min-width: 300px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastIn 0.25s ease forwards;
}

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

.toast-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink-1);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12.5px;
    color: var(--text-muted);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Skeletons */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

/* ==========================================================================
   Módulo GED & Motor de Workflows BPM
   ========================================================================== */

/* Abas de Navegação Interna */
.nav-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 24px;
}

.nav-tab-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-5);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.nav-tab-btn:hover {
    color: var(--primary);
}

.nav-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

/* Pílulas de Filtro de Documentos */
.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-pill {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--ink-4);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.filter-pill:hover {
    background: var(--surface-3);
}

.filter-pill.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Pipeline BPM (Representação Gráfica do Fluxo) */
.bpm-workflow-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.bpm-workflow-card:hover {
    box-shadow: var(--shadow-md);
}

.bpm-pipeline {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 16px 4px;
}

.bpm-step-card {
    background: var(--surface-1);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 170px;
    max-width: 220px;
    position: relative;
    flex-shrink: 0;
}

.bpm-step-card.active-step {
    background: var(--info-soft);
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.bpm-step-order {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 4px;
}

.bpm-step-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-1);
    margin-bottom: 6px;
}

.bpm-step-meta {
    font-size: 11px;
    color: var(--ink-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bpm-connector {
    color: var(--ink-6);
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Stepper Visual no Modal do Documento */
.workflow-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    padding: 20px 10px;
    margin-bottom: 24px;
}

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

.stepper-node {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--ink-5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 2px #cbd5e1;
    transition: all 0.2s;
}

.stepper-step.completed .stepper-node {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 0 0 2px #10b981;
}

.stepper-step.skipped { opacity: 0.55; }
.stepper-step.skipped .stepper-node { background: var(--surface-3); border-style: dashed; color: var(--ink-5); }

.stepper-step.active .stepper-node {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
    animation: pulse 1.8s infinite;
}

.stepper-step.rejected .stepper-node {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 0 2px #ef4444;
}

.stepper-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-3);
    max-width: 130px;
}

.stepper-subtext {
    font-size: 10.5px;
    color: var(--ink-6);
    margin-top: 2px;
}

.stepper-line {
    position: absolute;
    top: 36px;
    left: 8%;
    right: 8%;
    height: 3px;
    background: var(--surface-3);
    z-index: 0;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Painel de Parecer e Ações */
.workflow-action-box {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px;
}

/* Formulários Globais */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-3);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--ink-1);
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 75px;
    line-height: 1.45;
}

.modal-dialog.modal-lg {
    max-width: 900px;
}

.modal-dialog.modal-xl {
    max-width: 1260px;
    width: 95vw;
}

.modal-dialog.modal-2xl {
    max-width: 1440px;
    width: 98vw;
}

.modal-body {
    max-height: calc(88vh - 120px);
    overflow-y: auto;
    padding: 24px;
}

/* ==========================================================================
   Barra de Ferramentas e Seletor Segmentado de Visualização (Processos)
   ========================================================================== */

.processes-view-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 10px 18px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    flex-wrap: wrap;
    gap: 14px;
}

.view-segmented-group {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--line);
    gap: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.view-segment-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-5);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    user-select: none;
    line-height: 1.4;
    text-decoration: none;
}

.view-segment-btn:hover {
    color: var(--ink-2);
    background: rgba(255, 255, 255, 0.7);
}

.view-segment-btn.active {
    background: var(--surface);
    color: #2563eb;
    font-weight: 700;
    border-color: rgba(37, 99, 235, 0.15);
    box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.08), 0 1px 3px -1px rgba(0, 0, 0, 0.06);
}

.segment-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.segment-text {
    font-size: 13px;
    letter-spacing: -0.2px;
}

.segment-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--ink-5);
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.view-segment-btn.active .segment-badge {
    background: var(--info-soft);
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Compatibilidade para classes .nav-tab e .process-nav-tab */
.nav-tab.process-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-5);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    line-height: 1.4;
}

.nav-tab.process-nav-tab:hover {
    color: var(--ink-2);
    background: rgba(255, 255, 255, 0.7);
}

.nav-tab.process-nav-tab.active {
    background: var(--surface);
    color: #2563eb;
    font-weight: 700;
    border-color: rgba(37, 99, 235, 0.15);
    box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.08);
}

.filter-pills-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Arquitetura da Cadeia de Valor de Processos (ISO 9001 / Value Chain Board)
   ========================================================================== */

.value-chain-board {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 8px;
}

/* Raias da Cadeia de Valor */
.vc-tier {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
}

.vc-tier:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

.vc-tier-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

/* Tier 1: Estratégicos (Direcionamento & Governança) */
.vc-tier.strategic {
    border-top: 4px solid #8b5cf6;
}
.vc-tier.strategic .vc-tier-header {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.08) 0%, var(--surface) 100%);
    border-bottom-color: rgba(139, 92, 246, 0.15);
}

/* Tier 2: Operacionais (Cadeia de Valor Core / A Grande Esteira de Valor) */
.vc-tier.operational {
    border: 2px solid #3b82f6;
    border-top: 6px solid #1d4ed8;
    background: var(--surface-1);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}
.vc-tier.operational .vc-tier-header {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, rgba(6, 182, 212, 0.05) 60%, var(--surface) 100%);
    border-bottom-color: #bfdbfe;
}

/* Tier 3: Apoio & Suporte (Sustentação Operacional) */
.vc-tier.support {
    border-top: 4px solid #10b981;
}
.vc-tier.support .vc-tier-header {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, var(--surface) 100%);
    border-bottom-color: rgba(16, 185, 129, 0.15);
}

.vc-tier-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink-1);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.vc-tier-subtitle {
    font-size: 12px;
    color: var(--ink-5);
    margin-top: 2px;
}

.vc-tier-badge {
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border-color);
}

.vc-tier-body {
    padding: 20px 24px;
}

/* Grid Fluido para Estratégicos e Apoio */
.vc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

/* ESTEIRA DE VALOR HORIZONTAL CONECTADA (Processos Core) */
.vc-stream-pipeline {
    display: flex;
    align-items: stretch;
    gap: 16px;
    overflow-x: auto;
    padding: 10px 4px 16px 4px;
    scroll-behavior: smooth;
}

.vc-portal-card {
    min-width: 190px;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.vc-portal-card.input {
    background: linear-gradient(135deg, var(--info-soft) 0%, var(--info-soft-2) 100%);
    border: 2px dashed #3b82f6;
    color: #1e40af;
}

.vc-portal-card.output {
    background: linear-gradient(135deg, var(--ok-soft) 0%, var(--ok-soft-2) 100%);
    border: 2px dashed #10b981;
    color: var(--ok-ink);
}

.vc-portal-icon {
    font-size: 32px;
    margin-bottom: 8px;
    line-height: 1;
}

.vc-portal-label {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vc-portal-sub {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.85;
    margin-top: 4px;
    line-height: 1.3;
}

.vc-stream-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-6);
    font-size: 24px;
    font-weight: 900;
    flex-shrink: 0;
    padding: 0 4px;
}

/* Card Moderno de Processo */
.vc-process-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all var(--transition-normal);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 320px;
}

.vc-process-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.09);
    border-color: #3b82f6;
}

.vc-process-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.vc-process-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-1);
    line-height: 1.35;
    margin-bottom: 6px;
}

.vc-process-desc {
    font-size: 12.5px;
    color: var(--ink-5);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 14px;
    flex: 1;
}

.vc-turtle-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ok-ink);
    background: var(--ok-soft);
    border: 1px solid #a7f3d0;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.vc-process-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 11.5px;
    color: var(--ink-5);
}

/* Pills de Vínculos QMS */
.process-qms-pills {
    display: flex;
    gap: 6px;
}

.qms-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    background: var(--surface-1);
    border: 1px solid var(--line);
    color: var(--ink-4);
}

.qms-pill.docs { background: var(--info-soft); border-color: #bfdbfe; color: var(--info-ink); }
.qms-pill.risks { background: var(--bad-soft); border-color: #fecaca; color: var(--bad-ink); }
.qms-pill.indicators { background: var(--ok-soft); border-color: #bbf7d0; color: var(--ok-ink); }


/* ==========================================================================
   DIAGRAMA DE TARTARUGA ISO 9001 HORIZONTAL (Idêntico à Imagem de Referência)
   ========================================================================== */

.turtle-view-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.turtle-view-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.turtle-ref-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.turtle-ref-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 16px 22px;
    align-items: center;
    max-width: 1260px;
    margin: 0 auto;
}

/* Blocos Verde-Petróleo / Teal */
.turtle-ref-box {
    background: var(--surface);
    border: 2px solid #4d8e85;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(77, 142, 133, 0.08);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.turtle-ref-box:hover, .turtle-ref-box.active {
    box-shadow: 0 8px 24px rgba(77, 142, 133, 0.22);
    border-color: #397169;
    transform: translateY(-2px);
}

.turtle-ref-box.active {
    border-color: #06b6d4 !important;
    outline: 2px solid #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.45), 0 10px 25px -3px rgba(6, 182, 212, 0.35) !important;
    transform: translateY(-3px) scale(1.015);
    z-index: 2;
}

.turtle-ref-box.active .turtle-ref-header {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.4);
}

.turtle-ref-header {
    background: #4d8e85;
    color: #ffffff;
    font-weight: 800;
    font-size: 14.5px;
    letter-spacing: 0.8px;
    padding: 10px 16px;
    text-align: center;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Seta de Entrada (Formato Chevron apontando para a Direita) */
.turtle-ref-box.arrow-entry .turtle-ref-header {
    background: linear-gradient(90deg, #4d8e85 0%, #437d74 88%, #36675f 100%);
    position: relative;
}

.turtle-ref-box.arrow-exit .turtle-ref-header {
    background: linear-gradient(90deg, #4d8e85 0%, #437d74 88%, #36675f 100%);
    position: relative;
}

/* Indicadores de Chevrons Verticais (Entre Quem/Recursos e Tartaruga / Entre Como/Indicadores e Tartaruga) */
.turtle-chevrons-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 6px auto;
}

.turtle-chevrons-vertical svg {
    width: 26px;
    height: 14px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
    transition: all 0.2s ease;
}

.turtle-ref-box:hover + .turtle-chevrons-vertical svg,
.turtle-ref-box.active + .turtle-chevrons-vertical svg {
    transform: scale(1.15);
}

/* Centro: Tartaruga Horizontal SVG */
.turtle-center-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.turtle-horizontal-svg {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.14));
    transition: transform 0.25s ease;
}

.turtle-horizontal-svg:hover {
    transform: scale(1.02);
}

.turtle-svg-node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.turtle-svg-node:hover path,
.turtle-svg-node:hover ellipse,
.turtle-svg-node.active path,
.turtle-svg-node.active ellipse {
    fill: #22d3ee !important;
    filter: drop-shadow(0 0 8px #06b6d4);
}

/* Conteúdo de Texto ou Edição nos Blocos */
.turtle-ref-body {
    padding: 12px 14px;
    background: var(--surface);
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.55;
    min-height: 90px;
    max-height: 175px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.turtle-ref-body textarea.form-control {
    min-height: 90px;
    border: 1px solid var(--line-strong);
    font-size: 12.5px;
    line-height: 1.45;
}

.turtle-ref-body textarea.form-control:focus {
    border-color: #4d8e85;
    box-shadow: 0 0 0 3px rgba(77, 142, 133, 0.2);
}

.turtle-empty-text {
    color: var(--ink-6);
    font-style: italic;
    font-size: 12.5px;
}

/* Seta Chevron Indicativa Lateral */
.turtle-chevron-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6faaa1;
    font-size: 26px;
    font-weight: bold;
}

/* ==========================================================================
   MÓDULO DE RISCOS & OPORTUNIDADES (ISO 31000 / ISO 9001 CL. 6.1)
   ========================================================================== */

/* Matriz 5x5 Heatmap Container */
.risk-matrix-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

.matrix-perspective-selector {
    display: inline-flex;
    background: var(--surface-2);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    gap: 4px;
}

.matrix-perspective-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-5);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.matrix-perspective-btn.active {
    background: var(--surface);
    color: var(--ink-1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Tabela da Matriz 5x5 */
.risk-matrix-table-wrap {
    display: flex;
    align-items: stretch;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.matrix-y-axis-label {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-4);
    padding: 10px 4px;
    background: var(--surface-1);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
}

.risk-matrix-table {
    width: 100%;
    min-width: 780px;
    border-collapse: separate;
    border-spacing: 8px;
}

.risk-matrix-table th.matrix-impact-header {
    background: var(--surface-1);
    color: var(--ink-4);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.risk-matrix-table td.matrix-prob-header {
    background: var(--surface-1);
    color: var(--ink-4);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    padding: 10px 12px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    vertical-align: middle;
}

.matrix-cell {
    width: 18%;
    height: 110px;
    vertical-align: top;
    padding: 8px;
    border-radius: var(--radius-md);
    position: relative;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    cursor: default;
}

.matrix-cell:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    z-index: 10;
}

/* Zonas de Calor (ISO 31000) */
.matrix-cell.zone-low {
    background: linear-gradient(135deg, var(--ok-soft) 0%, var(--ok-soft-2) 100%);
    border-color: #a7f3d0;
}

.matrix-cell.zone-medium {
    background: linear-gradient(135deg, var(--warn-soft) 0%, var(--warn-soft-2) 100%);
    border-color: #fde68a;
}

.matrix-cell.zone-high {
    background: linear-gradient(135deg, var(--warn-soft) 0%, #ffedd5 100%);
    border-color: #fed7aa;
}

.matrix-cell.zone-critical {
    background: linear-gradient(135deg, var(--bad-soft) 0%, var(--bad-soft-2) 100%);
    border-color: #fca5a5;
}

/* Marca d'água com o Score numérico P x I */
.matrix-score-watermark {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 15px;
    font-weight: 900;
    opacity: 0.35;
    pointer-events: none;
}

.zone-low .matrix-score-watermark { color: var(--ok-ink); }
.zone-medium .matrix-score-watermark { color: var(--warn-ink); }
.zone-high .matrix-score-watermark { color: #c2410c; }
.zone-critical .matrix-score-watermark { color: var(--bad-ink); }

.matrix-items-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 94px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Chips / Pílulas de Risco na Matriz */
.matrix-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.matrix-chip:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.matrix-chip.type-risk {
    border-left: 3px solid #ef4444;
    color: var(--ink-2);
}

.matrix-chip.type-opportunity {
    border-left: 3px solid #10b981;
    color: var(--ok-ink);
    background: var(--ok-soft);
}

.matrix-chip-code {
    font-weight: 700;
    font-size: 10.5px;
}

.matrix-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 85px;
}

/* Botão adicionar inline na célula */
.matrix-cell-add-btn {
    opacity: 0;
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-4);
    transition: all 0.2s ease;
}

.matrix-cell:hover .matrix-cell-add-btn {
    opacity: 1;
}

.matrix-cell-add-btn:hover {
    background: #2563eb;
    color: #ffffff;
    transform: scale(1.1);
}

/* Legenda da Matriz */
.matrix-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    flex-wrap: wrap;
    gap: 12px;
}

.matrix-legend-items {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.matrix-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-4);
}

.matrix-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Radar de Oportunidades */
.opportunities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.opportunity-card {
    background: var(--surface);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.06);
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.opportunity-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.12);
    border-color: #86efac;
}

.opp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.opp-card-badge {
    background: var(--ok-soft);
    color: var(--ok-ink);
    border: 1px solid #a7f3d0;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.opp-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-1);
    line-height: 1.4;
    margin-bottom: 8px;
}

.opp-card-desc {
    font-size: 13px;
    color: var(--ink-4);
    line-height: 1.5;
    margin-bottom: 14px;
    flex: 1;
}

.opp-card-metrics {
    display: flex;
    justify-content: space-between;
    background: var(--surface-1);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
}

.opp-metric-item {
    display: flex;
    flex-direction: column;
}

.opp-metric-label {
    font-size: 11px;
    color: var(--ink-5);
    font-weight: 600;
    text-transform: uppercase;
}

.opp-metric-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink-1);
}

/* Ficha 360 do Risco (Comparativo Inerente x Residual) */
.risk-360-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.risk-level-box {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.risk-level-box.inherent {
    border-top: 4px solid #ef4444;
}

.risk-level-box.residual {
    border-top: 4px solid #10b981;
}

.risk-level-box .score-display {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    margin: 8px 0;
}

.risk-reduction-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ok-soft);
    border: 1px solid #bbf7d0;
    color: var(--ok-ink);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    margin-bottom: 20px;
}

/* Calculadora Interativa P x I em Modal */
.risk-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 140px;
    gap: 16px;
    align-items: center;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.risk-calc-result {
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    border: 2px solid var(--line);
}

.risk-calc-score {
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}

.risk-calc-crit {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Harmonização dos Cards de Indicadores de Riscos & Oportunidades */
.risk-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .risk-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .risk-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card.risk-kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    min-height: 104px;
}

.kpi-card.risk-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.risk-kpi-card.card-total {
    border-left: 4px solid #2563eb;
}

.risk-kpi-card.card-critical {
    border-left: 4px solid #ef4444;
}

.risk-kpi-card.card-high {
    border-left: 4px solid #f59e0b;
}

.risk-kpi-card.card-mitigated {
    border-left: 4px solid #10b981;
}

.risk-kpi-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.risk-kpi-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-5);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.risk-kpi-value {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.risk-kpi-meta {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-5);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.risk-kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 12px;
    transition: transform 0.2s ease;
}

.risk-kpi-card:hover .risk-kpi-icon {
    transform: scale(1.08);
}

/* ==========================================================================
   MÓDULO DE INDICADORES & METAS (KPIs) — QUALIHUB QMS
   ========================================================================== */

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .indicators-grid {
        grid-template-columns: 1fr;
    }
}

.indicator-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.indicator-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.indicator-card.status-on_target {
    border-top: 4px solid var(--success);
}

.indicator-card.status-warning {
    border-top: 4px solid var(--warning);
}

.indicator-card.status-critical {
    border-top: 4px solid var(--danger);
}

.indicator-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.indicator-code-badge {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.indicator-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-1);
    line-height: 1.35;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.indicator-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}

.indicator-val-box {
    display: flex;
    flex-direction: column;
}

.indicator-val-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ink-5);
    margin-bottom: 2px;
}

.indicator-val-number {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.indicator-gauge-wrap {
    margin-bottom: 14px;
}

.indicator-gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    margin-bottom: 6px;
}

.indicator-progress-track {
    height: 8px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.indicator-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.indicator-progress-fill.on_target {
    background: linear-gradient(90deg, #10b981, #059669);
}

.indicator-progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.indicator-progress-fill.critical {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.indicator-meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11.5px;
    color: var(--ink-5);
    margin-top: auto;
    padding-top: 10px;
}

.indicator-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-1);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.indicator-trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.indicator-trend-pill.up { background: var(--ok-soft); color: #059669; }
.indicator-trend-pill.down { background: var(--bad-soft); color: #dc2626; }
.indicator-trend-pill.stable { background: var(--surface-2); color: var(--ink-4); }

/* Gráfico de Evolução Histórica SVG */
.indicator-chart-box {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}


/* ==========================================================================
   MÓDULO DE NÃO CONFORMIDADES (RNC / CAPA) — QUALIHUB QMS
   ========================================================================== */

/* Stepper do Ciclo de Vida QMS */
.qms-lifecycle-stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    margin-bottom: 20px;
    overflow-x: auto;
    gap: 8px;
}

.qms-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    flex: 1;
    min-width: 90px;
}

.qms-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    color: var(--ink-5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 6px;
    transition: all 0.2s ease;
    z-index: 2;
}

.qms-step-item.active .qms-step-circle {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.qms-step-item.completed .qms-step-circle {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.qms-step-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.qms-step-item.active .qms-step-label {
    color: #2563eb;
}

.qms-step-item.completed .qms-step-label {
    color: #059669;
}

/* Kanban Board de Não Conformidades */
.nc-kanban-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(240px, 1fr));
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.nc-kanban-col {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 480px;
    max-height: calc(100vh - 280px);
}

.nc-kanban-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.nc-kanban-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--ink-1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nc-kanban-count {
    font-size: 11px;
    font-weight: 800;
    background: var(--surface-2);
    color: var(--ink-4);
    padding: 2px 7px;
    border-radius: 999px;
}

.nc-kanban-cards {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.nc-kanban-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid var(--line-strong);
}

.nc-kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #94a3b8;
}

.nc-kanban-card.sev-critical { border-left-color: var(--danger); }
.nc-kanban-card.sev-major { border-left-color: var(--warning); }
.nc-kanban-card.sev-minor { border-left-color: #3b82f6; }

.nc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.nc-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-1);
    line-height: 1.3;
    margin-bottom: 8px;
}

.nc-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--ink-5);
    padding-top: 8px;
    border-top: 1px solid #f8fafc;
}

/* Diagrama de Ishikawa (Espinha de Peixe 6M) */
.ishikawa-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
}

.ishikawa-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

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

.ishikawa-bone {
    background: var(--surface-1);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 14px;
    transition: border-color 0.2s ease;
}

.ishikawa-bone:hover, .ishikawa-bone:focus-within {
    border-color: #3b82f6;
    background: var(--surface);
}

.ishikawa-bone-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--ink-2);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--line);
}

.ishikawa-bone-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--info-soft);
    color: #2563eb;
    font-size: 13px;
}

.ishikawa-tags {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.ishikawa-tag-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--ink-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ishikawa-head-box {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* 5 Porquês (5 Whys Timeline) */
.five-whys-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.why-step-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.2s ease;
}

.why-step-card:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.why-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--info-soft);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.why-badge.root {
    background: var(--bad-soft);
    color: #ef4444;
}

.why-content {
    flex: 1;
}

.why-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink-5);
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* ==========================================================================
   GED & GESTÃO ELETRÔNICA DE DOCUMENTOS (ISO 9001:2015 Cláusula 7.5)
   ========================================================================== */

/* Seletor de Sub-Visão do GED */
.active-subview-btn {
    background: #0f172a !important;
    color: #ffffff !important;
    border-color: #0f172a !important;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}

/* Árvore Hierárquica de Pastas Físicas */
.ged-folder-tree {
    user-select: none;
    font-size: 13px;
}

.folder-node {
    margin: 2px 0;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--ink-3);
}

.folder-header:hover {
    background: var(--surface-2);
    color: var(--ink-1);
}

.folder-header.active {
    background: var(--info-soft);
    color: #2563eb;
    font-weight: 700;
    box-shadow: inset 2px 0 0 #2563eb;
}

.folder-toggle-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-6);
    transition: transform 0.2s ease;
}

.folder-toggle-icon.expanded {
    transform: rotate(90deg);
}

.folder-icon {
    display: flex;
    align-items: center;
    color: #f59e0b;
}

.folder-icon.category-icon {
    color: #3b82f6;
}

.folder-icon.type-icon {
    color: #10b981;
}

.folder-icon.process-icon {
    color: #8b5cf6;
}

.folder-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-5);
}

.folder-header.active .folder-badge {
    background: var(--info-soft-2);
    color: #2563eb;
}

.folder-children {
    padding-left: 18px;
    border-left: 1px dashed var(--line);
    margin-left: 10px;
    display: block;
}

.folder-children.collapsed {
    display: none;
}

/* Cards de Arquivos do Explorador */
.ged-file-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ged-file-card:hover {
    border-color: var(--line-strong);
    box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.ged-file-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.ged-file-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface-1);
}

.ged-file-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-1);
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ged-file-card-meta {
    font-size: 11px;
    color: var(--ink-5);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ged-file-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--line-soft);
    padding-top: 10px;
    margin-top: auto;
}

/* Modal do Visualizador In-App Integrado */
.ged-viewer-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ged-viewer-dialog {
    background: var(--surface);
    width: 100%;
    max-width: 1380px;
    height: 90vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.25s ease;
}

.ged-viewer-dialog.is-fullscreen {
    max-width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.ged-viewer-header {
    background: var(--surface);
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.ged-viewer-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    flex: 1;
    overflow: hidden;
    background: #334155;
}

.ged-viewer-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #475569;
}

.ged-viewer-sidebar {
    background: var(--surface);
    border-left: 1px solid var(--line);
    padding: 20px;
    overflow-y: auto;
}

.ged-sidebar-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12px;
}

.ged-sidebar-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-5);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ged-sidebar-val {
    font-weight: 600;
    color: var(--ink-1);
}

/* ==========================================================================
   Central de Ajuda & Guia Operacional dos Processos QMS (ISO 9001:2015)
   ========================================================================== */

.help-portal-container {
    padding-bottom: 50px;
}

.help-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.help-nav-btn:hover {
    background: var(--surface-2);
    color: var(--ink-1);
    transform: translateX(3px);
}

.help-nav-btn.active {
    background: var(--info-soft);
    color: #2563eb;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #2563eb;
}

.help-nav-icon {
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

/* Cartões de Ciclo PDCA */
.pdca-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.pdca-title {
    font-size: 13.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.pdca-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--ink-4);
    line-height: 1.6;
}

/* Stepper Visual de Processos */
.workflow-stepper-box {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 20px 16px;
    overflow-x: auto;
}

.help-stepper {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    min-width: 680px;
}

.help-step {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
    display: flex;
    flex-direction: column;
}

.help-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.help-step-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-1);
    margin-bottom: 6px;
}

.help-step-desc {
    font-size: 11.5px;
    color: var(--ink-5);
    line-height: 1.5;
    flex-grow: 1;
}

.help-step-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-6);
    font-size: 16px;
    font-weight: 800;
    padding: 0 4px;
}

/* Guia Operacional Passo a Passo */
.help-guide-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 14px;
}

.help-guide-title {
    font-size: 14px;
    color: var(--ink-1);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 6px;
}

.help-guide-body {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.7;
}

.help-guide-body ol, .help-guide-body ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.help-guide-body li {
    margin-bottom: 6px;
}

/* FAQ Acordeão */
.help-faq-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all 0.2s;
}

.help-faq-q {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface-1);
    border: none;
    text-align: left;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink-1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.help-faq-q:hover {
    background: var(--surface-2);
}

.help-faq-icon {
    font-size: 16px;
    font-weight: 700;
    color: #2563eb;
}

.help-faq-a {
    display: none;
    padding: 16px 18px;
    font-size: 13px;
    color: var(--ink-4);
    line-height: 1.7;
    background: var(--surface);
    border-top: 1px solid var(--line-soft);
}

.help-faq-item.open .help-faq-a {
    display: block;
}

.help-faq-item.open {
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

@media print {
    .app-sidebar, .app-header, #help-search-input, .help-nav-list, .help-layout > div:first-child {
        display: none !important;
    }
    .help-layout {
        display: block !important;
    }
    .help-topic-section {
        display: block !important;
        page-break-after: always;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* ==========================================================================
   CONTROLE DE VALIDADE & CICLO DE VIDA DOCUMENTAL (ISO 9001:2015 CL. 7.5.3)
   ========================================================================== */

/* Grid Específico de Validade (Garante 5 cards alinhados perfeitamente lado a lado) */
.validity-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

@media (max-width: 1100px) {
    .validity-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .validity-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .validity-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* KPIs Clicáveis e Interativos Harmonizados */
.kpi-card-clickable {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    min-height: 104px;
    box-sizing: border-box;
}

.kpi-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -4px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
}

.kpi-card-clickable.active-kpi-filter {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), 0 8px 16px -4px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-2px);
    border-color: #2563eb !important;
    background: var(--surface);
}

.kpi-card-clickable.active-kpi-filter::after {
    content: "FILTRANDO";
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: #0f172a;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Borda Esquerda de Destaque Harmonizada */
.kpi-validity-expired { border-left: 4px solid #ef4444 !important; }
.kpi-validity-30d { border-left: 4px solid #ea580c !important; }
.kpi-validity-90d { border-left: 4px solid #f59e0b !important; }
.kpi-validity-ok { border-left: 4px solid #10b981 !important; }
.kpi-validity-bpm { border-left: 4px solid #3b82f6 !important; }

/* Conteúdo Interno dos Cards de Validade */
.kpi-content-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.kpi-badge-indicator {
    display: inline-block;
    align-self: flex-start;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    line-height: 1.2;
}

.badge-expired { background: var(--bad-soft); color: #dc2626; border: 1px solid #fee2e2; }
.badge-30d { background: var(--warn-soft); color: #ea580c; border: 1px solid #ffedd5; }
.badge-90d { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid #fef3c7; }
.badge-ok { background: var(--ok-soft); color: #059669; border: 1px solid #d1fae5; }
.badge-bpm { background: var(--info-soft); color: #2563eb; border: 1px solid #dbeafe; }

.kpi-val-number {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.text-danger { color: #ef4444; }
.text-orange { color: #ea580c; }
.text-amber { color: #d97706; }
.text-success { color: #10b981; }
.text-primary { color: #2563eb; }

.kpi-title-label {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.kpi-sublabel {
    font-size: 11px;
    color: var(--ink-5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ícones dos Cards de Validade */
.kpi-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 10px;
}

.icon-danger { background: var(--bad-soft); color: #ef4444; }
.icon-orange { background: var(--warn-soft); color: #ea580c; }
.icon-amber { background: var(--warn-soft); color: #f59e0b; }
.icon-success { background: var(--ok-soft); color: #10b981; }
.icon-primary { background: var(--info-soft); color: #3b82f6; }

/* Banner Executivo de Saúde e Conformidade */
.validity-executive-banner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.compliance-meter {
    display: flex;
    align-items: center;
    gap: 16px;
}

.compliance-circle-container {
    width: 64px;
    height: 64px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compliance-circle-val {
    font-size: 15px;
    font-weight: 800;
    color: var(--ink-1);
}

.validity-dist-container {
    flex: 1;
    min-width: 280px;
    max-width: 620px;
}

.validity-dist-bar {
    height: 10px;
    border-radius: 9999px;
    background: var(--surface-3);
    display: flex;
    overflow: hidden;
    margin-top: 8px;
    margin-bottom: 8px;
}

.dist-seg {
    height: 100%;
    transition: width 0.4s ease;
}

.dist-seg-ok { background: #10b981; }
.dist-seg-90d { background: #f59e0b; }
.dist-seg-30d { background: #ea580c; }
.dist-seg-exp { background: #ef4444; }
.dist-seg-bpm { background: #3b82f6; }
.dist-seg-draft { background: #94a3b8; }

.validity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11.5px;
    color: var(--ink-5);
}

.validity-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.validity-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Barra de Ferramentas / Filtros Avançados */
.validity-toolbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.validity-search-group {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}

.validity-search-group svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-6);
}

.validity-search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: 13px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.validity-search-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Barra de Envelhecimento e Contagem Regressiva na Tabela */
.validity-aging-container {
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.validity-progress {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.validity-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Pipeline Kanban do Ciclo de Vida Documental */
.lifecycle-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(250px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 14px;
    margin-top: 6px;
}

.lifecycle-column {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 480px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.lifecycle-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-3);
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--line);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.lifecycle-col-header.col-draft { border-color: #94a3b8; }
.lifecycle-col-header.col-bpm { border-color: #3b82f6; }
.lifecycle-col-header.col-ok { border-color: #10b981; }
.lifecycle-col-header.col-review { border-color: #f59e0b; }
.lifecycle-col-header.col-obsolete { border-color: #ef4444; }

.lifecycle-col-count {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-4);
}

.lifecycle-col-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    max-height: 700px;
    padding-right: 2px;
}

.lifecycle-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lifecycle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(15, 23, 42, 0.08);
    border-color: var(--line-strong);
}

.lifecycle-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lifecycle-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-1);
    line-height: 1.35;
    margin: 0;
}

.lifecycle-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
    margin-top: 4px;
}

/* Stepper 360° do Ciclo de Vida */
.lifecycle-stepper-360 {
    display: flex;
    position: relative;
    margin: 20px 0 28px 0;
    padding: 0;
}

.stepper-step {
    flex: 1;
    position: relative;
    text-align: center;
    padding: 0 8px;
}

.stepper-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--surface-3);
    z-index: 1;
}

.stepper-step.step-completed:not(:last-child)::after {
    background: #10b981;
}

.stepper-step-node {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--line-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
    position: relative;
    z-index: 2;
    color: var(--ink-5);
    font-weight: 700;
    font-size: 12px;
    transition: all 0.2s ease;
}

.stepper-step.step-completed .stepper-step-node {
    background: var(--ok-soft);
    border-color: #10b981;
    color: #059669;
}

.stepper-step.step-active .stepper-step-node {
    background: var(--info-soft);
    border-color: #2563eb;
    color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.stepper-step-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-1);
}

.stepper-step-sub {
    font-size: 11px;
    color: var(--ink-5);
    margin-top: 2px;
}

/* ==========================================================================
   QualiHUB — Módulos Avançados de QMS (Fornecedores, Treinamentos e RAC)
   ========================================================================== */

/* Efeito Pulsante para Status em Tempo Real / Vigência */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Badges Complementares */
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-amber  { background: var(--warn-soft-2); color: var(--warn-ink); }

/* KPI Cards Refinados com Acentos Coloridos */
.kpi-card.accent-blue   { border-left: 4px solid #2563eb; }
.kpi-card.accent-orange { border-left: 4px solid #ea580c; }
.kpi-card.accent-green  { border-left: 4px solid #10b981; }
.kpi-card.accent-sky    { border-left: 4px solid #0284c7; }
.kpi-card.accent-purple { border-left: 4px solid #8b5cf6; }

/* Segmented Filter Pills */
.filter-pills-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 9999px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--ink-4);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.filter-pill:hover {
    background: var(--surface-3);
    color: var(--ink-1);
    transform: translateY(-1px);
}

.filter-pill.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.15);
}

.filter-pill .pill-counter {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.filter-pill.active .pill-counter {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Segmented Tab Control */
.segmented-tabs-wrapper {
    display: inline-flex;
    background: var(--surface-2);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    gap: 4px;
}

.segmented-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-5);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.18s ease;
}

.segmented-tab-btn:hover {
    color: var(--ink-1);
    background: rgba(255, 255, 255, 0.6);
}

.segmented-tab-btn.active {
    background: var(--surface);
    color: var(--ink-1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    font-weight: 700;
}

/* Avatar / Iniciais do Fornecedor */
.supplier-avatar {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    letter-spacing: -0.5px;
}

/* Barra de Progresso IQF Estilizada */
.iqf-progress-track {
    background: var(--surface-2);
    border: 1px solid var(--line);
    height: 9px;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.iqf-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.iqf-progress-fill.grade-a {
    background: linear-gradient(90deg, #10b981, #059669);
}

.iqf-progress-fill.grade-b {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.iqf-progress-fill.grade-c {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Cards das 8 Entradas da RAC */
.rac-input-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.rac-input-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.rac-card-icon-wrapper {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Impressão Executiva de Ata RAC */
@media print {
    .app-sidebar, .app-header, .btn, .filter-pills-bar, .segmented-tabs-wrapper {
        display: none !important;
    }
    .content-wrapper {
        padding: 0 !important;
        overflow: visible !important;
    }
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Shell v2 — Navegação responsiva, busca global, badges e acessibilidade
   ========================================================================== */
.sidebar-toggle { display: none; padding: 6px 9px; }
.sidebar-backdrop { display: none; }
.btn-icon-round { padding: 6px 10px; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink-4); }
.notif-badge { position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; }
.notif-badge[hidden], .nav-badge[hidden] { display: none; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; }
.header-user { display: flex; align-items: center; gap: 10px; margin-left: 8px; }
.header-user-info { text-align: right; text-decoration: none; border-radius: var(--radius-sm); padding: 2px 6px; }
.header-user-info:hover { background: var(--surface-2); }

.global-search { position: relative; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 6px 14px; color: var(--ink-5); min-width: 280px; }
.global-search:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.global-search input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; color: var(--text-main); font-family: inherit; }
.global-search-results { position: absolute; top: calc(100% + 6px); left: 0; width: min(520px, 92vw); max-height: 420px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xl); z-index: 60; padding: 6px; }
.global-search-results[hidden] { display: none; }
.search-group-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--ink-6); padding: 8px 10px 4px; letter-spacing: .4px; }
.search-result { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; color: inherit; }
.search-result:hover, .search-result.active { background: var(--primary-light); }
.search-result-code { font-size: 11px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.search-result-title { font-size: 13px; color: var(--ink-1); font-weight: 600; }
.search-result-meta { font-size: 11.5px; color: var(--ink-5); }
.search-empty { padding: 16px; text-align: center; color: var(--ink-6); font-size: 13px; }

/* Acessibilidade: foco visível para navegação por teclado */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1280px) {
    .global-search { min-width: 200px; }
}

@media (max-width: 1024px) {
    .sidebar-toggle { display: inline-flex; }
    .app-sidebar {
        display: flex !important;
        position: fixed; top: 0; bottom: 0; left: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-xl);
        z-index: 70;
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 65; }
    .app-header { padding: 0 12px; gap: 8px; }
    .header-left, .header-right { gap: 8px; }
    .content-wrapper { padding: 16px !important; }
    .modal-dialog { width: 96vw !important; max-width: 96vw !important; }
    .table-responsive, .card { overflow-x: auto; }
}

@media (max-width: 640px) {
    .hide-sm { display: none !important; }
    .global-search { min-width: 0; flex: 1; padding: 6px 10px; }
    .company-select { max-width: 130px; }
    .header-user-info { display: none; }
}

/* Comparação de versões de documento (redline) */
.rl-line{padding:3px 8px;font-size:13px;line-height:1.5;border-left:3px solid transparent}
.rl-add{background:#dcfce7;color:#166534;text-decoration:none}
.rl-del{background:var(--bad-soft-2);color:#991b1b;text-decoration:line-through}
div.rl-add{border-left-color:#16a34a}
div.rl-del{border-left-color:#dc2626}

/* ==========================================================================
   TARTARUGA ISO 9001 — quadro redesenhado (cartões por eixo + tartaruga ilustrada)
   ========================================================================== */
.turtle-board { padding: 18px; background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface) 60%); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.tb-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-4); margin-bottom: 14px; }
.tb-pills { display: inline-flex; gap: 6px; }
.tb-pill { width: 28px; height: 8px; border-radius: 4px; background: var(--surface-3); border: 0; padding: 0; cursor: pointer; transition: background .2s, transform .15s; }
.tb-pill.on { background: var(--ax); }
.tb-pill:hover { transform: scaleY(1.6); }
.tb-flow { margin-left: auto; font-size: 11.5px; color: var(--ink-5); }
.tb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr) minmax(0, 1fr); gap: 18px; align-items: stretch; max-width: 1320px; margin: 0 auto; }
.tb-col { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tb-center { display: flex; align-items: center; justify-content: center; padding: 0; }
.tb-svg { width: 100%; max-width: 400px; height: auto; filter: drop-shadow(0 10px 18px rgba(15, 23, 42, .18)); }
.tb-limb { cursor: pointer; transition: filter .2s; }
.tb-limb:hover, .tb-limb.active { filter: brightness(1.18) drop-shadow(0 0 7px currentColor); }
.tb-limb.active line, .tb-limb.active circle, .tb-limb.active polygon { filter: none; fill-opacity: 1; }

.turtle-board .turtle-ref-box.tb-card { --ax: #4d8e85; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--ax); border-radius: 12px; box-shadow: 0 2px 8px rgba(15, 23, 42, .05); overflow: hidden; min-width: 0; transition: box-shadow .2s, transform .2s, border-color .2s; }
.turtle-board .turtle-ref-box.tb-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .12); transform: translateY(-2px); border-color: var(--line); border-left-color: var(--ax); }
.turtle-board .turtle-ref-box.tb-card.active { border-color: var(--ax) !important; border-left-color: var(--ax) !important; outline: 2px solid var(--ax) !important; outline-offset: 1px; box-shadow: 0 10px 26px rgba(15, 23, 42, .16) !important; transform: translateY(-2px) !important; }
.turtle-board .tb-head.turtle-ref-header { background: none !important; color: var(--ax) !important; box-shadow: none !important; text-align: left; justify-content: flex-start; align-items: center; gap: 10px; padding: 10px 14px 4px; font-size: 13px; letter-spacing: .6px; }
.tb-icon { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; background: var(--surface-2); background: color-mix(in srgb, var(--ax) 12%, var(--surface)); }
.tb-title { display: flex; flex-direction: column; line-height: 1.15; font-weight: 800; }
.tb-title small { font-size: 11px; font-weight: 600; color: var(--ink-5); letter-spacing: 0; text-transform: none; }
.tb-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--ax); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.turtle-board .tb-body.turtle-ref-body { padding: 4px 14px 12px; min-height: 0; max-height: 170px; font-size: 13px; }
.tb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.tb-list li { position: relative; padding-left: 14px; color: var(--ink-3); line-height: 1.4; }
.tb-list li::before { content: ''; position: absolute; left: 0; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--ax); }
.turtle-board textarea.form-control { min-height: 96px; resize: vertical; border-color: var(--line-strong); }
.turtle-board textarea.form-control:focus { border-color: var(--ax); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ax) 22%, transparent); }
.tb-hint { color: var(--ink-6); font-size: 11px; margin-top: 3px; }
@media (max-width: 1000px) {
    .tb-grid { grid-template-columns: 1fr; }
    .tb-center { order: -1; }
    .tb-svg { max-width: 300px; }
    .tb-col { grid-template-rows: none; }
    .tb-flow { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .turtle-board * { transition: none !important; } }
.turtle-svg-node.tb-limb:hover path, .turtle-svg-node.tb-limb.active path { fill: none !important; filter: none !important; }
