
:root {
    --primary: #f4530b;
    --primary-deep: #d84a06;
    --primary-soft: #ff7a45;
    --brand-green: #02aa39;
    --ink: #171b21;
    --secondary: #d84a06;
    --success: #02a83a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #2563eb;
    --brand-gradient: linear-gradient(90deg, var(--brand-green), var(--primary) 55%);
    --brand-gradient-v: linear-gradient(180deg, var(--brand-green), var(--primary) 60%);

    --primary-safe: #cf4504;
    --danger-safe:  #dc2626;
    --success-safe: #067d2d;
    --link: #a83a05;

    --n-50:  #f8fafc;
    --n-100: #f1f5f9;
    --n-200: #e5e7eb;
    --n-300: #d1d5db;
    --n-400: #9ca3af;
    --n-500: #6b7280;
    --n-600: #4b5563;
    --n-700: #374151;
    --n-800: #1f2937;
    --n-900: #111827;

    --bg:            #eef2f6;
    --surface:       #ffffff;
    --surface-2:     var(--n-50);
    --surface-3:     var(--n-100);
    --border:        var(--n-200);
    --border-strong: var(--n-300);
    --text:          var(--n-900);
    --text-muted:    #5b6371;
    --text-soft:     var(--n-700);
    --ring:          var(--primary);

    --success-bg: #dcfce7;  --success-fg: #15803d;  --success-bd: #86efac;
    --danger-bg:  #fee2e2;  --danger-fg:  #b91c1c;  --danger-bd:  #fca5a5;
    --warning-bg: #fef3c7;  --warning-fg: #92400e;  --warning-bd: #fcd34d;
    --info-bg:    #eff6ff;  --info-fg:    #1e40af;  --info-bd:    #bfdbfe;
    --violet-bg:  #ede9fe;  --violet-fg:  #6d28d9;  --violet-bd:  #c4b5fd;

    --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-md: 0.875rem;
    --fs-lg: 1rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 1.875rem;
    --lh: 1.45;

    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-6: 24px; --s-8: 32px; --s-12: 48px;

    --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-full: 999px;

    --sh-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --sh-2: 0 2px 6px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .08);
    --sh-3: 0 12px 32px rgba(16, 24, 40, .16);

    --t: 150ms ease;

    --page-max: 1320px;
    --gutter: var(--s-6);
    --navbar-h: 60px;
}

body.dark-mode {
    --link: #ff8a52;
    --bg:            #0f151c;
    --surface:       #18212c;
    --surface-2:     #202b38;
    --surface-3:     #26323f;
    --border:        #2f3d4c;
    --border-strong: #3f5063;
    --text:          #e8edf3;
    --text-muted:    #9fb0c2;
    --text-soft:     #c3cedb;

    --success-bg: #10321f;  --success-fg: #86efac;  --success-bd: #1d5f37;
    --danger-bg:  #3b1717;  --danger-fg:  #fca5a5;  --danger-bd:  #7f1d1d;
    --warning-bg: #3a2a0c;  --warning-fg: #fcd34d;  --warning-bd: #92610a;
    --info-bg:    #14243d;  --info-fg:    #bfdbfe;  --info-bd:    #1e40af;
    --violet-bg:  #251a4a;  --violet-fg:  #c4b5fd;  --violet-bd:  #4c1d95;

    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 2px 6px rgba(0, 0, 0, .35), 0 6px 16px rgba(0, 0, 0, .3);
    --sh-3: 0 12px 32px rgba(0, 0, 0, .55);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: var(--lh);
    min-height: 100vh;
    transition: background-color var(--t), color var(--t);
}

.tabular, .history-table td, .stat-value, .sys-info-value, td.num, .closing-count {
    font-variant-numeric: tabular-nums;
}

a { color: var(--link); }

hr { border-color: var(--border); opacity: 1; margin: var(--s-6) 0; }

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
.navbar :focus-visible { outline-color: #fff; }

::selection { background: rgba(244, 83, 11, .22); }

.navbar {
    background: var(--ink);
    box-shadow: var(--sh-2);
    border-bottom: 3px solid var(--primary);
    border-image: var(--brand-gradient) 1;
    min-height: var(--navbar-h);
    padding: var(--s-2) 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-weight: 700;
    font-size: var(--fs-lg);
    letter-spacing: .2px;
    color: #fff;
}
.navbar-brand i { color: var(--primary); }
.navbar-logo {
    height: 40px;
    width: auto;
    background: #fff;
    border-radius: var(--r-sm);
    padding: 2px;
}

.navbar-nav .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    color: rgba(255, 255, 255, .78) !important;
    font-size: var(--fs-md);
    font-weight: 500;
    padding: var(--s-2) var(--s-3);
    margin: 0 2px;
    border-radius: var(--r-sm);
    transition: background-color var(--t), color var(--t);
}
.navbar-nav .nav-link:hover { color: #fff !important; background: rgba(255, 255, 255, .09); }
.navbar-nav .nav-link.active { color: #fff !important; background: rgba(255, 255, 255, .14); }
.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    left: var(--s-3); right: var(--s-3); bottom: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}
.navbar-nav .nav-link i { font-size: var(--fs-sm); opacity: .9; }

.nav-pending-badge {
    display: inline-flex;
    align-items: center; justify-content: center;
    min-width: 18px; height: 18px;
    margin-left: var(--s-1);
    padding: 0 5px;
    background: var(--primary-safe);
    color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
    border-radius: var(--r-full);
}

@media (max-width: 991px) {
    .navbar .d-flex.align-items-center { flex-wrap: wrap; row-gap: var(--s-1); }
    .navbar-nav.flex-row { flex-wrap: wrap; }
    .navbar-nav .nav-link { padding: 6px var(--s-2); }
}

.user-dropdown { position: relative; margin-left: var(--s-3); }
.user-button {
    display: inline-flex; align-items: center; gap: var(--s-2);
    background: none; border: 1px solid rgba(255, 255, 255, .16);
    color: rgba(255, 255, 255, .92) !important;
    cursor: pointer;
    padding: 6px var(--s-3);
    border-radius: var(--r-full);
    font-size: var(--fs-md);
    transition: background-color var(--t), border-color var(--t);
}
.user-button:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .3); }
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    background: var(--brand-gradient-v);
    color: #fff; font-weight: 700; font-size: var(--fs-xs);
    border-radius: var(--r-full);
}

