:root {
  --roxo: #6c47ff;
  --roxo-escuro: #5233e0;
  --roxo-claro: #e9e3ff;
  --roxo-borda: #b9a8ff;
  --fundo: #f1f3f7;
  --card: #ffffff;
  --texto: #1d1f24;
  --texto-2: #5c6170;
  --borda: #dfe2ea;
  --borda-forte: #1d1f24;
  --verde: #1fb34a;
  --verde-claro: #e3f6e8;
  --vermelho: #e5484d;
  --vermelho-claro: #fde8e8;
  --laranja: #f2701d;
  --amarelo-claro: #fff4dc;
  --console: #0f1115;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); line-height: 1.45;
}
a { color: var(--roxo); text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.muted { color: var(--texto-2); }
.pequeno { font-size: .85rem; }
.hide-sm {}

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: #fff; border-right: 1px solid var(--borda);
  display: flex; flex-direction: column; padding: 16px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: #1f3b4d; font-size: 1.15rem; padding: 4px 4px 22px; }
.brand b { font-weight: 800; margin-left: 3px; }
.brand-mark { width: 30px; height: 30px; stroke: none; color: #1f3b4d; }
.brand-mark.grande { width: 64px; height: 64px; color: #fff; }
.brand-mark path { stroke: none; }
.brand-mark.grande path:last-child { fill: #3a2a9e; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; color: var(--texto); }
.menu a:hover { background: var(--fundo); }
.menu a.ativo { background: var(--roxo-claro); color: var(--roxo); font-weight: 700; }
.mi { width: 36px; height: 36px; display: grid; place-items: center; background: var(--fundo); border-radius: 8px; }
.menu a.ativo .mi { background: #d7ccff; }
.userbox { margin-top: auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--borda); padding-top: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #1f3b4d; color: #fff; display: grid; place-items: center; font-weight: 800; }
.userinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.userinfo strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userinfo small { color: var(--texto-2); font-size: .75rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: #fff;
  border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5;
}
.spacer { flex: 1; }
.pill { border: 1px solid var(--borda-forte); border-radius: 999px; padding: 7px 16px; font-size: .82rem; white-space: nowrap; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.rodape { margin-top: auto; padding: 12px 24px; font-size: .75rem; color: var(--texto-2); text-align: right; }
.topbar .menu-toggle { display: none; }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--roxo); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 700;
}
.btn-primary:hover { background: var(--roxo-escuro); }
.btn-primary svg.i { width: 16px; height: 16px; }
.btn-primary.largo { width: 100%; padding: 12px; }
.btn-outline {
  background: #fff; border: 1.5px solid var(--borda-forte); border-radius: 999px; padding: 11px 16px; font-weight: 600; color: var(--texto);
}
.btn-outline:hover { background: var(--roxo-claro); border-color: var(--roxo); color: var(--roxo); }
.btn-outline-sm {
  display: inline-block; background: #fff; border: 1.5px solid var(--borda-forte); border-radius: 999px;
  padding: 6px 14px; font-size: .85rem; font-weight: 600; color: var(--texto);
}
.btn-outline-sm:hover { border-color: var(--roxo); color: var(--roxo); }
.btn-ghost { background: var(--fundo); border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 600; }
.icon-btn { background: transparent; border: 0; padding: 6px; border-radius: 8px; color: var(--texto); display: grid; place-items: center; }
.icon-btn:hover { background: var(--fundo); }
.icon-btn.sair { color: #d6336c; }
.link { background: none; border: 0; color: var(--roxo); font-weight: 700; padding: 0; text-decoration: underline; }

/* ---------- page ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 10px; color: var(--texto); font-size: .92rem; margin-bottom: 14px; }
.crumbs span { color: var(--texto-2); }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.tag { border-radius: 6px; padding: 3px 10px; font-size: .8rem; font-weight: 700; background: var(--fundo); color: var(--texto-2); }
.tag.ok { background: var(--verde-claro); color: #137a33; }
.tag.alerta { background: var(--amarelo-claro); color: #9a5b00; }
.tag.erro { background: var(--vermelho-claro); color: #b42318; }

.card { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; margin-bottom: 20px; }
.card.estreito { max-width: 620px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 12px; }
.ico { width: 40px; height: 40px; border-radius: 50%; background: var(--fundo); display: grid; place-items: center; }
.card-actions { display: flex; gap: 10px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; border-bottom: 4px solid var(--borda); }
.stat span { color: var(--texto-2); font-size: .85rem; font-weight: 600; }
.stat strong { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat:nth-child(1) { border-bottom-color: var(--verde); }
.stat:nth-child(2) { border-bottom-color: var(--vermelho); }
.stat:nth-child(3) { border-bottom-color: var(--roxo); }
.stat:nth-child(4) strong { font-size: 1.25rem; padding-top: 8px; }

.acoes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 10px; }
.banner { margin-top: 12px; display: flex; align-items: center; gap: 12px; background: var(--roxo-claro); border-radius: 12px; padding: 12px 16px; font-weight: 600; }
.spinner { width: 16px; height: 16px; border: 2.5px solid var(--roxo-borda); border-top-color: var(--roxo); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: #f0f0f2; text-align: left; font-weight: 700; padding: 11px 10px; font-size: .92rem; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tbl td.sem-pad { padding: 8px 6px; }
.svc-nome { font-weight: 600; }
.svc-desc { display: block; color: var(--texto-2); font-size: .8rem; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .82rem; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .85rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #c4c7cf; display: inline-block; }
.dot.online { background: var(--verde); }
.dot.offline { background: var(--laranja); }
.dot.executando { background: var(--roxo); animation: pulsa 1s ease-in-out infinite; }
@keyframes pulsa { 50% { opacity: .35; } }

.dd { position: relative; display: inline-block; }
.dd-toggle { white-space: nowrap; background: #fff; border: 1.5px solid var(--borda); border-radius: 999px; padding: 5px 12px; font-size: .85rem; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.dd-toggle:hover { border-color: var(--roxo); color: var(--roxo); }
.dd-menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.12); min-width: 170px; padding: 6px; z-index: 10; display: none; }
.dd.open .dd-menu { display: block; }
.dd-menu button, .dd-menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--texto); font-size: .92rem; }
.dd-menu button:hover, .dd-menu a:hover { background: var(--roxo-claro); color: var(--roxo); }
.dd-menu button:disabled { color: #b0b4be; background: none; cursor: not-allowed; }

.erro-box { background: var(--vermelho-claro); color: #b42318; border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; font-size: .88rem; }

.badge { display: inline-block; border-radius: 6px; padding: 2px 9px; font-size: .75rem; font-weight: 800; letter-spacing: .02em; background: var(--fundo); color: var(--texto-2); }
.badge.succeeded { background: var(--verde-claro); color: #137a33; }
.badge.failed { background: var(--vermelho-claro); color: #b42318; }
.badge.running { background: var(--roxo-claro); color: var(--roxo); }

.mini-lista { list-style: none; margin: 0; padding: 0; }
.mini-lista li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.mini-lista li:last-child { border-bottom: 0; }
.ml-titulo { font-weight: 700; flex: 1; min-width: 200px; }

/* ---------- timeline (ações executadas) ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.filtros label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .88rem; flex: 1; min-width: 200px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.tl-item { display: grid; grid-template-columns: 260px 1fr 180px; gap: 16px; align-items: stretch; }
.tl-quando { position: relative; border: 2px solid var(--roxo); border-radius: 12px; padding: 22px 18px 14px; font-size: .9rem; }
.tl-dot { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--roxo); background: #fff; }
.tl-dot.succeeded::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--roxo); font-weight: 800; font-size: .75rem; }
.tl-dot.failed { border-color: var(--vermelho); }
.tl-dot.failed::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--vermelho); font-weight: 800; font-size: .8rem; }
.tl-dot.running { background: var(--roxo); animation: pulsa 1s infinite; }
.tl-corpo { background: var(--fundo); border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 3px; }
.tl-titulo { font-weight: 800; }
.tl-status { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 10px; }
.paginacao { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 20px; }

/* ---------- forms ---------- */
input, select {
  font: inherit; border: 1.5px solid var(--borda); border-radius: 10px; padding: 9px 12px; background: #fff; color: var(--texto); min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--roxo-borda); border-color: var(--roxo); }
label { font-weight: 600; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1.4fr 1.2fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 10px; }
.form-grid label, .form-col label { display: flex; flex-direction: column; gap: 4px; }
.form-col { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.form-col label { width: 100%; }
.linha-usuario { display: grid; grid-template-columns: 1fr 170px 110px 150px auto; gap: 10px; align-items: center; }
.linha-usuario.cab { font-weight: 700; font-size: .92rem; text-align: left; }
.linha-usuario.cab span:first-child { padding-left: 9px; }
.tbl th:has(.linha-usuario) { padding: 11px 6px; }
.lu-nome { display: flex; flex-direction: column; gap: 2px; }
.lu-nome input { border-color: transparent; padding: 4px 8px; font-weight: 700; }
.lu-nome input:hover { border-color: var(--borda); }
.lu-nome small { padding-left: 9px; }
.reset { padding: 4px 9px 0; font-size: .85rem; }
.reset summary { cursor: pointer; color: var(--roxo); font-weight: 600; }
.reset form { display: flex; gap: 8px; margin-top: 8px; }
.dados { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.dados dt { color: var(--texto-2); font-weight: 600; }
.dados dd { margin: 0; font-weight: 700; }

.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
.flash.ok { background: var(--verde-claro); color: #137a33; }
.flash.erro { background: var(--vermelho-claro); color: #b42318; }

/* ---------- logs ---------- */
.log-controles { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 14px; }
.log-controles label { display: flex; flex-direction: column; gap: 4px; }
.switch { flex-direction: row !important; align-items: center; gap: 8px !important; padding-bottom: 10px; cursor: pointer; }
.switch input { display: none; }
.switch span { width: 40px; height: 22px; border-radius: 999px; background: #cfd3dc; position: relative; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--roxo); }
.switch input:checked + span::after { left: 21px; }
.console {
  background: var(--console); color: #e6e6e6; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .8rem;
  border-radius: 10px; padding: 14px 16px; margin: 0; max-height: 52vh; min-height: 200px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.console.alto { max-height: 68vh; min-height: 420px; }
.console .ok { color: #4ade80; } .console .err { color: #f87171; } .console .warn { color: #fbbf24; } .console mark { background: #6c47ff; color: #fff; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20, 22, 30, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: #fff; border-radius: 18px; width: min(900px, 100%); overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box.pequeno { width: min(460px, 100%); }
.modal-head { background: var(--roxo); color: #fff; text-align: center; padding: 16px; font-weight: 700; letter-spacing: .02em; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--borda); }
.saida-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; font-size: .88rem; color: var(--texto-2); flex-wrap: wrap; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-arte {
  background: linear-gradient(150deg, #1f3b4d 0%, #3a2a9e 55%, #6c47ff 100%); color: #fff;
  display: flex; flex-direction: column; justify-content: center; padding: 8vw; gap: 14px;
}
.login-arte h2 { font-size: 2.2rem; font-weight: 800; }
.login-arte p { font-size: 1.1rem; opacity: .9; max-width: 440px; margin: 0; }
.login-arte ul { padding-left: 18px; opacity: .85; }
.login-wrap > .login-card, .login-wrap form.login-card { align-self: center; justify-self: center; }
.login-card { width: min(400px, 92vw); display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; }
.login-card input { padding: 12px 14px; }
.login-wrap:not(:has(.login-arte)) { grid-template-columns: 1fr; place-items: center; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .tl-item { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.aberta { left: 0; }
  .topbar .menu-toggle { display: grid; }
  .hide-sm { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .acoes-grid { grid-template-columns: 1fr; }
  .linha-usuario { grid-template-columns: 1fr 1fr; }
  .lu-nome { grid-column: 1 / -1; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-arte { display: none; }
}
