/* Pacing · desenho da marca (DESIGN.md): carteira em Vermelho, mercado em Teal, curvas suaves.
   Tudo preso a #tab-pacing e ao drawer #pacing-ops; as fontes vêm do @font-face do landing.css.
   Acima/abaixo é dito por seta e texto, nunca por vermelho (o vermelho é a cor da carteira). */
#tab-pacing, #pacing-ops, #pacing-ops-scrim {
  --pc-own: #FF585D;
  --pc-mkt: #0F988E;
  --pc-ink: #1A1A2E;
  --pc-ink-2: #2E2E3A;
  --pc-mut: #52525E;
  --pc-bg: transparent;
  --pc-card: #FBFAF8;
  --pc-soft: #F4F2ED;
  --pc-line: rgba(26, 26, 46, .13);
  --pc-line-2: rgba(26, 26, 46, .08);
  --pc-up: rgba(15, 152, 142, .16);
  --pc-tip: #1A1A2E;
  --pc-on-tip: #E8E5DE;
  --pc-on-tip-mut: #B9B6AE;
  --pc-shadow: 0 1px 2px rgba(26, 26, 46, .05), 0 14px 30px -24px rgba(26, 26, 46, .4);
  --pc-font: "Onest", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --pc-mono: "Martian Mono", ui-monospace, monospace;
  --pc-ease: cubic-bezier(.16, 1, .3, 1);
  --pc-band: transparent; --pc-dim-op: .72; --pc-edge-op: .45;
}
body.dark-mode #tab-pacing, body.dark-mode #pacing-ops {
  --pc-ink: #E8E5DE; --pc-ink-2: #CFCBC2; --pc-mut: #A9A69F; --pc-card: #22223A; --pc-soft: #2A2A44;
  --pc-line: rgba(232, 229, 222, .14); --pc-line-2: rgba(232, 229, 222, .08); --pc-up: rgba(15, 152, 142, .28);
  --pc-band: rgba(232, 229, 222, .07); --pc-dim-op: .88; --pc-edge-op: .8;
  --pc-tip: #0F0F1C; --pc-shadow: 0 0 0 1px rgba(232, 229, 222, .06), 0 14px 30px -24px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  body:not(.light-mode) #tab-pacing, body:not(.light-mode) #pacing-ops {
    --pc-ink: #E8E5DE; --pc-ink-2: #CFCBC2; --pc-mut: #A9A69F; --pc-card: #22223A; --pc-soft: #2A2A44;
    --pc-line: rgba(232, 229, 222, .14); --pc-line-2: rgba(232, 229, 222, .08); --pc-up: rgba(15, 152, 142, .28);
    --pc-band: rgba(232, 229, 222, .07); --pc-dim-op: .88; --pc-edge-op: .8;
  --pc-tip: #0F0F1C; --pc-shadow: 0 0 0 1px rgba(232, 229, 222, .06), 0 14px 30px -24px rgba(26, 26, 46, .7);
  }
}

/* Isola das regras de elemento do app.css (h1–h4, a, strong, button, tabela…).
   Peso de elemento de propósito: vence o app.css (carrega depois) e perde para as classes .pc-*. */
