@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/plex-sans-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/plex-sans-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/plex-sans-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/plex-mono-500.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --bg: #eef2f5; --dot: #d5dde4; --surface: #ffffff; --surface-2: #f1f4f7; --surface-3: #e4eaef;
  --text: #15202b; --muted: #566676; --line: #d9e0e6; --line-strong: #bcc7d1;
  --accent: #0b7a70; --accent-strong: #09655d; --accent-text: #ffffff; --accent-soft: #dcf3f0;
  --ok: #12683a; --ok-bg: #dcf3e4; --bad: #a4211c; --bad-bg: #fbe3e1; --warn: #7d5407; --warn-bg: #f9edc8;
  --term-bg: #0e161d; --term-text: #cfe3dc;
  --shadow: 0 1px 2px rgb(20 35 50 / .06), 0 4px 16px rgb(20 35 50 / .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a1016; --dot: #18222c; --surface: #121a22; --surface-2: #19232d; --surface-3: #222e3a;
    --text: #e6edf3; --muted: #93a4b4; --line: #24313d; --line-strong: #35475a;
    --accent: #2dd4bf; --accent-strong: #5eead4; --accent-text: #05201c; --accent-soft: #10332f;
    --ok: #74dba0; --ok-bg: #12301f; --bad: #f6a6a0; --bad-bg: #3f1d1b; --warn: #eec96f; --warn-bg: #372c10;
    --term-bg: #070c11; --term-text: #cfe3dc;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .22);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1016; --dot: #18222c; --surface: #121a22; --surface-2: #19232d; --surface-3: #222e3a;
  --text: #e6edf3; --muted: #93a4b4; --line: #24313d; --line-strong: #35475a;
  --accent: #2dd4bf; --accent-strong: #5eead4; --accent-text: #05201c; --accent-soft: #10332f;
  --ok: #74dba0; --ok-bg: #12301f; --bad: #f6a6a0; --bad-bg: #3f1d1b; --warn: #eec96f; --warn-bg: #372c10;
  --term-bg: #070c11; --term-text: #cfe3dc;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
a { color: var(--accent-strong); }
.muted { color: var(--muted); }
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .93em; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.error { color: var(--bad); background: var(--bad-bg); padding: .6rem .85rem; border-radius: 8px; margin: 0; }

/* Controles */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: .5rem .75rem; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; transition: border-color .12s, background .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .45rem .9rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500;
  transition: background .12s, border-color .12s, filter .12s;
}
button:hover { background: var(--surface-2); border-color: var(--line-strong); }
button:disabled { opacity: .55; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; padding-inline: 1.2rem; }
.primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.1); }
.ghost { background: transparent; }
.icon-btn { width: 42px; padding: 0; }
.danger { color: var(--bad); }
label { display: block; font-weight: 500; font-size: .88rem; color: var(--muted); }
label input, label select, label textarea { margin-top: .3rem; font-size: .95rem; color: var(--text); font-weight: 400; }
label.check { display: flex; gap: .55rem; align-items: center; color: var(--text); min-height: 42px; }
label.check input { margin: 0; flex: none; }
.help { display: block; font-weight: 400; font-size: .8rem; margin-top: .25rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }

/* Marca */
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; flex: none; }

/* Login */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 22px 22px;
}
.login-card { width: min(400px, 100%); display: grid; gap: 1rem; padding: 1.75rem; }
.login-head { display: grid; gap: .5rem; margin-bottom: .25rem; }
.login-head .brand { font-size: 1.35rem; }
.login-head .brand-mark { width: 36px; height: 36px; }
.login-head p { margin: 0; }
.login-card .primary { width: 100%; margin-top: .25rem; }

