/* Bastion — consola de operação. Escuro, denso, dados em monoespaçado. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --ink: #0e1216;
  --panel: #151b21;
  --panel-2: #1b232a;
  --line: #262f37;
  --line-soft: #1e262d;
  --text: #dde5ea;
  --muted: #7d8d99;
  --amber: #f2a93b;
  --red: #e5544b;
  --green: #37c98b;
  --blue: #5aa9e6;

  --ui: 'Archivo', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 4px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font: 400 15px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- estrutura */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px;
  flex: 0 0 216px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 0;
  display: flex;
  flex-direction: column;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  padding: 0 20px 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 9px; height: 18px;
  background: var(--amber);
  border-radius: 1px;
  box-shadow: 4px 0 0 -1px rgba(242, 169, 59, 0.35);
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  color: var(--muted);
  padding: 8px 20px;
  font-size: 14px;
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.on { color: var(--text); border-left-color: var(--amber); background: var(--panel-2); }

.side-foot {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.side-foot strong { display: block; color: var(--text); font-weight: 500; }

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; }

.eyebrow {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

h1 { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

/* ------------------------------------------------------------- cartões */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card > h2 { padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }

.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.k2 { grid-template-columns: repeat(2, 1fr); }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat .n { font: 600 27px/1.1 var(--mono); letter-spacing: -0.03em; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.alert .n { color: var(--amber); }

/* ------------------------------------------------------------- tabelas */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 9px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
td.tight { width: 1%; white-space: nowrap; }
.trunc { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { color: var(--muted); font-size: 14px; padding: 18px 0; }
.empty b { color: var(--text); font-weight: 500; display: block; margin-bottom: 3px; }

/* ------------------------------------------------------------- etiquetas */
.tag {
  display: inline-block;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.block { color: var(--red); border-color: rgba(229, 84, 75, 0.35); background: rgba(229, 84, 75, 0.08); }
.tag.allow { color: var(--green); border-color: rgba(55, 201, 139, 0.35); background: rgba(55, 201, 139, 0.08); }
.tag.chal  { color: var(--amber); border-color: rgba(242, 169, 59, 0.35); background: rgba(242, 169, 59, 0.08); }
.tag.off   { opacity: 0.55; }

/* Pulso do agente: cheio = a sincronizar, vazio = calado */
.pulse { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.pulse i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); flex: 0 0 auto;
}
.pulse.live i { background: var(--green); box-shadow: 0 0 0 3px rgba(55, 201, 139, 0.15); }
.pulse.stale i { background: var(--amber); box-shadow: 0 0 0 3px rgba(242, 169, 59, 0.15); }
.pulse.dead i { background: var(--line); border: 1px solid var(--muted); }

/* ------------------------------------------------------------- formulários */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r);
  padding: 8px 10px;
  font: 400 14px var(--ui);
}
input.mono, select.mono { font-family: var(--mono); font-size: 13px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); outline: none; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.row > div { flex: 1; min-width: 130px; }
.row > div.narrow { flex: 0 0 130px; }

.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-bottom: 10px; }
.check input { width: auto; }

.btn {
  display: inline-block;
  background: var(--amber);
  color: #17120a;
  border: 1px solid var(--amber);
  border-radius: var(--r);
  padding: 8px 15px;
  font: 600 13.5px var(--ui);
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(229, 84, 75, 0.4); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.link { background: none; border: 0; color: var(--muted); padding: 4px 6px; font-size: 12px; cursor: pointer; }
.btn.link:hover { color: var(--text); }

form.inline { display: inline; }

/* ------------------------------------------------------------- avisos */
.flash {
  border: 1px solid var(--line);
  border-left: 2px solid var(--green);
  background: var(--panel);
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 20px;
}
.flash.erro { border-left-color: var(--red); }
.flash.aviso { border-left-color: var(--amber); }

.note {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 16px;
}
.note code { color: var(--text); font-family: var(--mono); font-size: 12.5px; }

pre.snippet {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  overflow-x: auto;
  font: 400 12.5px/1.6 var(--mono);
  color: var(--text);
  margin: 0 0 12px;
}

.secret {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 9px;
  display: inline-block;
  word-break: break-all;
}

/* ------------------------------------------------------------- entrar */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 100%; max-width: 360px; }
.auth .brand { padding: 0 0 26px; font-size: 20px; }
.auth .card { padding: 24px; }
.auth label { margin-top: 12px; }
.auth label:first-of-type { margin-top: 0; }
.auth .btn { width: 100%; margin-top: 18px; }
.auth .alt { text-align: center; margin-top: 16px; font-size: 13px; }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head .sub { margin: 0; }

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side { width: auto; flex: none; padding: 14px 0; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .nav a.on { border-left: 0; border-bottom-color: var(--amber); }
  .side-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid.k4, .grid.k2 { grid-template-columns: repeat(2, 1fr); }
  .trunc { max-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