:where(#tab-pacing, #pacing-ops) :is(h2, h3, p, ul, li, dl, dt, dd, strong, button, label, select, input, table, thead, tbody, tr, th, td, details, summary, small, code) { all: revert; }
#tab-pacing, #pacing-ops { color: var(--pc-ink); font: 400 15px/1.5 var(--pc-font); font-variant-numeric: tabular-nums; }
:where(#tab-pacing, #pacing-ops) :is(button, input, select) { font: inherit; color: inherit; }
:where(#tab-pacing, #pacing-ops) :is(h2, h3, p, ul, dl, dd) { margin: 0; }
:where(#tab-pacing, #pacing-ops) :is(ul) { padding: 0; list-style: none; }
#tab-pacing :focus-visible, #pacing-ops :focus-visible { outline: 2px solid var(--pc-ink); outline-offset: 2px; border-radius: 6px; }
#tab-pacing ::selection, #pacing-ops ::selection { background: #0F988E; color: #1A1A2E; }
.pc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pc-muted { color: var(--pc-mut); font-size: 13.5px; }

/* Cabeçalho */
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pc-head h2 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.pc-head p { color: var(--pc-mut); margin-top: 2px; }
.pc-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.pc-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--pc-line); border-radius: 10px; background: var(--pc-card); color: var(--pc-ink); font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color .18s var(--pc-ease), background-color .18s var(--pc-ease); }
.pc-btn:hover { border-color: rgba(26, 26, 46, .35); }
.pc-btn:disabled { opacity: .55; cursor: not-allowed; }
.pc-btn svg { width: 16px; height: 16px; flex: none; }
.pc-btn.pc-primary { width: 100%; justify-content: center; min-height: 46px; background: #FF585D; border-color: transparent; color: #1A1A2E; }
.pc-btn.pc-primary:hover:not(:disabled) { background: #FF6D71; }
.pc-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--pc-ink); color: var(--pc-card); font-size: 12px; display: inline-grid; place-items: center; }
.pc-badge[hidden] { display: none; }
.pc-status { margin: 14px 0 0; padding: 11px 14px; border-radius: 12px; background: var(--pc-soft); border: 1px solid var(--pc-line); font-size: 14px; }
.pc-status[hidden] { display: none; }
.pc-status[data-state="error"] { border-color: rgba(255, 88, 93, .55); }

/* Veredito */
.pc-verdict { margin: 24px 0 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: end; }
.pc-spark { display: grid; gap: 6px; justify-items: end; }
.pc-spark[hidden] { display: none; }
.pc-spark small { font-size: 12.5px; color: var(--pc-mut); max-width: 240px; text-align: right; }
.pc-spark svg { display: block; overflow: visible; }
.pc-note { margin-top: 10px; font-size: 13px; color: var(--pc-mut); }
.pc-note:empty { display: none; }
.pc-verdict h3 { font-size: clamp(26px, 2.7vw, 38px); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; }
.pc-verdict p { font-size: clamp(18px, 1.6vw, 23px); font-weight: 600; letter-spacing: -.015em; line-height: 1.3; margin-top: 8px; color: var(--pc-ink-2); }
.pc-verdict p[hidden] { display: none; }
.pc-mark { color: var(--pc-ink); padding: 0 .18em; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; background: var(--pc-soft); box-shadow: inset 0 0 0 1px var(--pc-line); }
.pc-mark.up { background: var(--pc-up); box-shadow: none; }
.pc-arr { width: .62em; height: .62em; margin-right: .12em; vertical-align: .02em; }

/* Período e leitura */
.pc-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.pc-controls-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pc-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--pc-soft); border: 1px solid var(--pc-line); flex-wrap: wrap; }
.pc-seg button { min-height: 38px; padding: 0 13px; border: 0; border-radius: 9px; background: transparent; color: var(--pc-mut); font-weight: 600; font-size: 14px; cursor: pointer; }
.pc-seg button[aria-checked="true"], .pc-seg button[aria-pressed="true"] { background: var(--pc-card); color: var(--pc-ink); box-shadow: 0 1px 2px rgba(26, 26, 46, .14), 0 4px 10px -6px rgba(26, 26, 46, .35); }
.pc-seg button:hover { color: var(--pc-ink); }
.pc-seg-sm button { min-height: 32px; font-size: 13px; padding: 0 10px; }
.pc-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--pc-mut); }
.pc-custom[hidden] { display: none; }
.pc-custom input { height: 38px; border: 1px solid var(--pc-line); border-radius: 9px; background: var(--pc-card); padding: 0 8px; color: var(--pc-ink); }
.pc-reading { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--pc-mut); }
.pc-dot { width: 8px; height: 8px; border-radius: 50%; background: #0F988E; flex: none; }

/* Cartões */
.pc-grid { display: grid; gap: 16px; }
.pc-top { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
.pc-mid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); margin-top: 16px; align-items: start; }
.pc-card { background: var(--pc-card); border: 1px solid var(--pc-line); border-radius: 18px; padding: 20px 22px; box-shadow: var(--pc-shadow); min-width: 0; }
.pc-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pc-card h3 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.pc-sub { font-size: 13.5px; color: var(--pc-mut); }
.pc-how { font-size: 14px; color: var(--pc-mut); margin: -4px 0 10px; max-width: 80ch; }
.pc-empty { padding: 18px; border-radius: 12px; background: var(--pc-soft); color: var(--pc-mut); font-size: 14px; }
.pacing-panel.is-refetching .pc-card { opacity: .6; transition: opacity .15s; }

