/* AMI · Altitude — tokens from Manual de Marca 1.0 (2026). Interfaces: white/Névoa dominate,
   Azul Profundo as navigation band, Azul Altitude as the single accent. */
:root {
  --profundo: #061B33;
  --institucional: #0A2A58;
  --altitude: #1B75BC;
  --sinal: #5AA9FF;
  --cinza: #414142;
  --aco: #5E6875;
  --nevoa: #E9EDF2;
  --branco: #FFFFFF;

  --bg: #F6F8FB;
  --surface: var(--branco);
  --ink: var(--cinza);
  --ink-strong: var(--profundo);
  --muted: var(--aco);
  --line: #DCE2EA;
  --grid: #E9EDF2;

  --good: #0B7A3E;
  --good-bg: #E7F5EC;
  --warn: #8A5A00;
  --warn-bg: #FFF4DB;
  --critical: #B42318;
  --critical-bg: #FDECEA;

  --radius: 10px;
  --title: 'Montserrat', Arial, sans-serif;
  --text: 'Inter', Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--text); }
h1, h2, h3 { font-family: var(--title); color: var(--ink-strong); margin: 0; }
a { color: var(--altitude); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--altitude); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--profundo); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip-link:focus { left: 8px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--profundo); color: #C9D4E3; padding: 24px 14px 18px; display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand { display: block; padding: 4px 10px 0; }
.brand img { display: block; width: 132px; height: auto; }
.brand-product { margin: 10px 10px 0; font: 600 11px/1.4 var(--text); color: #A9B8CC; }
nav { margin-top: 28px; display: grid; gap: 2px; }
.nav-label { margin: 18px 10px 6px; font: 700 11px/1 var(--title); letter-spacing: .16em; text-transform: uppercase; color: #8FA3BD; }
.nav-label:first-child { margin-top: 0; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px; border-radius: 8px; color: #D5DCE5; text-decoration: none; font-weight: 500; font-size: 14px; }
.nav-link:hover { background: var(--institucional); color: #fff; }
.nav-link.active { background: var(--altitude); color: #fff; }
.nav-link i { margin-left: auto; font-style: normal; font-size: 11px; background: var(--institucional); color: #fff; border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.nav-link.active i { background: var(--profundo); }
.nav-link i:empty { display: none; }
.sidebar-foot { margin: auto 10px 0; padding-top: 18px; border-top: 1px solid var(--institucional); font-size: 12px; color: #A9B8CC; }
.sidebar-foot span { color: #8FA3BD; }

main { margin-left: 248px; width: calc(100% - 248px); max-width: 1440px; padding: 0 40px 40px; min-width: 0; }
body { overflow-x: hidden; }
main:focus { outline: none; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 0 14px; border-bottom: 1px solid var(--line); }
.page-heading { flex: 1; min-width: 0; }
.eyebrow { margin: 0 0 4px; font: 700 12px/1 var(--title); letter-spacing: .16em; text-transform: uppercase; color: var(--altitude); }
.page-heading h1 { font-size: 28px; line-height: 1.15; font-weight: 700; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 42px; height: 42px; align-items: center; justify-content: center; color: var(--ink-strong); }
.sync-line { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 20px; }
.sync-line.error { color: var(--critical); }
.data-alert { margin: 10px 0 0; padding: 10px 12px; border-radius: 6px; background: var(--critical-bg); color: var(--critical); font-size: 14px; font-weight: 600; }

/* Buttons and period menu */
.date-btn, .refresh-btn, .text-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-strong); font-weight: 500; font-size: 14px; cursor: pointer; }
.date-btn:hover, .refresh-btn:hover { border-color: var(--altitude); }
.date-btn.primary { background: var(--altitude); border-color: var(--altitude); color: #fff; }
.date-btn.primary:hover { background: #17649F; }
.date-btn:disabled, .refresh-btn:disabled { opacity: .55; cursor: progress; }
.text-btn { border: 0; background: none; color: var(--altitude); padding: 0; min-height: 32px; }
.text-link { color: var(--altitude); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.period-control { position: relative; }
.period-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgba(6, 27, 51, .14); }
.period-menu > button { display: flex; width: 100%; border: 0; background: transparent; border-radius: 6px; padding: 9px 10px; text-align: left; font-size: 14px; cursor: pointer; }
.period-menu > button:hover { background: var(--nevoa); }
.period-menu > button[aria-current="true"] { font-weight: 600; color: var(--ink-strong); }
.period-menu > button[aria-current="true"]::after { content: "✓"; margin-left: auto; font-weight: 700; color: var(--altitude); }
.period-custom { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 4px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.period-custom label { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.period-custom input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px; font-size: 13px; }
.period-custom button { grid-column: 1 / -1; border: 0; border-radius: 6px; padding: 8px; background: var(--profundo); color: #fff; font-weight: 600; cursor: pointer; }

/* Views and layout */
.view { padding-top: 20px; }
.view[aria-busy="true"] .card, .view[aria-busy="true"] .kpi { opacity: .6; transition: opacity .2s; }
.period-summary { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; min-width: 0; }
.grid-2 > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-head h2 { font-size: 18px; font-weight: 600; }
.card-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.card-foot { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 8px 0; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-value { margin-top: 6px; font: 700 30px/1.15 var(--title); color: var(--ink-strong); letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.kpi-row strong { color: var(--ink); font-weight: 600; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 13px; border-radius: 999px; padding: 1px 8px; }
.delta.good { color: var(--good); background: var(--good-bg); }
.delta.bad { color: var(--critical); background: var(--critical-bg); }
.delta.flat { color: var(--muted); background: var(--nevoa); }
.term { border-bottom: 1px dotted var(--aco); cursor: help; }

/* Attention list (status uses icon + label, never color alone) */
.attention-list { display: grid; gap: 10px; }
.attention { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 12px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.attention .badge { grid-row: span 2; align-self: start; }
.attention strong { color: var(--ink-strong); font-size: 14px; font-weight: 600; }
.attention p { margin: 0; font-size: 13px; color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.badge.critical { color: var(--critical); background: var(--critical-bg); }
.badge.warning { color: var(--warn); background: var(--warn-bg); }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.info { color: var(--institucional); background: var(--nevoa); }
.collection .card-head { margin-bottom: 10px; }
.collection-status { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.collection-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; }
.collection-item .badge { grid-row: span 2; }
.collection-item strong { color: var(--ink-strong); font-weight: 600; }
.collection-item small { color: var(--muted); font-size: 12px; }

/* AMI agents */
.team-status .card-head { margin-bottom: 0; }
.team-status .sync-line:empty { display: none; }
.team-actions { display: flex; gap: 8px; }
.agents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agent-tile { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.agent-tile-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.agent-tile-head strong { color: var(--ink-strong); font-family: var(--title); font-weight: 600; }
.agent-tile p { margin: 0; font-size: 13px; }
.agent-tile small { color: var(--muted); font-size: 12px; }
.agent-tile details summary { cursor: pointer; font-size: 13px; color: var(--altitude); font-weight: 600; }
.agent-tile details p { margin: 6px 0 8px; color: var(--muted); }
.history-list { display: grid; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--nevoa); }
.history-row strong { display: block; color: var(--ink-strong); font-weight: 600; font-size: 14px; }
.history-row small { color: var(--muted); font-size: 12px; }
.history-actions { display: flex; gap: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pager:empty { display: none; }
.conclusion { background: var(--bg); border-left: 3px solid var(--altitude); border-radius: 0 8px 8px 0; padding: 12px 16px; margin-bottom: 12px; }
.conclusion h3, .section-title { font-size: 15px; font-weight: 600; margin: 8px 0 4px; }
.conclusion p { margin: 0 0 8px; }
.finding-list { display: grid; gap: 10px; }
.finding-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--bg); }
.finding-item p { margin: 6px 0 0; font-size: 14px; }
.finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.finding-head strong { color: var(--ink-strong); font-weight: 600; }
.finding-state { margin-left: auto; font-size: 12px; color: var(--muted); }
.finding-rec { color: var(--ink); }
.finding-periods { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.finding-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 6px; }
.finding-actions details { flex-basis: 100%; font-size: 13px; }
.finding-actions details summary { cursor: pointer; color: var(--altitude); font-weight: 600; display: inline; }
.finding-item pre, .result-details pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px; max-height: 260px; overflow: auto; }
.finding-item.done { opacity: .65; }
.result-details { margin-top: 12px; }
.result-details summary { cursor: pointer; font-weight: 600; color: var(--ink-strong); }

/* Funnel + horizontal bars (single hue; values in text tokens) */
.funnel-bars, .hbars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 32%) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.bar-row .bar-label { color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.bar-track { position: relative; height: 22px; }
.bar-fill { position: absolute; inset: 0 auto 0 0; max-width: 100%; height: 22px; background: var(--altitude); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-fill.muted { background: #8FA3BD; }
.bar-row .bar-value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-strong); text-align: right; min-width: 64px; }
.bar-row .bar-note { grid-column: 2 / -1; margin-top: -8px; font-size: 12px; color: var(--muted); }
.bar-row:hover .bar-fill { background: #17649F; }

/* Column / line charts (SVG) */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font: 12px var(--text); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .col { fill: var(--altitude); }
.chart .col:hover, .chart .hit:hover + .col { fill: #17649F; }
.chart .line { fill: none; stroke: var(--altitude); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--altitude); stroke: var(--surface); stroke-width: 2; }
.chart .value-label { font: 600 12px var(--text); fill: var(--ink-strong); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--profundo); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 8px 20px rgba(6, 27, 51, .25); max-width: 260px; }
.tooltip strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.tooltip span { color: #C9D4E3; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: right; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 2px solid var(--altitude); outline-offset: 2px; border-radius: 4px; }
table.data th[aria-sort="ascending"] button::after { content: "▲"; font-size: 9px; }
table.data th[aria-sort="descending"] button::after { content: "▼"; font-size: 9px; }
table.data td { padding: 9px 8px; border-bottom: 1px solid var(--nevoa); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td:first-child { white-space: normal; min-width: 200px; max-width: 300px; overflow-wrap: anywhere; }
table.data tr.benchmark td { background: var(--bg); font-weight: 600; color: var(--ink-strong); }
table.data tbody tr:hover td { background: #F1F5FA; }
.name-main { display: block; color: var(--ink-strong); font-weight: 500; }
.name-sub { display: block; font-size: 12px; color: var(--muted); }
table.compare th[scope="row"] { text-align: left; font-weight: 500; color: var(--ink); }
table.compare td.better { font-weight: 600; color: var(--ink-strong); }
.better-tag { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.account-group h3 { font-size: 14px; margin: 16px 0 8px; color: var(--ink-strong); }
.live-row.level-adset { padding-left: 16px; }
.live-row.level-ad { padding-left: 32px; }
.live-row small { color: var(--muted); }
.inline-budget { display: inline-flex; gap: 6px; align-items: center; }
.ad-single, .card-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ad-carousel { display: grid; gap: 10px; }
.check-line { display: flex; gap: 8px; align-items: center; }
.team-head { display: grid; gap: 4px; justify-items: end; text-align: right; }
.team-grid { margin-top: 12px; align-items: start; }
.team-report h3 { margin: 0; font-size: 18px; }
.team-summary { font-size: 15px; color: var(--ink-strong); margin: 12px 0; }
.team-section h4 { margin: 14px 0 4px; font-size: 14px; color: var(--ink-strong); }
.team-section p { margin: 0 0 6px; }
.team-run { width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; font: inherit; color: inherit; }
.team-run:hover { background: var(--bg); }
.team-proposal p { margin: 4px 0; }
.team-answer { border-left: 4px solid var(--altitude); margin-top: 12px; }
.team-answer h4 { margin-top: 0; }
#team-memory-box { margin-top: 16px; }
#team-memory-box summary { cursor: pointer; font-weight: 600; color: var(--ink-strong); }
.team-memory { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.team-memory li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.team-ad { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.team-copy { white-space: pre-line; color: var(--ink-strong); }
.team-preview { margin: 8px 0 0; max-width: 360px; }
.table-scroll { overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th, .team-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.team-table td:first-child { white-space: normal; }
.team-table th { color: var(--muted, inherit); font-weight: 600; }
.team-section ul, .team-section ol { margin: 6px 0 6px 18px; padding: 0; }
.team-section li { margin: 3px 0; }
.team-preview img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.team-preview figcaption { font-weight: 600; margin-top: 6px; }
.team-carousel { display: flex; gap: 8px; overflow-x: auto; }
.team-carousel .team-preview { flex: 0 0 220px; }
.ad-carousel[hidden], .ad-single[hidden] { display: none; }
.card-fields { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 600px) { .ad-single, .card-list { grid-template-columns: minmax(0, 1fr); } }
.inline-budget input { width: 96px; min-height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.cell-bar { display: inline-block; vertical-align: middle; height: 8px; background: var(--altitude); border-radius: 0 4px 4px 0; margin-right: 8px; }
.na { color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.segmented button { border: 0; background: transparent; border-radius: 6px; padding: 7px 14px; font-weight: 500; cursor: pointer; color: var(--muted); }
.segmented button[aria-checked="true"] { background: var(--profundo); color: #fff; }
.search input { min-height: 40px; min-width: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); }

/* Glossary */
.glossary summary { cursor: pointer; list-style: none; }
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary h2 { font-size: 18px; font-weight: 600; display: inline; }
.glossary summary::after { content: "+"; float: right; font: 700 20px var(--title); color: var(--altitude); }
.glossary[open] summary::after { content: "−"; }
.glossary dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 16px 0 0; font-size: 14px; }
.glossary dt { font-weight: 600; color: var(--ink-strong); }
.glossary dd { margin: 0; color: var(--ink); }

/* Agents: Théo and Supervisor (class names kept for app.js) */
.agent-card { position: relative; background: var(--profundo); color: #fff; border-radius: var(--radius); padding: 22px 22px 64px; margin-bottom: 16px; overflow: hidden; }
.agent-card .eyebrow { color: var(--sinal); margin-top: 6px; }
.agent-card h3 { color: #fff; font-size: 22px; line-height: 1.2; white-space: pre-line; }
.agent-card .status { display: inline-flex; font-size: 12px; font-weight: 600; color: #C9D4E3; border: 1px solid var(--institucional); border-radius: 999px; padding: 2px 10px; }
.card-copy { color: #C9D4E3; font-size: 14px; margin: 8px 0 14px; }
.action-list, .conversation { background: var(--institucional); border-radius: 8px; padding: 12px; }
.action-list p, .conversation p { margin: 0; font-size: 13px; color: #D5DCE5; }
.action-list b, .chat-name { color: #fff; font-weight: 600; font-size: 14px; }
.action-list small { display: block; color: #A9B8CC; margin-top: 2px; }
.card-footer { position: absolute; left: 0; right: 0; bottom: 0; min-height: 46px; border: 0; background: var(--altitude); color: #fff; text-align: left; padding: 0 22px; font-weight: 600; cursor: pointer; }
.card-footer:hover { background: #17649F; }
.activity-list p { margin: 0; }
.activity-list b { display: block; color: var(--ink-strong); font-weight: 600; }
.activity-list small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

.coaching-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { font-size: 18px; font-weight: 600; }
.panel-copy { font-size: 13px; color: var(--muted); margin: 6px 0 0; max-width: 640px; }
.panel-status { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.coaching-items, .feedback-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.coaching-item, .feedback-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.coaching-item h3 { font-size: 15px; margin: 0 0 8px; }
.coaching-item h4, .feedback-item h4 { font: 600 13px var(--text); color: var(--ink-strong); margin: 12px 0 2px; }
.coaching-item p, .feedback-item p { font-size: 13px; color: var(--ink); margin: 6px 0; }
.coaching-item ul { padding-left: 18px; margin: 6px 0; font-size: 13px; }
.coaching-item small { color: var(--muted); font-size: 12px; display: block; margin-top: 8px; }
.coaching-priority { display: inline-block; background: var(--nevoa); border-radius: 999px; padding: 2px 9px; font-size: 12px !important; }
.coaching-empty { font-size: 13px !important; color: var(--muted) !important; }
.coaching-provenance, .coaching-delivery { font-size: 12px !important; }
.coaching-delivery { padding: 6px 9px; border-radius: 6px; }
.coaching-delivery.sent { background: var(--good-bg); color: var(--good) !important; }
.coaching-delivery.pending { background: var(--warn-bg); color: var(--warn) !important; }
.feedback-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.feedback-meta strong { font-size: 15px; color: var(--ink-strong); }
.feedback-meta span { font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 2px 8px; }
.feedback-item label { font-size: 13px; color: var(--muted); display: grid; gap: 6px; margin-top: 12px; }
.feedback-text { min-height: 92px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; padding: 9px; font-size: 13px; }
.feedback-item button { margin-top: 10px; }

.task-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.task-form label { font-size: 13px; font-weight: 500; color: var(--ink); display: grid; gap: 6px; }
.task-form input, .task-form select, .task-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 9px 10px; font-size: 14px; }
.task-form textarea { min-height: 96px; resize: vertical; }
.task-wide { grid-column: 1 / -1; }
.task-form button { justify-self: start; }
.task-form .wide { grid-column: 1 / -1; }
.task-form.compact { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; }
.meter { height: 10px; border-radius: 999px; background: var(--nevoa); overflow: hidden; margin: 12px 0 4px; }
.meter > span { display: block; height: 100%; background: var(--altitude); border-radius: 999px; }
.limit-figures { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.limit-figures small { display: block; font-size: 12px; color: var(--muted); }
.limit-figures strong { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.city-picker summary { cursor: pointer; font-size: 13px; font-weight: 500; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.city-group { display: grid; gap: 4px; font-size: 13px; }
.task-form .city-group label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; line-height: 1.35; }
.task-form .city-group input { width: auto; flex: none; margin: 2px 0 0; }
.city-group .city-state { font-weight: 600; }
.ad-fields { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0 0 12px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ad-fields legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.ad-fields .wide { grid-column: 1 / -1; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.draft-item { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.draft-item:last-child { border-bottom: 0; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 16px; }
.publish-image { margin: 0; display: grid; gap: 6px; }
.publish-image img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--nevoa); }
.publish-image figcaption { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.live-box { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; background: var(--nevoa); border-radius: 6px; }
.live-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.live-row > span:first-child { flex: 1 1 200px; }
.created-box { border-left: 3px solid var(--altitude); padding: 4px 12px; font-size: 13px; }
.created-box .error { color: var(--critical); }
.draft-item .problems { margin: 0; padding-left: 18px; color: var(--critical); font-size: 13px; }

.theo-operation { display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.theo-operation > strong { font: 700 34px var(--title); color: var(--ink-strong); }
.theo-operation div { display: grid; gap: 2px; flex: 1; }
.theo-operation b { font-size: 14px; color: var(--ink-strong); }
.theo-operation small { font-size: 13px; color: var(--muted); }
.theo-operation-health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.theo-operation-health > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.theo-operation-health b { display: block; font-size: 18px; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.theo-operation-health small { display: block; font-size: 12px; color: var(--muted); }
.exceptions { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.exceptions summary { cursor: pointer; font-weight: 600; color: var(--ink-strong); }
.exceptions .coaching-item { margin-top: 10px; }

.material-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.material-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.material-item img { display: block; width: 100%; height: 140px; object-fit: cover; background: var(--nevoa); }
.material-item div { padding: 10px; }
.material-item strong { font-size: 14px; display: block; color: var(--ink-strong); }
.material-item small { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; }
.material-pdf { display: flex; align-items: center; justify-content: center; min-height: 140px; background: var(--nevoa); color: var(--institucional); text-decoration: none; font-weight: 600; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 70; max-width: 360px; background: var(--profundo); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* Responsive */
@media (max-width: 1100px) {
  .kpi-grid, .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; visibility: hidden; }
  body.menu-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(6, 27, 51, .4); }
  main { margin-left: 0; width: 100%; padding: 0 16px 32px; }
  .menu-btn { display: inline-flex; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > .card { margin-bottom: 0; }
  .coaching-items, .feedback-items, .material-items, .agents-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; padding-top: 14px; }
  .page-heading h1 { font-size: 22px; }
  .top-actions { width: 100%; }
  .top-actions .period-control { flex: 1; }
  .top-actions .date-btn { width: 100%; justify-content: flex-start; }
  .refresh-btn span { display: none; }
  .kpi-grid, .kpi-grid-4, .kpi-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .card { padding: 16px; }
  .card-head { flex-direction: column; gap: 6px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .bar-row .bar-note { grid-column: 1 / -1; margin-top: 0; }
  .task-form { grid-template-columns: minmax(0, 1fr); }
  .task-form.compact, .ad-fields { grid-template-columns: minmax(0, 1fr); }
  .panel-heading { flex-direction: column; }
  table.data td:first-child { min-width: 160px; }
  .theo-operation-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search input { min-width: 0; width: 100%; }
  .search { flex: 1; }
  .glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 8px; }
  .period-menu { width: min(300px, calc(100vw - 32px)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
table.data tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.group th { text-align: left; padding-top: 16px; font-size: 13px; color: var(--institucional); }

/* Sales closed in the period (2026-10-08): text columns read left to right. */
.closing-title { font-size: 15px; margin: 18px 0 6px; }
#closing-summary th:first-child, #closing-summary td:first-child,
#closing-sales th:nth-child(n+4), #closing-sales td:nth-child(n+4) { text-align: left; }

/* Login (2026-10-17) */
.auth-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: var(--profundo); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius); padding: 28px 24px; display: grid; gap: 14px; }
.auth-card h1 { font-size: 22px; }
.auth-sub { margin: -8px 0 4px; color: var(--muted); font-size: 14px; }
.auth-card label { display: grid; gap: 6px; font-size: 14px; color: var(--ink-strong); font-weight: 500; }
.auth-card input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.auth-submit { margin-top: 4px; border: 0; border-radius: 8px; padding: 11px 14px; background: var(--altitude); color: var(--branco); font-weight: 600; cursor: pointer; }
.auth-error { margin: 0; min-height: 1.2em; color: var(--critical); font-size: 14px; }
.auth-logo { height: 36px; justify-self: start; }
.auth-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.auth-user button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--ink-strong); }
