:root {
  color-scheme: dark;
  --bg: #14171d; --bg-elevated: #191d25; --surface: #1e232c; --surface-hover: #242a34;
  --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6f8; --text-muted: #aab2c0; --text-faint: #6b7280;
  --accent: #3fd6a3; --accent-strong: #2fbe8f; --accent-soft: rgba(63, 214, 163, 0.12); --accent-soft-border: rgba(63, 214, 163, 0.28);
  --info: #3f96d6; --info-soft: rgba(63, 150, 214, 0.14);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, 0.14);
  --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, 0.14);
  --radius-pill: 999px; --radius-lg: 18px; --radius-md: 12px; --radius-sm: 8px;
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.28);
  --font-display: "Poppins", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bg-elevated); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand img { width: 44px; height: auto; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-muted); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: grid; gap: 10px; }
.who { display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.who b { display: block; font-weight: 600; line-height: 1.2; }
.who span { font-size: 12px; color: var(--text-faint); }
.main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--text-muted); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; min-width: 0; }
.card h2 { font-size: 15px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.kpi small { color: var(--text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi b { display: block; font-family: var(--font-display); font-size: 34px; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi span { color: var(--text-muted); font-size: 13px; }
.kpi.k-ok b { color: var(--accent); } .kpi.k-info b { color: var(--info); } .kpi.k-bad b { color: var(--danger); }
.cols-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.cols-eq { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
@media (max-width: 960px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 16px; align-content: start; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-pill); border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--accent); color: #0a1712; white-space: nowrap; transition: background .15s, border-color .15s, transform .12s; }
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(.97); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #240a0a; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 8px 12px; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.input, .select { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; font-size: 14px; outline: none; }
.input:focus, .select:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-faint); }
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.field { display: grid; gap: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-border); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); color: var(--text-muted); font-size: 13px; font-weight: 600; }
.pill:hover { color: var(--text); border-color: var(--text-muted); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #0a1712; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }
.table td small { display: block; color: var(--text-faint); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.row-link { font-weight: 600; }
.table a.row-link:hover { color: var(--accent); }

.hb { display: block; width: 100%; height: 10px; }
.hb-bg { fill: var(--bg-elevated); } .hb-fill { fill: var(--accent); } .hb-info { fill: var(--info); } .hb-hot { fill: var(--danger); } .hb-warm { fill: var(--warning); } .hb-cold { fill: var(--info); } .hb-none { fill: var(--text-faint); } .hb-gold { fill: var(--text-muted); }
.hrow { display: grid; grid-template-columns: 130px minmax(0, 1fr) 46px; gap: 12px; align-items: center; padding: 6px 0; }
.hrow span:first-child { color: var(--text-muted); }
.hrow b { text-align: right; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.tick { fill: var(--text-faint); font-size: 11px; font-family: var(--font-body); text-anchor: middle; }
.note { color: var(--text-muted); font-size: 13px; }
.list { margin: 0; padding: 0; list-style: none; display: grid; }
.list li { padding: 11px 0; border-top: 1px solid var(--border); display: grid; gap: 2px; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list span { color: var(--text-muted); font-size: 13px; }
.list a { color: var(--accent); }
.health { display: flex; gap: 8px; flex-wrap: wrap; }
.head-health { flex: 1 1 320px; justify-content: center; align-self: center; }

.thread { display: flex; flex-direction: column; gap: 8px; max-height: 64vh; overflow-y: auto; padding-right: 4px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 16px; white-space: pre-line; overflow-wrap: anywhere; }
.msg small { display: block; text-align: right; font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.msg.in { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-soft-border); border-bottom-right-radius: 4px; }
.msg.human { background: var(--info-soft); border-color: transparent; }
.dl { display: grid; margin: 0; }
.dl div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.dl div:first-child { border-top: 0; }
.dl dt { color: var(--text-faint); font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { padding: 12px 16px; border-radius: var(--radius-md); background: var(--warning-soft); color: var(--warning); margin-bottom: 16px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--accent-soft); color: var(--accent); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; background: var(--bg-elevated); border: 1px dashed var(--accent-soft-border); border-radius: var(--radius-md); padding: 10px 14px; user-select: all; }
.day h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 10px; }
.day.today h2::after { content: "hoje"; margin-left: 8px; color: var(--text-faint); text-transform: none; letter-spacing: 0; }
.slot { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--border); }
.slot:first-of-type { border-top: 0; }
.slot time { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot small { color: var(--text-faint); display: block; }
@media (max-width: 640px) { .slot { grid-template-columns: 80px minmax(0, 1fr); } .slot .badge { grid-column: 2; justify-self: start; } }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--text-muted); }
.empty { text-align: center; padding: 34px 16px; color: var(--text-muted); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 32px 28px; display: grid; gap: 18px; }
.login-card img { width: 120px; margin: 0 auto; display: block; }
.login-card h1 { font-size: 20px; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-muted); margin-top: -10px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
  .brand { padding: 0; }
  .brand img { width: 34px; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; flex: none; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .sidebar-foot { border: 0; padding: 0; margin-left: auto; display: flex; align-items: center; }
  .who div:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; } .mb16 { margin-bottom: 16px; }
.w460 { max-width: 460px; } .w640 { max-width: 640px; } .minw { min-width: 160px; } .wauto { width: auto; }
.lnk { color: var(--accent); }

[data-tip] { position: relative; cursor: help; }
[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: max-content; max-width: min(280px, 80vw); padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-card); font: 400 12.5px/1.45 var(--font-body); letter-spacing: 0; text-transform: none; white-space: normal; text-align: left; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s ease, transform .15s ease, visibility .15s; pointer-events: none; }
[data-tip][data-tip-pos="end"]::after { left: auto; right: 0; }
.head-health [data-tip]::after { left: 50%; margin-left: -140px; }
.head-health [data-tip]:first-child::after { left: 0; margin-left: 0; }
.head-health [data-tip]:last-child::after { left: auto; right: 0; margin-left: 0; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; visibility: visible; transform: none; }
[data-tip]:focus-visible { outline: 2px solid var(--accent-soft-border); outline-offset: 2px; }

