/* ═══════════════════════════════════════════════════════════════
   ZENTRA WA CORE — design system do painel
   Dark sofisticado, verde-esmeralda calibrado, glass sutil,
   micro-interações curtas e layout 100% responsivo.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg: #080b11;
  --bg-soft: #0c1119;
  --surface: #101722;
  --surface-2: #151f2c;
  --surface-3: #1b2736;
  --line: #223043;
  --line-soft: #1a2432;
  --text: #e9eef6;
  --text-2: #a9b6c8;
  --text-3: #5d6b7d;
  --muted: #8695a9;

  --brand: #10b981;
  --brand-2: #34d399;
  --brand-3: #059669;
  --brand-ink: #04231a;
  --brand-glow: rgba(16, 185, 129, .18);

  --blue: #3b82f6;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --red: #ef4444;
  --pink: #ec4899;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 24px -12px rgba(0,0,0,.7);
  --sh-3: 0 24px 60px -24px rgba(0,0,0,.85);
  --ring: 0 0 0 3px rgba(16,185,129,.28);

  --sidebar-w: 254px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --t: 160ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(16,185,129,.10), transparent 60%),
    radial-gradient(900px 600px at 92% 4%, rgba(59,130,246,.09), transparent 62%),
    radial-gradient(700px 500px at 60% 110%, rgba(139,92,246,.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
[hidden] { display: none !important; }

/* ───────── login ───────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, rgba(21,31,44,.92), rgba(14,20,29,.96));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 28px 26px;
  box-shadow: var(--sh-3), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(18px);
  animation: rise .38s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.brand-lg { padding: 0 0 22px; gap: 14px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: var(--brand-ink);
  background: linear-gradient(145deg, var(--brand-2), var(--brand-3));
  box-shadow: 0 6px 18px -8px var(--brand), inset 0 1px 0 rgba(255,255,255,.4);
}
.brand-lg .brand-mark { width: 46px; height: 46px; flex-basis: 46px; font-size: 23px; border-radius: 13px; }
.brand-lg h1 { font-size: 19px; }
.brand-txt { display: grid; line-height: 1.25; }

.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--text-2); letter-spacing: .01em; }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: 13.5px;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input::placeholder, textarea::placeholder { color: #5b6a7d; }
input:hover, select:hover, textarea:hover { border-color: #2c3d54; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: var(--ring); background: var(--surface-3);
}
textarea { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
label.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
label.check input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
/* toggle em forma de cartão (higienização / ajustes avançados) */
label.check { padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: rgba(255,255,255,.012); transition: border-color var(--t), background var(--t); }
label.check:hover { border-color: rgba(148,163,184,.3); background: rgba(255,255,255,.03); }
label.check:has(input:checked) { border-color: rgba(16,185,129,.34); background: rgba(16,185,129,.055); }
label.check input:checked + span { color: var(--text); font-weight: 550; }
/* utilidades */
.ta-r { text-align: right; }
.ta-c { text-align: center; }

