:root {
  --bg:      #f0f2f5;
  --surface: #ffffff;
  --border:  #d1d5db;
  --accent:  #2563eb;
  --accent2: #1d4ed8;
  --green:   #16a34a;
  --red:     #dc2626;
  --yellow:  #d97706;
  --text:    #111827;
  --muted:   #6b7280;
  --nav-bg:  #1e293b;
  --nav-text:#e2e8f0;
  --mono:    'IBM Plex Mono', monospace;
  --sans:    'IBM Plex Sans', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; }

/* ── Layout app ── */
.app { display:flex; min-height:100vh; }
.sidebar { width:220px; flex-shrink:0; background:var(--nav-bg); border-right:1px solid #0f172a; display:flex; flex-direction:column; position:fixed; top:0; left:0; bottom:0; overflow-y:auto; z-index:100; }
.sidebar::-webkit-scrollbar { width:4px; }
.sidebar::-webkit-scrollbar-thumb { background:rgba(255,255,255,.1); border-radius:2px; }
.main { margin-left:220px; flex:1; display:flex; flex-direction:column; min-height:100vh; background:var(--bg); }
.topbar { background:#fff; border-bottom:1px solid var(--border); padding:0 24px; height:50px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:50; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.content { padding:24px; flex:1; }

/* ── Sidebar brand ── */
.sb-brand { padding:18px 16px 14px; border-bottom:1px solid rgba(255,255,255,.08); display:block; text-decoration:none; color:inherit; }
.sb-brand-icon { font-size:22px; margin-bottom:3px; color:#fff; }
.sb-brand-title { font-family:var(--mono); font-size:13px; font-weight:700; letter-spacing:.04em; color:#fff; }
.sb-brand-title span { color:#60a5fa; }
.sb-brand-sub { font-size:10px; color:rgba(255,255,255,.4); margin-top:2px; }

/* ── Sidebar sections ── */
.sb-section { padding:10px 14px 6px; font-size:10px; color:rgba(255,255,255,.35); font-weight:700; letter-spacing:.1em; text-transform:uppercase; cursor:pointer; display:flex; justify-content:space-between; align-items:center; user-select:none; transition:color .15s; }
.sb-section:hover { color:rgba(255,255,255,.55); }
.sb-chevron { font-size:9px; opacity:.5; transition:transform .2s; flex-shrink:0; }
.sb-section.open .sb-chevron { transform:rotate(180deg); }
.sb-group { display:none; }
.sb-group.open { display:block; }
.sb-item { display:flex; align-items:center; gap:9px; padding:8px 14px; color:rgba(255,255,255,.55); text-decoration:none; border-radius:6px; margin:1px 6px; transition:all .15s; font-size:13px; }
.sb-item:hover { background:rgba(255,255,255,.07); color:rgba(255,255,255,.9); }
.sb-item.active { background:rgba(37,99,235,.4); color:#93c5fd; font-weight:600; }
.sb-item .ico { width:16px; text-align:center; flex-shrink:0; font-size:14px; }
.sb-bottom { margin-top:auto; border-top:1px solid rgba(255,255,255,.08); padding:12px; }
.sb-user { font-size:12px; color:rgba(255,255,255,.45); padding:6px 8px; }
.sb-user strong { display:block; color:rgba(255,255,255,.85); font-size:13px; }
.sb-user small { font-size:10px; }
.sb-logout { display:flex; align-items:center; justify-content:center; gap:6px; width:100%; margin-top:6px; padding:7px; border-radius:6px; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.1); color:rgba(255,255,255,.6); text-decoration:none; font-size:12px; font-weight:600; font-family:var(--sans); cursor:pointer; transition:.15s; }
.sb-logout:hover { background:rgba(220,38,38,.2); border-color:rgba(220,38,38,.4); color:#fca5a5; }

/* ── Sidebar search ── */
.sb-search-wrap { position:relative; margin:2px 12px 10px; }
.sb-search-wrap .sb-search-ico { position:absolute; left:9px; top:50%; transform:translateY(-50%); font-size:12px; opacity:.4; pointer-events:none; }
.sb-search { width:100%; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.1); border-radius:6px; color:#fff; font-size:12px; padding:7px 26px 7px 28px; font-family:var(--sans); }
.sb-search::placeholder { color:rgba(255,255,255,.35); }
.sb-search:focus { outline:none; border-color:rgba(147,197,253,.5); background:rgba(255,255,255,.1); }
.sb-search-clear { position:absolute; right:6px; top:50%; transform:translateY(-50%); background:none; border:none; color:rgba(255,255,255,.35); font-size:13px; cursor:pointer; padding:2px 4px; display:none; }
.sb-search-wrap.filled .sb-search-clear { display:block; }
.sb-item.sb-hide { display:none !important; }
.sb-section.sb-hide { display:none !important; }
.sb-group.sb-hide { display:none !important; }
.sb-no-results { padding:10px 14px; font-size:12px; color:rgba(255,255,255,.35); display:none; }
.sb-no-results.show { display:block; }
.sb-item mark { background:rgba(147,197,253,.5); color:#fff; border-radius:2px; }
.sb-collapse-row { display:flex; gap:6px; margin:0 12px 10px; }
.sb-collapse-btn { flex:1; background:none; border:1px solid rgba(255,255,255,.1); border-radius:5px; color:rgba(255,255,255,.4); font-size:11px; padding:5px 4px; cursor:pointer; font-family:var(--sans); transition:.15s; }
.sb-collapse-btn:hover { background:rgba(255,255,255,.07); color:rgba(255,255,255,.75); border-color:rgba(255,255,255,.2); }

/* ── Topbar ── */
.tb-breadcrumb { font-size:13px; color:var(--muted); }
.tb-breadcrumb strong { color:var(--text); font-weight:700; }
.tb-right { display:flex; align-items:center; gap:10px; }
.tb-badge { font-size:10px; padding:3px 9px; border-radius:20px; font-family:var(--mono); font-weight:700; }
.tb-badge-hom { background:#fef9c3; border:1px solid #fde047; color:#854d0e; }
.tb-badge-prd { background:#fee2e2; border:1px solid #fca5a5; color:#991b1b; }
.tb-user { font-size:12px; color:var(--muted); }

.container { max-width:1200px; margin:0 auto; }

/* ── Alertas ── */
.alert { padding: 11px 16px; border-radius: 6px; margin-bottom: 18px; font-size: 13px; font-weight: 500; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* ── Botões ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: .13s; white-space: nowrap; }
.btn-primary { background: var(--accent);  color: #fff; border-color: var(--accent2); }  .btn-primary:hover  { background: var(--accent2); }
.btn-success { background: var(--green);   color: #fff; }                                 .btn-success:hover  { background: #15803d; }
.btn-danger  { background: var(--red);     color: #fff; }                                 .btn-danger:hover   { background: #b91c1c; }
.btn-ghost   { background: #fff; color: #374151; border-color: var(--border); }           .btn-ghost:hover   { background: #f9fafb; border-color: #9ca3af; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Tabela ── */
.table-wrap { overflow-x: auto; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); }
tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 10px 14px; font-size: 13px; vertical-align: middle; color: var(--text); }

/* ── Badges de status ── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; font-family: var(--mono); }
.status-PENDENTE    { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.status-PROCESSANDO { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.status-AUTORIZADO  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.status-REJEITADO   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.status-CANCELADO   { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* ── Cards e formulários ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 22px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-title { font-size: 12px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid #e5e7eb; background: #f8fafc; margin: -22px -22px 18px; padding: 12px 22px; border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; color: #374151; font-weight: 600; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea { background: #fff; border: 1px solid #d1d5db; border-radius: 5px; color: var(--text); padding: 7px 11px; font-size: 13px; font-family: var(--sans); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; min-height: 80px; }
select option { background: #fff; color: var(--text); }
input[readonly] { background: #f9fafb; color: var(--muted); }

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-title  { font-size: 19px; font-weight: 700; color: var(--text); }
.page-sub    { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Métricas ── */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric-card  { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.metric-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.metric-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-family: var(--mono); }
.c-green { color: #16a34a; } .c-blue { color: var(--accent); } .c-yellow { color: var(--yellow); } .c-red { color: var(--red); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
@keyframes autoFill { 0%,100%{border-color:var(--border);}50%{border-color:#16a34a;box-shadow:0 0 0 3px rgba(22,163,74,.12);} }
.auto-filled { animation: autoFill 1.2s ease 2; }

/* ── Overlay de envio (aguardando resposta do provedor) ── */
.send-overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.55); z-index:9999; align-items:center; justify-content:center; }
.send-overlay.show { display:flex; }
.send-overlay-box { background:var(--surface); border-radius:10px; padding:28px 36px; box-shadow:0 10px 40px rgba(0,0,0,.25); display:flex; flex-direction:column; align-items:center; gap:14px; max-width:320px; text-align:center; }
.send-overlay-spinner { width:32px; height:32px; border:3px solid #bfdbfe; border-top-color:var(--accent); border-radius:50%; animation:cnaeSpinner .8s linear infinite; }
.send-overlay-msg { font-size:14px; font-weight:600; color:var(--text); }
.send-overlay-sub { font-size:12px; color:var(--muted); }