/* Gráficos */
.pc-chartbox { position: relative; }
.pc-chartbox svg { display: block; width: 100%; overflow: visible; }
.pc-chartbox svg:focus-visible { outline: 2px solid var(--pc-ink); outline-offset: 4px; }
.pc-axis { font: 400 13px var(--pc-font); fill: var(--pc-mut); }
.pc-gridl { stroke: var(--pc-line-2); stroke-width: 1; }
.pc-weekend { fill: rgba(26, 26, 46, .022); }
body.dark-mode .pc-weekend { fill: rgba(232, 229, 222, .03); }
/* Destaque do "Onde agir": esmaece o que está fora do período (cor do cartão por cima das curvas). */
.pc-focus { pointer-events: none; }
/* No escuro, esmaecer com a cor do cartão quase não muda nada: lá o período também ganha uma faixa clara por trás. */
.pc-dim { fill: var(--pc-card); opacity: var(--pc-dim-op); }
.pc-band { fill: var(--pc-band); }
.pc-focus-edge { stroke: var(--pc-ink); stroke-opacity: var(--pc-edge-op); stroke-width: 1.2; stroke-dasharray: 3 3; }
.pc-focus-label { font: 500 11px var(--pc-mono); fill: var(--pc-ink); paint-order: stroke; stroke: var(--pc-card); stroke-width: 4px; stroke-linejoin: round; }
.pc-cursor { stroke: var(--pc-ink); stroke-width: 1; opacity: .45; }
.pc-hot { stroke: var(--pc-card); stroke-width: 2; }
.pc-lbl-box { fill: var(--pc-card); stroke-width: 1.5; }
.pc-lbl { font: 600 13px var(--pc-font); fill: var(--pc-ink); }
.pc-tip { position: absolute; top: 8px; pointer-events: none; background: var(--pc-tip); color: var(--pc-on-tip); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; min-width: 200px; box-shadow: 0 12px 30px -12px rgba(26, 26, 46, .6); }
.pc-tip[hidden] { display: none; }
.pc-tip b { font-weight: 600; }
.pc-tip .pc-tip-row { display: flex; justify-content: space-between; gap: 16px; }
.pc-tip .pc-tip-key { display: inline-flex; align-items: center; gap: 6px; color: var(--pc-on-tip-mut); }
.pc-sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.pc-sq.dash { background: transparent !important; box-shadow: inset 0 0 0 2px currentColor; }
.pc-legend { display: flex; gap: 6px 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--pc-mut); align-items: center; }
.pc-legend button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px 0 10px; border: 1px solid var(--pc-line); border-radius: 999px; background: var(--pc-card); color: var(--pc-ink); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.pc-legend button[aria-pressed="false"] { color: var(--pc-mut); background: transparent; }
.pc-legend button[aria-pressed="false"] svg { opacity: .3; }
.pc-legend svg { display: block; flex: none; }
.pc-legend .pc-wk { display: inline-flex; align-items: center; gap: 7px; }
.pc-legend .pc-wk i { width: 22px; height: 14px; border-radius: 3px; background: rgba(26, 26, 46, .06); box-shadow: inset 0 0 0 1px var(--pc-line); }
.pc-details { margin-top: 12px; }
.pc-details summary { cursor: pointer; font-weight: 600; font-size: 14px; min-height: 36px; display: inline-flex; align-items: center; gap: 8px; }
.pc-scroll { overflow: auto; max-height: 320px; border: 1px solid var(--pc-line-2); border-radius: 10px; margin-top: 6px; }
.pc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pc-table th, .pc-table td { padding: 7px 10px; text-align: left; white-space: nowrap; }
.pc-table .num { text-align: right; }
.pc-table thead th { position: sticky; top: 0; background: var(--pc-soft); color: var(--pc-mut); font-weight: 500; }
.pc-table tbody tr:nth-child(even) { background: rgba(26, 26, 46, .025); }
.pc-table td.wrap { white-space: normal; min-width: 220px; }