.dropdown-menu-custom {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    min-width: 240px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}
.dropdown-menu-custom.show { display: block; animation: slideDown .18s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.dropdown-user-info {
    padding: var(--s-3) var(--s-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.dropdown-user-info strong { color: var(--text); }
.dropdown-user-info small { color: var(--text-muted); }

.dropdown-menu-custom a,
.dropdown-menu-custom button {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%;
    padding: var(--s-3) var(--s-4);
    background: none; border: none;
    color: var(--text-soft);
    font-size: var(--fs-md);
    text-align: left; text-decoration: none;
    cursor: pointer;
    transition: background-color var(--t), color var(--t);
}
.dropdown-menu-custom a:hover,
.dropdown-menu-custom button:hover { background: var(--surface-2); color: var(--link); }
.dropdown-menu-custom i { width: 16px; text-align: center; color: var(--text-muted); }

.container-main {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: var(--s-8) var(--gutter) var(--s-12);
}
@media (max-width: 768px) { .container-main { padding: var(--s-6) var(--s-4) var(--s-8); } }

.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title {
    position: relative;
    display: flex; align-items: center; gap: var(--s-3);
    margin: 0 0 var(--s-2);
    padding-left: var(--s-4);
    font-size: var(--fs-2xl);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
}
.section-title::before {
    content: '';
    position: absolute; left: 0; top: 4px; bottom: 4px;
    width: 4px;
    background: var(--brand-gradient-v);
    border-radius: 2px;
}
.section-title i { color: var(--primary); font-size: var(--fs-xl); }

.page-section > .mb-5,
.page-section > .page-header { margin-bottom: var(--s-8) !important; }
.page-section .lead,
.page-section > .page-header .lead {
    margin: 0;
    padding-left: var(--s-4);
    font-size: var(--fs-md);
    color: var(--text-muted) !important;
}

.app-footer {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: var(--s-6) var(--gutter) var(--s-8);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    text-align: center;
    border-top: 1px solid var(--border);
}


.card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    margin-bottom: var(--s-6);
    overflow: hidden;
    transition: box-shadow var(--t), border-color var(--t);
}
.card:hover { box-shadow: var(--sh-2); }
.card + .card { margin-top: 0; }

.card-header {
    display: flex; align-items: center; gap: var(--s-2);
    background: var(--surface-2);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--s-6);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: .1px;
}
.card-header i { color: var(--primary); }
.card-body { padding: var(--s-6); color: var(--text); }

.card-header-ai      { background: var(--violet-bg); color: var(--violet-fg); border-bottom-color: var(--violet-bd); }
.card-header-ai i    { color: var(--violet-fg); }
.card-header-danger  { background: var(--danger-bg); color: var(--danger-fg); border-bottom-color: var(--danger-bd); }
.card-header-danger i{ color: var(--danger-fg); }
.card-header-ok      { background: var(--success-bg); color: var(--success-fg); border-bottom-color: var(--success-bd); }
.card-header-ok i    { color: var(--success-fg); }
.card-header-warn    { background: var(--warning-bg); color: var(--warning-fg); border-bottom-color: var(--warning-bd); }
.card-header-warn i  { color: var(--warning-fg); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-md);
    font-weight: 600;
    padding: 9px var(--s-4);
    border: 1px solid transparent;
    transition: background-color var(--t), border-color var(--t), color var(--t),
                box-shadow var(--t), transform var(--t);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { padding: 5px var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { padding: 12px var(--s-6); font-size: var(--fs-lg); border-radius: var(--r-md); }

.btn-primary { background: var(--primary-safe); border-color: var(--primary-safe); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #b53b03; border-color: #b53b03; color: #fff; box-shadow: var(--sh-2); }
.btn-secondary { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text); }
.btn-success { background: var(--success-safe); border-color: var(--success-safe); color: #fff; }
.btn-success:hover:not(:disabled) { background: #046323; border-color: #046323; color: #fff; }
.btn-danger { background: var(--danger-safe); border-color: var(--danger-safe); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); border-color: #d97706; color: #422006; }
.btn-warning:hover:not(:disabled) { background: #d97706; border-color: #b45309; color: #fff; }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--link); }
.btn-outline-primary:hover:not(:disabled) { background: var(--primary-safe); border-color: var(--primary-safe); color: #fff; }

.btn-outline-secondary { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }
.btn-outline-secondary:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger-fg); }
.btn-outline-danger:hover:not(:disabled) { background: var(--danger-safe); border-color: var(--danger-safe); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-edit, .btn-delete, .btn-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: var(--r-sm);
    padding: 5px var(--s-3);
    font-size: var(--fs-sm); font-weight: 600;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    transition: all var(--t);
}
.btn-edit:hover { border-color: var(--primary); color: var(--link); }
.btn-delete { border-color: var(--danger-bd); color: var(--danger-fg); }
.btn-delete:hover { background: var(--danger-safe); border-color: var(--danger-safe); color: #fff; }
.btn-toggle { border-color: var(--success-bd); color: var(--success-fg); }
.btn-toggle:hover { background: var(--success-safe); border-color: var(--success-safe); color: #fff; }
.btn-toggle.btn-toggle-off { border-color: var(--border-strong); color: var(--text-muted); }
.btn-toggle.btn-toggle-off:hover { background: var(--surface-3); color: var(--text); }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-soft);
    letter-spacing: .1px;
}
.form-control, .form-select {
    min-height: 40px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 8px var(--s-3);
    font-size: var(--fs-md);
    transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.form-control::placeholder { color: var(--text-muted); opacity: 1; }
.form-control:focus, .form-select:focus {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 83, 11, .16);
    outline: none;
}
.form-control:disabled, .form-control[readonly] { background: var(--surface-3); color: var(--text-muted); }
.form-control-sm, .form-select-sm { min-height: 34px; padding: 4px var(--s-2); font-size: var(--fs-sm); }
.form-control.is-invalid { border-color: var(--danger); }
.field-error { display: block; margin-top: var(--s-1); font-size: var(--fs-xs); color: var(--danger-fg); }
.form-text, .form-hint { color: var(--text-muted) !important; font-size: var(--fs-xs); }
textarea.form-control { min-height: 84px; line-height: var(--lh); }

.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.form-check-label { color: var(--text-soft); }
label:has(> input[type="checkbox"]), label.form-check-label, .ajuste-rotulo, .pers-nome { cursor: default; }
.form-check-input[type="checkbox"] { cursor: pointer; }
.form-check-input { background-color: var(--surface); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(244, 83, 11, .16); }

input[type="file"].form-control {
    display: flex; align-items: center;
    padding: 0 var(--s-3) 0 0;
    min-height: 42px;
    overflow: hidden;
}
input[type="file"].form-control::file-selector-button {
    margin: var(--s-1) var(--s-3) var(--s-1) var(--s-1);
    padding: 6px var(--s-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--text-soft);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--t), border-color var(--t);
}
input[type="file"].form-control:hover::file-selector-button {
    background: var(--border);
    border-color: var(--text-muted);
}

.upload-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
}
@media (max-width: 900px) { .upload-container { grid-template-columns: 1fr; } }

.upload-box.upload-box-faixa {
    flex-direction: row; align-items: center; gap: var(--s-3);
    margin-bottom: var(--s-3); padding: var(--s-3) var(--s-4);
    text-align: left;
}
.upload-box-faixa .upload-icon { margin: 0; font-size: 1.4rem; }
.upload-faixa-texto { flex: 1 1 auto; min-width: 0; }
.upload-faixa-arquivo { flex: 0 1 45%; min-width: 0; }
.upload-faixa-arquivo .file-name:empty + .upload-files:empty { display: none; }
@media (max-width: 700px) {
    .upload-box.upload-box-faixa { flex-direction: column; align-items: stretch; text-align: center; }
    .upload-faixa-arquivo { flex-basis: auto; }
}

.upload-box {
    display: flex; flex-direction: column; align-items: center;
    background: var(--surface-2);
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: var(--s-6) var(--s-4);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--t), background-color var(--t), transform var(--t);
}
.upload-box:hover { border-color: var(--primary); background: var(--surface-3); }
.upload-box.dragover {
    border-color: var(--primary);
    background: rgba(244, 83, 11, .08);
    transform: scale(1.01);
}
.upload-box strong { font-size: var(--fs-md); color: var(--text); }
.upload-box .text-muted { color: var(--text-muted) !important; }
.upload-icon { font-size: var(--fs-2xl); color: var(--primary); margin-bottom: var(--s-2); }
.upload-box input[type="file"] { display: none; }
.file-name { margin-top: var(--s-2); font-size: var(--fs-xs); font-weight: 600; color: var(--success-fg); }

.upload-files {
    width: 100%;
    margin-top: var(--s-2);
    max-height: 96px;
    overflow-y: auto;
    text-align: left;
    font-size: var(--fs-xs);
    color: var(--text-soft);
}
.upload-files div { padding: 2px 0; border-top: 1px solid var(--border); }
.upload-files div:first-child { border-top: none; }

.sel-groups { display: block; margin-bottom: var(--s-4); }

.sel-group {
    display: grid;
    grid-template-columns: 128px 1fr;
    gap: var(--s-4);
    align-items: start;
    padding: var(--s-3) 0;
    border-top: 1px solid var(--border);
}
.sel-group:first-child { border-top: none; padding-top: 0; }

.sel-group .form-label {
    margin: 6px 0 0;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}
.sel-count { display: block; margin-top: 2px; font-size: 10px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.sel-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sel-pill {
    display: inline-flex; align-items: center; gap: 5px;
    min-height: 30px;
    padding: 4px var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    color: var(--text-soft);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all var(--t);
}
.sel-pill:hover { border-color: var(--primary); color: var(--link); }
.sel-pill.active {
    background: var(--primary-safe);
    border-color: var(--primary-safe);
    color: #fff;
    font-weight: 600;
}
.sel-pill.active::before { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; }

@media (max-width: 700px) {
    .sel-group { grid-template-columns: 1fr; gap: var(--s-2); }
}

.chip, .badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px var(--s-2);
    border: 1px solid transparent;
    border-radius: var(--r-full);
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.chip-neutral   { background: var(--surface-3); color: var(--text-soft); border-color: var(--border); }
.chip-ok, .badge-completed        { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.chip-danger, .badge-completed-errors, .badge-failed { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.chip-warn, .badge-completed-warning, .badge-pending { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.chip-info, .badge-processing, .badge-queued { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.chip-brand { background: rgba(244, 83, 11, .12); color: var(--link); border-color: rgba(244, 83, 11, .35); }
.chip-violet { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-bd); }

.chip-sev-alta  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.chip-sev-media { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.chip-sev-baixa { background: var(--surface-3);  color: var(--text-soft);  border-color: var(--border); }

.chip-report-ok      { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.chip-report-pending { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.chip-report-na      { background: transparent; color: var(--text-muted); border-color: transparent; }

.alert {
    display: block;
    padding: var(--s-3) var(--s-4);
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: var(--r-md);
    font-size: var(--fs-md);
    line-height: var(--lh);
}
.alert > i:first-child { margin-right: var(--s-2); }
.alert-custom { margin-bottom: var(--s-4); }
.alert-success, .alert-custom.alert-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.alert-danger, .alert-error, .alert-custom.alert-error { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.alert-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.alert-info, .alert-custom.alert-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }

.history-table { margin-bottom: 0; overflow-x: auto; }

.fluxo-barra { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.fluxo-barra .form-label { margin: 0; }
.fluxo-barra .form-select { width: auto; }
.fluxo-barra .muted-note { flex-basis: 100%; margin: 0; }
.fluxo-quadro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); align-items: start; }
@media (max-width: 992px) { .fluxo-quadro { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 576px) { .fluxo-quadro { grid-template-columns: 1fr; } }
.fluxo-coluna { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-3); min-width: 0; }
.fluxo-coluna-titulo { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.fluxo-coluna-titulo .chip { margin-left: auto; }
.fluxo-card {
    display: flex; flex-direction: column; gap: var(--s-1);
    width: 100%; margin-bottom: var(--s-2); padding: var(--s-2) var(--s-3);
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--r-sm);
    text-align: left; cursor: pointer;
}
.fluxo-card:hover { border-color: var(--primary); }
.fluxo-card-op { font-weight: 700; }
.fluxo-card-etapas { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.fluxo-card-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.fluxo-dobra summary { cursor: pointer; margin-bottom: var(--s-2); color: var(--link); font-size: var(--fs-sm); }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-striped-bg: transparent;
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: transparent;
    --bs-table-hover-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-accent-bg: transparent;
}

.history-table table, .table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
}
.history-table thead th, .table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-2);
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--s-4);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}
.history-table tbody td, .table tbody td {
    height: 44px;
    padding: var(--s-2) var(--s-4);
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-md);
    vertical-align: middle;
    color: var(--text);
}
.table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.history-table tbody tr, .table-hover tbody tr { cursor: pointer; transition: background-color var(--t); }
.history-table tbody tr:hover td, .table-hover tbody tr:hover td { background: rgba(244, 83, 11, .07); }
.history-table tbody tr:last-child td { border-bottom: none; }
.row-chevron { color: var(--text-muted); font-size: var(--fs-xs); }

.pagination { margin: var(--s-4) 0 0; flex-wrap: wrap; gap: var(--s-1); }
.pagination .page-link {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: var(--r-sm);
    padding: 5px var(--s-3);
    font-size: var(--fs-sm);
}
.pagination .page-item.active .page-link { background: var(--primary-safe); border-color: var(--primary-safe); color: #fff; }
.pagination .page-item.disabled .page-link { opacity: .45; }

.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
    padding: var(--s-8) var(--s-4);
    color: var(--text-muted);
    text-align: center;
}
.empty-state-icon { font-size: var(--fs-3xl); color: var(--border-strong); }
.empty-state p { margin: 0; }
.empty-state .btn { margin-top: var(--s-2); }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: skeleton 1.3s ease infinite;
    border-radius: var(--r-sm);
    height: 14px;
    margin-bottom: var(--s-2);
}
.skeleton-row { height: 44px; margin-bottom: 1px; border-radius: 0; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.modal-custom {
    position: fixed; inset: 0;
    background: rgba(10, 15, 21, .55);
    backdrop-filter: blur(2px);
    z-index: 1050;
    display: none;
    align-items: center; justify-content: center;
    padding: var(--s-4);
}
.modal-content-custom {
    display: flex; flex-direction: column;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
    animation: slideIn .2s ease;
    overflow: hidden;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-header-custom {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
    flex: 0 0 auto;
    padding: var(--s-4) var(--s-6);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.modal-header-custom h3 { margin: 0; font-size: var(--fs-xl); font-weight: 700; color: var(--text); }
.close-modal {
    background: none; border: none;
    color: var(--text-muted);
    font-size: var(--fs-2xl); line-height: 1;
    cursor: pointer;
    padding: 0 var(--s-2);
    border-radius: var(--r-sm);
    transition: color var(--t), background-color var(--t);
}
.close-modal:hover { color: var(--danger); background: var(--surface-3); }

.modal-body-custom { flex: 1 1 auto; overflow-y: auto; padding: var(--s-6); }
.modal-body-custom pre {
    background: var(--surface-2);
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: var(--s-3);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    white-space: pre-wrap;
    max-height: 300px; overflow-y: auto;
}
.modal-body-custom textarea {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: var(--s-3);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
}
.modal-footer-custom {
    display: flex; justify-content: flex-end; gap: var(--s-2);
    flex: 0 0 auto;
    padding: var(--s-3) var(--s-6);
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}
.modal-summary-block { margin-bottom: var(--s-5, 20px); }

.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg); }
.modal-header, .modal-footer { border-color: var(--border); background: var(--surface-2); }
.modal-body { color: var(--text); }
body.dark-mode .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

.prompt-info {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
}
.prompt-info-row {
    display: flex; justify-content: space-between; gap: var(--s-4);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.prompt-info-row:last-child { border-bottom: none; }
.prompt-info-label { color: var(--text-muted); font-size: var(--fs-sm); }
.prompt-info-value { color: var(--text); font-weight: 600; font-size: var(--fs-sm); text-align: right; }

.toast-host {
    position: fixed; right: var(--s-6); bottom: var(--s-6);
    z-index: 1100;
    display: flex; flex-direction: column; gap: var(--s-2);
    pointer-events: none;
}
.toast-item {
    display: flex; align-items: center; gap: var(--s-2);
    max-width: 380px;
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    font-size: var(--fs-md);
    pointer-events: auto;
    animation: toastIn .18s ease;
}
.toast-item i { color: var(--success); }
.toast-err { border-left-color: var(--danger); }
.toast-err i { color: var(--danger); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .toast-host { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); } .toast-item { max-width: none; } }

#history-type-tabs.nav-tabs,
#images-type-tabs.nav-tabs,
#prompts-type-tabs.nav-tabs,
#agentes-tabs.nav-tabs,
#perf-tabs.nav-tabs {
    display: inline-flex;
    gap: var(--s-1);
    margin-bottom: var(--s-6);
    padding: var(--s-1);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
#history-type-tabs .nav-link,
#images-type-tabs .nav-link,
#prompts-type-tabs .nav-link,
#agentes-tabs .nav-link,
#perf-tabs .nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px var(--s-3);
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    transition: background-color var(--t), color var(--t);
}
#history-type-tabs .nav-link:hover,
#images-type-tabs .nav-link:hover,
#prompts-type-tabs .nav-link:hover,
#agentes-tabs .nav-link:hover,
#perf-tabs .nav-link:hover { background: var(--surface-3); color: var(--text); }
#history-type-tabs .nav-link.active,
#images-type-tabs .nav-link.active,
#prompts-type-tabs .nav-link.active,
#agentes-tabs .nav-link.active,
#perf-tabs .nav-link.active {
    background: var(--surface);
    color: var(--link);
    box-shadow: var(--sh-1);
}

