/* Loupe · tema "nova perspectiva" (base: loupe_crm_logo_lupa_ordenacao.html, Victor) */
:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-2: #f4f6fb;
  --line: #e5eaf2;
  --line-2: #edf0f4;
  --text: #142b55;
  --ink-2: #273c61;
  --muted: #778397;
  --muted-2: #8994a5;
  --nav: #ffffff;
  --nav-text: #536176;
  --nav-hover: #173b86;
  --accent: #3158d8;
  --accent-ink: #2349bd;
  --accent-soft: #edf2ff;
  --link: #365bc4;
  --good: #269b77;
  --good-soft: #e4f7ed;
  --bad: #d85c68;
  --bad-soft: #fff0f0;
  --warn: #bd8731;
  --warn-soft: #fff4d9;
  --demo: #6b4fa0;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(25, 45, 75, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --panel: #141d31; --panel-2: #1a2540; --line: #26324d; --line-2: #222d46; --text: #e6ecfa; --ink-2: #d2dbef;
    --muted: #93a0b8; --muted-2: #8591aa; --nav: #111a2c; --nav-text: #b3bfd6; --accent: #6f8ff0; --accent-ink: #a9bcff; --accent-soft: #1f2c4f;
    --link: #9fb4ff; --good: #5cc79e; --good-soft: #15302a; --bad: #f08a93; --bad-soft: #3a1d24; --warn: #e0b061; --warn-soft: #3a2e17;
    --demo: #9d85d6; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --panel: #141d31; --panel-2: #1a2540; --line: #26324d; --line-2: #222d46; --text: #e6ecfa; --ink-2: #d2dbef;
  --muted: #93a0b8; --muted-2: #8591aa; --nav: #111a2c; --nav-text: #b3bfd6; --accent: #6f8ff0; --accent-ink: #a9bcff; --accent-soft: #1f2c4f;
  --link: #9fb4ff; --good: #5cc79e; --good-soft: #15302a; --bad: #f08a93; --bad-soft: #3a1d24; --warn: #e0b061; --warn-soft: #3a2e17;
  --demo: #9d85d6; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--link); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 48px; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brandmark { width: 40px; height: 40px; border-radius: 12px; background: #3158d8; color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 5px 14px #3158d833; }