/* Onde agir */
.pc-acts { display: grid; gap: 8px; }
.pc-acts button { width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--pc-line); border-radius: 12px; background: var(--pc-card); color: var(--pc-ink); cursor: pointer; transition: border-color .18s var(--pc-ease), transform .18s var(--pc-ease); }
.pc-acts button:hover { border-color: rgba(26, 26, 46, .35); transform: translateY(-1px); }
.pc-acts button[aria-pressed="true"] { border-color: var(--pc-ink); box-shadow: inset 0 0 0 1px var(--pc-ink); }
.pc-acts .pc-when { font-weight: 600; }
.pc-acts .pc-meta { grid-column: 1 / 2; font-size: 13px; color: var(--pc-mut); }
.pc-acts .pc-chip { align-self: center; grid-row: 1 / 3; grid-column: 2; }
.pc-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--pc-soft); box-shadow: inset 0 0 0 1px var(--pc-line); }
.pc-chip.up { background: var(--pc-up); box-shadow: none; }
.pc-chip.nt { box-shadow: none; }
.pc-chip .pc-arr { width: 11px; height: 11px; margin-right: 3px; }
.pc-chip-plain { font-size: 12.5px; color: var(--pc-mut); font-weight: 500; }

/* Comparativo e projeção */
.pc-cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.pc-cmp th { font-weight: 500; color: var(--pc-mut); font-size: 12.5px; text-align: right; padding: 0 0 8px; }
.pc-cmp th:first-child, .pc-cmp td:first-child { text-align: left; }
.pc-cmp td { padding: 11px 0; border-top: 1px solid var(--pc-line-2); text-align: right; font-weight: 600; }
.pc-cmp td:first-child { font-weight: 500; }
.pc-proj { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--pc-soft); font-size: 14px; line-height: 1.5; }
.pc-proj[hidden] { display: none; }
.pc-proj b { font-size: 20px; letter-spacing: -.02em; }
.pc-proj small { display: block; color: var(--pc-mut); font-size: 12.5px; margin-top: 4px; }

/* Recorte */
.pc-pop-wrap { position: relative; }
.pc-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 340px; max-height: 70vh; overflow: auto; background: var(--pc-card); border: 1px solid var(--pc-line); border-radius: 14px; padding: 14px; box-shadow: 0 2px 6px rgba(26, 26, 46, .1), 0 24px 50px -20px rgba(26, 26, 46, .45); }
.pc-pop[hidden] { display: none; }
.pc-pop h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.pc-pop p { font-size: 12.5px; color: var(--pc-mut); margin-bottom: 10px; }
.pc-groups label { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; cursor: pointer; }
.pc-groups label small { margin-left: auto; color: var(--pc-mut); font-size: 12.5px; }
.pc-groups .pc-group-name { font-weight: 600; }
.pc-groups ul { padding-left: 26px; }
.pc-groups input[type="checkbox"], #pacing-ops input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: #1A1A2E; flex: none; }
.pc-pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--pc-line-2); }

