/* Raio-X: painel de operação. Fundo neutro levemente esverdeado, barra lateral grafite, números em mono. */
:root {
  --ink: #14161A;
  --ink-2: #3F444C;
  --muted: #5B616B;
  --line: #E1E3DD;
  --line-2: #ECEDE8;
  --line-strong: #C9CCC4;
  --line-hover: #9EA39A;
  --bg: #F3F4F1;
  --card: #FFFFFF;
  --field: #FFFFFF;
  --hover: #FAFAF8;
  --on-ink: #FFFFFF;
  --ink-hover: #2A2E35;
  --nav: #14161A;
  --nav-2: #2A2E35;
  --nav-text: #C9CDC6;
  --nav-strong: #FFFFFF;
  --nav-dim: #B9BDB6;
  --accent: #1F4FB8;
  --accent-ink: #163A88;
  --info-bg: #EEF3FC; --info: #1D3F86;
  --ok-bg: #E3F1E8; --ok: #1E6B43; --ok-bar: #2E8B57;
  --warn-bg: #FBEFD9; --warn: #7A4A00; --warn-bar: #C98A1B;
  --bad-bg: #FBE4E2; --bad: #A61E17; --bad-ink: #6E1510; --bad-bar: #C0392B;
  --gray-bg: #ECEDE8; --gray: #4A4F57;
  --real-bg: #E4ECFA; --real: #1D3F86;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E8EAE6; --ink-2: #C3C7C0; --muted: #9AA096;
    --line: #2E3238; --line-2: #262A2F; --line-strong: #474C53; --line-hover: #6A7078;
    --bg: #111316; --card: #1A1D21; --field: #15181B; --hover: #21252A;
    --on-ink: #111316; --ink-hover: #FFFFFF;
    --nav: #0B0C0E; --nav-2: #24282E;
    --accent: #8FB0F5; --accent-ink: #B5CCFA;
    --info-bg: #1B2740; --info: #B5CCFA;
    --ok-bg: #16301F; --ok: #7FD3A0; --ok-bar: #3FA96B;
    --warn-bg: #3A2A0E; --warn: #F0C46E; --warn-bar: #D9A13A;
    --bad-bg: #3D1715; --bad: #F2908A; --bad-ink: #F7C4C0; --bad-bar: #E0574B;
    --gray-bg: #2A2E33; --gray: #C3C7C0;
    --real-bg: #1B2740; --real: #B5CCFA;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E8EAE6; --ink-2: #C3C7C0; --muted: #9AA096;
  --line: #2E3238; --line-2: #262A2F; --line-strong: #474C53; --line-hover: #6A7078;
  --bg: #111316; --card: #1A1D21; --field: #15181B; --hover: #21252A;
  --on-ink: #111316; --ink-hover: #FFFFFF;
  --nav: #0B0C0E; --nav-2: #24282E;
  --accent: #8FB0F5; --accent-ink: #B5CCFA;
  --info-bg: #1B2740; --info: #B5CCFA;
  --ok-bg: #16301F; --ok: #7FD3A0; --ok-bar: #3FA96B;
  --warn-bg: #3A2A0E; --warn: #F0C46E; --warn-bar: #D9A13A;
  --bad-bg: #3D1715; --bad: #F2908A; --bad-ink: #F7C4C0; --bad-bar: #E0574B;
  --gray-bg: #2A2E33; --gray: #C3C7C0;
  --real-bg: #1B2740; --real: #B5CCFA;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 28px; font-weight: 600; }
h2 { margin: 0; font-size: 19px; font-weight: 600; }
h3 { margin: 0; font-size: 16px; font-weight: 600; }
p { line-height: 1.5; }

.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 220px; max-width: 260px; background: var(--nav); color: var(--nav-text); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand b { display: block; font-size: 18px; color: var(--nav-strong); }
.brand span { font-size: 12px; color: var(--nav-dim); }
.nav a { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--nav-text); }
.nav a:hover { background: var(--nav-2); color: var(--nav-strong); }
.nav a.active { background: var(--nav-2); color: var(--nav-strong); font-weight: 500; }
.nav .foot { margin-top: auto; padding: 18px 12px 0; font-size: 12px; color: var(--nav-dim); line-height: 1.6; }
.nav .foot { display: flex; flex-direction: column; gap: 8px; }
.nav .foot .who { overflow-wrap: anywhere; }
.foot-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; }
.nav .icon-btn { color: var(--nav-text); border-color: var(--nav-2); }
.nav .icon-btn:hover { background: var(--nav-2); color: var(--nav-strong); }
.link-btn { background: none; border: 0; color: var(--nav-text); padding: 0 8px; cursor: pointer; min-height: 40px; text-decoration: underline; }
.link-btn:hover { color: var(--nav-strong); }
.main { flex: 999 1 560px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 22px; }

