/* Sentinela — tema claro, cores do logotipo */
:root {
  --navy: #002046;
  --navy-2: #0B2D5E;
  --blue: #0071F9;
  --blue-600: #005FD6;
  --blue-50: #EAF3FF;
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #13213A;
  --text-2: #475569;
  --muted: #64748B;
  --ok: #15803D;      --ok-bg: #E8F6EC;
  --warn: #B45309;    --warn-bg: #FEF3E2;
  --bad: #C62828;     --bad-bg: #FDECEC;
  --none: #CBD5E1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --sidebar: 248px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.pre { white-space: pre-wrap; }
.strong { font-weight: 600; color: var(--text); }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); font-weight: 600; } .text-bad { color: var(--bad); font-weight: 600; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { padding: 4px 20px 20px; margin: 0; }
.print-only { display: none; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: block; padding: 4px 10px 22px; }
.brand img { display: block; height: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--navy); text-decoration: none; }
.nav-link.is-active { background: var(--blue-50); color: var(--blue-600); }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.user { display: flex; align-items: center; gap: 10px; padding: 0 8px 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-meta { min-width: 0; }
.user-meta strong { display: block; font-size: 13px; color: var(--text); }
.user-meta small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 28px 32px; max-width: 1400px; width: 100%; }
.content-wide { max-width: none; }
.footer { margin-top: auto; padding: 16px 32px; color: var(--muted); font-size: 12px; }
.topbar-mobile { display: none; }
.scrim { display: none; }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.page-head .url { font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.with-badge { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #94A3B8; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-sm-inline { height: 36px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.btn-sm-inline.is-active { background: var(--bad-bg); border-color: #F5B5B5; color: var(--bad); font-weight: 600; }
.btn-sm-inline.is-active:hover { background: #FBDADA; border-color: #EE9A9A; }
.btn-sm { height: 32px; font-size: 13px; padding: 0 10px; margin-top: 12px; }
.btn-block { width: 100%; }
.btn-danger-ghost { color: var(--bad); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: transparent; }
.btn-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); border-color: var(--border); color: var(--navy); }
.is-busy .icon, .btn-icon.is-busy .icon { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Flash */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi-alert { border-color: #F5B5B5; background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; box-shadow: inset 3px 0 0 var(--bad), var(--shadow); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 30px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.kpi-value-sm { font-size: 22px; padding-top: 6px; }
.kpi-foot { font-size: 12px; display: inline-flex; gap: 5px; align-items: center; }
.kpi-foot.ok { color: var(--ok); } .kpi-foot.bad { color: var(--bad); font-weight: 600; }
.kpi-foot.link { color: var(--blue); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.card-head h2 .count { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; font-size: 12px; padding: 0 8px; margin-left: 6px; color: var(--text-2); }
.pad-card { padding: 20px; }
.pad-card h3 { margin-bottom: 10px; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); background: var(--surface); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.segmented button, .segmented a {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.segmented a:hover { text-decoration: none; color: var(--navy); }
.segmented .is-active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFF; }
.table tbody tr.row-error { background: #FFF5F5; }
.table tbody tr.row-error:hover { background: #FFEDED; }
.table tbody tr.row-alert { background: #FDFFEC; }
.table tbody tr.row-alert:hover { background: #F8FBD9; }
.th-sort {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; border-radius: 4px;
}
.th-sort:hover { color: var(--navy); }
.th-sort:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sort-ind { width: 10px; display: inline-block; font-size: 10px; }
.sort-ind::after { content: "↕"; opacity: .35; }
th[aria-sort=ascending] .th-sort, th[aria-sort=descending] .th-sort { color: var(--blue-600); }
th[aria-sort=ascending] .sort-ind::after { content: "▲"; opacity: 1; }
th[aria-sort=descending] .sort-ind::after { content: "▼"; opacity: 1; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions-col { width: 1%; text-align: right; white-space: nowrap; }
.table-compact td { padding: 8px 16px; }
.table tr.is-paused td { opacity: .6; }
.table .url { color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.table .url .icon { opacity: .5; }
.url { display: inline-flex; align-items: center; gap: 5px; }
.issue-line { color: var(--warn); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.code-err { font-weight: 700; color: var(--bad); font-variant-numeric: tabular-nums; }
.empty-filter { padding: 18px 20px; margin: 0; }

/* Badges (sempre com ícone/ponto + texto) */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-bad .dot { animation: pulse 1.6s ease-in-out infinite; }
.badge-muted { background: #EEF2F6; color: var(--muted); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .badge-bad .dot, .is-busy .icon { animation: none; } }

/* Empty */
.empty { text-align: center; padding: 48px 20px 56px; }
.empty h3 { font-size: 16px; margin: 14px 0 6px; }
.empty p { margin: 0 0 18px; }
.small-empty { padding: 28px; color: var(--ok); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.small-empty p { color: var(--text-2); margin: 0; }

/* Site detail */
.alert-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; }
.alert-item.sev-critical { background: var(--bad-bg); border-color: #F5C2C2; color: var(--bad); }
.alert-item.sev-warning { background: var(--warn-bg); border-color: #F8D9A8; color: var(--warn); }
.alert-item div { color: var(--text); }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.info-grid .card { margin: 0; }
.info { padding: 18px; }
.info h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.info h3 .icon { color: var(--blue); }
.info dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; min-width: 0; }
.stat-row { display: flex; gap: 32px; padding: 0 20px 6px; flex-wrap: wrap; }
.stat-label { display: block; font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.timeline { list-style: none; margin: 0; padding: 0 20px 16px; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.timeline li:last-child { border-bottom: 0; }
.tl-type { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tl-msg { color: var(--text-2); }
.danger-zone { display: flex; justify-content: flex-end; }

/* Charts */
.chart-wrap { position: relative; padding: 8px 16px 16px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: #EDF1F6; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--blue); opacity: .07; }
.chart .line-dot { fill: var(--blue); }
.chart .down-mark { fill: var(--bad); }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { fill: var(--blue); stroke: #fff; stroke-width: 2; }
.chart-empty { padding: 20px; margin: 0; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; padding: 6px 10px;
  border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 4px 12px rgba(0, 32, 70, .25); z-index: 5;
}
.tooltip strong { display: block; font-size: 13px; }
.uptime-bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; padding: 4px 20px 0; height: 44px; position: relative; }
.ub { border-radius: 3px; cursor: default; }
.ub:hover { filter: brightness(.88); }
.ub-ok { background: #34A853; } .ub-warn { background: #F29D0C; } .ub-bad { background: var(--bad); } .ub-none { background: #E5EAF0; }
.uptime-legend { display: flex; gap: 16px; padding: 10px 20px 18px; font-size: 12px; flex-wrap: wrap; }
.uptime-legend span { display: inline-flex; align-items: center; gap: 6px; }
.uptime-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.card > .tooltip-host { position: relative; }

/* Forms */
.form fieldset { border: 0; margin: 0; padding: 20px 22px 6px; border-bottom: 1px solid var(--border); }
.form legend { font-weight: 600; color: var(--navy); font-size: 15px; padding: 0; margin-bottom: 14px; float: left; width: 100%; }
.form legend + * { clear: both; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 600; font-size: 13px; color: var(--text); }
.field small { color: var(--muted); font-size: 12px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%; outline: 0; transition: border-color .15s, box-shadow .15s;
}
select { height: 38px; padding: 0 10px; width: auto; min-width: 160px; }
.field select { width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.search input[type=search] { border: 0; outline: 0; font: inherit; width: 200px; background: transparent; color: var(--text); padding: 0; box-shadow: none; border-radius: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-group { display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; }
.form-grid { max-width: 820px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack > .card { margin-bottom: 20px; }
.pad-card.form .field { margin-bottom: 12px; }
.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.type-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 18px; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font-size: 13px; }

/* Auth */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, #DCEBFF, var(--bg)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 30px rgba(0, 32, 70, .08); }
.auth-logo { display: block; margin: 0 auto 6px; height: auto; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-card .form .field { margin-bottom: 14px; }

/* Responsivo */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 32, 70, .3); z-index: 30; }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar-mobile img { display: block; }
  .content { padding: 20px 16px; }
  .footer { padding: 16px; }
  .two-col, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpis, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .info-grid, .row-2 { grid-template-columns: 1fr; }
  .search input[type=search] { width: 100%; }
  .filters, .search { width: 100%; }
  .segmented { overflow-x: auto; max-width: 100%; }
  .uptime-bars { gap: 2px; padding: 4px 16px 0; }
  .page-head .actions { width: 100%; }
  h1 { font-size: 21px; }
}

/* Impressão (relatórios) */
@media print {
  .sidebar, .topbar-mobile, .footer, .no-print, .scrim, .flash { display: none !important; }
  .print-only { display: block; }
  .print-head { margin-bottom: 16px; }
  body { background: #fff; }
  .content { padding: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  a { color: inherit; }
}
