/* Painel de Servidores: tema preto e laranja */
:root {
  --bg: #0a0a0b; --surface: #141416; --surface-2: #1c1c20; --surface-3: #24242a;
  --text: #f3f3f4; --muted: #8f8f98; --border: #27272d;
  --accent: #ff7a1a; --accent-2: #ff9a4d; --accent-soft: rgba(255, 122, 26, .13); --accent-text: #111;
  --ok: #3ddc84; --ok-bg: rgba(61, 220, 132, .12);
  --bad: #ff4d4f; --bad-bg: rgba(255, 77, 79, .14);
  --warn: #ffb020; --paused: #55555c; --unknown: #3a3a40;
  --radius: 16px; --side-w: 236px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); min-height: 100vh;
  background: radial-gradient(1100px 520px at 90% -10%, rgba(255,122,26,.09), transparent 60%) fixed, var(--bg);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace; font-size: .88em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
small { font-size: .55em; font-weight: 600; margin-left: 2px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.txt-ok { color: var(--ok); }
.txt-bad { color: var(--bad); }
.txt-warn { color: var(--warn); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout com menu lateral */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20; display: flex; flex-direction: column;
  gap: 1.25rem; padding: 1.25rem 1rem; background: #0d0d0f; border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--text); line-height: 1.15;
  font-size: 1.05rem; padding: 0 .5rem; text-decoration: none !important; }
.logo { color: var(--accent); text-shadow: 0 0 14px var(--accent); font-size: 1.3rem; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; }
.side-nav a { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: 11px; color: var(--muted);
  font-weight: 600; font-size: .98rem; text-decoration: none; transition: background .15s, color .15s; }
.side-nav a svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 800; min-width: 22px; height: 22px;
  border-radius: 99px; display: inline-grid; place-items: center; padding: 0 6px; animation: pulse 1.6s infinite; }
.side-quick { display: flex; flex-direction: column; gap: .5rem; }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: .75rem .5rem 0; border-top: 1px solid var(--border); }
body.with-nav main { margin-left: var(--side-w); }
.mobile-bar { display: none; }
.scrim { display: none; }
.container { max-width: 1240px; margin: 0 auto; padding: 1.75rem 2rem; }
.container.wide { max-width: 1600px; }
.crumbs { margin: 0 0 .75rem; color: var(--muted); font-size: .9rem; }

