@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: #f1f8fd; --dot: #d3e7f5; --surface: #ffffff; --surface-2: #edf6fc; --surface-3: #d9ebf7;
  --text: #0f2639; --muted: #4a667d; --line: #d2e4f1; --line-strong: #a8c8df;
  --accent: #89cff0; --accent-strong: #176a9f; --accent-text: #08283d; --accent-soft: #def1fb;
  --ok: #12683a; --ok-bg: #dcf3e4; --bad: #a4211c; --bad-bg: #fbe3e1; --warn: #7d5407; --warn-bg: #f9edc8;
  --term-bg: #0d1f30; --term-text: #cfe6f5;
  --hero: linear-gradient(120deg, #c9e9fa, #e3f3fc 55%, #ffffff);
  --shadow: 0 1px 2px rgb(23 75 115 / .06), 0 8px 24px rgb(23 75 115 / .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0a1622; --dot: #15283a; --surface: #102030; --surface-2: #172a3d; --surface-3: #22384d;
  --text: #e8f3fb; --muted: #9fb6c9; --line: #223749; --line-strong: #37526c;
  --accent: #8fd3f5; --accent-strong: #a3deff; --accent-text: #06233a; --accent-soft: #14354e;
  --ok: #74dba0; --ok-bg: #12301f; --bad: #f6a6a0; --bad-bg: #3f1d1b; --warn: #eec96f; --warn-bg: #372c10;
  --term-bg: #07111b; --term-text: #cfe6f5;
  --hero: linear-gradient(120deg, #143a57, #102a41 60%, #102030);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .24);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1622; --dot: #15283a; --surface: #102030; --surface-2: #172a3d; --surface-3: #22384d;
  --text: #e8f3fb; --muted: #9fb6c9; --line: #223749; --line-strong: #37526c;
  --accent: #8fd3f5; --accent-strong: #a3deff; --accent-text: #06233a; --accent-soft: #14354e;
  --ok: #74dba0; --ok-bg: #12301f; --bad: #f6a6a0; --bad-bg: #3f1d1b; --warn: #eec96f; --warn-bg: #372c10;
  --term-bg: #07111b; --term-text: #cfe6f5;
  --hero: linear-gradient(120deg, #143a57, #102a41 60%, #102030);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .24);
}

* { 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-strong); outline: 3px 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-strong); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-strong); 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.05) saturate(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: 14px; padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }

/* Marca */
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 9px; box-shadow: 0 2px 6px rgb(23 90 140 / .3); }
.brand-name { display: grid; gap: .1rem; line-height: 1; }
.brand-name strong { font-size: 1.08rem; font-weight: 600; letter-spacing: -.012em; color: var(--text); }
.brand-name span { font-size: .63rem; font-weight: 500; letter-spacing: .23em; text-transform: uppercase; color: var(--accent-strong); }

/* Login */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: var(--hero);
}
.login-card { width: min(400px, 100%); display: grid; gap: 1rem; padding: 1.75rem; }
.login-head { display: grid; justify-items: center; gap: .85rem; margin-bottom: .5rem; text-align: center; }
.login-head .brand { gap: .8rem; }
.login-head .brand-mark { width: 54px; height: 54px; border-radius: 13px; }
.login-head .brand-name { gap: .17rem; text-align: left; }
.login-head .brand-name strong { font-size: 1.55rem; }
.login-head .brand-name span { font-size: .78rem; letter-spacing: .27em; }
.login-head p { margin: 0; }
.login-card .primary { width: 100%; margin-top: .25rem; }

/* Estrutura */
.layout {
  min-height: 100%; display: grid; grid-template-columns: 284px 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; }
.quick-search { position: relative; flex: 1 1 auto; max-width: 620px; margin-left: 1.5rem; min-width: 0; }
.quick-search input { min-height: 40px; padding-right: 4.6rem; border-radius: 10px; }
.quick-search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); padding: .05rem .4rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--muted); font: 500 .7rem "IBM Plex Sans", system-ui, sans-serif; pointer-events: none; }
.quick-search input::-webkit-search-cancel-button { display: none; }
.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: 2px; border-radius: 10px;
  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; box-shadow: inset 3px 0 0 var(--accent); }
