/* NuGeo Monitor — dashboard (dark) */
:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --surface: #11161d;
  --surface-2: #161c25;
  --surface-3: #1c2430;
  --line: #1f2833;
  --line-2: #2a3542;
  --text: #e6eaf0;
  --text-2: #a3aebd;
  --muted: #6d7888;
  --accent: #3987e5;
  --ok: #22c55e;
  --warn: #eab308;
  --bad: #ef4444;
  --off: #6d7888;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  font: 13px/1.45 "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.nav { border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; background: #0c1016; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; letter-spacing: .01em; }
.brand img { width: 22px; height: 22px; }
.brand small { display: block; font-weight: 450; color: var(--muted); font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--text-2); }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav .grow { flex: 1; }
.nav .who { padding: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.nav .who button { background: none; border: 0; color: var(--text-2); padding: 0; cursor: pointer; text-decoration: underline; }
main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.page-head .spacer { flex: 1; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input, select { background: var(--surface); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 9px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.btn { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4757; background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #fca5a5; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 6px 10px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-3); color: var(--text); }

/* ------------------------------------------------------------------ cards */
.grid { display: grid; gap: 14px; }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .note { text-transform: none; letter-spacing: 0; font-weight: 450; color: var(--muted); margin-left: auto; font-size: 12px; }
.section-gap { height: 14px; }
.stat .label { color: var(--text-2); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat .foot { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero .value { font-size: 32px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--off); }
.dot.online, .dot.active { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .14); }
.dot.idle { background: var(--warn); box-shadow: 0 0 0 3px rgba(234, 179, 8, .12); }
.dot.offline { background: var(--off); }
.dot.revoked { background: var(--bad); }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

/* ------------------------------------------------------------------ barras */
.stack { display: flex; height: 12px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack > span { min-width: 2px; height: 100%; }
.stack > span:first-child { border-radius: 4px 0 0 4px; }
.stack > span:last-child { border-radius: 0 4px 4px 0; }
.legend { display: grid; grid-template-columns: 1fr auto auto; gap: 7px 14px; margin-top: 14px; align-items: center; }
.legend .k { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hatch { background-image: repeating-linear-gradient(135deg, rgba(10, 13, 18, .55) 0 3px, transparent 3px 7px); }

.rowbar { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 3px 12px; align-items: center; }
.rowbar .lbl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rowbar .track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.rowbar .track > span { display: block; height: 100%; border-radius: 2px; }
.rowbar .v { text-align: right; }

.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px 1px 6px; font-size: 11.5px; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
button.chip { cursor: pointer; }
button.chip:hover { border-color: #46566a; color: var(--text); }

/* ------------------------------------------------------------------ simultâneo */
.sim { border: 1px dashed transparent; background:
  linear-gradient(var(--surface), var(--surface)) padding-box,
  repeating-linear-gradient(135deg, #2a3542 0 6px, #161c25 6px 12px) border-box; }
.sim-banner { display: flex; gap: 10px; align-items: flex-start; background: rgba(57, 135, 229, .08); border: 1px solid rgba(57, 135, 229, .25); color: #bcd4f3; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; }
.sim-banner b { color: #e3eefc; }
.sim-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.sim-row:first-of-type { border-top: 0; }
.sim-row .title { font-weight: 550; }
.sim-row .meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sim-row .big { text-align: right; font-weight: 650; font-size: 15px; }

/* ------------------------------------------------------------------ tabela */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 550; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl tfoot td { font-weight: 650; border-bottom: 0; border-top: 1px solid var(--line-2); }
.tbl th.simcol, .tbl td.simcol { background: rgba(57, 135, 229, .05); }
.tbl-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ timeline */
.tl { position: relative; user-select: none; }
.tl svg { display: block; width: 100%; }
.tl .lane-label { fill: var(--text-2); font-size: 11.5px; }
.tl .axis { fill: var(--muted); font-size: 11px; }
.tl .grid-line { stroke: var(--line); stroke-width: 1; }
.tl .blk { cursor: pointer; }
.tl .blk:hover { filter: brightness(1.25); }
.tl .sel { fill: rgba(57, 135, 229, .12); stroke: var(--accent); stroke-width: 1; }
.tl .evt { stroke: var(--muted); stroke-width: 1; }
.tl-help { color: var(--muted); font-size: 12px; margin-top: 6px; }

.seq { font-family: var(--mono); font-size: 12.5px; }
.seq .ln { display: grid; grid-template-columns: 52px minmax(80px, 1fr) minmax(0, 2fr); gap: 12px; align-items: center; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.seq .ln:hover { background: var(--surface-2); }
.seq .ln.on { background: rgba(57, 135, 229, .12); }
.seq .bar { height: 6px; border-radius: 3px; }
.seq .child { color: var(--text-2); }
.seq .child .t { padding-left: 14px; }

.detail h3 { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin: 16px 0 6px; font-weight: 600; }
.detail h3:first-child { margin-top: 0; }
.app-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.app-row .name { font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; }
.app-row .sub { color: var(--muted); font-size: 12px; }
.app-row .v { text-align: right; }
.web-row { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 3px 0 0 18px; color: var(--text-2); font-size: 12.5px; }

/* ------------------------------------------------------------------ gráfico por hora */
.hours { display: grid; grid-template-columns: 36px 1fr; gap: 0 8px; }
.hours .yax { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 11px; text-align: right; height: 150px; }
.hours .plot { position: relative; height: 150px; border-bottom: 1px solid var(--line-2); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; }
.hours .plot .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.hours .col { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; cursor: default; position: relative; }
.hours .col > span:first-child { border-radius: 0 0 1px 1px; }
.hours .col > span:last-child { border-radius: 4px 4px 0 0; }
.hours .col:hover { background: rgba(255, 255, 255, .03); }
.hours .xax { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; color: var(--muted); font-size: 11px; margin-top: 4px; }
.hours .xax span { text-align: center; }
.hours .media-strip { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 34px; align-items: end; margin-top: 10px; border-bottom: 1px solid var(--line-2); }
.hours .media-strip span { border-radius: 3px 3px 0 0; }
.hours .strip-label { grid-column: 1; align-self: end; color: var(--muted); font-size: 11px; text-align: right; margin-top: 10px; }

/* ------------------------------------------------------------------ tooltip / modal / login */
.tip { position: fixed; z-index: 50; pointer-events: none; background: #0d1117; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: 360px; box-shadow: 0 8px 28px rgba(0, 0, 0, .5); }
.tip b { font-weight: 600; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.modal-bg { position: fixed; inset: 0; background: rgba(3, 5, 8, .7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: min(520px, 100%); padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal .row { display: grid; gap: 5px; margin-top: 12px; }
.modal .row label { color: var(--text-2); font-size: 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); background: rgba(57, 135, 229, .07); }
.radio input { margin-top: 3px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(57, 135, 229, .12), transparent 60%), var(--bg); }
.login form { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: grid; gap: 12px; }
.login h1 { margin: 0 0 6px; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.login h1 img { width: 24px; }
.err { color: #fca5a5; font-size: 12.5px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 14px; z-index: 60; }
code.blk { display: block; white-space: pre-wrap; word-break: break-all; background: #0c1016; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }

@media (max-width: 1180px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav .grow, .nav .who { display: none; }
  .brand { padding: 4px 10px 4px 0; }
  main { padding: 16px; }
  .g-5, .g-3, .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
}