/* ---------- blocos básicos */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.35rem; margin-bottom: 1rem; }
section.card { overflow-x: auto; }
.narrow { max-width: 680px; }
.narrow-form { max-width: 360px; }
.auth { max-width: 400px; margin: 12vh auto; border-top: 3px solid var(--accent); }
.auth h1::before { content: "●"; color: var(--accent); margin-right: .45rem; text-shadow: 0 0 12px var(--accent); }
.empty { text-align: center; padding: 2.75rem 1rem; }
.page-head, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-head { margin-bottom: .5rem; }
.section-head h2 { margin-bottom: .5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.danger-zone { margin: 1.5rem 0; }
.alert { padding: .7rem 1rem; border-radius: 10px; background: var(--accent-soft); border: 1px solid rgba(255,122,26,.3); }
.alert.error { background: var(--bad-bg); color: var(--bad); border-color: rgba(255,77,79,.35); }

/* ---------- botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none !important; transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { padding: .32rem .75rem; font-size: .85rem; border-radius: 8px; }
.btn.big { padding: .8rem 1.3rem; font-size: 1rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn:disabled { opacity: .55; cursor: wait; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
form.inline { display: inline; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text); font-size: 1.05rem; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.spinning, .spinning .ico { animation: spin 1s linear infinite; }
.btn.spinning { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }
.toggle { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-3);
  cursor: pointer; font-size: 1rem; filter: grayscale(1); opacity: .45; }
.toggle.on { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.toggle.star { color: var(--accent); }

/* ---------- formulários */
.stack { display: flex; flex-direction: column; gap: .9rem; border: 0; padding: 0; margin: 0; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 150px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 500; }
input, select, textarea { font: inherit; padding: .62rem .75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- status */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--unknown); flex: none; }
.dot.up { background: var(--ok); box-shadow: 0 0 9px rgba(61,220,132,.6); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); animation: pulse 1.4s infinite; }
.dot.paused { background: var(--paused); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill.big { font-size: .85rem; padding: 4px 12px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.strip { display: inline-flex; gap: 2px; align-items: flex-end; height: 20px; flex: none; }
.strip i { width: 4px; height: 100%; border-radius: 2px; background: var(--ok); opacity: .85; }
.strip i.bad { background: var(--bad); }
.strip i.na { background: var(--unknown); opacity: .5; }

/* ---------- tabelas */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 700; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.table th, .table td { padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.disabled, .table tr.paused { opacity: .6; }
.table tr.is-hidden { opacity: .4; }
.table tr.down td { background: var(--bad-bg); }

/* ---------- dashboard: indicadores */
.kpis { display: grid; grid-template-columns: 2.2fr repeat(5, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; justify-content: center; gap: .15rem; text-align: left; padding: 1.1rem 1.3rem;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; min-height: 116px; }
button.kpi { cursor: pointer; transition: border-color .15s, transform .15s; }
button.kpi:hover { border-color: var(--accent); transform: translateY(-2px); }
button.kpi:disabled { cursor: default; transform: none; border-color: var(--border); }
.kpi.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.kpi-value { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.kpi-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi.ok .kpi-value { color: var(--ok); }
.kpi.bad .kpi-value { color: var(--bad); }
.kpi.bad.alert { background: linear-gradient(135deg, rgba(255,77,79,.18), var(--surface)); border-color: rgba(255,77,79,.5); }
.kpi:nth-child(5) .kpi-value, .kpi:nth-child(4) .kpi-value { color: var(--accent); }
.kpi-health { flex-direction: row; align-items: center; gap: 1.2rem; background: linear-gradient(135deg, var(--surface-2), var(--surface)); }
.kpi-health.bad { border-color: rgba(255,77,79,.5); background: linear-gradient(135deg, rgba(255,77,79,.16), var(--surface)); }
.kpi-health.ok { border-color: rgba(61,220,132,.3); }
.kpi-health > div { display: flex; flex-direction: column; gap: .15rem; }
.kpi-title { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.ring { --p: 0; --c: var(--ok); width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.kpi-health.bad .ring { --c: var(--bad); }
.ring span { width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
  font-weight: 800; font-size: 1.1rem; }

/* ---------- dashboard: barra de filtros */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .8rem; position: sticky; top: .5rem; z-index: 5;
  background: rgba(20,20,22,.92); backdrop-filter: blur(8px); }
.toolbar input[type=search] { min-width: 0; }
.toolbar > input[type=search] { flex: 1 1 280px; width: auto; }
.toolbar select { width: auto; min-width: 190px; }
.search-wrap { position: relative; flex: 1 1 260px; }
.search-wrap .ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap input { padding-left: 2.4rem; }
.chips, .seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.chips button, .seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: .9rem;
  padding: .45rem .85rem; border-radius: 8px; cursor: pointer; }
.chips button:hover, .seg button:hover { color: var(--text); }
.chips button.on, .seg button.on { background: var(--accent); color: var(--accent-text); }
.customize-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }

/* ---------- dashboard: por servidor */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid > * { min-width: 0; }
.grid .card { margin: 0; display: flex; flex-direction: column; }
.server { border-top: 3px solid var(--accent); }
.server.has-down { border-top-color: var(--bad); }
.server header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.server-id { display: flex; gap: .8rem; align-items: center; color: var(--text); text-decoration: none !important; min-width: 0; }
.server-id > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.server-name { font-size: 1.15rem; font-weight: 800; }
.server-id:hover .server-name { color: var(--accent); }
.server-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.has-down .server-icon { background: var(--bad-bg); color: var(--bad); }
.server footer { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1rem; font-weight: 600; }
.svc-list { list-style: none; padding: 0; margin: .75rem 0; display: flex; flex-direction: column; gap: .4rem; }
.svc-list li.svc { display: flex; align-items: center; gap: .75rem; padding: .65rem .7rem; border-radius: 11px;
  background: var(--surface-2); border: 1px solid transparent; }
.svc-list li.down { background: var(--bad-bg); border-color: rgba(255,77,79,.35); }
.svc-list li.paused { opacity: .55; }
.svc-list li.is-hidden { opacity: .35; border-style: dashed; border-color: var(--border); }
.svc-list li.is-pinned { border-color: rgba(255,122,26,.35); }
.svc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.svc-main .small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.down .svc-main .small { color: var(--bad); }
.svc-name { color: var(--text); font-weight: 700; font-size: 1rem; }
.svc-name:hover { color: var(--accent); text-decoration: none; }
.pin { color: var(--accent); margin-right: .3rem; }
.svc-meta { display: flex; flex-direction: column; align-items: flex-end; min-width: 58px; line-height: 1.2; font-size: .8rem; color: var(--muted); }
.svc-meta b { font-size: .95rem; }
.svc-actions { display: flex; gap: .3rem; }
.empty-svc { padding: .5rem; }

/* ---------- dashboard: blocos */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { position: relative; display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.2rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--unknown); min-width: 0; }
.tile.up { border-left-color: var(--ok); }
.tile.down { border-left-color: var(--bad); background: linear-gradient(135deg, rgba(255,77,79,.16), var(--surface)); border-color: rgba(255,77,79,.45); }
.tile.paused { opacity: .55; }
.tile.is-hidden { opacity: .35; border-style: dashed; }
.tile-top { display: flex; justify-content: space-between; align-items: center; }
.tile-status { font-size: .78rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.up .tile-status { color: var(--ok); }
.down .tile-status { color: var(--bad); }
.tile-name { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.2; overflow-wrap: anywhere; }
.tile-name:hover { color: var(--accent); text-decoration: none; }
.tile-server { color: var(--muted); font-size: .85rem; }
.tile-metrics { display: flex; gap: 1.5rem; margin: .4rem 0 .2rem; }
.tile-metrics div { display: flex; flex-direction: column; }
.tile-metrics b { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.tile-metrics span { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.tile-error { color: var(--bad); font-size: .82rem; overflow-wrap: anywhere; }
.tile .strip { height: 22px; }

/* ---------- listas de cadastro */
.list-cards { display: flex; flex-direction: column; gap: .75rem; }
.list-card { display: flex; align-items: center; gap: 1.25rem; margin: 0; color: var(--text); text-decoration: none !important;
  border-left: 4px solid var(--accent); transition: border-color .15s, transform .15s; }
.list-card:hover { transform: translateX(3px); border-color: var(--accent); }
.list-card.has-down { border-left-color: var(--bad); }
.list-title { font-size: 1.15rem; font-weight: 800; }
.list-stat { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.list-stat b { font-size: 1.5rem; line-height: 1.1; }
.list-stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.list-stat.ok b { color: var(--ok); }
.list-stat.bad b { color: var(--bad); }
.chev { font-size: 1.8rem; color: var(--muted); }

/* ---------- tarefas / terminal */
.log { background: #050506; color: #d1d7e0; padding: .8rem; border-radius: 10px; border: 1px solid var(--border); max-height: 420px; overflow: auto;
  font: .82rem/1.45 ui-monospace, "DejaVu Sans Mono", monospace; white-space: pre-wrap; word-break: break-all; margin: .5rem 0; }
.copy-row { display: flex; gap: .5rem; align-items: flex-start; }
.copy-row .log { flex: 1; margin: 0; }
.updates-summary { margin: .5rem 0 1rem; }
details summary { cursor: pointer; color: var(--accent); margin: .25rem 0; font-weight: 600; }
.term-page { display: flex; flex-direction: column; height: 100vh; padding: .75rem; }
.term-bar { display: flex; gap: .75rem; align-items: center; padding: .25rem .5rem .6rem; }
#terminal { flex: 1; min-height: 0; background: #050506; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }

/* ---------- responsivo */
@media (max-width: 1300px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi-health { grid-column: span 3; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 15; }
  body.with-nav main { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; position: sticky; top: 0; z-index: 10;
    background: rgba(10,10,11,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
  .mobile-bar .nav-badge { margin-left: auto; }
  .container { padding: 1rem; }
  .term-page { height: calc(100vh - 55px); }
  .toolbar { top: 60px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .kpi-health { grid-column: span 2; }
  .kpi { min-height: 92px; padding: .9rem 1rem; }
  .kpi-value { font-size: 2rem; }
  .ring { width: 66px; height: 66px; }
  .ring span { width: 52px; height: 52px; font-size: .95rem; }
  .kpi-title { font-size: 1.1rem; }
  .toolbar { position: static; }
  .toolbar select, .chips, .seg { width: 100%; }
  .chips button, .seg button { flex: 1; padding: .5rem .3rem; }
  .svc-list li.svc .strip { display: none; }
  .dash-head .actions { width: 100%; }
  .dash-head .actions .btn { flex: 1; padding: .7rem .6rem; white-space: nowrap; font-size: .95rem; }
  .hide-sm { display: none; }
  .list-card { flex-wrap: wrap; gap: .75rem; }
  .list-card .grow { flex-basis: calc(100% - 70px); }
  .list-stat { min-width: 0; flex: 1; }
  .chev { display: none; }
}