.brand.clickable { cursor: pointer; }
.main { grid-area: main; padding: 1.5rem; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); 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: 46px; height: 46px; flex: none; border-radius: 13px; background: linear-gradient(145deg, var(--accent-soft), var(--surface-3)); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--line); }
.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; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
.results > * { min-width: 0; }
.section-box { min-width: 0; }
.section-box > summary { padding: .7rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; flex-wrap: wrap; }
.section-box > summary .tone { margin-left: auto; }
.section-box > summary .tone { font-size: .78rem; font-weight: 500; }
.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-strong); 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-strong); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--accent-strong); }
progress::-moz-progress-bar { background: var(--accent-strong); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, 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, dd .tone { white-space: normal; border-radius: 10px; overflow-wrap: anywhere; }

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: #93b4cc; background: var(--term-bg); border-bottom: 1px solid #1c3347; }
.terminal-bar span { width: 8px; height: 8px; border-radius: 50%; background: #89cff0; }
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 min(340px, 100%); 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); overflow-wrap: anywhere; word-break: break-word; }
.note { padding: .75rem 1rem; }
/* Sem quebra de linha em tela larga; no celular o texto volta a quebrar, porque não há espaço. */
@media (min-width: 801px) {
  .sidebar button > span:not(.badge), .tool-card small, .tool-card strong, .stat-card .stat-note, .stat-card .stat-value, .service-card strong, .outage-state > span.muted, .outage-state .tone, .tool-head p, .home-hero > p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .sidebar button > span:not(.badge) { min-width: 0; }
  .tool-card span.tool-text, .tool-head > div, .stat-card > span { min-width: 0; max-width: 100%; }
  .outage-state .tone { border-radius: 999px; }
  .tool-form > label.check { white-space: nowrap; flex: 0 0 auto; }
  .tool-head { min-width: 0; }
}
/* Tela inicial */
.home-hero { background: var(--hero); border-color: var(--line-strong); padding: 1.75rem 1.75rem 1.5rem; display: grid; gap: .9rem; }
.home-hero h2 { font-size: 1.6rem; letter-spacing: -.015em; }
.home-hero > p { margin: 0; color: var(--muted); }
.home-search { display: flex; gap: .6rem; align-items: stretch; }
.home-search input { min-height: 52px; font-size: 1.02rem; background: var(--surface); border-color: var(--line-strong); border-radius: 12px; padding-inline: 1rem; }
.home-search button { min-height: 52px; padding-inline: 1.6rem; border-radius: 12px; flex: none; }
.home-hints { display: flex; flex-wrap: wrap; gap: .4rem; }
.home-hints button { min-height: 30px; padding: .1rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 500; color: var(--muted); background: var(--surface); }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); gap: .85rem; }
.stat-card { display: grid; justify-items: start; align-content: start; justify-content: stretch; gap: .35rem; padding: 1rem 1.1rem; min-height: 112px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); background: var(--surface); }
.stat-card .stat-label { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 500; color: var(--muted); }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.stat-card .stat-note { font-size: .8rem; color: var(--muted); font-weight: 400; }
.home-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; min-width: 0; }
.home-section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.home-section-head h3 { font-size: 1.02rem; }
.link-btn { min-height: 30px; padding: .1rem .6rem; border: 0; background: none; color: var(--accent-strong); font-size: .85rem; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(205px, 100%), 1fr)); gap: .6rem; }
.service-card { display: flex; justify-content: flex-start; align-items: center; gap: .6rem; min-height: 62px; padding: .55rem .7rem; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.service-card:hover { border-color: var(--accent); background: var(--surface); }
.service-card .outage-logo { width: 34px; height: 34px; border-radius: 9px; }
.service-card span.service-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: .05rem; min-width: 0; flex: 1 1 0; }
.service-card small span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-card strong { font-size: .9rem; font-weight: 600; overflow-wrap: anywhere; color: var(--text); }
.service-card small { display: flex; min-width: 0; align-items: center; gap: .3rem; font-size: .74rem; color: var(--muted); }
.state-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.state-dot.ok { background: var(--ok); }
.state-dot.warn { background: var(--warn); border-radius: 2px; }
.state-dot.bad { background: var(--bad); border-radius: 0; transform: rotate(45deg); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: .65rem; }
.tool-card { display: flex; justify-content: flex-start; align-items: flex-start; gap: .75rem; padding: .85rem .9rem; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-weight: 400; }
.tool-card:hover { border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow); }
.tool-card .tool-icon { width: 38px; height: 38px; border-radius: 10px; }
.tool-card .tool-icon .icon { width: 19px; height: 19px; }
.tool-card span.tool-text { display: grid; gap: .1rem; min-width: 0; }
.tool-card strong { font-size: .92rem; font-weight: 600; color: var(--text); }
.tool-card small { font-size: .78rem; line-height: 1.35; color: var(--muted); }
.tool-card-wrap { position: relative; min-width: 0; }
.tool-card-wrap .tool-card { height: 100%; padding-right: 2.6rem; }
.star-btn { width: 34px; min-height: 34px; padding: 0; border: 0; background: none; color: var(--muted); flex: none; border-radius: 8px; }
.star-btn:hover { background: var(--accent-soft); color: var(--accent-strong); }
.star-btn.on { color: var(--accent-strong); }
.star-btn.on .icon { fill: var(--accent); }
.tool-card-wrap .star-btn { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); }
.tool-head .star-btn { margin-left: auto; }
.nowrap-table td, .nowrap-table th { white-space: nowrap; }
.ticket-box { margin: 0; }
.ticket-box textarea { background: var(--surface); line-height: 1.45; white-space: pre-wrap; }
.change-block { display: grid; gap: .3rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.change-block:first-of-type { border-top: 0; }
.change-block p { margin: 0; }
.change-line { display: flex; align-items: flex-start; gap: .5rem; overflow-wrap: anywhere; }
.change-line .tone { flex: none; }
.state-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.state-head h3 { margin: 0; }
.state-head select { width: auto; max-width: 100%; min-height: 36px; padding-block: .2rem; }
.uf-wrap { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.uf-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 46px)); grid-auto-rows: 46px; gap: 3px; flex: 0 1 340px; min-width: 0; }
.uf-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 7px; line-height: 1.1; min-width: 0; overflow: hidden; border: 1px solid transparent; }
.uf-tile strong { font-size: .78rem; font-weight: 600; }
.uf-tile small { font-size: .62rem; }
.uf-tile.ok, .uf-swatch.ok { background: var(--ok-bg); color: var(--ok); }
.uf-tile.warn, .uf-swatch.warn { background: var(--warn-bg); color: var(--warn); }
.uf-tile.bad, .uf-swatch.bad { background: var(--bad-bg); color: var(--bad); }
.uf-tile.none, .uf-swatch.none { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.uf-side { flex: 1 1 280px; min-width: 0; display: grid; gap: .55rem; }
.uf-side p { margin: 0; }
.uf-legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .85rem; }
.uf-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.uf-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); }
.recent-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; }
.recent-item { display: flex; justify-content: flex-start; align-items: center; gap: .65rem; width: 100%; min-height: 44px; padding: .3rem .55rem; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 400; }
.recent-item .icon { color: var(--accent-strong); }
.recent-item strong { font-weight: 500; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .recent-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .85rem; flex: 1 1 0; }
.recent-item .recent-when { flex: none; color: var(--muted); font-size: .78rem; }
@media (max-width: 560px) {
  .home-hero { padding: 1.15rem; }
  .home-hero h2 { font-size: 1.3rem; }
  .home-search { flex-direction: column; }
  .home-search button { width: 100%; }
  .watch-item .watch-actions { flex: 1 1 100%; min-width: 0; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .stat-card { padding: .8rem; min-height: 104px; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .recent-item .recent-when { display: none; }
}
.nav-tools { display: grid; gap: .3rem; padding: 0 .35rem .5rem; }
.nav-tools input { width: 100%; min-height: 36px; font-size: .88rem; }
.sidebar .nav-expand { min-height: 28px; padding: .1rem .4rem; border: 0; background: none; color: var(--muted); font-size: .78rem; justify-content: flex-start; }
.sidebar .nav-head { width: 100%; min-height: 32px; padding: .3rem .7rem; margin: .35rem 0 .1rem; justify-content: space-between; border: 0; background: none; color: var(--muted); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sidebar .nav-head:hover { color: var(--text); background: var(--surface-2); }
.nav-chevron { font-size: .9rem; transition: transform .12s; }
.nav-section.closed .nav-chevron { transform: rotate(-90deg); }
.nav-section.closed .nav-items { display: none; }
.searching .nav-section.closed .nav-items { display: block; }
.perm-box { display: grid; gap: .55rem; min-width: 0; }
.perm-switch { display: flex !important; align-items: center; gap: .55rem; padding: .55rem .7rem; background: var(--surface-2); border-radius: 8px; cursor: pointer; }
.perm-switch input { appearance: none; flex: none; position: relative; width: 38px; height: 22px; min-height: 0; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background .12s; }
.perm-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .12s; }
.perm-switch input:checked { background: var(--accent-strong); }
.perm-switch input:checked::after { left: 19px; }
.perm-list { display: grid; gap: .6rem; max-height: 46vh; overflow-y: auto; padding-right: .3rem; }
.perm-group { display: grid; gap: .2rem; margin: 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.perm-group legend { padding: 0 .3rem; font-weight: 600; font-size: .85rem; }
.perm-group > button { justify-self: start; margin-bottom: .2rem; }
.perm-item { display: flex !important; align-items: flex-start; gap: .5rem; padding: .25rem 0; font-weight: 400; cursor: pointer; }
.perm-item input { flex: none; width: 18px; height: 18px; min-height: 0; margin-top: .1rem; accent-color: var(--accent-strong); }
.perm-item > span { display: grid; gap: .05rem; min-width: 0; }
.perm-item small { font-size: .76rem; line-height: 1.3; }
.outage-headline .tone { font-size: 1rem; padding: .3rem .8rem; white-space: normal; border-radius: 10px; }
.outage-filter { padding: .6rem 1rem; }
.outage-filter input { width: 100%; }
.outage-list { display: grid; gap: .35rem; }
.outage-item { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(400px, 1.7fr) minmax(170px, 1.5fr); gap: .5rem .9rem; align-items: center; padding: .55rem .25rem; border-bottom: 1px solid var(--line); min-width: 0; }
.outage-item:last-child { border-bottom: 0; }
.outage-name { display: flex; width: 100%; justify-content: flex-start; align-items: center; gap: .6rem; text-align: left; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; min-width: 0; }
.outage-title { display: grid; gap: .05rem; justify-items: start; min-width: 0; }
.outage-title span { font-size: .78rem; overflow-wrap: anywhere; }
/* Fundo claro fixo: logos escuras continuam visíveis no tema escuro. */
.outage-logo { flex: none; width: 28px; height: 28px; padding: 2px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.outage-logo.letter { display: grid; place-items: center; padding: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem; }
.outage-state { display: grid; gap: .15rem; justify-items: start; min-width: 0; font-size: .82rem; overflow-wrap: anywhere; grid-template-columns: minmax(0, 1fr); }
.outage-state .tone { white-space: normal; border-radius: 10px; }
.outage-detail { grid-column: 1 / -1; display: grid; gap: .5rem; padding: .35rem 0 .5rem; min-width: 0; }
.chart-box { position: relative; min-width: 0; width: 100%; }
.chart { display: block; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent-strong); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: .28; stroke: none; }
.chart-dot { fill: var(--accent-strong); }
.chart-fail { fill: var(--bad); }
.chart-fail.lifted { opacity: .7; }
.chart-ok { fill: var(--line-strong); }
.chart-band { fill: var(--bad); opacity: .22; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-ext-ok { fill: var(--ok); stroke: var(--surface); stroke-width: 2; }
.chart-ext-bad { fill: var(--bad); stroke: var(--surface); stroke-width: 2; }
.chart-tip { position: absolute; top: 2px; left: 0; z-index: 3; pointer-events: none; display: grid; gap: .1rem; max-width: 260px; padding: .35rem .55rem; font-size: .78rem; background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); }
.chart-tip strong { color: var(--text); font-weight: 600; }
.spark .chart-tip { top: 100%; margin-top: 2px; }
.chart-table { margin-top: .4rem; font-size: .85rem; }
.chart-table > summary { font-weight: 500; font-size: .85rem; color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i { display: inline-block; flex: none; }
.key-line { width: 16px; height: 2px; background: var(--accent-strong); }
.key-band { width: 12px; height: 12px; background: var(--bad-bg); border: 1px solid var(--bad); }
.key-ok { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.key-bad { width: 8px; height: 8px; background: var(--bad); }
.outage-chart { min-width: 0; }
@media (max-width: 760px) {
  .outage-item { grid-template-columns: minmax(0, 1fr); }
}
input[type="file"] { display: block; width: 100%; padding: .55rem; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: .75rem; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.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(540px, 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, .quick-search { 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; }
}
