/* Portal 89 — "sala de controle": barra lateral roxo-profundo, área de trabalho clara, títulos condensados
   em caixa alta como etiquetas de painel, ciano para o que está vivo. Tokens da marca 89Creative. */

@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --purple: #682696;
  --purple-deep: #3C2F68;
  --ink-night: #1a1430;
  --cyan: #04B4E0;
  --cyan-soft: #e3f7fc;
  --text: #1D1D1D;
  --text-2: #474747;
  --muted: #646464;
  --paper: #f6f4fa;
  --card: #ffffff;
  --line: #e4dfee;
  --ok: #12a36b;
  --ok-soft: #e1f6ec;
  --warn: #c98a05;
  --warn-soft: #fdf3dc;
  --bad: #c8333f;
  --bad-soft: #fbe5e7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26, 20, 48, .06), 0 8px 24px -12px rgba(26, 20, 48, .18);
  --font-head: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); color: var(--text); background: var(--paper); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
a { color: var(--purple); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- carregando / login ---------- */
.boot, .gate {
  min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding: 32px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(4, 180, 224, .28), transparent 60%),
    radial-gradient(700px 600px at -10% 110%, rgba(104, 38, 150, .55), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 48px),
    var(--ink-night);
}
.boot-mark, .gate-mark {
  font-family: var(--font-head); font-weight: 800; font-size: 96px; line-height: .8; letter-spacing: -2px;
  background: linear-gradient(135deg, #fff 30%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.boot-mark { animation: pulse 1.4s ease-in-out infinite; }
.boot-text { color: rgba(255, 255, 255, .7); margin: 0; }
@keyframes pulse { 50% { opacity: .45; } }
.gate h1 { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 22px; margin: 0; }
.gate p { max-width: 34ch; margin: 0; color: rgba(255, 255, 255, .75); }
.gate .btn { margin-top: 8px; }
.gate-foot { font-size: 12px; color: rgba(255, 255, 255, .45); margin-top: 28px; }

/* ---------- casca ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.side {
  background: linear-gradient(180deg, var(--purple-deep), var(--ink-night)); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: baseline; gap: 10px; padding: 0 8px; text-decoration: none; color: #fff; }
.brand b { font-family: var(--font-head); font-weight: 800; font-size: 40px; line-height: 1; background: linear-gradient(135deg, #fff 35%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; letter-spacing: .2em; font-size: 13px; color: rgba(255, 255, 255, .7); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: rgba(255, 255, 255, .45); padding: 10px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 600; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a[aria-current="page"] { background: rgba(4, 180, 224, .14); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.nav .glyph { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 13px; background: rgba(255, 255, 255, .1); }
.who { margin-top: auto; padding: 12px 10px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }
.who strong { display: block; }
.who small { color: rgba(255, 255, 255, .55); word-break: break-all; }
.who .btn { margin-top: 10px; width: 100%; }

.main { padding: 32px clamp(18px, 4vw, 48px) 64px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .2em; font-size: 12px; color: var(--purple); font-weight: 700; margin: 0 0 4px; }
h1.title { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; font-size: clamp(30px, 4vw, 42px); line-height: 1; margin: 0; letter-spacing: .01em; color: var(--ink-night); }
.lede { color: var(--text-2); margin: 8px 0 0; max-width: 62ch; }

/* ---------- hub ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
a.card { text-decoration: none; color: inherit; position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; animation: rise .5s both; }
a.card:nth-child(2) { animation-delay: .06s; } a.card:nth-child(3) { animation-delay: .12s; }
a.card::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(4, 180, 224, .18), transparent 70%); transition: transform .3s; }
a.card:hover { transform: translateY(-3px); border-color: rgba(104, 38, 150, .35); }
a.card:hover::after { transform: scale(1.3); }
.card h2 { font-family: var(--font-head); text-transform: uppercase; font-weight: 800; font-size: 24px; margin: 12px 0 4px; letter-spacing: .02em; }
.card p { color: var(--text-2); margin: 0; }
.card .go { display: inline-block; margin-top: 14px; font-weight: 700; color: var(--purple); }
.card.soon { border-style: dashed; background: transparent; box-shadow: none; color: var(--muted); }
.card .glyph { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--purple), var(--cyan)); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; font-family: var(--font-head); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 15px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a[aria-current="page"] { color: var(--ink-night); border-color: var(--purple); }
.tabs a:hover { color: var(--purple); }

/* ---------- painéis e tabelas ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel, .stat-row + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .1em; font-size: 16px; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 18px; background: #fbfaff; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); font-weight: 700; }
.stat .v { font-family: var(--font-head); font-weight: 800; font-size: 34px; line-height: 1.1; color: var(--ink-night); }
.stat .v small { font-size: 18px; color: var(--muted); font-weight: 700; }

/* luzes de estado */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.note { display: block; margin-top: 6px; font-size: 13px; color: var(--text-2); max-width: 42ch; }

/* barra de uso */
.meter { width: 140px; }
.meter .bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 4px; }
.meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--purple)); border-radius: inherit; }
.meter.hot .bar i { background: var(--bad); }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: #561f7d; }
.btn-cyan { background: var(--cyan); color: var(--ink-night); }
.btn-cyan:hover { background: #18c3ee; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-light { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #fff; }
.btn-light:hover { background: rgba(255, 255, 255, .16); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }

/* ---------- formulário ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; padding: 18px; align-items: start; }
/* campo só com botão: desce a altura do rótulo para o botão alinhar com os inputs (texto de ajuda não desalinha) */
.field.action { padding-top: calc(13px * 1.5 + 6px); }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.field input:focus, .field select:focus { border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(104, 38, 150, .15); }

/* ---------- diálogo ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(26, 20, 48, .5); }
dialog::backdrop { background: rgba(26, 20, 48, .55); backdrop-filter: blur(2px); }
.dlg { padding: 24px; }
.dlg h2 { font-family: var(--font-head); text-transform: uppercase; font-weight: 800; font-size: 24px; margin: 0 0 8px; }
.dlg p { color: var(--text-2); margin: 0 0 12px; }
.dlg .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.secret { display: flex; gap: 8px; align-items: stretch; margin: 14px 0; }
.secret code { flex: 1; padding: 12px; background: var(--ink-night); color: #b9f1ff; border-radius: 8px; word-break: break-all; font-size: 14px; }
.callout { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: #6b4a00; font-size: 14px; }
.howto { background: #fbfaff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }

/* ---------- avisos ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink-night); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: rise .25s both; border-left: 4px solid var(--cyan); }
.toast.err { border-left-color: var(--bad); }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.error-box { padding: 18px; color: var(--bad); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; gap: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
  .who { margin-top: 0; border-top: 0; padding: 0; margin-left: auto; text-align: right; }
  .who .btn { width: auto; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.gate-err { color: #ffb4bc !important; font-size: 14px; }

/* ---------- tenants / formulários ---------- */
.crumb { margin: 0 0 10px; font-weight: 700; }
.crumb a { text-decoration: none; }
a.tlink { font-weight: 800; color: var(--ink-night); text-decoration: none; border-bottom: 2px solid rgba(4, 180, 224, .5); }
a.tlink:hover { color: var(--purple); border-color: var(--purple); }
.pad { padding: 18px; }
.pad-x { padding: 0 18px; }
.stat-row.pad { padding: 18px; }
.stat .v.small { font-size: 22px; word-break: break-all; }
.panel.danger { border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.panel.danger .panel-head h2 { color: var(--bad); }
.form-stack { grid-template-columns: 1fr; padding: 0; margin-top: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--purple); }
.field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; }
.field textarea:focus { border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(104, 38, 150, .15); }
.field input:disabled { background: var(--paper); color: var(--muted); }
.fields-table input, .fields-table select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; min-width: 90px; }
.fields-table input[type="checkbox"] { width: 18px; height: 18px; min-width: 0; accent-color: var(--purple); }
.fields-table td { padding: 8px 10px; }
.row-end { display: flex; justify-content: flex-end; margin-top: 16px; }