@media (max-width: 760px) {
  .nav { max-width: none; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { width: 100%; padding-bottom: 8px; }
  .nav .foot { display: none; }
  .main { padding: 16px; }
}

.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.head .eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.head p { margin: 6px 0 0; color: var(--ink-2); max-width: 760px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card.flat { padding: 0; overflow: hidden; }
.row { display: flex; flex-wrap: wrap; gap: 22px; }
.row > * { flex: 1 1 340px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-family: var(--mono); font-size: 22px; font-weight: 500; white-space: nowrap; }
.kpi .s { font-size: 13px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--line-hover); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-hover); color: var(--on-ink); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--field); cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
label.f small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=url], input[type=number], input[type=email], input[type=password], input[type=search], input[type=month], select, textarea {
  min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .pill:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tag.saudavel, .tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.atencao { background: var(--warn-bg); color: var(--warn); }
.tag.abaixo, .tag.prejuizo, .tag.erro { background: var(--bad-bg); color: var(--bad); }
.tag.sem_custo, .tag.sem_sku, .tag.cinza { background: var(--gray-bg); color: var(--gray); }
.tag.real { background: var(--real-bg); color: var(--real); }
.tag.estimado { background: var(--gray-bg); color: var(--gray); }

.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--ink); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
#ptable td:first-child { min-width: 230px; }
td .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.lines { display: flex; flex-direction: column; }
.lines .ln { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.lines .ln span:last-child { font-family: var(--mono); white-space: nowrap; }
.lines .ln.total { font-weight: 600; border-bottom: 0; padding-top: 12px; }
.lines .ln.sub2 { color: var(--muted); }

.bar { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar > div { height: 10px; border-radius: 999px; }

.notice { border-radius: 10px; padding: 14px 16px; line-height: 1.5; background: var(--info-bg); color: var(--info); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice a { color: inherit; font-weight: 600; }

.alert-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.alert-item:hover { border-color: var(--line-hover); color: var(--ink); }

.empty { padding: 32px; text-align: center; color: var(--muted); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--on-ink); padding: 12px 16px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 50; max-width: 360px; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--bad); color: var(--on-ink); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.conn { display: flex; flex-direction: column; gap: 12px; }
.conn .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
code { font-family: var(--mono); font-size: 13px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
details summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.big-num { font-family: var(--mono); font-size: 34px; font-weight: 500; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: min(400px, 100%); }

/* Painel de configurações */
dialog.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--card); color: var(--ink); overflow: auto; }
dialog.modal::backdrop { background: rgba(10, 12, 14, .55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.modal-head .icon-btn { color: var(--muted); }
.modal-head .icon-btn:hover { background: var(--hover); color: var(--ink); }
.modal-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.set-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.set-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; min-height: 44px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.set-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.set-themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.set-theme { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); cursor: pointer; }
.set-theme[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.set-theme small { color: var(--muted); }
.theme-prev { width: 100%; height: 64px; border-radius: 8px; display: grid; grid-template-columns: 28% 1fr; overflow: hidden; border: 1px solid var(--line); margin-bottom: 6px; }
.theme-prev i { display: block; }
.theme-prev .pl-nav { background: #14161A; }
.theme-prev .pl-light { background: #F3F4F1; }
.theme-prev .pl-dark { background: #111316; }
.theme-prev .pl-auto { background: linear-gradient(90deg, #F3F4F1 50%, #111316 50%); }

/* Visão geral */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi .vs { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 4px; }
.kpi.hero { grid-column: span 2; background: var(--card); }
.kpi.hero .v { font-size: 38px; }
@media (max-width: 560px) { .kpi.hero { grid-column: auto; } .kpi.hero .v { font-size: 30px; } }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sw.line { height: 3px; border-radius: 2px; }
.sw.s1, .seg.s1 { background: var(--s1); } .sw.s2, .seg.s2 { background: var(--s2); } .sw.s3, .seg.s3 { background: var(--s3); }
.sw.s4, .seg.s4 { background: var(--s4); } .sw.s5, .seg.s5 { background: var(--s5); } .sw.s6, .seg.s6 { background: var(--s6); }
.chart { position: relative; min-width: 0; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.chart .s1 { fill: var(--s1); }
.chart .s2line { fill: none; stroke: var(--s2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s2dot { fill: var(--s2); stroke: var(--card); stroke-width: 2; }
.chart .xhair { stroke: var(--line-hover); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip { position: absolute; z-index: 5; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 220px; }
.tip span { display: flex; align-items: center; gap: 6px; }
.tip span b { margin-left: auto; font-weight: 500; }
.split-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr auto; gap: 14px; align-items: center; }
.split-row.total { border-top: 1px solid var(--line-2); padding-top: 12px; }
.split-label { display: flex; flex-direction: column; }
.split-bar { display: flex; height: 30px; min-width: 0; }
.seg { height: 30px; border-right: 2px solid var(--card); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-family: var(--mono); font-weight: 500; min-width: 0; overflow: hidden; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-right: 0; border-radius: 0 4px 4px 0; }
.seg span { text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.split-end { font-size: 13px; white-space: nowrap; color: var(--ink-2); }
@media (max-width: 640px) { .split-row { grid-template-columns: 1fr; gap: 6px; } }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ch-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ch-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.big-pct { font-size: 30px; font-weight: 500; line-height: 1.1; }
.ch-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 4px; }
.todo { gap: 12px; }
.todo-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.todo-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--info-bg); min-height: 48px; }
.todo-item.warn { background: var(--warn-bg); }
.todo-item.bad { background: var(--bad-bg); }
.todo-item:hover { color: var(--ink); filter: brightness(.97); }
.todo-cta { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--accent); }

.spark { width: 100%; height: 38px; display: block; margin-top: 2px; }
.spark .sp-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .sp-area { opacity: .12; }
.spark.s1 .sp-line { stroke: var(--s1); } .spark.s1 .sp-area, .spark.s1 .sp-dot { fill: var(--s1); }
.spark.s2 .sp-line { stroke: var(--s2); } .spark.s2 .sp-area, .spark.s2 .sp-dot { fill: var(--s2); }
.spark .sp-dot { stroke: var(--card); stroke-width: 2; }
.meter { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 14px 0 15px; }
.meter > div { height: 8px; border-radius: 999px; background: var(--s5); }
.kpi.hero { background: var(--card); border-color: var(--line); position: relative; overflow: hidden; }
.kpi.hero::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ok-bar); }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.dn.s1 { fill: var(--s1); stroke: var(--s1); } .dn.s2 { fill: var(--s2); stroke: var(--s2); } .dn.s3 { fill: var(--s3); stroke: var(--s3); } .dn.s4 { fill: var(--s4); stroke: var(--s4); }
path.dn { stroke: none; }
circle.dn { fill: none; }
.dn-total { font-family: var(--mono); font-size: 13px; font-weight: 500; fill: var(--ink); }
.dn-sub { font-size: 11px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dl-row { display: flex; gap: 10px; align-items: flex-start; }
.dl-row .sw { margin-top: 4px; }
.dl-row div { display: flex; flex-direction: column; }
.rank { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); border-radius: 8px; }
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: var(--hover); color: var(--ink); }
.rank-n { width: 26px; height: 26px; border-radius: 50%; background: var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-2); }
.rank-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rank-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.ads-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.am-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.am-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.am-top .tag { margin-left: auto; }
.am-bar { position: relative; height: 10px; border-radius: 999px; background: var(--line-2); }
.am-fill { height: 10px; border-radius: 999px; }
.am-mark { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); border-radius: 1px; }
.am-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ptab { padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.ptab:hover { color: var(--ink); }
.ptab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.ptools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchips .pill b { margin-left: 4px; font-weight: 500; }
.psearch { flex: 0 1 300px; }
.probs summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }

/* Inteligência */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.ins { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--card); position: relative; overflow: hidden; }
.ins::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--info); }
.ins.bad::before { background: var(--bad-bar); } .ins.warn::before { background: var(--warn-bar); } .ins.ok::before { background: var(--ok-bar); }
.ins-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ins-head { display: flex; flex-direction: column; gap: 2px; }
.ins-head b { font-weight: 600; }
.ins-why, .ins-action { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ins-action span { font-weight: 600; color: var(--ink); }
.ins-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line-2); }
.ins-impact { font-size: 13px; color: var(--ok); min-width: 0; flex: 1; }
.ins-foot a { white-space: nowrap; }
.ins.bad .ins-impact { color: var(--bad); }
.ins-dot { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; margin-right: 4px; vertical-align: middle; }
.ins-dot.bad { background: var(--bad-bg); color: var(--bad); } .ins-dot.warn { background: var(--warn-bg); color: var(--warn); }
.ins-dot.ok { background: var(--ok-bg); color: var(--ok); } .ins-dot.info { background: var(--info-bg); color: var(--info); }