/* Estrutura */
.layout {
  min-height: 100%; display: grid; grid-template-columns: 256px minmax(0, 1fr);
  grid-template-rows: auto 1fr auto; grid-template-areas: "top top" "side main" "side foot";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: .5rem; padding: .55rem 1rem; min-height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3;
}
.who { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--muted); padding-right: .35rem; }
.who b { color: var(--text); font-weight: 500; }
.role { font-size: .72rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); padding: .05rem .45rem; border-radius: 999px; }
.menu-toggle, .mobile-only { display: none; }
.sidebar button.mobile-only { display: none; }
.sidebar {
  grid-area: side; padding: .75rem; background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar h3 { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 1.1rem .7rem .35rem; }
.sidebar h3:first-child { margin-top: .35rem; }
.sidebar button {
  width: 100%; justify-content: flex-start; gap: .65rem; min-height: 38px; padding: .35rem .7rem; margin-bottom: 1px;
  border: 0; background: transparent; color: var(--muted); font-weight: 500; text-align: left;
}
.sidebar button:hover { background: var(--surface-2); color: var(--text); }
.sidebar button[aria-current=page] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.main { grid-area: main; padding: 1.5rem; width: 100%; max-width: 1180px; display: grid; gap: 1rem; align-content: start; min-width: 0; }
.footer { grid-area: foot; padding: .25rem 1.5rem 1.1rem; font-size: .78rem; }
.footer a { color: inherit; }

/* Cabeçalho da página */
.tool-head { display: flex; gap: .85rem; align-items: center; }
.tool-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); }
.tool-icon .icon { width: 22px; height: 22px; }
.tool-head h2 { font-size: 1.3rem; letter-spacing: -.01em; }
.tool-head p { margin: .1rem 0 0; font-size: .92rem; }

/* Formulário */
.tool-form { display: flex; flex-wrap: wrap; gap: .85rem 1rem; align-items: flex-start; }
.tool-form > label.check { margin-top: 1.62rem; }
.tool-form > label { flex: 1 1 150px; min-width: 0; }
.tool-form > label.field-main { flex: 3 1 280px; }
.tool-form > .error { flex: 1 1 100%; }
.tool-form > label.field-main input, .tool-form > label.field-main textarea { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .95rem; }
.tool-form .actions { display: flex; flex: 0 0 auto; margin-top: 1.62rem; }