/* ───────── botões ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r-sm);
  border: 1px solid rgba(148,163,184,.26);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 550;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  cursor: pointer; white-space: nowrap;
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t), color var(--t);
}
.btn:hover { background: var(--surface-3); border-color: #2e405a; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(150deg, var(--brand-2), var(--brand-3));
  border-color: transparent; color: var(--brand-ink); font-weight: 700;
  box-shadow: 0 8px 20px -10px var(--brand);
}
.btn-primary:hover { background: linear-gradient(150deg, #4ade80, var(--brand)); box-shadow: 0 12px 26px -10px var(--brand); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,.055); color: var(--text); border-color: transparent; }
.btn-danger { color: #fecaca; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.10); }
.btn-danger:hover { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.55); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ───────── shell ───────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(16,23,34,.9), rgba(9,13,19,.96));
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
  z-index: 20;
}
.nav { display: grid; gap: 2px; padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none; position: relative;
  transition: background var(--t), color var(--t), transform var(--t);
}
.nav a .ico { width: 17px; text-align: center; opacity: .75; font-size: 13px; }
.nav a:hover { background: rgba(255,255,255,.045); color: var(--text); text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, rgba(16,185,129,.16), rgba(16,185,129,.03));
  color: #d7fbec;
}
.nav a.active::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; border-radius: 3px;
  background: var(--brand); box-shadow: 0 0 12px var(--brand);
}
.nav a.active .ico { opacity: 1; color: var(--brand-2); }
.sidebar-foot { padding: 12px; display: grid; gap: 9px; border-top: 1px solid var(--line-soft); }
.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.pill.ok .dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,.18); animation: pulse 2.4s infinite; }
.pill.bad .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 16px;
  padding: 15px 26px;
  background: rgba(8,11,17,.78);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.view { padding: 22px 26px 60px; flex: 1; }

/* ───────── cards e grids ───────── */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card {
  background: linear-gradient(180deg, rgba(21,31,44,.75), rgba(13,19,27,.85));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,.025);
  position: relative; overflow: hidden;
}
.card.pad-0 { padding: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { margin-left: auto; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.subhead { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.subhead::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.stat { display: grid; gap: 6px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat .d { font-size: 12px; color: var(--muted); }
.stat.accent .v { background: linear-gradient(120deg, var(--brand-2), #7dd3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ───────── tabelas ───────── */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 650;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
  white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: rgba(255,255,255,.028); }
tbody tr:last-child td { border-bottom: none; }
td .title { font-weight: 600; }
td .sub { color: var(--muted); font-size: 12px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--text-2); margin-bottom: 6px; font-size: 14px; }

/* ───────── badges ───────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: #6ee7b7; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); }
.badge.warn { color: #fcd34d; background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.badge.bad { color: #fca5a5; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); }
.badge.idle { color: #94a3b8; background: rgba(148,163,184,.1); border-color: rgba(148,163,184,.25); }
.badge.info { color: #93c5fd; background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); }
.badge.plain { color: var(--text-2); background: var(--surface-2); border-color: var(--line); }
.badge.plain::before { display: none; }

/* ───────── barras ───────── */
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-3), var(--brand-2)); transition: width .4s ease; }
.bar.warn > i { background: linear-gradient(90deg, #b45309, var(--amber)); }
.bar.bad > i { background: linear-gradient(90deg, #b91c1c, var(--red)); }

/* ───────── charts ───────── */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 118px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; position: relative; }
.spark .col i { display: block; border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.spark .col i.out { background: linear-gradient(180deg, var(--brand-2), rgba(16,185,129,.35)); }
.spark .col i.in { background: linear-gradient(180deg, #60a5fa, rgba(59,130,246,.3)); }
.spark .col span { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }

/* ───────── modal ───────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4,7,11,.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 22px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: min(620px, 100%); max-height: 90vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #141d29, #0e151e);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: rise .24s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 15px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }

/* ───────── toasts ───────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 9px; }
.toast {
  min-width: 240px; max-width: 380px;
  padding: 11px 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: var(--sh-2); font-size: 13px;
  animation: slidein .22s cubic-bezier(.2,.8,.2,1);
  border-left: 3px solid var(--brand);
}
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes slidein { from { opacity: 0; transform: translateX(18px); } }

/* ───────── util ───────── */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.stack.tight { gap: 8px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.sep { height: 1px; background: var(--line-soft); margin: 14px 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.secret-box {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; border-radius: var(--r-sm);
  background: rgba(16,185,129,.07); border: 1px dashed rgba(16,185,129,.4);
  font-family: var(--mono); font-size: 12.5px; word-break: break-all;
}
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: var(--r); }
.qr-box img { width: 250px; height: 250px; image-rendering: pixelated; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  padding: 9px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: color var(--t), border-color var(--t); white-space: nowrap;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand); }
.chk-list { display: grid; gap: 9px; }
.chk {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.chk .mark { width: 19px; height: 19px; flex: 0 0 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; margin-top: 1px; }
.chk .body { min-width: 0; flex: 1 1 auto; }
.chk.ok .mark { background: rgba(16,185,129,.16); color: var(--brand-2); }
.chk.no .mark, .chk.bad .mark { background: rgba(239,68,68,.14); color: #fca5a5; }
.chk.warn .mark { background: rgba(245,158,11,.14); color: var(--amber); }
.chk.idle .mark { background: rgba(148,163,184,.14); color: var(--text-3); }
.chk .t { font-weight: 550; font-size: 13px; }
.chk .s { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; word-break: break-word; line-height: 1.45; }
.chart-wrap { position: relative; }
.chart-empty {
  position: absolute; inset: 0; display: grid; gap: 3px; place-content: center; text-align: center;
  padding: 8px 20px; pointer-events: none;
}
.chart-empty strong { display: block; font-size: 13px; color: var(--text-2); }
.chart-empty span { display: block; font-size: 11.5px; color: var(--muted); max-width: 340px; }
.chart-wrap.empty { display: grid; place-items: center; min-height: 148px; }
.card-fill { display: flex; flex-direction: column; }
.card-fill .card-head { flex: 0 0 auto; }
.card-fill .chart-wrap { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; }
.card-fill .chart-wrap.empty { justify-content: center; }
.chart-empty.static { position: static; inset: auto; }
.chart-empty.static strong { font-size: 13.5px; }
.only-mobile { display: none; }

/* ───────── responsivo ───────── */
@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 272px;
    transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.2,.8,.2,1);
    box-shadow: var(--sh-3);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 50px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dd { margin-bottom: 8px; }
  .chip { display: none; }
  .toasts { left: 14px; right: 14px; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
