/* ═══════════════════════════════════════════════════════════ */
/* DESIGN SYSTEM - Delta Condições Especiais                   */
/* ═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #FAFAFA; /* Offwhite */
    --bg-secondary: #EAF0F6; /* Azul Pérola */
    --bg-card: #FFFFFF;
    --bg-card-hover: #F8FAFC;
    --bg-input: #FFFFFF;
    --border: #D1D5DB;
    --border-focus: #F97316; /* Laranja Claro */
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --accent: #F97316; /* Laranja Claro */
    --accent-hover: #EA580C;
    --accent-glow: rgba(249, 115, 22, 0.15);
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.1);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --sidebar-w: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
}

/* ─── DARK THEME ─────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-primary: #0F1117;
    --bg-secondary: #161B27;
    --bg-card: #1C2033;
    --bg-card-hover: #232740;
    --bg-input: #161B27;
    --border: #2D3348;
    --border-focus: #F97316;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --accent: #F97316;
    --accent-hover: #EA580C;
    --accent-glow: rgba(249, 115, 22, 0.2);
    --green: #4ade80;
    --green-bg: rgba(74, 222, 128, 0.12);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.12);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --shadow: 0 4px 24px rgba(0,0,0,0.6);
}

/* Transição suave ao trocar tema */
html { transition: background-color 0.2s ease, color 0.2s ease; }
body, .sidebar, .main-content { transition: background-color 0.2s ease; }

/* Status badges — dark overrides */
[data-theme="dark"] .status-rascunho { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
[data-theme="dark"] .status-aguardando_analise { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
[data-theme="dark"] .status-arquivada { background: rgba(75, 85, 99, 0.2); color: #9ca3af; }

/* Toasts — dark overrides */
[data-theme="dark"] .toast-success { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .toast-error { background: #7f1d1d; color: #fecaca; }

/* Loading overlay — dark override */
[data-theme="dark"] .loading-overlay { background: rgba(15, 17, 23, 0.88); }

/* Notification cards — dark overrides */
[data-theme="dark"] .notif-card-assinatura { background: rgba(124, 58, 237, 0.1); border-color: rgba(124, 58, 237, 0.3); }
[data-theme="dark"] .notif-card-sucesso { background: rgba(5, 150, 105, 0.1); border-color: rgba(5, 150, 105, 0.3); }
[data-theme="dark"] .notif-card-erro { background: rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.3); }

/* Assinatura digital — dark overrides */
[data-theme="dark"] .assin-digital-col { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.2); }
[data-theme="dark"] .assin-pendente-col { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.2); }

/* Verificar assinatura — dark overrides */
[data-theme="dark"] .verificar-valido { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.3); }
[data-theme="dark"] .verificar-invalido { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }

/* Como Usar — role cards dark overrides */
[data-theme="dark"] .cu-role-card { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .cu-step-card { background: var(--bg-card); border-color: var(--border); }

/* PDF preview area — stays light for fidelidade ao documento impresso */
[data-theme="dark"] .pdf-dashboard-wrapper { background: #fff; color: #1a1a2e; }

/* ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), #FBD38D);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.logo-title { font-weight: 700; font-size: 1.15rem; display: block; }
.logo-subtitle { font-size: 0.75rem; color: var(--text-muted); display: block; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border: none; background: none;
    color: var(--text-secondary);
    font-size: 0.93rem; font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-version { font-size: 0.75rem; color: var(--text-muted); margin-top: 12px; }
.sidebar-version a { color: inherit; text-decoration: none; }
.sidebar-version a:hover { color: var(--accent); text-decoration: underline; }
.sidebar-credit {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    user-select: none;
}
.sidebar-credit b { color: var(--text-secondary); font-weight: 600; }

/* ─── PERMISSIONS GRID ──────────────────────────────── */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.permissions-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}
.permissions-grid label:hover { border-color: var(--accent); }
.permissions-grid input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ─── ADMIN TABS ────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.admin-tab {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ─── PAGINATION ────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.pag-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-right: 8px;
}
.pag-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    min-width: 36px;
    text-align: center;
}
.pag-btn:hover:not(:disabled):not(.pag-btn-active) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.pag-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.pag-btn-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
}
.pag-ellipsis {
    padding: 5px 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    user-select: none;
}

