
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  /* Deep UI — light mode */
  --brand:#3034ff;--brand-light:#5256ff;--brand-dark:#2428cc;
  --brand-fade:rgba(48,52,255,.12);
  --accent:#0ea5e9;--success:#16a34a;--danger:#dc2626;--warning:#d97706;
  --bg:#f8fafc;--surface:#ffffff;--border:#e2e8f0;--text:#1e293b;--text-muted:#64748b;
  --card-shadow:0 4px 20px rgba(0,0,0,.06);
  --sidebar-w:248px;--sidebar-bg:#ffffff;--sidebar-border:#e2e8f0;
  /* ── Escala de border-radius ───────────────────────────────
     Segue a regra "outer = inner + padding" para cantos concentricos.
       --radius-xs : detalhes muito pequenos (kbd, scrollbar)
       --radius-sm : badges/chips pequenos (interior de botoes, etc)
       --radius    : base (botoes, inputs, nav-items)
       --radius-md : cards e paineis pequenos
       --radius-lg : modais, painel de progresso
       --radius-xl : barras sticky com padding generoso
     Inner radius sempre <= outer; padding tipico (10-16px) define delta. */
  --radius-xs:4px;--radius-sm:6px;--radius:10px;--radius-md:14px;--radius-lg:18px;--radius-xl:24px;
  --shadow:0 1px 6px rgba(0,0,0,.08);--transition:.18s ease;
  --primary-bg:#ededff;
}
.dark{
  --brand:#5256ff;--brand-light:#7577ff;--brand-dark:#3034ff;
  --brand-fade:rgba(48,52,255,.25);
  --bg:#080c16;--surface:#111827;--border:#1e2a3e;--text:#f1f5f9;--text-muted:#94a3b8;
  --card-shadow:0 4px 20px rgba(0,0,0,.3);
  --sidebar-bg:linear-gradient(180deg,#111827 0%,#0c1322 100%);--sidebar-border:#1e2a3e;
  --primary-bg:rgba(48,52,255,.2);
}
html{font-size:15px}
body{font-family:'Plus Jakarta Sans','Segoe UI',system-ui,sans-serif;background:var(--bg);color:var(--text);min-height:100vh;transition:background .3s,color .3s}

/* LOGIN */
#login-screen{display:flex;min-height:100vh;background:#fff}





.form-group{margin-bottom:18px}
.form-group label{display:block;font-size:12px;font-weight:600;color:var(--text-muted);margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}
.form-group input{width:100%;padding:11px 14px;border:1.5px solid var(--border);border-radius:var(--radius);font-size:14px;transition:border var(--transition);outline:none}
.form-group input:focus{border-color:var(--accent)}
.btn{display:inline-flex;align-items:center;gap:6px;padding:10px 20px;border-radius:var(--radius);border:none;cursor:pointer;font-size:14px;font-weight:600;transition:all var(--transition)}
.btn-primary{background:var(--brand);color:#fff}.btn-primary:hover{background:var(--brand-light)}
.btn-success{background:var(--success);color:#fff}.btn-success:hover{filter:brightness(1.1)}
.btn-danger{background:var(--danger);color:#fff}.btn-danger:hover{filter:brightness(1.1)}
.btn-outline{background:transparent;border:1.5px solid var(--border);color:var(--text)}.btn-outline:hover{border-color:var(--accent);color:var(--accent)}
.btn-sm{padding:6px 14px;font-size:13px}
.btn-full{width:100%;justify-content:center;padding:13px;font-size:15px}
.login-error{background:#fef2f2;border:1px solid #fecaca;color:#dc2626;padding:10px 14px;border-radius:6px;font-size:13px;margin-bottom:16px;display:none}

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

/* SIDEBAR */
.sidebar{width:var(--sidebar-w);background:var(--sidebar-bg);display:flex;flex-direction:column;flex-shrink:0;position:fixed;left:0;top:0;bottom:0;z-index:100;font-family:inherit;border-right:1px solid var(--sidebar-border);box-shadow:2px 0 16px rgba(0,0,0,.08);transition:background .3s}
.sidebar-header{height:auto;min-height:84px;padding:12px 18px 14px;border-bottom:1px solid var(--sidebar-border);box-sizing:border-box;background:linear-gradient(180deg,rgba(37,99,235,.04) 0%,transparent 100%)}
.dark .sidebar-header{background:linear-gradient(180deg,rgba(59,130,246,.08) 0%,transparent 100%)}
.sidebar-brand{display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center}
.sidebar-brand .brand-logo{height:34px;width:auto;max-width:100%;object-fit:contain;filter:drop-shadow(0 1px 2px rgba(0,0,0,.06))}
.sidebar-brand .brand-app{font-family:'Inter','Segoe UI',system-ui,sans-serif;font-size:15px;font-weight:800;color:#0f172a;letter-spacing:-.02em;line-height:1;padding:3px 10px;border-radius:12px;background:rgba(37,99,235,.08)}
.sidebar-brand .brand-app span{font-weight:400;color:#2563eb}
.dark .sidebar-brand .brand-app{color:#f1f5f9;background:rgba(96,165,250,.12)}
.dark .sidebar-brand .brand-app span{color:#60a5fa}
/* Compat: classes antigas que possam estar em html — esconde */
.sidebar-logo-sub,.sidebar-logo-text{display:none}

/* Stepper visual de fluxo de aprovacao — animacao do ring na etapa ativa */
@keyframes pulseRing{
  0%  {box-shadow:0 0 0 0 rgba(37,99,235,.4)}
  70% {box-shadow:0 0 0 8px rgba(37,99,235,0)}
  100%{box-shadow:0 0 0 0 rgba(37,99,235,0)}
}
.theme-toggle-btn{width:36px;height:20px;background:var(--border);border-radius:12px;cursor:pointer;position:relative;border:none;transition:background .3s;flex-shrink:0}
.theme-toggle-btn::after{content:'';position:absolute;left:3px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.2);transition:transform .3s}
.dark .theme-toggle-btn{background:var(--brand)}
.dark .theme-toggle-btn::after{transform:translateX(16px)}
.sidebar-nav{flex:1;padding:2px 0 8px;overflow-y:auto}
.sidebar-nav::-webkit-scrollbar{width:3px}
.sidebar-nav::-webkit-scrollbar-thumb{background:var(--border);border-radius:4px}
.nav-section{font-size:10px;font-weight:700;color:var(--brand);padding:6px 20px 5px;letter-spacing:.12em;text-transform:uppercase;position:relative}
.nav-section::after{content:'';position:absolute;left:20px;bottom:1px;width:20px;height:2px;background:var(--brand);border-radius:2px}
.nav-item{display:flex;align-items:center;padding:0 10px;margin:0 6px;border-radius:var(--radius);font-size:12.5px;font-weight:500;color:var(--text);transition:all .18s;border:1px solid transparent;position:relative;cursor:pointer;user-select:none;line-height:1.15}
.nav-item:hover{background:var(--primary-bg);color:var(--brand)}
.nav-item:hover .nav-icon-box{background:var(--primary-bg);color:var(--brand)}
.nav-item.active{background:var(--primary-bg);color:var(--brand);font-weight:600}
.nav-item.active::before{content:'';position:absolute;left:0;top:20%;height:60%;width:3px;background:var(--brand);border-radius:0 3px 3px 0}
.nav-item.active .nav-icon-box{background:var(--brand-fade);color:var(--brand)}
.nav-icon-box{display:flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:5px;background:var(--border);font-size:11px;margin-right:8px;flex-shrink:0;transition:all .18s;color:var(--text-muted)}
.dark .nav-icon-box{background:rgba(30,41,59,.8)}
.nav-label{flex:1}
.nav-icon{display:none}
.nav-badge{margin-left:auto;background:#ef4444;color:#fff;font-size:10px;padding:1px 7px;border-radius:10px;font-weight:700}
.sidebar-user{display:none}
.sidebar-footer{padding:0;border-top:none}
.sidebar-user-card{display:flex;align-items:center;padding:12px 14px;gap:10px;transition:background .18s}
.sidebar-user-avatar{width:36px;height:36px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0;overflow:hidden}
.sidebar-user-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.sidebar-user-info{flex:1;min-width:0}
.sidebar-user-name{font-size:12.5px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-user-role{font-size:11px;color:var(--text-muted);text-transform:capitalize;margin-top:1px}
.sidebar-logout-btn{width:30px;height:30px;border-radius:8px;background:var(--border);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:15px;transition:background .18s;color:var(--text-muted);flex-shrink:0}
.sidebar-logout-btn:hover{background:#fee2e2;color:#ef4444}
.sidebar-logout{display:none}
/* MAIN */
.main{margin-left:var(--sidebar-w);flex:1;min-height:100vh;display:flex;flex-direction:column;transition:background .3s}
.app-header{height:66px;background:var(--surface);border-bottom:1px solid var(--border);transition:background .3s,border-color .3s;display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:90;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.app-header-left{display:flex;align-items:center;gap:10px}
.app-header-title{font-size:16px;font-weight:700;color:var(--brand)}
.app-header-right{display:flex;align-items:center;gap:12px}
.app-header-center{flex:1;display:flex;justify-content:center;padding:0 24px;max-width:640px;margin:0 auto}
/* ── BUSCA GLOBAL ──────────────────────────────────────────── */
.global-search{position:relative;width:100%;max-width:480px}
.gs-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);font-size:14px;opacity:.55;pointer-events:none}
.gs-input{width:100%;height:38px;padding:0 60px 0 36px;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);font-size:13px;outline:none;transition:border-color .15s,box-shadow .15s,background .15s}
.gs-input::placeholder{color:var(--text-muted);opacity:.7}
.gs-input:focus{border-color:var(--brand);background:var(--surface);box-shadow:0 0 0 3px rgba(26,58,92,.08)}
.gs-kbd{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-family:monospace;font-size:10px;font-weight:600;color:var(--text-muted);background:var(--surface);border:1px solid var(--border);border-radius:5px;padding:2px 6px;letter-spacing:.5px;pointer-events:none;opacity:.85}
.gs-input:focus ~ .gs-kbd{display:none}
.gs-panel{position:absolute;top:46px;left:0;right:0;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:0 12px 36px rgba(0,0,0,.16);max-height:480px;overflow-y:auto;z-index:200}
.gs-panel[hidden]{display:none}
.gs-empty{padding:24px;text-align:center;color:var(--text-muted);font-size:13px}
.gs-loading{padding:18px;text-align:center;color:var(--text-muted);font-size:12px}
.gs-group{padding:6px 0;border-top:1px solid var(--border)}
.gs-group:first-child{border-top:none}
.gs-group-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--text-muted);padding:8px 14px 4px}
.gs-item{display:flex;gap:10px;align-items:center;padding:9px 14px;cursor:pointer;font-size:13px;border-left:3px solid transparent}
.gs-item:hover,.gs-item.active{background:var(--bg);border-left-color:var(--brand)}
.gs-item-icon{font-size:18px;flex-shrink:0;width:24px;text-align:center}
.gs-item-body{flex:1;min-width:0}
.gs-item-title{font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gs-item-sub{font-size:11px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.gs-item-meta{font-size:10px;color:var(--text-muted);background:var(--bg);padding:2px 7px;border-radius:10px;flex-shrink:0;font-weight:600}
.gs-hint{padding:8px 14px;font-size:11px;color:var(--text-muted);background:var(--bg);border-top:1px solid var(--border);display:flex;justify-content:space-between;align-items:center}
.gs-hint kbd{font-family:monospace;font-size:10px;background:var(--surface);border:1px solid var(--border);border-radius:4px;padding:1px 5px;margin:0 2px}
@media (max-width:900px){
  .app-header-center{display:none}
}
.header-user{display:flex;align-items:center;gap:10px;cursor:pointer;padding:6px 10px;border-radius:8px;transition:background var(--transition)}
.header-user:hover{background:var(--bg)}
.header-avatar{width:34px;height:34px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0;overflow:hidden}
.header-avatar img{width:100%;height:100%;object-fit:cover}
.header-user-info .hname{font-size:13px;font-weight:700;color:var(--text);line-height:1.2}
.header-user-info .hrole{font-size:11px;color:var(--text-muted)}
.bell-btn{position:relative;background:none;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background var(--transition);font-size:18px;line-height:1}
.bell-btn:hover{background:var(--bg)}
.bell-dot{position:absolute;top:5px;right:5px;width:9px;height:9px;background:#ef4444;border-radius:50%;border:2px solid #fff;display:none}
.bell-dot.visible{display:block}
.notif-panel{position:absolute;top:56px;right:28px;width:340px;background:#fff;border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:0 8px 32px rgba(0,0,0,.14);z-index:999;display:none;max-height:420px;overflow-y:auto}
.notif-panel.open{display:block}
.notif-header{padding:14px 16px;font-weight:700;font-size:13px;border-bottom:1px solid var(--border);color:var(--brand)}
.notif-item{padding:12px 16px;border-bottom:1px solid var(--border);font-size:13px;display:flex;gap:10px;align-items:flex-start;cursor:pointer;transition:background var(--transition)}
.notif-item:hover{background:#f8fafc}
.notif-item:last-child{border-bottom:none}
.notif-item .ni-icon{font-size:18px;flex-shrink:0;margin-top:1px}
.notif-item .ni-text{flex:1}
.notif-item .ni-title{font-weight:600;color:var(--text);margin-bottom:2px}
.notif-item .ni-sub{font-size:11px;color:var(--text-muted)}
.notif-empty{padding:28px 16px;text-align:center;color:var(--text-muted);font-size:13px}
.view-content{flex:1;padding:28px}

/* TOPBAR */
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px}
.page-title{font-size:22px;font-weight:700;color:var(--brand)}
.page-title span{font-size:14px;font-weight:400;color:var(--text-muted);margin-left:8px}
.card{background:var(--surface);border-radius:var(--radius-md);box-shadow:var(--shadow);border:1px solid var(--border)}
.card-header{padding:16px 20px;border-bottom:1px solid var(--border);font-weight:700;font-size:14px;color:var(--brand);display:flex;align-items:center;gap:8px}
.card-body{padding:20px}

/* METRICS */
.metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:16px;margin-bottom:24px}
.metric-card{background:var(--surface);border-radius:var(--radius-lg);padding:20px;border:1px solid var(--border);box-shadow:var(--shadow)}
.metric-card .num{font-size:36px;font-weight:800;color:var(--brand);line-height:1}
.metric-card .lbl{font-size:12px;color:var(--text-muted);margin-top:6px}
.metric-card.accent{border-left:4px solid var(--accent)}
.metric-card.success{border-left:4px solid var(--success)}
.metric-card.danger{border-left:4px solid var(--danger)}
.metric-card.warning{border-left:4px solid var(--warning)}

/* FORM */
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
.form-row.full{grid-template-columns:1fr}
.form-row.three{grid-template-columns:1fr 1fr 1fr}
.field label{display:block;font-size:12px;font-weight:600;color:var(--text-muted);margin-bottom:5px;text-transform:uppercase;letter-spacing:.4px}
.field input,.field select,.field textarea{width:100%;padding:9px 12px;border:1.5px solid var(--border);border-radius:6px;font-size:14px;outline:none;transition:border var(--transition);font-family:inherit}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--accent)}
.tipo-options{display:flex;gap:12px}
.tipo-opt{flex:1;border:1.5px solid var(--border);border-radius:8px;padding:12px;cursor:pointer;text-align:center;transition:all var(--transition)}
.tipo-opt:hover{border-color:var(--accent);background:#f0f9ff}
.tipo-opt.selected{border-color:var(--brand);background:#e8f0fb;color:var(--brand)}
.tipo-opt .tipo-icon{font-size:24px}
.tipo-opt .tipo-lbl{font-size:12px;font-weight:600;margin-top:4px}

/* TABLE */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13.5px}
table th{background:#f8fafc;font-weight:700;font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted);padding:10px 14px;border-bottom:2px solid var(--border);text-align:left}
table td{padding:10px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
table tr:last-child td{border-bottom:none}
table tr:hover td{background:#f8fafc}
.badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:700;white-space:nowrap}
.badge-pending{background:#fef3c7;color:#92400e}
.badge-approved{background:#d1fae5;color:#065f46}
.badge-rejected{background:#fee2e2;color:#7f1d1d}
.badge-gestor{background:#dbeafe;color:#1e40af}
.badge-expired{background:#fee2e2;color:#991b1b;border:1px solid #fca5a5}
.badge-liberado{background:#ede9fe;color:#5b21b6}.badge-acessou{background:#16a34a;color:#fff;border:1px solid #15803d;font-weight:700}
.badge-naoveio{background:#fef3c7;color:#92400e;border:1px solid #fbbf24;font-weight:700}
.nav-section{font-size:10px;font-weight:700;color:#6b7280;padding:10px 20px 4px;letter-spacing:.12em;text-transform:uppercase}

/* FILTERS */
.filters{display:flex;gap:12px;margin-bottom:16px;flex-wrap:wrap;align-items:flex-end}
.filters .field{flex:1;min-width:140px}

/* TOAST */
.toast-wrap{position:fixed;top:20px;right:20px;z-index:9999;display:flex;flex-direction:column;gap:8px}
.toast{padding:12px 18px;border-radius:var(--radius-md);color:#fff;font-size:13.5px;font-weight:600;box-shadow:0 4px 20px rgba(0,0,0,.2);animation:slideIn .2s ease;max-width:340px}
.toast.success{background:#16a34a}
.toast.error{background:#dc2626}
.toast.info{background:#1a3a5c}
@keyframes slideIn{from{transform:translateX(120%);opacity:0}to{transform:translateX(0);opacity:1}}
@keyframes spin{to{transform:rotate(360deg)}}

/* MODAL */
.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:1000;display:flex;align-items:center;justify-content:center}
.modal{background:#fff;border-radius:var(--radius-lg);padding:32px;max-width:520px;width:90%;max-height:85vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal h2{font-size:18px;font-weight:700;margin-bottom:20px;color:var(--brand)}
.modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px}

/* PORTARIA */
.portaria-card{background:#fff;border-radius:var(--radius-md);border:1px solid var(--border);padding:16px;display:flex;align-items:center;gap:16px;box-shadow:var(--shadow)}
.portaria-avatar{width:48px;height:48px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:700;flex-shrink:0}
.portaria-info .name{font-weight:700;font-size:15px}
.portaria-info .meta{font-size:12px;color:var(--text-muted);margin-top:2px}
.portaria-status{margin-left:auto}

/* LOADING */
.loading{text-align:center;padding:40px;color:var(--text-muted);font-size:14px}

/* PROGRESS */
.progress-overlay{position:fixed;inset:0;background:rgba(15,36,64,.7);z-index:5000;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff}
.progress-box{background:#fff;border-radius:var(--radius-xl);padding:36px 40px;width:380px;text-align:center;color:var(--text)}
.progress-box .prog-icon{font-size:40px;margin-bottom:12px}
.progress-box .prog-title{font-size:16px;font-weight:700;color:var(--brand);margin-bottom:6px}
.progress-box .prog-msg{font-size:13px;color:var(--text-muted);margin-bottom:20px;min-height:20px}
.progress-bar-wrap{background:#e2e8f0;border-radius:20px;height:8px;overflow:hidden;margin-bottom:8px}
.progress-bar-fill{height:100%;border-radius:20px;background:linear-gradient(90deg,var(--brand),var(--accent));transition:width .4s ease;width:0%}
.progress-pct{font-size:12px;color:var(--text-muted);font-weight:600}

/* FLUXOS */
.fluxo-bloco-palette{display:flex;align-items:center;gap:8px;padding:8px 10px;margin-bottom:6px;
  border-radius:6px;cursor:grab;border:1.5px solid var(--border);background:#fff;
  font-size:12px;font-weight:600;transition:all .15s ease;user-select:none}
.fluxo-bloco-palette:hover{border-color:var(--accent)}

@media(max-width:768px){
  .sidebar{transform:translateX(-100%)}.sidebar.open{transform:translateX(0)}
  .main{margin-left:0;padding:16px}
  .form-row,.form-row.three{grid-template-columns:1fr}
  .metrics{grid-template-columns:1fr 1fr}
}

.logo-dark{display:none}.dark .logo-light{display:none!important}.dark .logo-dark{display:block!important}

.header-logout-btn{width:32px;height:32px;border-radius:8px;background:transparent;border:1.5px solid var(--border);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background .18s,border-color .18s,color .18s;color:var(--text-muted);flex-shrink:0;margin-left:4px}
.header-logout-btn:hover{background:#fee2e2;border-color:#fca5a5;color:#ef4444}