/* Pedidos */
dialog.modal.wide { width: min(860px, calc(100vw - 32px)); }
.b-loss { background: var(--bad-bar); } .b-low { background: var(--warn-bar); } .b-mid { background: var(--s1); } .b-high { background: var(--ok-bar); }
.split-bar.band { margin-top: 6px; }
.split-bar.band .seg { height: 26px; }
.blist { display: flex; flex-direction: column; gap: 10px; }
.bl-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-bar { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bl-bar > div { height: 10px; background: var(--s1); border-radius: 999px; }
.bl-val { font-size: 12px; color: var(--muted); white-space: nowrap; }
.worst { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; cursor: pointer; color: var(--ink); }
.worst:hover { border-color: var(--line-hover); }
.odet-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.odet-top > div { display: flex; flex-direction: column; gap: 2px; }
a.pill { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
a.pill[aria-pressed="true"] { color: var(--on-ink); }

/* Ads e CAC */
.ptab .count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); font-size: 12px; font-weight: 600; align-items: center; justify-content: center; }
.ruler { position: relative; height: 92px; margin: 34px 8px 4px; }
.ruler-track { position: absolute; left: 0; right: 0; top: 0; height: 12px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.ruler-track .z { position: absolute; top: 0; bottom: 0; left: 0; opacity: .55; }
.ruler-track .z.bad { background: var(--bad-bar); } .ruler-track .z.warn { background: var(--warn-bar); } .ruler-track .z.ok { background: var(--ok-bar); }
.ruler-mark { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ruler-mark i { width: 2px; height: 20px; background: var(--ink-2); display: block; }
.ruler-mark b { color: var(--ink); font-weight: 500; font-size: 13px; }
.ruler-now { position: absolute; top: -32px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.ruler-now b { background: var(--ink); color: var(--on-ink); padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 500; position: relative; }
.ruler-now b::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-bottom: 0; border-top-color: var(--ink); }
.ruler-now span { order: 2; display: none; }
.grid.mini { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.grid.mini > div { display: flex; flex-direction: column; gap: 2px; }
.big { font-size: 20px; font-weight: 500; }
td.diag { min-width: 260px; white-space: normal; }
td.diag .sub { margin-top: 6px; line-height: 1.45; }
.flag { display: block; margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--warn); padding-left: 10px; border-left: 2px solid var(--warn-bar); }
.budget-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.budget-flow > div { display: flex; flex-direction: column; gap: 2px; }
.budget-flow .arrow { font-size: 22px; color: var(--muted); }
.plist { display: flex; flex-direction: column; }
.prow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 20px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-2); }
.prow:last-child { border-bottom: 0; }
.prow-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prow-main b { font-weight: 500; }
.prow-main .small { color: var(--ink-2); line-height: 1.45; }
.prow-stats { display: flex; gap: 18px; }
.prow-stats > span { display: flex; flex-direction: column; align-items: flex-end; }
.prow-stats b { font-weight: 500; font-size: 14px; }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.fstep { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 70px; gap: 14px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.fstep.weak { background: var(--warn-bg); }
.fstep-l { display: flex; flex-direction: column; gap: 2px; }
.fstep-l b { font-weight: 500; }
.fbar { height: 22px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.fbar > div { height: 22px; background: var(--s1); border-radius: 6px; }
.fstep.weak .fbar > div { background: var(--warn-bar); }
.fval { text-align: right; font-weight: 500; }
.brow { display: grid; grid-template-columns: minmax(120px, 230px) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.brow .bar > div.s1bg { background: var(--s1); } .brow .bar > div.s2bg { background: var(--s2); } .brow .bar > div.s3bg { background: var(--s3); }
.cols { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 6px; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.col > div { width: 100%; max-width: 40px; background: var(--s1); opacity: .45; border-radius: 4px 4px 0 0; }
.col.top > div { opacity: 1; }
.col .small { white-space: nowrap; }
@media (max-width: 640px) {
  .prow { grid-template-columns: 1fr; }
  .prow-stats { flex-wrap: wrap; gap: 12px; }
  .prow-stats > span { align-items: flex-start; }
  .fstep { grid-template-columns: 1fr 56px; }
  .fstep .fbar { grid-column: 1 / -1; grid-row: 2; }
  .brow { grid-template-columns: 1fr auto; }
  .brow .bar { grid-column: 1 / -1; grid-row: 2; }
  .cols { gap: 4px; }
}
.ruler-mark.lv1 i { height: 44px; }
.grid.five { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ruler-legend { display: none; }
@media (max-width: 640px) {
  .ruler { height: 56px; }
  .ruler-mark span { display: none; }
  .ruler-mark.lv1 i { height: 20px; }
  .ruler-mark.lv1 b { margin-top: 18px; }
  .ruler-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
  .ruler-legend b { color: var(--ink); font-weight: 500; }
  .grid.five .kpi { padding: 14px; }
  .grid.five .kpi .v { font-size: 17px; }
}
.lines .ln.subtotal { font-weight: 600; background: var(--hover); border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.costfix { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.costfix input { width: 110px; min-height: 36px; padding: 6px 10px; }
.more-btn { align-self: flex-start; margin-top: 10px; }
.prow[hidden], .rank-row[hidden], tr[hidden] { display: none; }
.todo-item.bad { background: var(--bad-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--line-2); font-size: 13px; color: var(--ink); }
.wk-lists { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.wk-lists > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: baseline; }
.proj .grid.mini > div .small { line-height: 1.4; }
@media (max-width: 640px) { .wk-lists > div { grid-template-columns: 1fr; gap: 2px; } }

/* Hub */
.nav a.hub-only { display: none; }
body[data-mode="hub"] .nav a.hub-only { display: flex; }
body[data-mode="hub"] .nav a[data-route]:not([data-route="integracoes"]):not([data-route="hub"]) { display: none; }
.hubcard .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
code.secret { font-family: var(--mono); font-size: 13px; background: var(--card); color: var(--ink); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; user-select: all; }

/* Conectar com 1 clique */
.gbtn, .fbtn { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; min-height: 44px; padding: 0 18px; }
.gbtn svg { background: #fff; border-radius: 50%; padding: 2px; }
.fbtn { background: #1877F2; border-color: #1877F2; color: #fff; }
.fbtn:hover { background: #166FE5; color: #fff; }
.gcard { margin-bottom: 14px; }
.card.choose { border: 2px solid var(--accent); }
.redirect { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.redirect code { font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }

.card.allcard { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border: 2px solid var(--accent); }
.card.allcard > div { flex: 1 1 320px; min-width: 0; }
body.authpage { background: var(--bg); color: var(--ink); padding: 16px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

fieldset.groups { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.groups legend { padding: 0 6px; color: var(--muted); }
form.kgroups { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
