:root {
  --bg: #f5f8fc; --panel: #ffffff; --ink: #16202e; --muted: #5b6b7e; --faint: #8a99ab;
  --line: #e3e9f1; --line-2: #eef2f7;
  --brand: #0f766e; --brand-2: #14b8a6; --accent: #2563eb;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,32,46,.05), 0 12px 30px -18px rgba(16,32,46,.25);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
.right { text-align: right; }

.shell { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px);
  background: rgba(245,248,252,.82); border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; display: flex; align-items: baseline; gap: 8px; }
.brand b { color: var(--brand); }
.brand small { color: var(--faint); font-weight: 600; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.lang { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); }
.lang button { border: 0; background: transparent; padding: 6px 14px; font: inherit; font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.lang button.active { background: var(--brand); color: #fff; }

/* hero / landing */
.hero { padding: 56px 0 28px; }
.eyebrow { color: var(--brand); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: .74rem; margin: 0 0 12px; }
.page-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 16px; max-width: 18ch; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 60ch; margin: 0 0 28px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700;
  border-radius: 10px; padding: 11px 18px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #f3c9c9; }
.btn.sm { padding: 7px 12px; font-size: .82rem; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* sections / cards */
.section { margin-top: 40px; }
.section > h2 { font-size: 1.3rem; letter-spacing: -.01em; margin: 0 0 6px; }
.section > p.hint { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h2, .card h3 { margin: 0 0 4px; letter-spacing: -.01em; }
.card h3 { font-size: 1.02rem; }
.card .hint { color: var(--muted); margin: 0 0 16px; font-size: .92rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* feature / privacy / workflow (landing) */
.feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature-card .ico { font-size: 1.5rem; }
.feature-card h3 { margin: 8px 0 6px; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.workflow { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 10px; }
.workflow li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.workflow li::before { content: counter(step); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: .82rem; display: grid; place-items: center; }
.privacy { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.privacy li { position: relative; padding-left: 26px; color: var(--muted); }
.privacy li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: .86rem; }
.field .hint { color: var(--faint); font-size: .8rem; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(20,184,166,.35); border-color: var(--brand-2); }
.field textarea { min-height: 120px; font-family: var(--mono); font-size: .82rem; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1 1 160px; }

/* positions list */
.positions { display: grid; gap: 10px; }
.pos { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.pos .meta { display: flex; flex-direction: column; min-width: 0; }
.pos .meta b { font-weight: 700; }
.pos .meta span { color: var(--muted); font-size: .82rem; }
.pos .val { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.dig { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
table.dig th, table.dig td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.dig th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--line-2); position: sticky; top: 0; }
table.dig tbody tr:last-child td { border-bottom: 0; }
table.dig td.num, table.dig th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dig button.sort { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; font-weight: 700; }

/* allocation bars */
.alloc { display: grid; gap: 8px; }
.alloc .line { display: grid; grid-template-columns: minmax(140px, 1.4fr) 2fr auto auto; gap: 12px; align-items: center; }
.alloc .name { position: relative; font-weight: 600; }
.alloc .bar { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.alloc .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 999px; }
.alloc .pct { font-variant-numeric: tabular-nums; font-weight: 700; width: 64px; text-align: right; }
.alloc .val { font-variant-numeric: tabular-nums; color: var(--muted); width: 120px; text-align: right; }
@media (max-width: 620px) { .alloc .line { grid-template-columns: 1fr auto; } .alloc .bar { grid-column: 1 / -1; order: 3; } }

/* subclass tooltip */
.alloc .name.has-tip { cursor: help; border-bottom: 1px dotted var(--faint); }
.tip { position: absolute; left: 0; top: 120%; z-index: 30; width: 280px; background: #0f1b2a; color: #e8eef6; border-radius: 12px; padding: 12px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5); opacity: 0; visibility: hidden; transform: translateY(4px); transition: .15s; }
.alloc .name.has-tip:hover .tip, .alloc .name.has-tip:focus .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.tip .tip-title { font-weight: 800; font-size: .8rem; }
.tip .tip-note { color: #9fb2c7; font-size: .72rem; margin-bottom: 8px; }
.tip .tip-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: .78rem; padding: 3px 0; }
.tip .tip-row .tb { grid-column: 1 / -1; height: 6px; background: #24364c; border-radius: 999px; overflow: hidden; }
.tip .tip-row .tb i { display: block; height: 100%; background: var(--brand-2); }

/* KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 620px) { .kpi-row { grid-template-columns: 1fr; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 4px; }

/* status pills */
.status { font-weight: 800; font-size: .78rem; padding: 3px 9px; border-radius: 999px; }
.status.INSIDE { color: var(--ok); background: #e7f6ec; }
.status.ABOVE { color: var(--warn); background: #fdf2e3; }
.status.BELOW { color: var(--bad); background: #fbe9e9; }

/* warnings / snapshot / modal */
.warn { background: #fff7ed; border: 1px solid #f3d9b3; color: #8a4b08; border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; font-size: .9rem; }
.snap textarea { width: 100%; min-height: 96px; font-family: var(--mono); font-size: .74rem; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; background: #fbfdff; color: var(--muted); }
.modal .backdrop { position: fixed; inset: 0; background: rgba(15,27,42,.5); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal .box { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; padding: 22px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); }
.modal .box .x { float: right; border: 0; background: var(--line-2); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1.1rem; }

/* evolution */
.evolution svg { width: 100%; height: auto; }
.evolution .grid-line { stroke: var(--line); }
.evolution .line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.evolution .point { fill: var(--brand-2); stroke: #fff; stroke-width: 2; }
.evolution .axis { fill: var(--faint); font-size: 11px; font-family: var(--mono); }
.change-positive { color: var(--ok); font-weight: 700; }
.change-negative { color: var(--bad); font-weight: 700; }

/* misc */
.badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.footer { color: var(--faint); font-size: .8rem; margin-top: 40px; text-align: center; }
.status-line { font-size: .85rem; margin-top: 8px; }
.status-line.success { color: var(--ok); }
.status-line.error { color: var(--bad); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ══════════════════════════════════════════════════════════
 *  DASHBOARD (Entrega 4c) — complementa o design system da 4a
 *  ══════════════════════════════════════════════════════════ */

/* cabeçalho ordenável das barras de alocação */
.alloc-head {
  display: grid; grid-template-columns: minmax(140px, 1.4fr) 2fr auto auto;
  gap: 12px; align-items: center; padding-bottom: 6px;
  border-bottom: 1px solid var(--line-2); margin-bottom: 8px;
}
.alloc-head .sort {
  font: inherit; background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  display: inline-flex; gap: 4px; align-items: center;
}
.alloc-head .sort.num { justify-content: flex-end; }
.alloc-head .sort .ind { color: var(--faint); }
.alloc-head .sort.active { color: var(--ink); }
@media (max-width: 620px) { .alloc-head { grid-template-columns: 1fr auto; } .alloc-head .sort:nth-child(2) { display: none; } }

/* pontos fortes / atenção da análise de perfil */
.points { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
@media (max-width: 720px) { .points { grid-template-columns: 1fr; } }
.points h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.points ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.points li { position: relative; padding-left: 20px; font-size: .9rem; }
.points.ok li::before   { content: "✓"; position: absolute; left: 0; color: var(--ok);   font-weight: 800; }
.points.attn li::before { content: "!"; position: absolute; left: 0; color: var(--warn); font-weight: 800; }

/* diálogo de detalhes do ativo */
.asset-symbol { font-family: var(--mono); font-weight: 700; color: var(--brand); margin: 2px 0 6px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin: 12px 0; }
@media (max-width: 560px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-2); padding: 6px 0; font-size: .88rem; }
.detail-row span { color: var(--muted); }
.asset-summary { color: var(--muted); font-size: .9rem; margin: 10px 0; }
.asset-btn { display: inline-flex; align-items: center; gap: 6px; }
.info-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--line-2); color: var(--muted); font-size: .7rem; font-style: italic; font-weight: 700; }

/* lookthrough de fundos no diálogo (vazio no v1; já estilizado para o v2) */
.fund-lookthrough { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.fund-lookthrough h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }
.fund-competence { color: var(--faint); font-size: .78rem; margin: 0 0 8px; }
.fund-comp { display: flex; justify-content: space-between; font-size: .85rem; padding: 3px 0; }
.fund-note { color: var(--faint); font-size: .78rem; margin-top: 6px; }

/* impressão / salvar PDF */
@media print {
  .topbar, .no-print, .lang { display: none !important; }
  .modal { display: none !important; }
  body { background: #fff; }
  .shell { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .snap textarea { border-style: solid; color: #333; }
}

/* ══ Liquidez: régua segmentada (não usa bolinhas) ══ */
.liq-scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.liq-seg {
  height: 30px; border: 0; border-radius: 6px; cursor: pointer;
  opacity: .38; transition: opacity .15s, transform .12s; position: relative;
}
.liq-seg:hover { opacity: .82; }
.liq-seg[aria-pressed="true"] {
  opacity: 1; transform: translateY(-1px);
  outline: 3px solid rgba(15,27,42,.18); outline-offset: 1px;
}
.liq-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 5px; }
.liq-lab { font-size: .66rem; text-align: center; color: var(--faint); line-height: 1.12; }
.liq-lab.on { font-weight: 800; }
.liq-summary { font-size: .78rem; color: var(--muted); margin-top: 7px; }
@media (max-width: 560px) { .liq-lab { font-size: .6rem; } }