.proc-timeline {
    display: flex; align-items: flex-start; gap: 0;
    margin: var(--s-4) 0;
    overflow-x: auto;
    padding-bottom: var(--s-2);
}
.proc-step {
    flex: 1 1 0;
    min-width: 96px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    position: relative;
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.proc-step::before {
    content: '';
    position: absolute; top: 13px; left: -50%; right: 50%;
    height: 2px;
    background: var(--border);
}
.proc-step:first-child::before { display: none; }
.proc-dot {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: var(--surface);
    border: 2px solid var(--border-strong);
    border-radius: var(--r-full);
    font-size: var(--fs-xs);
    z-index: 1;
}
.proc-step-done .proc-dot { background: var(--success); border-color: var(--success); color: #fff; }
.proc-step-done::before,
.proc-step-active::before { background: var(--success); }
.proc-step-active .proc-dot { border-color: var(--primary); color: var(--primary); animation: pulse 1.4s ease infinite; }
.proc-step-active { color: var(--text); font-weight: 600; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244,83,11,.35); } 50% { box-shadow: 0 0 0 6px rgba(244,83,11,0); } }
.proc-elapsed { font-variant-numeric: tabular-nums; color: var(--text-muted); }


.pending-banner { margin-bottom: var(--s-6); }
.pending-banner-inner {
    display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--warning-bg);
    color: var(--warning-fg);
    border: 1px solid var(--warning-bd);
    border-left: 4px solid var(--warning);
    border-radius: var(--r-md);
}
.pending-banner-inner > i { font-size: var(--fs-lg); }
.pending-text { flex: 1 1 320px; font-size: var(--fs-md); }
.pending-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pending-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px var(--s-2);
    background: var(--surface);
    border: 1px solid var(--warning-bd);
    border-radius: var(--r-full);
    color: var(--warning-fg);
    font-size: var(--fs-xs); font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.pending-chip:hover { background: var(--warning); color: #422006; border-color: var(--warning); }
.pending-chip-age { font-weight: 400; opacity: .8; }
.pending-more { align-self: center; font-size: var(--fs-xs); opacity: .8; }
.pending-go { flex: 0 0 auto; }

.redo-banner-inner {
    background: var(--danger-bg);
    color: var(--danger-fg);
    border-color: var(--danger-bd);
    border-left-color: var(--danger);
}
.redo-chip { border-color: var(--danger-bd); color: var(--danger-fg); }
.redo-banner:has(+ .pending-banner:not([hidden])) { margin-bottom: var(--s-3); }
.redo-chip-ok { font-size: var(--fs-xs); }

.redo-form {
    flex: 1 1 100%;
    margin-top: var(--s-2);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--danger-bd);
    border-radius: var(--r-md);
}
.redo-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
    padding: var(--s-2) 0;
}
.redo-row + .redo-row { border-top: 1px solid var(--border); }
.redo-row-op { flex: 0 0 170px; font-weight: 700; font-size: var(--fs-md); }
.redo-row-tipo { font-weight: 400; color: var(--text-muted); font-size: var(--fs-sm); }
.redo-row-nota { color: var(--text-muted); font-size: var(--fs-sm); }
.redo-just { flex: 1 1 100%; margin: var(--s-1) 0 0; }
.redo-just .closing-relato { min-height: 56px; margin-top: 6px; font-weight: 400; }
.redo-form-erro {
    margin-top: var(--s-2);
    padding: var(--s-2) var(--s-3);
    background: var(--danger-bg); color: var(--danger-fg);
    border: 1px solid var(--danger-bd); border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}
.redo-form-acoes { display: flex; justify-content: flex-end; margin-top: var(--s-3); }
@media (max-width: 600px) { .redo-row-op { flex-basis: 100%; } }

.aviso-versao {
    position: fixed; left: 50%; bottom: var(--s-6); transform: translateX(-50%);
    z-index: 1090;
    display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3);
    max-width: min(560px, calc(100% - 2 * var(--s-4)));
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    font-size: var(--fs-md);
}
.aviso-versao > i { color: var(--info-fg); }
.redo-chip:hover { background: var(--danger-safe); color: #fff; border-color: var(--danger-safe); }

.errors-panel {
    background: var(--warning-bg);
    border: 1px solid var(--warning-bd);
    border-left: 4px solid var(--warning);
    border-radius: var(--r-md);
    padding: var(--s-4);
    margin-bottom: var(--s-4);
}
.errors-panel-title { margin: 0 0 var(--s-3); color: var(--warning-fg); font-size: var(--fs-md); font-weight: 700; }
.errors-panel-fatal { background: var(--danger-bg); border-color: var(--danger-bd); border-left-color: var(--danger); color: var(--danger-fg); }
.errors-panel-line { margin-bottom: var(--s-2); }
.errors-panel-line:last-child { margin-bottom: 0; }

.ai-error-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s-2); }
.ai-error {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
}
.ai-error > strong { font-size: var(--fs-md); color: var(--text); }
.ai-error em { color: var(--text-muted); font-style: normal; font-size: var(--fs-xs); }
.ai-error-desc { display: block; margin-top: var(--s-1); font-size: var(--fs-md); color: var(--text-soft); }
.ai-error-conf {
    display: inline-block; margin-left: var(--s-1);
    padding: 1px var(--s-2);
    background: var(--surface-3); color: var(--text-soft);
    border-radius: var(--r-full); font-size: var(--fs-xs);
}
.ai-error-origem {
    display: inline-block; margin-left: var(--s-1);
    padding: 1px var(--s-2);
    background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd);
    border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600;
}
.ai-error-extra {
    margin-top: var(--s-2);
    padding: var(--s-2) var(--s-3);
    background: var(--surface-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--text-soft);
}
.ai-error-extra strong { color: var(--text); }