/* 06/12: ajustes vistos no navegador */
#main:focus, #main:focus-visible { outline: none; } /* o foco programático da troca de tela não deve desenhar borda */
.stat-row.pad { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat .pill { white-space: normal; word-break: break-all; }
table.dns td.mono { word-break: break-all; white-space: normal; font-size: 12px; }
table.dns td:last-child { white-space: nowrap; }

dialog.wide { width: min(980px, calc(100vw - 32px)); }

.pad-b { padding-bottom: 14px; }
.warn-text { color: #8a5a00; font-weight: 700; }
.stat .secret { margin: 6px 0 0; }
.stat .secret code { font-size: 12px; padding: 8px; }

/* ---------- estado dos serviços ---------- */
.status-banner { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px; border-radius: var(--radius); font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 20px; margin-bottom: 16px; }
.status-banner small { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 14px; opacity: .85; }
.status-banner.ok { background: var(--ok); color: #fff; }
.status-banner.bad { background: var(--bad); color: #fff; }
.status-banner.warn { background: var(--warn-soft); color: #6b4a00; }
.svc-list { padding: 6px 18px 0; }
.svc { padding: 14px 0; border-bottom: 1px solid var(--line); }
.svc:last-child { border-bottom: 0; }
.svc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.svc-head strong { font-size: 16px; }
.svc-uptime { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.uptime-bar { display: flex; gap: 1px; height: 26px; margin-top: 10px; }
.uptime-bar i { flex: 1; border-radius: 2px; background: var(--line); }
.uptime-bar i.up { background: var(--ok); }
.uptime-bar i.down { background: var(--bad); }
.uptime-bar i:hover { opacity: .6; }
.svc-detail { margin-top: 6px; font-size: 12px; color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