/* ─── CHART CARD HEADER (with export button) ───────── */
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.chart-card-header h3 { margin: 0; }
.chart-card-header .btn-icon {
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.chart-card-header .btn-icon:hover { background: var(--bg-primary); }

/* ─── CHANGELOG MODAL ──────────────────────────────── */
.changelog-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}
.changelog-content h1,
.changelog-content h2,
.changelog-content h3 {
    margin-top: 20px;
    margin-bottom: 8px;
    font-weight: 700;
}
.changelog-content h1 { font-size: 1.3rem; }
.changelog-content h2 { font-size: 1.1rem; color: var(--accent); }
.changelog-content h3 { font-size: 0.95rem; color: var(--text-secondary); }
.changelog-content ul { padding-left: 20px; margin: 8px 0; }
.changelog-content li { margin: 4px 0; }
.changelog-content code {
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ─── PRINTABLE DASHBOARD WRAPPER ──────────────────── */
.pdf-dashboard-wrapper {
    background: white;
    padding: 40px;
    width: 1100px;
}
.pdf-dashboard-wrapper h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}
.pdf-dashboard-wrapper .pdf-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}
.sidebar-user-info {
    min-width: 0;
    flex: 1;
}
.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.sidebar-logout:hover {
    background: var(--bg-card);
    color: var(--red, #dc2626);
}

/* ─── THEME TOGGLE (sidebar) ──────────────────────────────── */
.sidebar-theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: inherit;
    transition: background var(--transition), color var(--transition);
    text-align: left;
}
.sidebar-theme-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.sidebar-theme-btn svg { flex-shrink: 0; opacity: 0.75; }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ─── MAIN ─────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 32px 40px;
    min-height: 100vh;
    min-width: 0; /* allow flex children to shrink below content size */
}

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── VIEW HEADER ──────────────────────────────────────── */
.view-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px;
}
.view-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.view-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

.header-actions { display: flex; gap: 10px; align-items: center; }

