/* Monitor uazapi: identidade visual da AI Solutions (aisolutions.pt).
   Noite profunda, azul elétrico, halo violeta e acento magenta. Archivo nos títulos, Instrument Sans no texto. */

@font-face {
  font-family: "Archivo";
  src: url("/static/brand/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/brand/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face { font-family: "Archivo Recurso"; src: local("Arial Bold"), local("Arial-BoldMT"), local("Arial"); font-weight: 600 800; size-adjust: 115%; }
@font-face { font-family: "Instrument Recurso"; src: local("Arial"), local("ArialMT"); font-weight: 400 700; size-adjust: 101.5%; }

:root {
  /* paleta oficial */
  --noite: #0A0130;
  --indigo: #110043;
  --superficie: #120548;
  --superficie-2: #170A57;
  --eletrico: #4125EB;
  --halo: #6B53F9;
  --halo-claro: #8F7DFF;
  --magenta: #F320F3;
  --luz: #F3F0FF;
  --flare: #E4DCFF;
  --texto-2: #ABA5DA;
  --texto-3: #9A93CC;
  --verde: #3BE08A;
  --traco: rgba(243, 240, 255, .10);
  --traco-forte: rgba(243, 240, 255, .20);

  /* papéis */
  --bg: var(--noite);
  --surface: var(--superficie);
  --text: var(--luz);
  --text-2: var(--texto-2);
  --muted: var(--texto-3);
  --line: var(--traco);
  --line-strong: var(--traco-forte);
  --brand-soft: rgba(107, 83, 249, .16);
  --ok: var(--verde);
  --ok-soft: rgba(59, 224, 138, .13);
  --bad: #FF5C8A;
  --bad-soft: rgba(255, 92, 138, .14);
  --warn: #FFC24B;
  --warn-soft: rgba(255, 194, 75, .13);
  --info: var(--halo-claro);
  --info-soft: rgba(143, 125, 255, .16);

  --gradiente: linear-gradient(135deg, var(--magenta) 0%, #9028F4 32%, var(--eletrico) 70%, #2A1ACD 100%);
  --gradiente-suave: linear-gradient(135deg, rgba(243, 32, 243, .18), rgba(65, 37, 235, .22));
  --f-display: "Archivo", "Archivo Recurso", "Arial Narrow", sans-serif;
  --f-texto: "Instrument Sans", "Instrument Recurso", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(243, 240, 255, .04) inset, 0 10px 30px rgba(3, 0, 20, .35);
  --shadow-lg: 0 30px 80px rgba(3, 0, 20, .6);
  --glow: 0 0 0 1px rgba(107, 83, 249, .35), 0 8px 28px rgba(65, 37, 235, .45);
  --sidebar: 256px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scrollbar-color: #2a1c6e var(--noite); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(107, 83, 249, .16), transparent 60%),
    radial-gradient(800px 480px at -10% 110%, rgba(243, 32, 243, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 var(--f-texto);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--eletrico); color: var(--luz); }
a { color: var(--halo-claro); text-decoration: none; }
a:hover { color: var(--flare); text-decoration: underline; }
h1, h2, h3 { font-family: var(--f-display); font-stretch: 112.5%; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; font-weight: 800; }
h2 { font-size: 1.05rem; margin: 0 0 4px; font-weight: 700; }
h3 { font-size: .95rem; margin: 0; font-weight: 700; }
p { margin: 0 0 10px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86em; background: rgba(243, 240, 255, .06); border: 1px solid var(--line); padding: 2px 7px; border-radius: 8px; color: var(--flare); }
strong { color: var(--text); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--halo); outline-offset: 3px; border-radius: 6px; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px;
  background: linear-gradient(180deg, rgba(17, 0, 67, .92), rgba(10, 1, 48, .96));
  border-right: 1px solid var(--line);
}
.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 2px 10px 22px; color: var(--text); }
.logo:hover { text-decoration: none; color: var(--text); }
.logo-img { height: 30px; width: auto; display: block; }
.logo-tag {
  font-family: var(--f-display); font-stretch: 112.5%; font-weight: 700; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--flare); padding: 3px 10px; border-radius: 999px; background: var(--gradiente-suave); border: 1px solid rgba(143, 125, 255, .35);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-family: var(--f-display); font-stretch: 112.5%; font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); padding: 16px 12px 6px; font-weight: 700; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(243, 240, 255, .05); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(107, 83, 249, .28), rgba(107, 83, 249, .06)); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gradiente); }