.brandmark svg { width: 31px; height: 31px; display: block; }
.brand-name { font-weight: 750; font-size: 21px; letter-spacing: -.5px; line-height: 1; color: var(--text); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 10px 30px rgba(24, 45, 85, .07); }
.auth-card h1 { font-size: 22px; letter-spacing: -.4px; margin: 22px 0 4px; }
.auth-card p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input, select.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.input:focus, .control:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- Botões / mensagens ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 650; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--link); padding: 0; font-weight: 600; }
.msg { padding: 11px 13px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.info { background: var(--accent-soft); color: var(--accent-ink); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 246px; flex: none; background: var(--nav); color: var(--nav-text); border-right: 1px solid var(--line); padding: 24px 14px 18px;
  position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; }
.navhead { display: flex; align-items: center; justify-content: space-between; }
.sidebar .brand { padding: 0 10px 30px; }
.navlabel { font-size: 10px; letter-spacing: 1.5px; color: var(--muted-2); font-weight: 800; padding: 8px 12px 8px; text-transform: uppercase; }
.nav { display: grid; gap: 3px; }
.nav-item, .subnav button { border: 0; background: transparent; color: var(--nav-text); text-align: left; width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 11px; font-size: 14px; font-weight: 550; min-height: 44px; transition: background .18s ease, color .18s ease; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover, .nav-item:focus-visible, .subnav button:hover, .subnav button:focus-visible { background: var(--nav-hover); color: #fff; outline: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 3px 0 var(--accent); font-weight: 750; }
.nav-item.active:hover { background: var(--nav-hover); color: #fff; }
.nav-group { display: grid; gap: 3px; }
.nav-chevron { margin-left: auto; font-size: 16px; transition: transform .18s ease; }
.nav-group:hover .nav-chevron, .nav-group:focus-within .nav-chevron, .nav-group.expanded .nav-chevron { transform: rotate(180deg); }
.subnav { display: none; padding: 2px 0 7px 42px; gap: 3px; }
.nav-group:hover .subnav, .nav-group:focus-within .subnav, .nav-group.expanded .subnav { display: grid; }
.subnav button { min-height: 38px; padding: 8px 12px; font-size: 13px; border-radius: 8px; color: var(--muted); }
.subnav button::before { content: ''; width: 5px; height: 5px; min-width: 5px; border-radius: 50%; background: #aab5c7; margin-right: -2px; }
.subnav button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 750; box-shadow: inset 2px 0 var(--accent); }
.subnav button.active:hover { background: var(--nav-hover); color: #fff; }
.sidefoot { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 10px 0; color: var(--muted-2); font-size: 12px; }
.sidefoot strong { display: block; color: var(--ink-2); font-size: 13px; margin-bottom: 3px; word-break: break-word; }
.mobile-menu-toggle { display: none; border: 1px solid var(--line); background: var(--panel); color: var(--accent-ink); border-radius: 9px; padding: 9px 12px; font-weight: 750; align-items: center; gap: 7px; }

.main { flex: 1; min-width: 0; }
.banner-demo { background: var(--demo); color: #fff; padding: 7px 24px; font-size: 13px; font-weight: 600; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 82px; background: color-mix(in srgb, var(--panel) 96%, transparent); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 12px 32px; flex-wrap: wrap; }
.top-title { min-width: 180px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 650; }
.crumb-sep { color: var(--muted-2); }
.top-context { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.command-search { position: relative; height: 46px; max-width: 560px; flex: 1; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--muted-2); background: var(--panel); }
.command-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.command-search > span { font-size: 22px; line-height: 1; }
.command-search input { border: 0; outline: 0; min-width: 0; flex: 1; font-size: 13px; background: transparent; color: var(--text); }
.command-search input::-webkit-search-cancel-button { display: none; }
.command-search kbd { font: 600 10px Inter, system-ui, sans-serif; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; color: var(--muted-2); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(20, 40, 80, .14); padding: 6px; max-height: 60vh; overflow: auto; z-index: 30; }
.search-results[hidden] { display: none; }
.sr-head { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted-2); padding: 8px 10px 4px; }
.sr-row { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px; color: var(--text); }
.sr-row:hover:not(.static) { background: var(--accent-soft); }
.sr-row b { display: block; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-row small { color: var(--muted); font-size: 12px; }
.sr-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.topcontrols { display: flex; align-items: center; gap: 8px; }
.control { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 10px; padding: 10px 11px; font-size: 13px; outline: none; height: 40px; }
.custom-dates { gap: 6px; flex-basis: 100%; justify-content: flex-end; }
.pop { position: relative; }
.pop-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 200px;
  box-shadow: 0 14px 40px rgba(20, 40, 80, .14); display: grid; z-index: 30; }
.pop-menu[hidden] { display: none; }
.pop-menu button { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 9px; font-size: 13px; color: var(--text); }
.pop-menu button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.top-new, .icon-button { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink-2); padding: 0 13px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.top-new { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-button { position: relative; width: 40px; padding: 0; font-size: 16px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.badge[hidden] { display: none; }
.user { width: 38px; height: 38px; border-radius: 50%; background: #f4f0e8; color: #b88939; display: grid; place-items: center; font-weight: 750; font-size: 14px; flex: none; }

.content { max-width: 1600px; margin: 0 auto; padding: 30px 34px 48px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow { color: #6e86bd; font-size: 11px; font-weight: 750; letter-spacing: 1.5px; text-transform: uppercase; }
.pagehead h1 { font-size: 28px; letter-spacing: -.7px; margin: 5px 0 5px; color: var(--text); }
.sub, .pagehead p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }

.subtabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 18px; }
.subtab { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 12px; color: var(--muted); font-size: 13px; font-weight: 550; white-space: nowrap; }
.subtab.active { background: var(--accent-soft); border-color: #dbe4ff; color: var(--accent); font-weight: 750; }

/* ---------- Cards e grids ---------- */
.section { margin-bottom: 26px; }
.section > h2 { font-size: 15px; color: var(--text); margin: 0 0 12px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.section > h2 .note { font-weight: 400; font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.cols { display: grid; gap: 14px; grid-template-columns: 1.5fr 1fr; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; box-shadow: var(--shadow); min-width: 0; }
.card > .label { font-size: 15px !important; color: var(--text); font-weight: 700 !important; }
.card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title h3 { font-size: 15px; margin: 0; font-weight: 700; color: var(--text); }
.card-title p { font-size: 13px; color: var(--muted); margin: 5px 0 0; line-height: 1.5; }
.card-title > span { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }

.kpi .label { font-size: 13px; color: var(--muted); font-weight: 650; display: flex; justify-content: space-between; gap: 6px; line-height: 1.4; }
.kpi .value { font-size: 30px; font-weight: 800; letter-spacing: -.8px; line-height: 1.12; margin-top: 8px; color: var(--text); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 18px; }
.kpi.empty .value, .kpi-value.is-empty { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.kpi .src { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi-foot { display: block; font-size: 12px; color: var(--muted-2); line-height: 1.45; margin-top: 2px; }
.delta { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; margin-top: 4px; }
.delta.inline { display: inline-flex; margin: 0; font-size: inherit; gap: 3px; }
.delta.up, .trend-arrow.up { color: var(--good); }
.delta.down, .trend-arrow.down { color: var(--bad); }
.delta.neutral, .trend-arrow.neutral { color: var(--muted-2); }
.trend-arrow { font-size: 17px; line-height: 1; font-weight: 900; }
.delta.inline .trend-arrow { font-size: 13px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.tag.api { background: var(--accent-soft); color: var(--accent-ink); }
.tag.good, .tag.A { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn, .tag.B { background: var(--warn-soft); color: var(--warn); }
.tag.demo { background: var(--demo); color: #fff; }
.tag.C { background: var(--panel-2); color: var(--muted); }

/* ---------- Visão Geral ---------- */
.welcome-grid { display: grid; grid-template-columns: 1.08fr 1fr; gap: 18px; margin-bottom: 18px; }
.welcome-hero { min-height: 300px; position: relative; overflow: hidden; border-radius: 20px; padding: 34px 36px; background: linear-gradient(115deg, #365fe0 0%, #2549b8 58%, #183576 100%);
  color: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.hero-orb { position: absolute; width: 230px; height: 230px; right: -64px; top: -88px; border-radius: 50%; background: rgba(255, 255, 255, .12); box-shadow: 0 0 0 42px rgba(255, 255, 255, .035); }
.hero-label { position: relative; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; color: #e4eaff; background: #ffffff20; border: 1px solid #ffffff2b; border-radius: 30px; padding: 7px 11px; margin-bottom: 18px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8ce1b6; margin-right: 7px; }
.welcome-hero h1 { position: relative; font-size: 31px; line-height: 1.12; letter-spacing: -1px; max-width: 540px; color: #fff; margin: 0 0 13px; }
.welcome-hero p { position: relative; color: #e0e8ff; font-size: 15px; line-height: 1.7; max-width: 570px; margin: 0; }
.hero-actions { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-primary, .hero-secondary { border: 0; border-radius: 10px; padding: 12px 15px; font-size: 13px; font-weight: 750; }
.hero-primary { background: #fff; color: #284dbd; }
.hero-secondary { background: #ffffff20; color: #fff; border: 1px solid #ffffff24; }
.hero-primary:hover, .hero-secondary:hover { filter: brightness(.96); }
.hero-period { font-size: 12px; color: #d4defc; margin-left: 4px; }
.coverage-card { padding: 25px 26px; }
.coverage-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 17px; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.coverage-head h3 { font-size: 15px; margin: 4px 0 7px; color: var(--text); }
.coverage-head p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.coverage-total { width: 86px; height: 86px; border: 1px solid var(--line); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 8px var(--accent-soft); flex-shrink: 0; }
.coverage-total strong { font-size: 21px; color: var(--accent); }
.coverage-total small { font-size: 10px; color: var(--muted-2); }
.coverage-line { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.coverage-line:last-child { border: 0; }
.coverage-line b { color: var(--text); font-size: 14px; }
.kpi-modern { padding: 19px 20px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 17px; }
.kpi-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 700; flex: none; }
.status-tag { font-size: 11px; font-weight: 750; border-radius: 20px; padding: 7px 10px; text-align: right; }
.green-tag { background: var(--good-soft); color: var(--good); }
.blue-tag { background: var(--accent-soft); color: var(--accent-ink); }
.amber-tag { background: var(--warn-soft); color: var(--warn); }
.red-tag { background: var(--bad-soft); color: var(--bad); }
.status-tag .delta.inline .trend-arrow { color: inherit; }
.kpi-modern .kpi-label { font-size: 11px; letter-spacing: 1px; font-weight: 800; color: var(--muted); }
.kpi-modern .kpi-value { font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -.8px; margin: 7px 0 4px; color: var(--text); }
.action-card, .health-card { padding: 22px 24px; }
.action-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.action-row:last-child { border: 0; }
.action-symbol { width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.red-symbol { background: var(--bad-soft); color: var(--bad); }
.amber-symbol { background: var(--warn-soft); color: var(--warn); }
.blue-symbol { background: var(--accent-soft); color: var(--accent); }
.action-row div { flex: 1; min-width: 0; }
.action-row strong { display: block; font-size: 13px; color: var(--ink-2); }
.action-row small { display: block; font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.action-row button, .full-link { border: 0; background: transparent; color: var(--link); font-size: 12px; font-weight: 750; white-space: nowrap; padding: 4px 0; }
.channel-health { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.channel-logo { width: 36px; height: 36px; border-radius: 11px; background: #fff3e8; color: #e6a24a; display: grid; place-items: center; font-weight: 900; flex: none; }
.channel-health div { flex: 1; min-width: 0; }
.channel-health strong { display: block; font-size: 13px; }
.channel-health small { display: block; font-size: 12px; color: var(--muted-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-status { font-size: 11px; font-weight: 750; color: var(--good); background: var(--good-soft); padding: 6px 9px; border-radius: 20px; white-space: nowrap; }
.health-status.wait { color: var(--accent-ink); background: var(--accent-soft); }
.health-status.bad { color: var(--bad); background: var(--bad-soft); }
.health-summary { display: flex; gap: 32px; flex-wrap: wrap; padding: 17px 0; }
.health-summary strong { display: block; font-size: 19px; color: var(--text); }
.health-summary small { font-size: 11px; color: var(--muted-2); }
.logi-bars { display: grid; gap: 15px; padding: 8px 0; }
.logi-bars > div { display: grid; grid-template-columns: 70px 44px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.logi-bars b { color: var(--text); }
.logi-bars i { height: 9px; background: var(--panel-2); border-radius: 10px; overflow: hidden; }
.logi-bars em { display: block; height: 100%; background: #5274df; border-radius: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; }
.metric { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.metric span { color: var(--muted); }
.metric b { font-weight: 700; text-align: right; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.dot.gray { background: #c7ccda; margin-left: 8px; }
.list .dot { margin-top: 6px; }
.dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); } .dot.good { background: var(--good); }

/* ---------- Listas, gráficos, tabelas ---------- */
.chart-box { position: relative; height: 260px; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.card .table-wrap { border-radius: 10px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 650; color: var(--muted); background: var(--panel-2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; color: var(--ink-2); }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.th-label { vertical-align: middle; }
.sort-controls { display: inline-flex; gap: 2px; align-items: center; margin-left: 6px; vertical-align: middle; }
.sort-btn { border: 0; background: transparent; color: #98a2b3; border-radius: 4px; padding: 1px 4px; min-width: 18px; height: 22px; line-height: 1; font-size: 14px; font-weight: 700; transition: background .15s, color .15s; }
.sort-btn:hover { background: var(--accent-soft); color: var(--accent); }
.sort-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.t-title { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); font-weight: 550; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { width: auto; }

.thermo { display: flex; gap: 4px; margin-top: 8px; }
.thermo span { flex: 1; height: 10px; border-radius: 3px; opacity: .25; }
.thermo span.on { opacity: 1; outline: 2px solid var(--text); outline-offset: 1px; }
.pending { border-style: dashed; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.map-grid .field { margin: 0; }
.steps { display: grid; gap: 12px; }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); padding: 22px; max-width: 520px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(10, 20, 40, .4); }

/* ---------- Portal de relatórios ---------- */
.portal { position: relative; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 24px; border: 2px dashed #c3cde0; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--accent-soft) 45%, var(--panel)) 100%); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.portal:hover { border-color: var(--accent); }
.portal.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.portal > * { pointer-events: none; }
.portal > button { pointer-events: auto; }
.portal-icon .brandmark { width: 64px; height: 64px; border-radius: 18px; }
.portal-icon .brandmark svg { width: 50px; height: 50px; }
.portal-title { font-size: 22px; font-weight: 750; letter-spacing: -.4px; }
.portal-sub { color: var(--muted); max-width: 560px; font-size: 14px; }
.portal-foot { color: var(--muted); font-size: 12px; margin-top: 4px; }
.qlist { display: grid; gap: 8px; }
.qitem { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.qitem.ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.qitem.erro { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.qhead { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.qicon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .5px; flex: none; }
.qmain { flex: 1; min-width: 200px; }
.qname { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qkind { font-size: 13px; color: var(--muted); }
.qkind b { color: var(--text); font-weight: 600; }
.qacc { width: auto; max-width: 200px; }
.qbody { border-top: 1px solid var(--line); padding: 14px; }
.rcard .rtitle { font-weight: 650; font-size: 14px; }
.name-tip { margin-top: 14px; font-size: 13px; color: var(--muted); }
.name-tip summary { cursor: pointer; padding: 6px 0; }
.name-codes { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.name-codes code, .name-tip code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.name-tip p { margin: 6px 0 0; font-size: 12px; }
.nodata-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 12px 16px; background: var(--accent-soft); border-color: #dfe7ff; color: var(--accent-ink); }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .welcome-grid { grid-template-columns: 1fr; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-search { max-width: 380px; }
}
@media (max-width: 1050px) {
  .sidebar { width: 225px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .topbar { padding-left: 22px; padding-right: 22px; }
  .cols { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .command-search { order: 3; max-width: none; flex-basis: 100%; }
  .topcontrols { margin-left: auto; }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 20; padding: 12px 14px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0; }
  .brand-name { font-size: 20px; }
  .brandmark { width: 36px; height: 36px; }
  .navlabel, .sidefoot { display: none; }
  .mobile-menu-toggle { display: flex; }
  .sidebar .nav { display: none; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); max-height: 65vh; overflow: auto; }
  .sidebar.mobile-open .nav { display: grid; }
  .sidebar.mobile-open .sidefoot { display: block; padding-top: 12px; margin-top: 8px; }
  .nav-group { grid-column: 1 / -1; }
  .nav-group:hover .subnav, .nav-group:focus-within .subnav { display: none; }
  .nav-group.expanded .subnav { display: grid; }
  .nav-group .subnav { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 2px 0 8px 12px; }
  .subnav button { justify-content: center; padding: 8px 5px; font-size: 12px; white-space: normal; text-align: center; }
  .subnav button::before { display: none; }
  .topbar { position: relative; min-height: 0; padding: 12px 14px; display: grid; grid-template-columns: 1fr; gap: 10px; }
  .command-search { max-width: none; width: 100%; }
  .topcontrols { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto auto auto; gap: 7px; margin: 0; }
  .topcontrols .control { width: 100%; min-width: 0; padding: 10px 8px; }
  .custom-dates { justify-content: stretch; }
  .custom-dates .control { flex: 1; min-width: 0; }
  .content { padding: 18px 14px 36px; }
  .pagehead h1 { font-size: 26px; }
  .welcome-hero { min-height: 260px; padding: 25px 22px; }
  .welcome-hero h1 { font-size: 27px; }
  .coverage-card { padding: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.wide, .grid.cols { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 14px; }
  .kpi .value, .kpi-modern .kpi-value { font-size: 26px; }
  .action-card, .health-card { padding: 18px; }
  .metric-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .content { padding: 15px 11px 30px; }
  .topbar { padding: 11px; }
  .topcontrols { grid-template-columns: 1fr 1fr auto auto; }
  .topcontrols .user { display: none; }
  .pagehead h1 { font-size: 24px; }
  .pagehead .sub { font-size: 13px; }
  .welcome-hero { min-height: 245px; padding: 22px 18px; }
  .welcome-hero h1 { font-size: 24px; }
  .welcome-hero p { font-size: 14px; }
  .grid, .grid.kpis { gap: 8px; }
  .card { padding: 13px; }
  .kpi .value, .kpi-modern .kpi-value { font-size: 22px; }
  .kpi .label { font-size: 12px; }
  .kpi-foot { font-size: 11px; }
  .status-tag { font-size: 9px; padding: 5px 7px; }
  .kpi-icon { width: 32px; height: 32px; font-size: 16px; }
  .coverage-line { font-size: 12px; }
  .coverage-total { width: 70px; height: 70px; }
  .coverage-total strong { font-size: 18px; }
  .hero-period { width: 100%; margin: 4px 0 0; }
  .action-row { align-items: flex-start; gap: 8px; }
  .portal { padding: 32px 16px; }
  .portal-title { font-size: 18px; }
  .qacc { max-width: 100%; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