.empty { display: grid; place-items: center; gap: .4rem; padding: 2.75rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.empty .icon { width: 28px; height: 28px; opacity: .7; }
.empty p { margin: 0; }

/* Resultados */
.results { display: grid; gap: 1rem; min-width: 0; }
.results > * { min-width: 0; }
.result h3 { font-size: .98rem; margin-bottom: .75rem; }
.result h3 + .note { margin: -.5rem 0 .75rem; font-size: .85rem; color: var(--muted); }
.scroll { overflow-x: auto; }

.status { order: -2; display: flex; gap: .6rem; align-items: center; min-height: 34px; font-size: .9rem; color: var(--muted); }
.status button { min-height: 32px; padding: .15rem .65rem; font-size: .85rem; margin-left: auto; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.running i { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status.ok i { background: var(--ok); }
.status.fail i { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .status.running i { animation: none; } * { transition: none !important; } }
progress { order: -1; width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-3); accent-color: var(--accent); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .55rem; margin: 0; }
.tile { background: var(--surface-2); border-radius: 8px; padding: .55rem .75rem; min-width: 0; }
.tile dt { font-size: .75rem; color: var(--muted); margin-bottom: .1rem; }
.tile dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .7rem; vertical-align: top; }
thead th { font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
tbody td { border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: .25rem; }

.tone { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.tone-ok { color: var(--ok); background: var(--ok-bg); }
.tone-bad { color: var(--bad); background: var(--bad-bg); }
.tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-muted { color: var(--muted); background: var(--surface-2); font-weight: 500; }
td .tone { white-space: normal; border-radius: 10px; }

details > summary { cursor: pointer; display: flex; gap: .5rem; align-items: center; font-weight: 600; font-size: .98rem; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--muted); transition: transform .12s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary .count { font-weight: 500; font-size: .8rem; color: var(--muted); background: var(--surface-2); padding: .02rem .5rem; border-radius: 999px; }
details[open] > summary { margin-bottom: .75rem; }

.terminal { padding: 0; overflow: hidden; }
.terminal-bar { display: flex; gap: .4rem; align-items: center; padding: .5rem .9rem; font-size: .78rem; color: #8ea3b3; background: var(--term-bg); border-bottom: 1px solid #1d2a35; }
.terminal-bar span { width: 8px; height: 8px; border-radius: 50%; background: #2dd4bf; }
pre {
  margin: 0; padding: .85rem 1rem; overflow-x: auto; background: var(--term-bg); color: var(--term-text);
  font: 13px/1.55 "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

.watch-list { display: grid; gap: .6rem; }
.watch-item { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: 8px; padding: .75rem .9rem; }
.watch-main { flex: 1 1 340px; min-width: 0; }
.watch-main p { margin: .15rem 0 0; font-size: .85rem; }
.watch-target { font-size: 1rem; font-weight: 500; }
.watch-summary { color: var(--text); }
.watch-actions { flex: 0 0 auto; }
.badge { margin-left: auto; min-width: 20px; padding: 0 .35rem; border-radius: 999px; text-align: center; font-size: .72rem; font-weight: 600; line-height: 20px; color: var(--bad); background: var(--bad-bg); }
.small { min-height: 32px; padding: .15rem .6rem; font-size: .85rem; white-space: nowrap; }
.nowrap { flex-wrap: nowrap; }
.card-head { margin-bottom: .75rem; }
.card-head h3 { margin: 0; }
.export { display: flex; gap: .4rem; margin-left: auto; align-items: center; }
.export button { margin: 0; }
.btn-link { display: inline-flex; align-items: center; min-height: 32px; padding: .15rem .65rem; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; font-weight: 500; text-decoration: none; }
.btn-link:hover { background: var(--surface-2); border-color: var(--line-strong); }

.links { display: flex; flex-wrap: wrap; gap: .5rem; }
.links a { display: inline-flex; align-items: center; min-height: 36px; padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 500; font-size: .9rem; }
.links a:hover { background: var(--surface-2); border-color: var(--line-strong); }

dialog { width: min(440px, calc(100vw - 32px)); color: var(--text); padding: 1.5rem; }
dialog::backdrop { background: rgb(4 10 16 / .6); }
#dialog-form { display: grid; gap: .9rem; }
#dialog-form h2 { font-size: 1.1rem; }
#dialog-fields { display: grid; gap: .8rem; }

@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "side" "main" "foot"; grid-template-rows: auto auto 1fr auto; }
  .menu-toggle { display: inline-flex; }
  .sidebar button.mobile-only { display: flex; }
  #change-password { display: none; }
  .topbar-actions { flex-wrap: nowrap; }
  .topbar { padding: .5rem 16px; gap: .35rem; }
  .sidebar { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar.open { display: block; }
  .main { padding: 1rem 16px; }
  .footer { padding: .25rem 16px 1rem; }
  .who { display: none; }
  .topbar-actions { margin-left: auto; }
  .card { padding: 1rem; }
  .tool-form .actions, .tool-form .actions button { width: 100%; }
  .tool-form .actions, .tool-form > label.check { margin-top: 0; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .scroll table { min-width: 620px; }
}

@media (max-width: 560px) {
  .status { flex-wrap: wrap; }
  .export { margin-left: 0; width: 100%; }
}

@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-2: #f3f5f7; --text: #000; --muted: #444; --line: #ccc; --line-strong: #999;
    --ok: #0a5a2c; --ok-bg: #fff; --bad: #8f1410; --bad-bg: #fff; --warn: #6b4700; --warn-bg: #fff;
    --term-bg: #fff; --term-text: #000; --shadow: none;
  }
  .topbar, .sidebar, .footer, .tool-form, .status, .links, dialog { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .card { break-inside: avoid; border-color: #ccc; }
  details > summary::before { content: none; }
  .scroll { overflow: visible; }
}