.card .sub { color: var(--text-muted); font-size: 12.5px; margin: -10px 0 14px; }
.chart .grid { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .ytick, .chart .xtick { fill: var(--text-muted); font: 400 11px var(--font-body); }
.chart .ytick { text-anchor: end; } .chart .xtick { text-anchor: middle; }
.chart .ytick.lbl { font-size: 12px; }
.chart .val { fill: var(--text); font: 600 11px var(--font-body); text-anchor: middle; }
.chart .val.left { text-anchor: start; font-size: 12px; }
.chart .val.zero { fill: var(--text-faint); font-weight: 400; }
.chart .bar { transition: opacity .15s; } .chart .bar:hover { opacity: .8; }
.c-accent { fill: var(--accent); } .c-info { fill: var(--info); } .c-warning { fill: var(--warning); } .c-danger { fill: var(--danger); } .c-faint { fill: var(--text-faint); } .c-purple { fill: #a855f7; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.c-accent { background: var(--accent); } .dot.c-info { background: var(--info); } .dot.c-warning { background: var(--warning); } .dot.c-danger { background: var(--danger); } .dot.c-faint { background: var(--text-faint); } .dot.c-purple { background: #a855f7; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut { width: 160px; height: 160px; flex: none; }
.donut path { transition: opacity .15s; } .donut path:hover { opacity: .8; }
.donut-empty { fill: none; stroke: var(--bg-elevated); stroke-width: 32; }
.donut-num { fill: var(--text); font: 600 26px var(--font-display); text-anchor: middle; }
.donut-lbl { fill: var(--text-muted); font: 400 12px var(--font-body); text-anchor: middle; }
.legend { list-style: none; display: grid; gap: 8px; color: var(--text-muted); font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }

.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline .select { width: auto; min-width: 160px; padding: 6px 10px; }
.textarea { width: 100%; min-height: 120px; resize: vertical; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; font-size: 14px; line-height: 1.5; outline: none; font-family: inherit; }
.textarea:focus { border-color: var(--accent); }
.script { scroll-margin-top: 16px; }
.script .help { margin: 4px 0 10px; }
.script .fields { margin: 6px 0 0; }
.script .bubble { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin: 4px 0; max-width: 520px; font-size: 13px; white-space: pre-wrap; }
.script .variant + .variant { margin-top: 12px; }
.script details { margin-top: 12px; }
.script details summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.script .hist { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.flash-ok { background: var(--accent-soft-bg, rgba(0,160,120,.12)); border: 1px solid var(--accent-soft-border); border-radius: var(--radius-md); padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.flash-err { background: rgba(220,60,60,.1); border: 1px solid rgba(220,60,60,.4); border-radius: var(--radius-md); padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