.ai-error-feedback { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-2); }
.fb-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    color: var(--text-soft);
    font-size: var(--fs-xs); font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.fb-btn:hover { border-color: var(--text-muted); }
.ai-error[data-verdict="procede"] .fb-procede { background: var(--success-safe); border-color: var(--success-safe); color: #fff; }
.ai-error[data-verdict="nao_procede"] .fb-nao-procede { background: var(--danger-safe); border-color: var(--danger-safe); color: #fff; }
.ai-error[data-verdict="procede"] .fb-nao-procede,
.ai-error[data-verdict="nao_procede"] .fb-procede { opacity: .45; }

.fb-motivo { display: none; align-items: center; gap: 6px; margin-top: var(--s-2); font-size: var(--fs-sm); }
.ai-error[data-verdict="nao_procede"] .fb-motivo { display: flex; flex-wrap: wrap; }
.fb-motivo label { margin: 0; color: var(--text-muted); white-space: nowrap; }
.fb-motivo-input {
    flex: 1 1 220px; max-width: 460px;
    padding: 3px var(--s-2);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}
.fb-motivo-input:focus { outline: none; border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.fb-motivo-status { min-width: 3em; font-size: var(--fs-xs); color: var(--success-fg); }

.fb-locked { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.fb-seal {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px var(--s-3);
    border: 1px solid transparent; border-radius: var(--r-full);
    font-size: var(--fs-xs); font-weight: 600;
}
.fb-seal-real  { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.fb-seal-falso { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.fb-seal-none  { background: var(--surface-3);  color: var(--text-muted); border-color: var(--border); }
.fb-locked-motivo { font-size: var(--fs-sm); color: var(--text-muted); }

.closing-card {
    margin-top: var(--s-4);
    padding: var(--s-4) var(--s-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
}
.closing-title {
    display: flex; align-items: center; gap: var(--s-2);
    margin: 0 0 var(--s-3);
    font-size: var(--fs-lg); font-weight: 700; color: var(--text);
}
.closing-title i { color: var(--primary); }

.closing-q { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-3); }
.closing-q-label { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.closing-pills { display: flex; gap: var(--s-2); }
.closing-pill {
    min-width: 64px;
    padding: 6px var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    color: var(--text-soft);
    font-size: var(--fs-md); font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.closing-pill:hover { border-color: var(--primary); color: var(--link); }
.closing-pill-no.active  { background: var(--success-safe); border-color: var(--success-safe); color: #fff; }
.closing-pill-yes.active { background: var(--warning); border-color: #d97706; color: #422006; }

.closing-missed { display: none; margin-bottom: var(--s-3); }
.closing-missed.closing-missed-open { display: block; }

.closing-form { display: block; }
.closing-label { display: block; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft); }
.closing-relato {
    width: 100%;
    min-height: 84px;
    padding: var(--s-3);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: var(--fs-md);
    line-height: var(--lh);
    resize: vertical;
}
.closing-relato:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(244,83,11,.16); }
.closing-meta {
    display: flex; justify-content: space-between; gap: var(--s-3);
    margin: var(--s-1) 0 var(--s-3);
    font-size: var(--fs-xs); color: var(--text-muted);
}
.closing-count-ok { color: var(--success-fg); }
.closing-error {
    margin-bottom: var(--s-3);
    padding: var(--s-2) var(--s-3);
    background: var(--danger-bg); color: var(--danger-fg);
    border: 1px solid var(--danger-bd); border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}
.closing-error.closing-error-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.closing-warning { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); }

.closing-card-ro { border-left-color: var(--success); }
.closing-card-alheia { border-left-color: var(--border-strong); }
.closing-alheia-nota { margin: 0 0 var(--s-2); font-size: var(--fs-sm); color: var(--text-muted); }
.closing-ro-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
.closing-ro-block { flex-direction: column; }
.closing-ro-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.closing-ro-value { font-size: var(--fs-sm); font-weight: 700; }
.closing-ro-yes { color: var(--warning-fg); }
.closing-ro-no  { color: var(--success-fg); }
.closing-ro-relato {
    margin: var(--s-1) 0 0;
    padding: var(--s-3);
    background: var(--surface-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-md);
    color: var(--text-soft);
    white-space: pre-wrap;
}
.closing-ro-empty { color: var(--text-muted); font-style: italic; }
.closing-ro-foot { margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--text-muted); }
.closing-ro-missed { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }

.closing-blind {
    display: flex; align-items: baseline; gap: var(--s-2);
    margin: 0 0 var(--s-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.closing-blind i { color: var(--info); }

.missed-errors-box {
    margin-top: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}
.missed-errors-list { margin: 0 0 var(--s-2); padding-left: var(--s-5, 20px); }
.missed-errors-list li { margin-bottom: 6px; font-size: var(--fs-md); color: var(--text-soft); }
.missed-errors-list strong { color: var(--text); }
.me-remove {
    border: none; background: none; color: var(--danger);
    font-size: var(--fs-lg); line-height: 1; cursor: pointer; padding: 0 var(--s-1);
}
.me-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-full);
    color: var(--text-soft);
    font-size: var(--fs-sm); font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}
.me-toggle:hover { border-color: var(--primary); color: var(--link); }
.me-form { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-3); }
.me-form select, .me-form input {
    padding: 5px var(--s-2);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}
.me-form .me-desc { flex: 1 1 260px; min-width: 200px; }
.me-save {
    padding: 5px var(--s-4);
    background: var(--warning); border: 1px solid #d97706;
    border-radius: var(--r-sm);
    color: #422006; font-size: var(--fs-sm); font-weight: 600;
    cursor: pointer;
}
.me-save:disabled { opacity: .6; }
.me-empty-locked { margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--text-muted); font-style: italic; }

.fb-flags { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.fb-flag {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 7px;
    border: 1px solid transparent; border-radius: var(--r-full);
    font-size: var(--fs-xs); font-weight: 600; line-height: 1;
}
.fb-flag-fp { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.fb-flag-fn { background: var(--violet-bg);  color: var(--violet-fg);  border-color: var(--violet-bd); }
.fb-flag-ok { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.fb-flag-none { color: var(--text-muted); font-size: var(--fs-sm); }

.analysis-details-container {
    margin: var(--s-4) 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.analysis-details-summary {
    display: flex; align-items: center; gap: var(--s-2);
    padding: var(--s-3) var(--s-4);
    background: var(--surface-2);
    color: var(--text);
    font-size: var(--fs-md); font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.analysis-details-summary::-webkit-details-marker { display: none; }
.analysis-details-summary::before {
    content: "\f054";
    font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7em;
    color: var(--text-muted);
    transition: transform var(--t);
}
details[open] > .analysis-details-summary::before { transform: rotate(90deg); }
.analysis-details-summary:hover { background: var(--surface-3); }
.analysis-toggle-hint { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
.analysis-details-body { padding: var(--s-4); }
.analysis-detail-row {
    display: flex; justify-content: space-between; gap: var(--s-4);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.analysis-detail-row:last-child { border-bottom: none; }
.analysis-detail-value { color: var(--text); font-weight: 600; text-align: right; }
.analysis-files-block {
    margin-bottom: var(--s-4);
    padding: var(--s-3);
    background: var(--surface-2);
    border-radius: var(--r-sm);
}
.analysis-files-title { margin-bottom: var(--s-2); font-weight: 700; color: var(--text); font-size: var(--fs-sm); }
.analysis-file-tipo { color: var(--text-muted); font-size: var(--fs-xs); }
.analysis-files-missing { color: var(--danger-fg); }
.analysis-ai-title { margin-top: var(--s-4); }
.analysis-orientation-table { width: 100%; margin-top: var(--s-2); font-size: var(--fs-sm); border-collapse: collapse; }
.analysis-orientation-table thead tr { background: var(--surface-2); }
.analysis-orientation-table th {
    padding: 6px var(--s-2); text-align: left;
    color: var(--text-soft); font-size: var(--fs-xs); font-weight: 700;
    text-transform: uppercase; letter-spacing: .4px;
    border-bottom: 1px solid var(--border);
}
.analysis-orientation-table td { padding: 6px var(--s-2); border-bottom: 1px solid var(--border); color: var(--text); }
.analysis-orientation-table .orientation-inverted { color: var(--danger-fg); font-weight: 600; }
.analysis-tokens { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.analysis-token-pill {
    display: inline-flex; align-items: baseline; gap: 5px;
    padding: 3px var(--s-3);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-full);
    font-size: var(--fs-xs); color: var(--text-muted);
}
.analysis-token-pill b { font-size: var(--fs-sm); color: var(--text); font-variant-numeric: tabular-nums; }

.reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); }
@media (max-width: 640px) { .reference-grid { grid-template-columns: 1fr; } }
.reference-card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.reference-card:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--border-strong); }
.reference-card.reference-inactive { opacity: .62; }
.ref-badge-inactive {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px var(--s-2);
    background: var(--surface-3); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--r-full);
    font-size: var(--fs-xs); font-weight: 600;
}
.reference-image { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.reference-image a { display: block; width: 100%; height: 100%; }
.reference-image img { width: 100%; height: 100%; object-fit: cover; }
.reference-info { padding: var(--s-3) var(--s-4); flex: 1 1 auto; }
.reference-name { margin: 0 0 var(--s-1); font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.reference-desc { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.reference-actions {
    display: flex; flex-wrap: wrap; gap: var(--s-2);
    padding: var(--s-2) var(--s-4) var(--s-4);
}

.sel-img-row {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--border);
}
.sel-img-name { font-size: var(--fs-sm); color: var(--text); }
.sel-img-states { display: flex; gap: var(--s-1); }
.sel-state {
    padding: 3px var(--s-2);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-soft);
    font-size: var(--fs-xs);
    cursor: pointer;
    transition: all var(--t);
}
.sel-state:hover { border-color: var(--text-muted); }
.sel-state.active.sel-state-def { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.sel-state.active.sel-state-exc { background: var(--danger-safe);  border-color: var(--danger-safe);  color: #fff; }
.sel-state.active.sel-state-inc { background: var(--success-safe); border-color: var(--success-safe); color: #fff; }
.sel-img-section { margin-bottom: var(--s-4); }
.sel-img-section-title {
    display: flex; align-items: center; gap: var(--s-2);
    margin-bottom: var(--s-2);
    font-size: var(--fs-sm); font-weight: 700; color: var(--text-soft);
    text-transform: uppercase; letter-spacing: .4px;
}
.sel-img-section-bulk { margin-left: auto; display: flex; gap: var(--s-1); }
.sel-img-section-bulk .sel-state { font-size: 11px; }
.sel-img-section-rows { display: block; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.sel-img-section-rows .sel-img-row:last-child { border-bottom: none; }
.sel-img-none { font-size: var(--fs-sm); color: var(--text-muted); }

.dash-section-label {
    display: flex; align-items: baseline; gap: var(--s-2);
    margin: var(--s-8) 0 var(--s-3);
    font-size: var(--fs-sm); font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .6px;
}
.dash-section-label small { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-muted); }

.stat-card { height: 100%; }
.stat-card .card-body { padding: var(--s-4); }
.stat-card .stat-label {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: var(--s-1);
    font-size: var(--fs-xs); font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px;
}
.stat-card .stat-value { font-size: var(--fs-3xl); font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-card .stat-hint { margin-top: var(--s-1); font-size: var(--fs-xs); color: var(--text-muted); }

.qual-value-bad  { color: var(--danger-fg); }
.qual-value-warn { color: var(--warning-fg); }
.qual-value-good { color: var(--success-fg); }
.qual-filters, .dash-periodo { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.qual-filters { align-items: flex-end; margin-bottom: var(--s-1); }
.qual-filters label, .dash-periodo label { display: block; margin-bottom: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
.qual-filters input, .qual-filters select,
.dash-periodo input, .dash-periodo select {
    padding: 5px var(--s-2);
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    font-size: var(--fs-sm);
}

.dash-periodo {
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.dash-periodo label { margin: 0; }
.dash-periodo-label { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dash-periodo [hidden] { display: none !important; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}
.kpi[open] { grid-column: 1 / -1; }

.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    transition: border-color var(--t), box-shadow var(--t);
}
.kpi:hover { border-color: var(--border-strong); }
.kpi[open] { border-color: var(--primary); box-shadow: var(--sh-2); }
.kpi > summary {
    display: grid;
    grid-template-areas: "rotulo abrir" "valor abrir" "dica abrir";
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px var(--s-2);
    padding: var(--s-4);
    cursor: pointer;
    list-style: none;
    border-radius: var(--r-md);
}
.kpi > summary::-webkit-details-marker { display: none; }
.kpi > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi-label {
    grid-area: rotulo;
    display: flex; align-items: center; gap: 6px;
    font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px;
}
.kpi-label i { color: var(--primary); }
.kpi-value {
    grid-area: valor;
    font-size: var(--fs-3xl); font-weight: 700; color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.kpi-duplo { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.kpi-duplo > span { display: inline-flex; flex-direction: column; }
.kpi-duplo small { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.kpi-hint { grid-area: dica; font-size: var(--fs-xs); color: var(--text-muted); }
.kpi-abrir {
    grid-area: abrir;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--r-full);
    color: var(--text-muted);
    transition: transform var(--t), border-color var(--t), color var(--t);
}
.kpi-abrir::before { content: '\25BC'; font-size: 9px; }
.kpi[open] .kpi-abrir { transform: rotate(180deg); border-color: var(--primary); color: var(--link); }
.kpi-corpo { padding: 0 var(--s-4) var(--s-4); border-top: 1px solid var(--border); padding-top: var(--s-4); }

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}
.mini-grid > div {
    padding: var(--s-3);
    background: var(--surface-2);
    border-radius: var(--r-sm);
}
.mini-label { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 2px; }
.mini-value { display: block; font-size: var(--fs-xl); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-sub {
    margin: var(--s-4) 0 var(--s-2);
    font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px;
}
.kpi-corpo .dash-sub:first-child { margin-top: 0; }

.dash-fold > summary {
    cursor: pointer;
    font-size: var(--fs-sm); font-weight: 600; color: var(--link);
    list-style: none;
    padding: var(--s-1) 0;
}
.dash-fold > summary::-webkit-details-marker { display: none; }
.dash-fold > summary::before { content: '\25B8 '; display: inline-block; transition: transform var(--t); }
.dash-fold[open] > summary::before { transform: rotate(90deg); }
.dash-fold > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.dash-fold-card {
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-top: var(--s-4);
}
.dash-bloco { margin-top: var(--s-4); }

.g-wrap { width: 100%; }
.g-svg { display: block; width: 100%; height: auto; overflow: visible; }
.g-grade { stroke: var(--border); stroke-width: 1; }
.g-eixo { fill: var(--text-muted); font-size: 10px; }
.g-legenda { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.g-legenda-item { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.g-legenda-item i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.gh { display: block; }
.gh-linha { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: var(--s-2); padding: 3px 0; }
.gh-rotulo {
    font-size: var(--fs-xs); color: var(--text-soft);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gh-barra { display: flex; height: 14px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.gh-parte { display: block; height: 100%; }

.g-c-fp     { fill: var(--danger-safe);  background: var(--danger-safe); }
.g-c-ok     { fill: var(--success-safe); background: var(--success-safe); }
.g-c-fn     { fill: var(--warning);      background: var(--warning); }
.g-c-exp    { fill: var(--primary);      background: var(--primary); }
.g-c-op     { fill: var(--info);         background: var(--info); }
.gh-total { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

.redo-resposta-quem { font-size: var(--fs-xs); color: var(--text-muted); margin-left: var(--s-1); }
.redo-resposta-texto { display: block; margin-top: var(--s-1); color: var(--text); white-space: pre-wrap; }

.relato-item { padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.relato-item:last-child { border-bottom: none; }
.relato-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-1); }
.relato-op { font-weight: 700; color: var(--text); }
.relato-when { font-size: var(--fs-xs); color: var(--text-muted); margin-left: auto; }
.relato-texto {
    margin: 0; font-size: var(--fs-sm); color: var(--text-soft);
    white-space: pre-wrap;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.relato-item.relato-open .relato-texto { -webkit-line-clamp: unset; }
.relato-toggle {
    margin-top: var(--s-1); padding: 0;
    background: none; border: none; color: var(--link);
    font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}

.operator-reminders {
    margin-top: var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--info-bg);
    color: var(--info-fg);
    border: 1px solid var(--info-bd);
    border-left: 4px solid var(--info);
    border-radius: var(--r-md);
}
.operator-reminders h6 { margin: 0 0 var(--s-2); font-size: var(--fs-md); font-weight: 700; }
.operator-reminders ul { margin: 0; padding-left: var(--s-5, 20px); }
.operator-reminders li { margin-bottom: var(--s-1); font-size: var(--fs-sm); }

.discussion-title { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.discussion-item {
    margin-bottom: var(--s-3);
    padding: var(--s-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.discussion-item .discussion-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.discussion-item .discussion-message-box {
    margin-top: var(--s-2); padding: var(--s-2) var(--s-3);
    background: var(--surface); border-radius: var(--r-sm);
}
.discussion-item .discussion-message-box strong { color: var(--text); }
.discussion-item .discussion-message-box p { margin: var(--s-1) 0 0; color: var(--text-soft); }
.discussion-item .discussion-no-errors { color: var(--success-fg); }
.discussion-item .discussion-with-errors { color: var(--danger-fg); }
.discussion-item .discussion-summary { color: var(--text-muted); }
.discussion-item ul li strong { color: var(--text); }
.discussion-item ul li em { color: var(--text-muted); }

#page-settings .card-body { padding: var(--s-6); }
#page-settings .form-check.form-switch { margin-top: var(--s-2); }
#page-settings .form-check-label { margin-left: var(--s-2); }

.sys-info-grid {
    padding: var(--s-3) var(--s-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.sys-info-row { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-1) 0; }
.sys-info-label { font-size: var(--fs-sm); color: var(--text-muted); }
.sys-info-value { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.sys-info-badge {
    padding: 2px var(--s-2);
    background: rgba(244, 83, 11, .12);
    border: 1px solid rgba(244, 83, 11, .3);
    border-radius: var(--r-full);
    color: var(--link);
    font-size: var(--fs-xs); font-weight: 700;
}

.settings-nav { position: sticky; top: calc(var(--navbar-h) + var(--s-4)); }
.settings-nav a {
    display: flex; align-items: center; gap: var(--s-2);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-sm);
    color: var(--text-soft);
    font-size: var(--fs-md);
    text-decoration: none;
    transition: background-color var(--t), color var(--t);
}
.settings-nav a:hover { background: var(--surface-2); color: var(--link); }
.settings-nav a i { width: 16px; text-align: center; color: var(--text-muted); }
@media (max-width: 991px) { .settings-nav { display: none; } }

.chave-relogio {
    display: block;
    margin-top: var(--s-1);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
    color: var(--warning-fg);
}
.chave-relogio:empty { display: none; }

code {
    padding: 1px 5px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--text);
    font-size: .92em;
}

.text-muted { color: var(--text-muted) !important; }
.lead { color: var(--text-muted); font-size: var(--fs-md); }
.card-title { color: var(--text); }
.card-text { color: var(--text-soft); }
label { color: var(--text-soft); }
pre { color: var(--text-soft); }
.spinner-border { color: currentColor; }

.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.muted-note { font-size: var(--fs-xs); color: var(--text-muted); }

.scroll-x { overflow-x: auto; }

.sg-section { margin-bottom: var(--s-8); }
.sg-section h3 {
    margin: 0 0 var(--s-2);
    font-size: var(--fs-lg); font-weight: 700; color: var(--text);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--border);
}
.sg-note { margin: 0 0 var(--s-3); font-size: var(--fs-sm); color: var(--text-muted); }
.sg-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-bottom: var(--s-3); }
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.sg-swatch {
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
    font-size: var(--fs-xs);
}
.sg-swatch-chip { height: 46px; }
.sg-swatch-name { padding: 5px var(--s-2); background: var(--surface); color: var(--text-soft); font-family: var(--font-mono); }
.sg-type-row { display: flex; align-items: baseline; gap: var(--s-3); padding: 4px 0; }
.sg-type-tag { min-width: 72px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }

.w-full { width: 100%; }
.span-all { grid-column: 1 / -1; }
.fs-xs-u { font-size: var(--fs-xs); }
.fs-sm-u { font-size: var(--fs-sm); }
.fs-md-u { font-size: var(--fs-md); }
.mb-4-u  { margin-bottom: var(--s-4); }
.mb-6-u  { margin-bottom: var(--s-6); }
.mt-3-u  { margin-top: var(--s-3); }
.mt-4-u  { margin-top: var(--s-4); }
.label-tight { margin-bottom: var(--s-1); }
.field-ok { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--success-fg); }
.pin-mono { font-family: var(--font-mono); letter-spacing: 1px; }
.switch-lg { width: 3rem; height: 1.5rem; cursor: pointer; }
.select-narrow { max-width: 220px; }
.select-xnarrow { max-width: 200px; }
.grow-240 { flex: 1 1 240px; min-width: 240px; }
.form-block-title {
    display: flex; align-items: center; gap: var(--s-2);
    margin-bottom: var(--s-4);
    font-size: var(--fs-md); font-weight: 700; color: var(--text);
}
.form-block-title i { color: var(--primary); }
.card-grid     { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }
.card-grid-sm  { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-4); }
.user-card-topo   { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-2); margin-bottom: var(--s-3); }
.user-card-info   { flex: 1 1 auto; min-width: 0; }
.user-card-info .card-title { margin-bottom: var(--s-1); overflow-wrap: anywhere; }
.user-card-email  { font-size: .85rem; margin-bottom: var(--s-2); overflow-wrap: anywhere; }
.user-card-chips  { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); flex-shrink: 0; }
.user-card-acoes  { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.card.user-card-inativo { border-left-color: var(--border); background: var(--surface-2); }
.modal-w-md  { max-width: 800px; }
.modal-w-lg  { max-width: 920px; }
.modal-w-xl  { max-width: 960px; }
.modal-scroll-70 { max-height: 70vh; overflow-y: auto; }

.chip-tipo-op       { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-bd); }
.chip-tipo-exportado{ background: var(--info-bg);   color: var(--info-fg);   border-color: var(--info-bd); }
.chip-prompt-default{ background: var(--success-bg);color: var(--success-fg);border-color: var(--success-bd); margin-left: var(--s-2); }
.chip-prompt-inativo{ background: var(--warning-bg);color: var(--warning-fg);border-color: var(--warning-bd); margin-left: var(--s-1); }
.ref-thumb-empty { font-size: var(--fs-3xl); color: var(--border-strong); }
.status-off { color: var(--danger-fg); }
.status-on  { color: var(--success-fg); }
.card-accent-primary { border-left: 4px solid var(--primary); }
.card-accent-success { border-left: 4px solid var(--success-fg); }
.user-secoes { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-2); }
.chip-mini { font-size: var(--fs-xs); padding: 1px var(--s-2); }
.secoes-grupo { border: 0; padding: 0; margin: 0 0 var(--s-3); min-width: 0; }
.secoes-grupo legend { float: none; width: 100%; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--s-1); }
.secoes-grupo .form-check { margin-bottom: var(--s-1); }
.upload-picked {
    padding: var(--s-2);
    background: var(--success-bg);
    color: var(--success-fg);
    border: 1px solid var(--success-bd);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
}
.upload-picked-row { display: flex; justify-content: space-between; gap: var(--s-2); padding: 2px 0; }
.upload-picked-size { opacity: .75; font-variant-numeric: tabular-nums; }
.divider-top { border-top: 1px solid var(--border); padding-top: var(--s-3); margin-top: var(--s-3); }
.prompt-preview {
    margin: var(--s-3) 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.selector-opt-row {
    display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
    padding: var(--s-2) var(--s-3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
}
.selector-group-card { margin-bottom: var(--s-4); }
.selector-group-body { padding: var(--s-4) 20px; }
.selector-group-head {
    display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
    margin-bottom: var(--s-3);
}
.selector-group-name { font-size: var(--fs-lg); }
.selector-opt-list { display: flex; flex-direction: column; gap: var(--s-2); }
.selector-opt-name { font-weight: 600; }
.selector-opt-actions { display: flex; gap: 6px; margin-left: auto; }
.btn-edit-xs { padding: 2px var(--s-2); font-size: var(--fs-xs); }
.selector-edit-form { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; width: 100%; }
.selector-input { max-width: 240px; }
.selector-select { max-width: 180px; }
.modal-w-sm { max-width: 480px; }
.dialogo-casa { display: flex; z-index: 1080; }
.dialogo-texto { margin: 0; white-space: pre-line; }
.text-brand { color: var(--link); }

.proc-card {
    margin-bottom: var(--s-4);
    padding: var(--s-4);
    background: var(--info-bg);
    color: var(--info-fg);
    border: 1px solid var(--info-bd);
    border-left: 4px solid var(--info);
    border-radius: var(--r-md);
}
.proc-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3);
    font-weight: 700; font-size: var(--fs-md);
    margin-bottom: var(--s-2);
}
.proc-label { font-size: var(--fs-sm); color: inherit; }
.proc-hint { font-size: var(--fs-xs); opacity: .75; }
.proc-step-pending { opacity: .5; }

body.login-page {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
    padding: var(--s-6) var(--s-4);
    background:
        radial-gradient(ellipse 70% 55% at 15% 0%, rgba(244, 83, 11, .16), transparent),
        radial-gradient(ellipse 60% 45% at 90% 100%, rgba(2, 170, 57, .12), transparent),
        var(--ink);
    font-family: var(--font);
}

.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: var(--s-8);
    background: #fff;
    color: var(--n-900);
    border-radius: var(--r-lg);
    box-shadow: 0 12px 44px rgba(0, 0, 0, .4);
    overflow: hidden;
}
.login-container::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--brand-gradient);
}

.login-header { text-align: center; margin-bottom: var(--s-8); }
.login-logo {
    height: 96px; width: auto;
    margin-bottom: var(--s-3);
    background: #fff;
    border-radius: var(--r-sm);
}
.login-header h1 { margin: 0 0 var(--s-1); font-size: var(--fs-2xl); font-weight: 700; color: var(--n-900); }
.login-header p { margin: 0; font-size: var(--fs-md); color: var(--n-700); }

.login-container .form-group { margin-bottom: var(--s-4); }
.login-container .form-group label {
    display: block; margin-bottom: 6px;
    font-size: var(--fs-sm); font-weight: 600; color: var(--n-700);
}
.login-container .form-group input {
    width: 100%;
    min-height: 44px;
    padding: var(--s-3);
    background: #fff;
    color: var(--n-900);
    border: 1px solid var(--n-300);
    border-radius: var(--r-sm);
    font-size: var(--fs-lg);
    transition: border-color var(--t), box-shadow var(--t);
}
.login-container .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 83, 11, .18);
}

.btn-login {
    width: 100%;
    min-height: 46px;
    background: var(--primary-safe);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: var(--fs-lg); font-weight: 700;
    cursor: pointer;
    transition: background-color var(--t), box-shadow var(--t), transform var(--t);
}
.btn-login:hover { background: #b53b03; box-shadow: 0 6px 20px rgba(244, 83, 11, .32); }
.btn-login:active { transform: translateY(1px); }

.login-container .error-message,
.login-container .info-message {
    margin-bottom: var(--s-4);
    padding: var(--s-3);
    border: 1px solid;
    border-radius: var(--r-sm);
    font-size: var(--fs-md);
}
.login-container .error-message { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.login-container .info-message  { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

.dois-fatores-bloco { margin-bottom: var(--s-4); font-size: var(--fs-md); color: var(--n-700); }
.dois-fatores-bloco p { margin: 0 0 var(--s-3); }
.dois-fatores-qr { display: flex; justify-content: center; margin: var(--s-3) 0; background: #fff; }
.dois-fatores-qr svg { width: 200px; height: 200px; }
.login-container code { background: var(--n-100); color: var(--n-900); border-color: var(--n-300); word-break: break-all; }
.dois-fatores-codigos {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2);
    margin: var(--s-3) 0 0; padding: 0; list-style: none;
}
.dois-fatores-codigos code { display: block; text-align: center; font-size: var(--fs-lg); }
.dois-fatores-continuar {
    display: flex; align-items: center; justify-content: center; gap: var(--s-2);
    text-decoration: none;
}
.dois-fatores-continuar:hover { color: #fff; }

.admin-menu { position: relative; }
.admin-menu-button {
    background: none; border: none;
    display: inline-flex; align-items: center; gap: var(--s-2);
    cursor: pointer;
}
.admin-menu .dropdown-menu-custom { left: 0; right: auto; min-width: 220px; }
.admin-menu .dropdown-menu-custom a.active { background: var(--surface-2); color: var(--link); }

.info-grid { display: flex; flex-direction: column; gap: var(--s-1); }
.info-item {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
    padding: var(--s-2) 0;
    border-bottom: 1px solid var(--border);
}
.info-item:last-child { border-bottom: none; }
.info-item label {
    margin: 0;
    font-size: var(--fs-xs); font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .4px;
}
.info-item value {
    display: block;
    font-size: var(--fs-md); font-weight: 600;
    color: var(--text);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chip-pending-verdict, .badge-completed-pending {
    background: var(--surface-3);
    color: var(--text-soft);
    border-color: var(--border-strong);
}

#result-container,
#result-container-op,
#discuss-container,
#discuss-container-op,
#operator-reminders,
.operator-reminders {
    margin-top: var(--s-6);
}

#result-container > * + *,
#result-container-op > * + *,
.modal-body-custom > * + * {
    margin-top: var(--s-4);
}

.closing-card { margin-top: var(--s-6); }

.alert-custom + *, .errors-panel + *, .analysis-details-container + * {
    margin-top: var(--s-4);
}

.closing-hint { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.sys-info-badge-version { font-variant-numeric: tabular-nums; letter-spacing: .3px; }

.modal-content-custom > form {
    display: flex; flex-direction: column;
    min-height: 0; flex: 1 1 auto;
}

.ui-nativo {
    position: absolute !important;
    width: 1px !important; height: 1px !important; min-height: 0 !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important;
    opacity: 0 !important; pointer-events: none !important;
    overflow: hidden; clip-path: inset(50%);
}
.ui-select, .ui-data { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.ui-select.ui-bloco, .ui-data.ui-bloco { display: block; width: 100%; }
.ui-select-botao {
    display: block; width: 100%;
    text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 2.25rem !important;
    cursor: pointer;
}
.ui-select::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7rem;
    position: absolute; top: 50%; right: .85rem; transform: translateY(-50%);
    color: var(--text-soft); pointer-events: none;
    transition: transform var(--t);
}
.ui-select:has(.ui-select-botao[aria-expanded="true"])::after { transform: translateY(-50%) rotate(180deg); }
.ui-select-botao { background-image: none !important; }
.ui-select-botao[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(244, 83, 11, .16); }
.ui-select-botao:disabled { cursor: not-allowed; background-color: var(--surface-3); color: var(--text-muted); }
.ui-select:not(.ui-bloco) .ui-select-botao { width: auto; min-width: 9rem; }

.ui-painel {
    position: fixed; z-index: 3000;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
}

.ui-select-lista {
    list-style: none; margin: 0; padding: var(--s-1);
    max-height: min(320px, calc(100vh - 16px)); overflow-y: auto;
    outline: none;
}
.ui-opcao {
    display: flex; align-items: center; gap: var(--s-2);
    padding: 7px var(--s-3) 7px var(--s-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-md); white-space: nowrap;
    cursor: pointer;
}
.ui-opcao-marca { width: 14px; flex: 0 0 14px; font-size: .8em; color: var(--link); visibility: hidden; }
.ui-opcao[aria-selected="true"] { font-weight: 600; color: var(--link); }
.ui-opcao[aria-selected="true"] .ui-opcao-marca { visibility: visible; }
.ui-opcao-ativa { background: var(--surface-3); }
.ui-opcao-desativada { color: var(--text-muted); cursor: not-allowed; }

.ui-data-texto { padding-right: 2.5rem !important; }
.ui-data:not(.ui-bloco) .ui-data-texto { width: 10.5rem; }
.ui-data-botao {
    position: absolute; top: 1px; right: 1px; bottom: 1px; width: 2.25rem;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-soft); cursor: pointer;
}
.ui-data-botao:hover, .ui-data-botao[aria-expanded="true"] { color: var(--link); }
.ui-data-botao:disabled { cursor: not-allowed; color: var(--text-muted); }

.ui-calendario { width: 288px; padding: var(--s-3); }
.ui-cal-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-2); }
.ui-cal-titulo { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.ui-cal-nav {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: var(--r-sm);
    color: var(--text-soft); cursor: pointer;
}
.ui-cal-nav:hover { background: var(--surface-3); color: var(--text); }
.ui-cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ui-cal-semana {
    padding: 4px 0; text-align: center; text-decoration: none;
    font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
    cursor: default;
}
.ui-dia {
    height: 34px;
    background: none; border: 0; border-radius: var(--r-sm);
    font-size: var(--fs-sm); color: var(--text);
    cursor: pointer;
}
.ui-dia:hover { background: var(--surface-3); }
.ui-dia-fora { color: var(--text-muted); }
.ui-dia-hoje { box-shadow: inset 0 0 0 1px var(--primary); font-weight: 700; }
.ui-dia-escolhido, .ui-dia-escolhido:hover { background: var(--primary-safe); color: #fff; font-weight: 700; }
.ui-dia:disabled { background: none; color: var(--text-muted); opacity: .5; cursor: not-allowed; }
.ui-cal-rodape {
    display: flex; justify-content: space-between;
    margin-top: var(--s-2); padding-top: var(--s-2);
    border-top: 1px solid var(--border);
}
.ui-cal-rodape button {
    padding: 4px var(--s-2);
    background: none; border: 0; border-radius: var(--r-sm);
    font-size: var(--fs-sm); font-weight: 600; color: var(--link);
    cursor: pointer;
}
.ui-cal-rodape button:hover { background: var(--surface-3); }
.ui-cal-rodape button:disabled { color: var(--text-muted); cursor: not-allowed; }
.ui-dia:focus-visible, .ui-cal-nav:focus-visible, .ui-cal-rodape button:focus-visible, .ui-data-botao:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 1px;
}
@media (max-width: 400px) { .ui-calendario { width: calc(100vw - 16px); } }

.api-cartoes {
    display: grid; grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4); align-items: start; margin-bottom: var(--s-4);
}
.api-coluna { display: contents; }
@media (min-width: 860px) {
    .api-cartoes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .api-coluna { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
}
#gemini-model-card { order: 1; }
#api-key-card { order: 2; }
#api-cartao-imagens { order: 3; }
#api-cartao-resposta { order: 4; }
#api-cartao-conferencia { order: 5; }
#api-cartao-gasto { order: 6; }
.api-cartao { width: 100%; margin: 0; }
.api-mais-grade { display: grid; grid-template-columns: 1fr; gap: var(--s-4); align-items: start; margin-bottom: var(--s-4); }
@media (min-width: 1100px) { .api-mais-grade { grid-template-columns: 1fr 1fr; } }
.api-modelo-ajustes { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--border); }
.api-raciocinio { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); }
@media (max-width: 575px) { .api-raciocinio { grid-template-columns: 1fr; } }
.api-cartao .card-body { padding: var(--s-3) var(--s-4); }
.api-nota, .api-gasto-linha { margin: 0 0 var(--s-2); font-size: var(--fs-sm); color: var(--text-soft); }
.api-acoes { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.api-preview > summary, .api-mais > summary {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
    cursor: pointer; list-style: none;
}
.api-preview > summary::-webkit-details-marker, .api-mais > summary::-webkit-details-marker { display: none; }
.api-preview-seta { transition: transform var(--t); }
.api-preview[open] .api-preview-seta, .api-mais[open] > summary .api-preview-seta { transform: rotate(180deg); }
.api-preview:not([open]) > summary, .api-mais:not([open]) > summary { border-bottom: 0; }
.ajuste-item { padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
.ajuste-item:last-child { border-bottom: 0; }
.ajuste-cabeca {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s-3); flex-wrap: wrap;
}
.ajuste-rotulo { margin: 0; font-weight: 600; color: var(--text); }
.ajuste-controle { display: flex; align-items: center; gap: var(--s-2); margin: 0; }
.ajuste-controle .form-check { margin: 0; min-height: 0; }
.ajuste-num { width: 8rem; }
.ajuste-texto { width: min(100%, 16rem); }
.ajuste-controle .form-select { width: auto; min-width: 10rem; }
.ajuste-unidade { font-size: var(--fs-sm); color: var(--text-muted); }
.ajuste-multi { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.ajuste-multi label { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text); }
.ajuste-rodape {
    display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
    margin-top: var(--s-1); font-size: var(--fs-xs); color: var(--text-muted);
}
.ajuste-rodape:not(:has(.chip)):has(.ajuste-status:empty) { display: none; }
.ajuste-voltar {
    padding: 0; background: none; border: 0;
    font-size: var(--fs-xs); font-weight: 600; color: var(--link); cursor: pointer;
}
.ajuste-voltar:hover { text-decoration: underline; }
.ajuste-voltar:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ajuste-status-ok { color: var(--success-fg); }
.ajuste-status-erro { color: var(--danger-fg); font-weight: 600; }

.pers-linha {
    display: flex; align-items: flex-start; gap: var(--s-3);
    padding: var(--s-3) 0; border-bottom: 1px solid var(--border);
}
.pers-linha:last-child { border-bottom: 0; }
.pers-icone {
    flex: 0 0 auto; width: 2.25rem; height: 2.25rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-full); background: var(--surface-3); color: var(--text-soft);
}
.pers-texto { flex: 1 1 auto; min-width: 0; }
.pers-nome { margin: 0; font-weight: 600; color: var(--text); }
.pers-ajuda { margin: var(--s-1) 0 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--text-soft); }
.pers-chips { display: flex; gap: var(--s-1); flex-wrap: wrap; margin-top: var(--s-2); }
.pers-controle { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); }
.pers-controle .form-check { margin: 0; min-height: 0; }
.pers-checagens { margin: var(--s-2) 0 0; padding-left: var(--s-4); columns: 2 16rem; color: var(--text); }
.pers-checagens li { margin-bottom: var(--s-1); }

.errors-panel.obs-bloco { background: var(--surface-2); border-color: var(--border); border-left-color: var(--border-strong); }
.obs-bloco { margin-top: var(--s-3); }
.obs-bloco .errors-panel-title { color: var(--text); }
.obs-titulo { margin: 0 0 var(--s-1); font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.obs-ajuda { margin: 0 0 var(--s-3); font-size: var(--fs-sm); color: var(--text-soft); }
.ai-obs { border-left: 4px solid var(--border-strong); }
.ai-obs[data-verdict="nao_procede"] { background: var(--surface-2); }
.ai-obs[data-verdict="nao_procede"] .ai-error-desc { color: var(--text-muted); }
.ai-error[data-verdict="nao_procede"] .fb-descartar { background: var(--surface-3); border-color: var(--text-muted); color: var(--text); }
.ai-error[data-verdict="procede"] .fb-descartar { opacity: .45; }
.fb-seal-descartada { background: var(--surface-3); color: var(--text-soft); border-color: var(--border); }
.obs-contagem { margin-left: var(--s-1); font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }

.aviso-linha {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
    padding: var(--s-3) 0; border-bottom: 1px solid var(--border);
}
.aviso-linha:last-child { border-bottom: 0; }
.aviso-corpo { flex: 1 1 auto; min-width: 0; }
.aviso-texto { margin: 0; color: var(--text); font-size: var(--fs-md); line-height: 1.45; }
.aviso-acoes { flex: 0 0 auto; display: flex; gap: var(--s-1); }
.aviso-acao {
    width: 2rem; height: 2rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--text-soft);
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    cursor: pointer; transition: background-color var(--t), color var(--t);
}
.aviso-acao:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.aviso-acao:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.aviso-acao:disabled { opacity: .4; cursor: default; }
.aviso-acao-remover:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }

.agente-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@media (max-width: 900px) { .agente-layout { grid-template-columns: minmax(0, 1fr); } }
.agente-lateral-topo { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); }
.agente-lista { padding: var(--s-2); max-height: 70vh; overflow-y: auto; }
.agente-lista.empty-state { padding: var(--s-6) var(--s-3); }
.agente-conversa { display: flex; align-items: center; gap: var(--s-1); border-radius: var(--r-sm); }
.agente-conversa.ativa { background: var(--surface-3); }
.agente-conversa-abrir {
    flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px;
    padding: var(--s-2); border: 0; border-radius: var(--r-sm); background: transparent;
    color: var(--text); text-align: left; cursor: pointer;
}
.agente-conversa-abrir:hover { background: var(--surface-2); }
.agente-conversa-abrir:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.agente-conversa-titulo { font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agente-chat { min-width: 0; }
.agente-chat-topo { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.agente-chat-nome { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.agente-mensagens { display: flex; flex-direction: column; gap: var(--s-4); max-height: 70vh; overflow-y: auto; }
.agente-msg { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); background: var(--surface); min-width: 0; }
.agente-msg-admin { background: var(--surface-2); align-self: flex-end; max-width: 85%; }
.agente-msg-papel { display: flex; align-items: center; gap: var(--s-1); margin-bottom: var(--s-2); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.agente-msg-texto { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: var(--fs-md); }
.agente-md { color: var(--text); font-size: var(--fs-md); line-height: var(--lh); overflow-wrap: anywhere; }
.agente-md p { margin: 0 0 var(--s-2); }
.agente-md ul, .agente-md ol { margin: 0 0 var(--s-2); padding-left: var(--s-6); }
.agente-md li { margin-bottom: var(--s-1); }
.agente-md .md-h { margin: var(--s-3) 0 var(--s-2); font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.agente-md > :last-child { margin-bottom: 0; }
.agente-pre {
    margin: var(--s-2) 0; padding: var(--s-2) var(--s-3); max-height: 420px; overflow: auto;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm);
    font-family: var(--font-mono); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere;
}
.agente-espera { display: flex; align-items: center; gap: var(--s-2); color: var(--text-soft); font-size: var(--fs-md); }
.agente-tempo { margin-left: var(--s-1); }
.agente-rodape { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); margin-top: var(--s-2); }
.agente-rodape:empty { display: none; }
.agente-form { padding: var(--s-4); border-top: 1px solid var(--border); }
.agente-form-acoes { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-3); }
.agente-proposta { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.agente-proposta-titulo { margin: 0 0 var(--s-2); font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.agente-relatorio { margin: 0 0 var(--s-3); padding-left: var(--s-6); color: var(--text); }
.agente-relatorio > li { margin-bottom: var(--s-3); }
.agente-relatorio-onde { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-1); }
.agente-relatorio-porque { margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--text-soft); }
.agente-trecho > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--link); margin-top: var(--s-1); }
.agente-trecho > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.agente-nota { margin-bottom: var(--s-2); padding: var(--s-2) var(--s-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: var(--fs-md); color: var(--text); }
.agente-nota > strong { display: block; margin-bottom: var(--s-1); }
.agente-regra { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--border); }
.agente-regra-titulo { margin: 0; font-weight: 600; }
.agente-regra-texto { margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--text-soft); }
.agente-diff { margin-top: var(--s-2); }
.agente-diff-corpo { margin-top: var(--s-2); max-height: 560px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.diff-linha { display: flex; gap: var(--s-2); padding: 0 var(--s-2); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-num { flex: 0 0 3.5em; text-align: right; color: var(--text-muted); user-select: none; }
.diff-sinal { flex: 0 0 1em; user-select: none; }
.diff-add { background: var(--success-bg); color: var(--success-fg); }
.diff-del { background: var(--danger-bg); color: var(--danger-fg); }
.diff-linha.diff-add .diff-num, .diff-linha.diff-del .diff-num { color: inherit; }
.diff-pulo { padding: var(--s-1) var(--s-2); font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface-2); }
.agente-salvar { margin-top: var(--s-3); }
.agente-salvar-acoes { display: flex; justify-content: flex-end; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.agente-salvo { margin: var(--s-3) 0 0; font-weight: 600; color: var(--success-fg); }
.perfil-texto { min-height: 8rem; line-height: var(--lh); }
.regras-filtros { display: flex; align-items: flex-end; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.regras-busca { flex: 1 1 14rem; }
.regra-titulo { margin: 0; font-weight: 600; color: var(--text); }
.regra-codigo { margin-right: var(--s-2); font-family: var(--font-mono); color: var(--link); }
.prompt-cartao { box-shadow: var(--sh-1); }
.prompt-cartao-titulo { margin-bottom: var(--s-1); }
.prompt-cartao-acoes { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-3); }
#prompts-arquivados > .card-grid { margin-top: var(--s-3); }
.api-provedores-titulo { margin: 0 0 var(--s-1); font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.api-chave-titulo { margin: 0 0 var(--s-2); font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.api-chave-agentes { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.api-chave-agentes fieldset { margin: 0; padding: 0; border: 0; }
.info-botao {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 24px; height: 24px; margin-left: var(--s-1); padding: 0; border: 0; border-radius: var(--r-full);
    background: transparent; color: var(--text-muted); font-size: var(--fs-md); cursor: pointer; vertical-align: middle;
}
.info-botao:hover, .info-botao[aria-expanded="true"] { background: var(--surface-3); color: var(--link); }
.info-botao:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.info-texto {
    margin: var(--s-1) 0 var(--s-3); padding: var(--s-2) var(--s-3);
    background: var(--surface-2); border-left: 3px solid var(--border-strong); border-radius: var(--r-sm);
    font-size: var(--fs-sm); line-height: 1.45; color: var(--text-soft);
}
.api-cabeca { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.api-info-linha { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-1); margin-bottom: var(--s-2); }
.ajuste-titulo { display: inline-flex; align-items: center; min-width: 0; }
.api-provedores { margin-bottom: var(--s-4); }
.api-provedores-titulo, .api-chave-titulo { display: flex; align-items: center; justify-content: space-between; }
.provedores { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s-2); }
.provedor {
    display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3);
    border: 1px solid var(--provedor-borda); border-radius: var(--r-md); background: var(--provedor-fundo);
}
.provedor-logo { display: inline-flex; flex: 0 0 auto; color: var(--text); }
.provedor-nome { font-weight: 700; color: var(--text); white-space: nowrap; }
.provedor-uso { margin-left: auto; font-size: var(--fs-xs); font-weight: 600; color: var(--text-soft); text-align: right; }
.provedor-gemini    { --provedor-fundo: rgba(71, 150, 227, .09);  --provedor-borda: rgba(71, 150, 227, .35); }
.provedor-openai    { --provedor-fundo: rgba(16, 163, 127, .09);  --provedor-borda: rgba(16, 163, 127, .35); }
.provedor-anthropic { --provedor-fundo: rgba(217, 119, 87, .11);  --provedor-borda: rgba(217, 119, 87, .40); }
body.dark-mode .provedor-gemini    { --provedor-fundo: rgba(71, 150, 227, .14); }
body.dark-mode .provedor-openai    { --provedor-fundo: rgba(16, 163, 127, .14); }
body.dark-mode .provedor-anthropic { --provedor-fundo: rgba(217, 119, 87, .16); }
.card-header .info-botao i { color: inherit; }
.api-chave-agentes legend { float: none; width: 100%; margin-bottom: var(--s-2); }
.api-chave-agentes .form-check { display: flex; align-items: center; gap: var(--s-2); min-height: 0; margin-bottom: var(--s-2); padding-left: 0; }
.api-chave-agentes .form-check-input { float: none; flex: 0 0 auto; margin: 0; }
.api-chave-agentes .form-check-label { margin: 0; line-height: 1.3; }
.agente-form-acoes > .btn:last-child { margin-left: auto; }

.closing-acoes { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.closing-sem-manual-texto { margin: 0; color: var(--text); }
.chip-icone { padding-inline: var(--s-2); }
.ai-error-detalhe { margin-top: var(--s-1); font-size: var(--fs-sm); }
.ai-error-detalhe summary { cursor: pointer; color: var(--text-muted); }
.ajuste-frase { width: min(100%, 24rem); }