.nav a.active svg.i { color: var(--halo-claro); }
.nav .pill { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who a { color: var(--text); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { color: var(--muted); font-size: .8rem; }
.content { min-width: 0; padding: 36px 44px 80px; }
.container { max-width: 1140px; margin: 0 auto; }
.container.narrow-page { max-width: 780px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto;
    flex-direction: row; align-items: center; gap: 8px; padding: 10px 16px;
    border-right: none; border-bottom: 1px solid var(--line); overflow-x: auto;
  }
  .logo { padding: 0 6px 0 0; }
  .logo-img { height: 22px; }
  .logo-tag, .nav-label, .sidebar-foot .who { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a.active::before { display: none; }
  .nav a span.lbl { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .content { padding: 22px 16px 56px; }
  .hide-sm { display: none; }
  .page-head .actions { width: 100%; }
}

/* ---------- cabeçalhos ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-head .sub { color: var(--text-2); margin: 6px 0 0; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.crumb:hover { color: var(--text); text-decoration: none; }
.crumb svg.i { width: 15px; height: 15px; }
.title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sync { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; margin-top: 8px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 4px rgba(59, 224, 138, .15); }
.sync.stale::before { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 194, 75, .15); }

/* ---------- botões (pílula, como no site) ---------- */
.btn, button {
  font: inherit; font-weight: 600; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(243, 240, 255, .04); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .05s, color .15s;
}
.btn:hover, button:hover { border-color: rgba(228, 220, 255, .55); background: rgba(243, 240, 255, .08); color: var(--text); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn svg.i, button svg.i { width: 16px; height: 16px; }
.btn-primary { background: var(--eletrico); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { background: #5236ff; border-color: transparent; box-shadow: 0 0 0 1px rgba(143, 125, 255, .55), 0 10px 34px rgba(65, 37, 235, .6); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(243, 240, 255, .06); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: rgba(255, 92, 138, .35); background: transparent; }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.btn-sm { height: 32px; padding: 0 13px; font-size: .82rem; }
.btn-lg { height: 54px; padding: 0 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; height: auto; padding: 4px; color: var(--halo-claro); font-weight: 600; border-radius: 6px; }
.btn-link:hover { text-decoration: underline; background: none; color: var(--flare); }
button:disabled { opacity: .55; cursor: progress; }
form.inline { display: inline-flex; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- cartões ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(23, 10, 87, .92), rgba(18, 5, 72, .92));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head p { margin: 3px 0 0; color: var(--text-2); font-size: .88rem; }
.container > .card + .card, .container > .card + .grid-2, .container > .grid-2 + .card { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.grid-2 > .stack-col { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { display: flex; align-items: center; gap: 14px; padding: 18px 20px; overflow: hidden; }
.kpi-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.kpi-icon svg.i { width: 20px; height: 20px; }
.kpi strong { display: block; font-family: var(--f-display); font-stretch: 112.5%; font-size: 1.75rem; line-height: 1.05; font-weight: 800; }
.kpi span { color: var(--text-2); font-size: .85rem; }
.kpi.is-alert { border-color: rgba(255, 92, 138, .5); box-shadow: 0 0 0 1px rgba(255, 92, 138, .25), 0 10px 40px rgba(255, 92, 138, .15); }
.kpi.is-alert strong { color: var(--bad); }
.kpi:first-child::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(243, 32, 243, .22), transparent 70%); pointer-events: none; }
.tone-brand { background: var(--brand-soft); color: var(--halo-claro); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-idle { background: rgba(243, 240, 255, .06); color: var(--muted); }

/* ---------- barra de filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.segmented { display: inline-flex; background: rgba(10, 1, 48, .6); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.segmented a { padding: 6px 16px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: .86rem; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.on { background: var(--eletrico); color: #fff; box-shadow: 0 4px 16px rgba(65, 37, 235, .45); }
.search { position: relative; flex: 1; max-width: 320px; min-width: 180px; }
.search svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 38px; height: 38px; border-radius: 999px; }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 15px 18px; vertical-align: middle; }
th { font-family: var(--f-display); font-stretch: 112.5%; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); background: rgba(10, 1, 48, .35); }
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr.row-link { cursor: pointer; }
tbody tr:hover { background: rgba(107, 83, 249, .08); }
tr.off { opacity: .55; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.cell-main a { color: var(--text); font-weight: 600; }
.cell-main a:hover { color: var(--flare); }
.cell-sub { color: var(--muted); font-size: .8rem; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 800; font-size: .78rem; letter-spacing: .02em;
  background: var(--gradiente-suave); color: var(--flare); border: 1px solid rgba(143, 125, 255, .3);
}
.avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: .66rem; }
.avatar.round { border-radius: 50%; }
.avatar svg.i { width: 17px; height: 17px; }
.person { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.t-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- estados ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status-connected { background: var(--ok-soft); color: var(--ok); }
.status-disconnected { background: var(--bad-soft); color: var(--bad); }
.status-disconnected::before { animation: pulse 1.6s infinite; }
.status-connecting { background: var(--info-soft); color: var(--info); }
.status-connecting::before { animation: pulse 1.2s infinite; }
.status-hibernated, .status-unknown { background: rgba(243, 240, 255, .06); color: var(--muted); }
.status-hibernated::before, .status-unknown::before { box-shadow: none; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tag svg.i { width: 13px; height: 13px; }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--magenta); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; box-shadow: 0 0 12px rgba(243, 32, 243, .6); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span.lbl { font-weight: 600; font-size: .86rem; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: .8rem; }
input, select, textarea {
  font: inherit; width: 100%; height: 42px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: rgba(10, 1, 48, .55); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: rgba(171, 165, 218, .55); }
select option, select optgroup { background: var(--superficie); color: var(--text); }
textarea { height: auto; padding: 11px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: transparent; outline: 2px solid var(--halo); outline-offset: 1px; }
input[readonly] { background: rgba(10, 1, 48, .8); color: var(--flare); }
.check { display: flex; align-items: flex-start; gap: 11px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(10, 1, 48, .4); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--eletrico); flex: none; }
.check strong { display: block; font-size: .9rem; }
.check span { color: var(--muted); font-size: .82rem; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 18px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { height: 32px; width: 190px; font-size: .84rem; border-radius: 999px; }

/* ---------- avisos (flash) ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 22px; font-weight: 500; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(59, 224, 138, .3); }
.flash-erro { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 92, 138, .3); }

/* ---------- ficha do cliente ---------- */
.hero { display: flex; align-items: center; gap: 18px; padding: 22px 24px; flex-wrap: wrap; }
.hero-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; flex: none; }
.hero-icon svg.i { width: 26px; height: 26px; }
.hero-text strong { font-family: var(--f-display); font-stretch: 112.5%; font-size: 1.15rem; display: block; }
.hero-text span { color: var(--text-2); }
.hero .actions { margin-left: auto; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.dl dt { color: var(--muted); font-size: .86rem; }
.dl dd { color: var(--text); word-break: break-word; }
.dl > :nth-last-child(-n+2) { border-bottom: none; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl dt { border-bottom: none; padding-bottom: 0; } }
.link-box { display: flex; gap: 8px; margin: 14px 0 12px; }
.link-box input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .8rem; border-radius: 999px; }
.link-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .82rem; margin-bottom: 16px; }
.link-meta span { display: inline-flex; align-items: center; gap: 6px; }
.link-meta svg.i { width: 14px; height: 14px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--brand-soft); border: 1px solid rgba(143, 125, 255, .25); color: var(--text-2); font-size: .9rem; }
.callout svg.i { color: var(--halo-claro); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); border-color: rgba(255, 194, 75, .28); }
.callout.warn svg.i { color: var(--warn); }
.empty-inline { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--muted); }
.empty-inline strong { color: var(--text); }
.empty-inline .kpi-icon { margin-bottom: 6px; }

/* linha do tempo */
.timeline { list-style: none; margin: 0; padding: 4px 24px 18px; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 12px 0 0; }
.timeline li::before { content: ""; position: absolute; left: 14px; top: 44px; bottom: -12px; width: 2px; background: linear-gradient(180deg, rgba(107, 83, 249, .45), rgba(107, 83, 249, .08)); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative; z-index: 1; }
.tl-dot svg.i { width: 14px; height: 14px; }
.tl-body { flex: 1; min-width: 0; padding-bottom: 4px; }
.tl-body strong { font-weight: 600; font-size: .9rem; }
.tl-body .cell-sub { display: block; }

/* avisos */
.notes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.note { display: flex; gap: 14px; padding: 18px 20px; position: relative; }
.note.unread { border-color: rgba(143, 125, 255, .45); }
.note.unread::after { content: ""; position: absolute; top: 22px; right: 20px; width: 9px; height: 9px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
.note-main { flex: 1; min-width: 0; }
.note-main strong { display: block; margin-bottom: 4px; padding-right: 20px; }
.note-text { color: var(--text-2); white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.note-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: .8rem; align-items: center; }
.note-foot a { font-weight: 600; }

/* vazio */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 24px; }
.empty .kpi-icon { width: 60px; height: 60px; border-radius: 18px; margin-bottom: 16px; }
.empty p { color: var(--text-2); max-width: 400px; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone p { margin: 0; color: var(--muted); font-size: .88rem; }
.demo-card { border-style: dashed; border-color: rgba(255, 194, 75, .5); background: linear-gradient(180deg, rgba(255, 194, 75, .08), rgba(18, 5, 72, .92)); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.pre { white-space: pre-wrap; word-break: break-word; }
.err { color: var(--bad); }

/* escolha do modo da instância */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } }
.mode-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: rgba(10, 1, 48, .4); transition: border-color .15s, box-shadow .15s, background .15s; }
.mode-card:hover { border-color: var(--line-strong); }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card strong { display: block; font-size: .92rem; margin-bottom: 2px; }
.mode-card span span { color: var(--muted); font-size: .82rem; line-height: 1.45; display: block; }
.mode-card:has(input:checked) { border-color: var(--halo); box-shadow: var(--glow); background: linear-gradient(160deg, rgba(107, 83, 249, .22), rgba(10, 1, 48, .5)); }
.mode-card:has(input:focus-visible) { outline: 2px solid var(--halo); outline-offset: 2px; }
.mode-card.disabled { opacity: .45; cursor: not-allowed; }
.mode-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.mode-icon svg.i { width: 17px; height: 17px; }

/* ---------- login ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(107, 83, 249, .35), transparent 70%),
    radial-gradient(500px 300px at 85% 100%, rgba(243, 32, 243, .14), transparent 70%),
    var(--noite);
}
.auth-card { width: 100%; max-width: 430px; padding: 36px 34px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(143, 125, 255, .2); }
.auth-card .logo { padding: 0 0 26px; }
.auth-card .logo-img { height: 34px; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 24px; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 20px; }

/* ---------- página pública ---------- */
body.public {
  background:
    radial-gradient(900px 500px at 50% -15%, rgba(107, 83, 249, .38), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(243, 32, 243, .12), transparent 70%),
    var(--noite);
}
.public-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 36px 16px; }
.public-brand { display: flex; align-items: center; margin-bottom: 26px; }
.public-brand img { height: 34px; width: auto; }
.public-card { width: 100%; max-width: 480px; padding: 34px 28px; text-align: center; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(143, 125, 255, .2); }
.public-card h1 { font-size: 1.45rem; margin-bottom: 10px; }
.public-card .lead { color: var(--text-2); }
.public-card .hero-icon { margin: 0 auto 18px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 18px 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: flex-start; color: var(--text-2); font-size: .92rem; }
.steps li::before { content: counter(s); width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--gradiente); color: #fff; font-weight: 700; font-size: .78rem; display: grid; place-items: center; margin-top: 1px; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 26px 0 8px; }
.qr-frame { position: relative; width: 292px; max-width: 100%; aspect-ratio: 1; margin: 18px auto 12px; padding: 14px; background: #fff; border-radius: 20px; box-shadow: 0 0 0 1px rgba(143, 125, 255, .4), 0 0 50px rgba(107, 83, 249, .45); display: grid; place-items: center; }
.qr-frame img { width: 100%; height: 100%; image-rendering: pixelated; border-radius: 6px; }
.loader { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #e4dcff; border-top-color: var(--eletrico); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.timer { height: 6px; border-radius: 999px; background: rgba(243, 240, 255, .08); overflow: hidden; margin: 6px auto 6px; max-width: 292px; }
.timer > div { height: 100%; width: 100%; background: var(--gradiente); transition: width 1s linear; }
.paircode { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 2.3rem; letter-spacing: .14em; font-weight: 700; margin: 18px 0 8px; padding: 20px; border-radius: 16px; background: rgba(10, 1, 48, .6); border: 1px dashed rgba(143, 125, 255, .55); color: var(--luz); word-break: break-all; }
.success-mark { width: 76px; height: 76px; border-radius: 50%; margin: 4px auto 18px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 40px rgba(59, 224, 138, .35); animation: pop .35s ease-out; }
.success-mark svg.i { width: 36px; height: 36px; stroke-width: 2.5; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.public-foot { color: var(--muted); font-size: .8rem; margin-top: 22px; text-align: center; }

/* utilitários (a CSP não deixa estilos inline) */
.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.ml-6 { margin-left: 6px; }
.card-body.tight { padding-top: 6px; padding-bottom: 6px; }
.jc-end { justify-content: flex-end; }
.av-lg { width: 58px; height: 58px; font-size: 1.1rem; }
.ta-left { text-align: left; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
details summary { cursor: pointer; }
details[open] summary { margin-bottom: 4px; }

/* ---------- painel agrupado por cliente ---------- */
tr.group-row td { background: rgba(10, 1, 48, .45); padding: 10px 18px; }
tr.group-row:hover { background: none; }
.group-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-head > a:first-child, .group-head > span:first-child { font-family: var(--f-display); font-weight: 700; color: var(--text); }
.group-head .btn { margin-left: auto; }
.jc-center { justify-content: center; }