/* Drawer de operação */
.pc-scrim { position: fixed; inset: 0; background: rgba(26, 26, 46, .45); z-index: 3990; }
.pc-scrim[hidden] { display: none; }
.pc-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); background: var(--pc-card); z-index: 4000; transform: translateX(102%); transition: transform .28s var(--pc-ease); display: flex; flex-direction: column; box-shadow: -20px 0 50px -30px rgba(26, 26, 46, .6); visibility: hidden; }
.pc-drawer.on { transform: none; visibility: visible; }
.pc-drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--pc-line-2); }
.pc-drawer header h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.pc-x { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--pc-ink); }
.pc-x:hover { background: var(--pc-soft); }
.pc-x svg { width: 20px; height: 20px; }
.pc-drawer-body { padding: 18px 22px 28px; overflow-y: auto; display: grid; gap: 24px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.pc-drawer section h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.pc-field { display: grid; gap: 6px; font-size: 14px; }
.pc-field label { font-weight: 600; }
.pc-field select { height: 44px; border: 1px solid rgba(26, 26, 46, .24); border-radius: 10px; background: var(--pc-soft); padding: 0 12px; color: var(--pc-ink); width: 100%; min-width: 0; text-overflow: ellipsis; }
.pc-check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; font-weight: 500; cursor: pointer; }
.pc-auto { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 12px; border-radius: 12px; background: var(--pc-soft); font-size: 13.5px; }
.pc-auto:empty { display: none; }
.pc-auto .pc-dot { grid-row: 1 / 3; margin-top: 6px; }
.pc-auto small { grid-column: 2; color: var(--pc-mut); overflow-wrap: anywhere; }
.pc-auto[data-tone="off"] .pc-dot { background: var(--pc-mut); }
.pc-auto[data-tone="warn"] .pc-dot { background: #D99A1E; }
.pc-progress { display: grid; gap: 8px; margin-top: 12px; }
.pc-progress-sub { font-size: 13.5px; color: var(--pc-mut); }
.pc-bar { height: 8px; border-radius: 999px; background: var(--pc-soft); overflow: hidden; }
.pc-bar i { display: block; height: 100%; width: 0; background: #0F988E; transition: width .3s var(--pc-ease); }
.pc-progress-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.pc-progress-tools input { height: 36px; border: 1px solid var(--pc-line); border-radius: 9px; background: var(--pc-card); padding: 0 10px; color: var(--pc-ink); }
.pacing-step-done { color: #0B6F68; }
body.dark-mode .pacing-step-done { color: #3CCFB9; }
.pacing-step-failed { font-weight: 600; }
.pacing-step-pending, .pacing-step-none { color: var(--pc-mut); }
.pc-src dt { font-weight: 600; font-size: 14px; margin-top: 10px; }
.pc-src dt:first-child { margin-top: 0; }
.pc-src dd { font-size: 13.5px; color: var(--pc-mut); margin: 2px 0 0; }
.pc-src details { margin-top: 4px; font-size: 13px; }
.pc-src summary { cursor: pointer; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; color: var(--pc-ink); }
.pc-src code { font-family: var(--pc-mono); font-size: 11.5px; background: var(--pc-soft); padding: 2px 6px; border-radius: 6px; word-break: break-word; }
.pacing-warnings { margin: 14px 0 0; padding-left: 18px; color: var(--pc-mut); font-size: 13.5px; list-style: disc; }
.pacing-warnings:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  #tab-pacing *, #pacing-ops, #pacing-ops * { transition: none !important; animation: none !important; }
}
@media (max-width: 1100px) { .pc-top, .pc-mid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) { .pc-verdict { grid-template-columns: minmax(0, 1fr); } .pc-spark { justify-items: start; } .pc-spark small { text-align: left; } }
@media (max-width: 560px) {
  .pc-head h2 { font-size: 24px; }
  .pc-tools { width: 100%; }
  .pc-tools > *, .pc-tools .pc-btn { flex: 1; justify-content: center; min-height: 44px; }
  .pc-pop-wrap .pc-btn { width: 100%; }
  .pc-seg { width: 100%; }
  .pc-seg button { flex: 1 1 auto; min-height: 44px; padding: 0 8px; }
  .pc-card { padding: 16px; }
  .pc-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .pc-cmp { font-size: 12.5px; table-layout: fixed; }
  .pc-cmp th { font-size: 11.5px; }
  .pc-cmp .pc-chip { padding: 2px 5px; font-size: 11.5px; }
  .pc-legend button, .pc-details summary { min-height: 44px; }
}