.next-number-badge {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* ─── BUTTONS ──────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #FBD38D);
    color: #fff;
    box-shadow: 0 2px 12px rgba(249, 115, 22, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(224, 62, 62, 0.35);
}
.btn-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.35);
    font-weight: 600;
}
.btn-success:hover { background: #16a34a; color: #fff; border-color: #16a34a; }
.status-assinado { background: #d1fae5; color: #065f46; font-size: 0.78rem; cursor: help; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ── Bloco de assinatura digital dentro do PDF ───────────── */
.pdf-assinatura-digital {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px solid #6ee7b7;
    border-radius: 6px;
    background: #f0fdf4;
    font-size: 0.72rem;
    color: #065f46;
    break-inside: avoid;
}
.pad-icon { font-size: 1rem; line-height: 1.4; }
.pad-info { display: flex; flex-direction: column; gap: 3px; }
.pad-titulo { font-weight: 700; font-size: 0.74rem; margin-bottom: 2px; }
.pad-detalhe { color: #047857; }
.pad-hash-row { display: flex; flex-direction: column; gap: 0; }
.pad-hash-label { font-size: 0.66rem; font-weight: 600; color: #374151; }
.pad-hash { font-family: monospace; font-size: 0.62rem; color: #6b7280; word-break: break-all; }

/* ── View Verificar Assinatura ───────────────────────────── */
.verificar-container {
    display: flex;
    justify-content: center;
    padding: 32px 16px;
}
.verificar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    max-width: 700px;
    width: 100%;
    box-shadow: var(--shadow-sm);
}
.verificar-instrucao { color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.verificar-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.verificar-input { flex: 1; font-family: monospace; font-size: 0.85rem; }
.verificar-resultado {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    border-radius: 10px;
    border: 1.5px solid;
}
.verificar-valido  { background: #f0fdf4; border-color: #6ee7b7; color: #065f46; }
.verificar-invalido { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.verificar-icone { font-size: 2rem; line-height: 1; }
.verificar-msg strong { display: block; font-size: 1.1rem; margin-bottom: 8px; }
.verificar-msg p { margin: 0; line-height: 1.5; }
.verificar-tabela { border-collapse: collapse; font-size: 0.9rem; margin-top: 4px; }
.verificar-tabela td { padding: 4px 12px 4px 0; vertical-align: top; }
.verificar-tabela td:first-child { font-weight: 600; white-space: nowrap; color: #047857; min-width: 120px; }
.hash-cell { font-family: monospace; font-size: 0.75rem; word-break: break-all; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ─── STATS ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.stat-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}
.stat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-total .stat-icon { background: var(--accent-glow); color: var(--accent); }
.stat-valida .stat-icon { background: var(--green-bg); color: var(--green); }
.stat-vencendo .stat-icon { background: var(--yellow-bg); color: var(--yellow); }
.stat-vencida .stat-icon { background: var(--red-bg); color: var(--red); }

.stat-value { font-size: 1.75rem; font-weight: 800; display: block; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 2px; }

/* ─── FILTERS ──────────────────────────────────────────── */
.filters-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1; min-width: 250px;
    position: relative;
}
.search-box svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit; font-size: 0.9rem;
    transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.filter-group { display: flex; gap: 10px; }

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 10px 38px 10px 14px;
    background: var(--bg-card) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23687387' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit; font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* ─── TABLE ────────────────────────────────────────────── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.data-table td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(42,53,80,0.5);
    vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-valida { background: var(--green-bg); color: var(--green); }
.status-vencendo { background: var(--yellow-bg); color: var(--yellow); }
.status-vencida { background: var(--red-bg); color: var(--red); }
.status-deferida { background: var(--green-bg); color: var(--green); }
.status-indeferida { background: var(--red-bg); color: var(--red); }
.status-pendente { background: var(--bg-secondary); color: var(--text-muted); }
.status-rascunho { background: #f3f4f6; color: #6b7280; }
.status-aguardando_analise { background: #fef3c7; color: #92400e; }
.status-arquivada { background: #e5e7eb; color: #374151; }

.decision-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.decision-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tipo-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tipo-tag {
    padding: 2px 8px;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }

/* ─── FORM ─────────────────────────────────────────────── */
.form-container { max-width: 900px; }

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.radio-row {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.radio-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-panel {
    max-width: 900px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.15s ease;
}
.modal-overlay.active { display: flex; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: modalIn 0.18s ease;
}
.modal-md { max-width: 640px; }
.modal-lg { max-width: 820px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-body-flush { padding: 0; }
.modal-body .form-grid-2 + .form-grid-2,
.modal-body .form-grid-2 + .form-field { margin-top: 16px; }

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

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.form-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1rem; font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.form-section-title svg { color: var(--accent); }

.form-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.span-2 { grid-column: span 2; }

.form-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.required { color: var(--red); }

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field textarea,
.form-field select,
select,
input[type="text"]:not([class]),
input[type="email"]:not([class]),
input[type="password"]:not([class]),
input[type="number"]:not([class]) {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

/* Custom select with chevron — replaces ugly native dropdown chrome */
.form-field select,
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23687387' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    line-height: 1.3;
}
.form-field select:hover,
select:hover { border-color: var(--text-muted); }
.form-field select:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}
.form-field select option,
select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-field input:disabled,
.form-field textarea:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 10px;
    font-style: italic;
}

/* ─── CHECKBOXES ───────────────────────────────────────── */
.checkbox-group-inline { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 4px; }

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 4px 0;
    transition: var(--transition);
}
.checkbox-label:hover { color: var(--text-primary); }

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    transition: var(--transition);
}
.checkbox-label input:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 6px; height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Checkbox Cards (Type selection) */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.checkbox-card { cursor: pointer; }
.checkbox-card input { display: none; }

.checkbox-card-inner {
    display: block;
    padding: 16px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}
.checkbox-card input:checked + .checkbox-card-inner {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.checkbox-card-check {
    position: absolute;
    top: 10px; right: 10px;
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    transition: var(--transition);
}
.checkbox-card input:checked + .checkbox-card-inner .checkbox-card-check {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox-card input:checked + .checkbox-card-inner .checkbox-card-check::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-card-text { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; color: var(--text-primary); }
.checkbox-card-desc { display: block; font-size: 0.75rem; color: var(--text-muted); }

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.category-group {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.category-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ─── FORM ACTIONS ─────────────────────────────────────── */
.form-actions {
    display: flex; justify-content: flex-end; gap: 12px;
    margin-top: 8px;
}

/* ─── PREVIEW ──────────────────────────────────────────── */
.preview-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.pdf-container {
    width: 210mm;
    min-height: 297mm;
    background: #fff;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    border-radius: 4px;
    overflow: hidden;
}

/* ─── PDF TEMPLATE STYLES ──────────────────────────────── */
.pdf-page {
    width: 210mm;
    height: 297mm;          /* Exato A4 — evita segunda página em branco */
    min-height: unset;
    overflow: hidden;       /* Nada vaza para uma segunda página */
    position: relative;
    color: #1a1a2e;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 10pt;
    padding: 0;
}

.pdf-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.pdf-content {
    position: relative;
    z-index: 1;
    padding: 110px 60px 80px 60px;
}

.pdf-header-values {
    position: absolute;
    top: 30px;
    right: 50px;
    z-index: 2;
    text-align: right;
    font-size: 9pt;
    line-height: 1.7;
}
.pdf-header-values .label { color: #555; }
.pdf-header-values .value { font-weight: 700; color: #1a1a2e; }

.pdf-title {
    text-align: center;
    font-size: 14pt;
    font-weight: 800;
    margin-bottom: 24px;
    margin-top: 10px;
    color: #0f172a;
}

.pdf-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 10pt;
}

.pdf-financeiro {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 10px 14px;
    border-radius: 4px;
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 9.5pt;
}
.pdf-financeiro .fin-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pdf-financeiro .fin-item span {
    color: #555;
    font-size: 8.5pt;
}
.pdf-financeiro .fin-total {
    color: var(--accent);
}

.pdf-section-title {
    font-weight: 700;
    font-size: 10pt;
    margin-top: 16px;
    margin-bottom: 8px;
    text-decoration: underline;
}

.pdf-tipo-list {
    margin-bottom: 10px;
    line-height: 1.8;
    font-size: 9.5pt;
}
.pdf-tipo-list .item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-style: italic;
    color: #aaa;
}
.pdf-tipo-list .item.checked {
    font-weight: 700;
    color: inherit;
}

.pdf-check-yes {
    display: inline-block;
    min-width: 14px;
    color: #1a7a3a;
    font-style: normal;
    font-weight: 700;
}
.pdf-check-no {
    display: inline-block;
    min-width: 14px;
}

.pdf-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    margin-bottom: 16px;
    font-size: 9pt;
}

.pdf-cat-group h4 {
    font-size: 9pt;
    font-weight: 700;
    text-decoration: underline;
    margin-bottom: 4px;
    margin-top: 8px;
}

.pdf-cat-group .cat-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding-left: 4px;
    line-height: 1.7;
    color: #aaa;
}
.pdf-cat-group .cat-item.checked {
    font-weight: 700;
    color: inherit;
}

.pdf-justificativa {
    margin-top: 16px;
    margin-bottom: 12px;
    font-size: 9.5pt;
    line-height: 1.6;
    /* Break long unspaced strings so the text never overflows the page */
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;     /* preserve user line breaks too */
    hyphens: auto;
    text-align: justify;
    max-width: 100%;
}
.pdf-justificativa strong { display: block; margin-bottom: 4px; }

.pdf-solicitante {
    font-weight: 700;
    margin-bottom: 28px;
    font-size: 10pt;
}

.pdf-assinaturas {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
    text-align: center;
    font-size: 9.5pt;
}

.pdf-assinatura-col {
    width: 200px;
}
.pdf-assinatura-col .line {
    border-top: 1px solid #333;
    margin-bottom: 4px;
    margin-top: 40px;
}
.pdf-assinatura-col .name { font-weight: 700; }
.pdf-assinatura-col .role { font-size: 8.5pt; color: #555; }

/* ─── TOAST ────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    box-shadow: var(--shadow);
    max-width: 380px;
}
.toast-success { background: #166534; color: #bbf7d0; border-left: 4px solid var(--green); }
.toast-error { background: #7f1d1d; color: #fecaca; border-left: 4px solid var(--red); }

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

/* ─── LOADING ──────────────────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(250, 250, 250, 0.85);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 10000;
    gap: 16px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── CHARTS ───────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.chart-card.span-2 {
    grid-column: span 2;
}

/* ─── TIMELINE / HISTORY ───────────────────────────────── */
.timeline-container {
    padding: 30px;
    max-height: 500px;
    overflow-y: auto;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    padding-bottom: 25px;
    border-left: 2px solid var(--border);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
}

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

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.timeline-content {
    background: var(--bg-primary);
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.timeline-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.timeline-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.action-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ─── RESPONSIVE BREAKPOINTS ──────────────────────────── */
@media (max-width: 1280px) {
    .main-content { padding: 24px 24px; }
}
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
    .main-content { padding: 20px 18px; }
    .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar-logo .logo-text,
    .sidebar-nav .nav-item span,
    .sidebar-user-info,
    .sidebar-version,
    .sidebar-credit { display: none; }
    .sidebar-nav .nav-item { justify-content: center; padding: 12px; }
    :root { --sidebar-w: 64px; }
    .main-content { padding: 16px 12px; }
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 { grid-template-columns: 1fr; }
    .view-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-actions { width: 100%; }
}

/* Tables: always allow horizontal scroll instead of overflowing main */
.table-container { overflow-x: auto; }
.data-table { min-width: 600px; }

.btn-icon {
    min-height: 32px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-danger { color: #b91c1c; border-color: #fecaca; }
.btn-icon-danger:hover { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.btn-icon-success { color: #065f46; border-color: #6ee7b7; }
.btn-icon-success:hover { background: #d1fae5; border-color: #34d399; color: #047857; }

.btn-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}
.status-valida { background: var(--green-bg); color: var(--green); }
.status-vencida { background: var(--red-bg); color: var(--red); }
.status-vencendo { background: var(--yellow-bg); color: var(--yellow); }
.status-deferida { background: var(--green-bg); color: var(--green); }
.status-indeferida { background: var(--red-bg); color: var(--red); }
.status-pendente { background: var(--bg-secondary); color: var(--text-muted); }
.status-rascunho { background: #f3f4f6; color: #6b7280; }
.status-aguardando_analise { background: #fef3c7; color: #92400e; }
.status-arquivada { background: #e5e7eb; color: #374151; }
.status-importado { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--accent); }

/* ─── IMPORT BANNER (form Nova Condição em modo importação) ─── */
.import-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.import-banner-left { display: flex; align-items: center; gap: 12px; }
.import-banner-icon { font-size: 1.4rem; }
.import-banner-title { font-weight: 700; color: var(--accent); font-size: 0.95rem; }
.import-banner-desc { color: var(--text-secondary); font-size: 0.82rem; margin-top: 2px; }
.import-banner-right {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.import-banner-right label { font-weight: 600; }

/* ─── IMPORT MODAL — Dropzone ───────────────────────────── */
.import-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 12px;
}
.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.import-dropzone-text { margin-top: 10px; font-size: 0.92rem; }
.import-dropzone-hint { margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); }

/* ─── CAMPO FALTANTE (highlight no form em modo importação) ─── */
.field-missing input,
.field-missing select,
.field-missing textarea {
    border-color: var(--red) !important;
    background: var(--red-bg) !important;
}
.field-missing > label::after {
    content: ' ⚠ obrigatório';
    color: var(--red);
    font-size: 0.72rem;
    font-weight: 600;
}

/* ─── BADGE: ROLE PERSONALIZADO (admin users table) ───────── */
.role-personalizado {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--yellow-bg);
    color: var(--yellow);
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 6px;
    border: 1px solid var(--yellow);
}

.chart-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}
.chart-card canvas {
    width: 100% !important;
    max-height: 300px;
}

/* ── Cadastros: colunas compactas para exibir botão Excluir ── */
#lista-clientes td:last-child,
#lista-solicitantes td:last-child { width: 80px; white-space: nowrap; }
#lista-clientes td:nth-child(2),
#lista-solicitantes td:nth-child(2) { width: 110px; white-space: nowrap; }
#lista-clientes .data-table,
#lista-solicitantes .data-table { table-layout: fixed; }

/* ── Nav badge (contador de pendências) ───────────────────── */
.nav-item { position: relative; }
.nav-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ── Nav badge — análise pendente (roxo) ───────────────────── */
.nav-badge-analise {
    background: #7c3aed;
}

/* ── Notificação toast (canto inferior direito) ──────────── */
.notif-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
}
.notif-card-analise {
    border-left-color: #7c3aed;
    background: #faf5ff;
}
.notif-card-deferida {
    border-left-color: #059669;
    background: #f0fdf4;
}
.notif-card-indeferida {
    border-left-color: #dc2626;
    background: #fff5f5;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}
.notif-icon { font-size: 1.4rem; line-height: 1; }
.notif-body { flex: 1; font-size: 0.85rem; line-height: 1.4; color: var(--text-primary); }
.notif-action-hint {
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
}
.notif-card-deferida   .notif-action-hint { color: #059669; }
.notif-card-indeferida .notif-action-hint { color: #dc2626; }
.notif-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--text-muted); padding: 0 4px; line-height: 1;
}
.notif-close:hover { color: var(--text-primary); }

/* ── Assinatura multi-party no PDF ───────────────────────── */
.assin-digital-col {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    background: #f0fdf4;
    border: 1px solid #6ee7b7;
    border-radius: 6px;
    font-size: 0.72rem;
    color: #065f46;
}
.assin-check { font-size: 1.1rem; line-height: 1.4; }
.assin-info { line-height: 1.5; }
.assin-dt { color: #047857; font-size: 0.67rem; }
.assin-pendente-col { text-align: center; }
.assin-ag { font-size: 0.68rem; color: #92400e; margin-top: 4px; }

/* ── Admin users table: adiciona coluna Perfil ───────────── */
#admin-users-tbody td:nth-child(3) { white-space: nowrap; }

/* ── Status: cancelada ───────────────────────────────────── */
.status-cancelada { background: #fce7f3; color: #9d174d; }

/* ── Badge clicável (motivo indeferimento / cancelamento) ── */
.badge-clickable {
    cursor: pointer;
    transition: opacity 0.15s;
}
.badge-clickable:hover { opacity: 0.8; }

/* ── Motivo display (modal de leitura) ───────────────────── */
.motivo-display {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

/* ── Tarja diagonal no documento (indeferida / cancelada) ── */
.pdf-page { position: relative; overflow: hidden; }

.pdf-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-38deg);
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.10;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    user-select: none;
}
.pdf-watermark-indeferida { color: #dc2626; border: 10px solid #dc2626; padding: 6px 24px; }
.pdf-watermark-cancelada  { color: #7c3aed; border: 10px solid #7c3aed; padding: 6px 24px; }

/* ── Filtro de Visualização (dropdown checkboxes) ───────── */
.vis-filter-wrap { position: relative; }

.vis-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
}
.vis-filter-btn-active { background: #ede9fe; color: #5b21b6; border-color: #a78bfa; }

.vis-filter-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 10px 14px 12px;
    min-width: 190px;
}
.vis-filter-panel.open { display: block; }

.vis-filter-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.vis-filter-opt {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    padding: 3px 0;
    cursor: pointer;
    user-select: none;
}
.vis-filter-opt input[type="checkbox"] { cursor: pointer; }

.vis-filter-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.btn-xs { font-size: 0.72rem; padding: 3px 8px; height: auto; }

/* ── Aba Configurações ───────────────────────────────────── */
#view-configuracoes {
    max-width: 700px;
    margin: 0 auto;
    padding-bottom: 40px;
}
.cfg-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
}
.cfg-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 18px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.cfg-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}
.cfg-row-info { flex: 1; }
.cfg-row-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.cfg-row-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.cfg-row-control { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.cfg-toggle-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

/* Toggle switch */
.cfg-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.cfg-toggle input { opacity: 0; width: 0; height: 0; }
.cfg-toggle-slider {
    position: absolute; inset: 0;
    background: #cbd5e1; border-radius: 24px;
    cursor: pointer; transition: 0.2s;
}
.cfg-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: white; border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.cfg-toggle input:checked + .cfg-toggle-slider { background: #059669; }
.cfg-toggle input:checked + .cfg-toggle-slider::before { transform: translateX(20px); }

/* ═══════════════════════════════════════════════════════════
   COMO USAR — Fluxograma e guia de uso
   ═══════════════════════════════════════════════════════════ */
#view-como-usar {
    max-width: 860px;
    margin: 0 auto;
    padding-bottom: 48px;
}

.cu-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 28px;
}

.cu-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ── Perfis ────────────────────────────────────────── */
.cu-roles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.cu-role-card {
    border-radius: 10px;
    padding: 16px 14px;
    border-left: 4px solid;
    background: var(--bg);
}

.cu-role-icon { font-size: 1.6rem; margin-bottom: 6px; }
.cu-role-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; }
.cu-role-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

.cu-role-op   { border-color: #3b82f6; }
.cu-role-dir  { border-color: #8b5cf6; }
.cu-role-solic { border-color: #f59e0b; }
.cu-role-chefe { border-color: #10b981; }

/* ── Fluxo principal ───────────────────────────────── */
.cu-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.cu-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    max-width: 600px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 5px solid;
    border-radius: 10px;
    padding: 14px 18px;
    position: relative;
}

.cu-step-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.cu-step-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.cu-step-body { flex: 1; min-width: 0; }
.cu-step-title { font-weight: 700; font-size: 0.92rem; margin-bottom: 3px; }
.cu-step-role  { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; opacity: 0.7; }
.cu-step-role-parallel { color: #059669; }
.cu-step-desc  { font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; }

/* Step variants */
.cu-step-op   { border-left-color: #3b82f6; }
.cu-step-dir  { border-left-color: #8b5cf6; }
.cu-step-sign { border-left-color: #f59e0b; }
.cu-step-done { border-left-color: #10b981; }
.cu-step-indf { border-left-color: #ef4444; }
.cu-step-arch { border-left-color: #6b7280; }

.cu-step-op   .cu-step-badge { background: #dbeafe; color: #1d4ed8; }
.cu-step-dir  .cu-step-badge { background: #ede9fe; color: #6d28d9; }
.cu-step-sign .cu-step-badge { background: #fef3c7; color: #92400e; }
.cu-step-done .cu-step-badge { background: #d1fae5; color: #065f46; }
.cu-step-indf .cu-step-badge { background: #fee2e2; color: #991b1b; }
.cu-step-arch .cu-step-badge { background: #f3f4f6; color: #374151; }

/* ── Seta entre passos ─────────────────────────────── */
.cu-arrow {
    font-size: 1.4rem;
    color: var(--text-muted);
    line-height: 1;
    padding: 6px 0;
    opacity: 0.5;
}

/* ── Bifurcação (deferida / indeferida) ────────────── */
.cu-fork {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 700px;
    margin-top: 4px;
}

.cu-fork-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.cu-fork-label {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 4px;
}

.cu-fork-yes { background: #d1fae5; color: #065f46; }
.cu-fork-no  { background: #fee2e2; color: #991b1b; }

/* ── Badges inline ─────────────────────────────────── */
.cu-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
}

.cu-badge-rascunho { background: #f3f4f6; color: #374151; }
.cu-badge-analise  { background: #fef3c7; color: #92400e; }
.cu-badge-solic    { background: #fef3c7; color: #92400e; }
.cu-badge-chefe    { background: #d1fae5; color: #065f46; }

/* ── Assinaturas paralelas ─────────────────────────── */
.cu-parallel-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.cu-parallel-plus {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ── Dicas rápidas ──────────────────────────────────── */
.cu-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cu-tip {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.cu-tip-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.cu-tip strong { color: var(--text); }

/* ── Responsivo ─────────────────────────────────────── */
@media (max-width: 600px) {
    .cu-fork { grid-template-columns: 1fr; }
    .cu-roles { grid-template-columns: 1fr 1fr; }
    .cu-section { padding: 18px 16px; }
}
