/* bex · investimentos
   Paleta PROVISÓRIA — ajuste as variáveis abaixo quando o logo definitivo for enviado. */
:root {
  --brand-900: #0b2239;   /* sidebar / títulos */
  --brand-800: #12314f;
  --brand-700: #1b4167;
  --primary: #0e7c66;     /* ação principal */
  --primary-600: #0b6855;
  --primary-50: #e6f4f1;
  --accent: #e0a100;      /* destaque (ouro) */

  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #16202c;
  --text-2: #4b5563;
  --muted: #6b7280;

  /* Semântica de prioridade / status — usada em painel, chips e notificações */
  --critical: #dc2626; --critical-bg: #fef2f2;
  --high: #ea580c;     --high-bg: #fff7ed;
  --warning: #d97706;  --warning-bg: #fffbeb;
  --ok: #15803d;       --ok-bg: #f0fdf4;
  --info: #2563eb;     --info-bg: #eff6ff;

  /* Classes de ativo */
  --c-renda_fixa: #2563eb; --c-fundo: #7c3aed; --c-fii: #0891b2;
  --c-acao: #0e7c66; --c-etf: #db2777; --c-cripto: #f59e0b;

  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.06);
  --shadow-lg: 0 20px 50px rgba(11,34,57,.25);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 999; border-radius: 6px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.pos { color: var(--ok); } .neg { color: var(--critical); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--brand-900); color: #c9d5e3; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
  background-image: radial-gradient(600px 300px at -20% 110%, rgba(14,124,102,.35), transparent 60%); }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 18px; }
.brand-logo { height: 34px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f93ab; padding: 14px 10px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; text-decoration: none; color: #c9d5e3; font-weight: 500; position: relative; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(14,124,102,.9), rgba(14,124,102,.55)); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item span:not(.badge-dot) { flex: 1; }
.badge-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--critical); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--brand-900); animation: pulse 2s infinite; }
.badge-dot.sm { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; font-size: 10px; box-shadow: 0 0 0 2px #fff; }
.badge-dot.inline { box-shadow: none; animation: none; margin-left: 4px; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.sidebar-foot { padding: 14px 18px 20px; }
.soon { display: flex; gap: 8px; font-size: 11.5px; color: #8fa3ba; background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.15); padding: 9px 10px; border-radius: 9px; }
.soon svg { color: var(--accent); width: 15px; height: 15px; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar-title { font-weight: 700; font-size: 16px; color: var(--brand-900); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); position: relative; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--critical-bg); color: var(--critical); }
.sidebar .icon-btn { color: #c9d5e3; } .sidebar .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.only-mobile { display: none; }

.user-btn { display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px 4px 4px; cursor: pointer; font: inherit; color: inherit; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--brand-700)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; vertical-align: middle; margin-right: 4px; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 7px; text-decoration: none; color: var(--text); }
.dropdown-menu a:hover, .dropdown-menu a:focus { background: var(--primary-50); outline: none; color: var(--primary-600); }

/* ---------- Page header / crumbs ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; color: var(--brand-900); }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.ph-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head-actions form { margin: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--primary); }
.crumbs svg { width: 14px; height: 14px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 46px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(14,124,102,.3); }
.btn.primary:hover { background: var(--primary-600); }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--critical); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.danger-ghost { background: #fff; color: var(--critical); border-color: #fecaca; }
.btn.danger-ghost:hover { background: var(--critical-bg); }
.btn.warn { background: var(--warning); color: #fff; }
.btn.light { background: #fff; color: var(--brand-900); }
.btn.outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn.outline-light:hover { background: rgba(255,255,255,.1); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.link { color: var(--primary); font-weight: 600; text-decoration: none; background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; } .link.sm { font-size: 13px; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--brand-900); }
.card-head h2 svg { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }
.span-2-lg { grid-row: span 2; }
.pad { padding: 8px 0; }

/* ---------- Hero / KPIs ---------- */
.hero { position: relative; overflow: hidden; background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-700) 55%, var(--primary) 130%); color: #fff; border-radius: 16px; padding: 24px 26px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; box-shadow: var(--shadow); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; opacity: .75; font-weight: 700; }
.hero-value { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-sub { opacity: .9; } .hero-sub .pos { color: #6ee7b7; } .hero-sub .neg { color: #fca5a5; }
.hero-sub .trend { background: rgba(255,255,255,.12); color: #fff; }
.hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-art { position: absolute; right: 230px; bottom: -18px; width: 190px; opacity: .25; pointer-events: none; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.sm .kpi-value { font-size: 18px; }
.kpi { --k: var(--info); --kb: var(--info-bg); display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--k); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; position: relative; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.1); }
.kpi.critical { --k: var(--critical); --kb: var(--critical-bg); }
.kpi.high { --k: var(--high); --kb: var(--high-bg); }
.kpi.warning { --k: var(--warning); --kb: var(--warning-bg); }
.kpi.ok { --k: var(--ok); --kb: var(--ok-bg); }
.kpi.critical, .kpi.high, .kpi.warning { background: linear-gradient(180deg, var(--kb), #fff 70%); }
.kpi-icon { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 9px; background: var(--kb); color: var(--k); display: flex; align-items: center; justify-content: center; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; padding-right: 36px; }
.kpi-value { font-size: 21px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi.critical .kpi-value { color: var(--critical); }
.kpi-foot { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fx-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.fx { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; box-shadow: var(--shadow); }
.fx:hover { border-color: var(--primary); }
.fx-body { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.fx-body small { color: var(--muted); font-size: 12px; } .fx-body b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fx-flag { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11.5px; color: #fff; flex-shrink: 0; }
.fx-flag.lg { width: 52px; height: 52px; font-size: 13px; }
.fx-usd { background: linear-gradient(135deg, #1e3a8a, #b91c1c); }
.fx-eur { background: linear-gradient(135deg, #1d4ed8, #facc15); color: #0b2239; }
.fx-cny { background: linear-gradient(135deg, #dc2626, #f59e0b); }

.trend { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend svg { width: 14px; height: 14px; }
.trend.up { color: var(--ok); background: var(--ok-bg); }
.trend.down { color: var(--critical); background: var(--critical-bg); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 320px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.legend-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 2px; }
.legend-list a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; text-decoration: none; }
.legend-list a:hover { background: var(--surface-2); }
.legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.movers { list-style: none; margin: 0; padding: 0; }
.movers a { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--border); text-decoration: none; }
.movers li:last-child a { border-bottom: 0; }
.movers a:hover { background: var(--surface-2); }
.mv-tick { font-weight: 800; } .mv-name { color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mv-price { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Class & priority colors ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2f6; color: var(--text-2); white-space: nowrap; }
.cls-renda_fixa { background: #eff6ff; color: var(--c-renda_fixa); } .cls-bg-renda_fixa { background: var(--c-renda_fixa); }
.cls-fundo { background: #f5f3ff; color: var(--c-fundo); } .cls-bg-fundo { background: var(--c-fundo); }
.cls-fii { background: #ecfeff; color: var(--c-fii); } .cls-bg-fii { background: var(--c-fii); }
.cls-acao { background: var(--primary-50); color: var(--c-acao); } .cls-bg-acao { background: var(--c-acao); }
.cls-etf { background: #fdf2f8; color: var(--c-etf); } .cls-bg-etf { background: var(--c-etf); }
.cls-cripto { background: #fffbeb; color: #b45309; } .cls-bg-cripto { background: var(--c-cripto); }
.prio-critica { background: var(--critical-bg); color: var(--critical); }
.prio-alta { background: var(--high-bg); color: var(--high); }
.prio-media { background: var(--warning-bg); color: var(--warning); }
.prio-baixa { background: var(--ok-bg); color: var(--ok); }
.prio-bg-critica { background: var(--critical); } .prio-bg-alta { background: var(--high); } .prio-bg-media { background: var(--warning); } .prio-bg-baixa { background: var(--ok); }
.tx-compra { background: var(--info-bg); color: var(--info); } .tx-venda { background: var(--high-bg); color: var(--high); } .tx-rendimento { background: var(--ok-bg); color: var(--ok); }
.role-admin { background: #0b2239; color: #fff; } .role-supervisor { background: var(--primary-50); color: var(--primary); } .role-operador { background: var(--info-bg); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.table.clickable tbody tr[data-href] { cursor: pointer; transition: background .1s; }
.table.clickable tbody tr[data-href]:hover, .table.clickable tbody tr[data-href]:focus { background: var(--primary-50); outline: none; }
.table tr.inactive td { opacity: .55; }
.table small { font-size: 12px; }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.ic-warn { color: var(--warning); width: 15px !important; height: 15px !important; vertical-align: -2px; }
.ic-muted { color: var(--muted); width: 15px !important; height: 15px !important; vertical-align: -2px; }
.center { text-align: center; }

/* ---------- Toolbar / filters / tabs ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.grow { flex: 1; }
.filters { padding: 14px 18px; }
.filters .field { margin: 0; }
.filters-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.class-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; scrollbar-width: thin; }
.class-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 20px; background: #fff; border: 1px solid var(--border); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--text-2); }
.class-tabs a.active { background: var(--brand-900); color: #fff; border-color: var(--brand-900); }
.roles-help { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

/* ---------- Forms ---------- */
.form { position: relative; }
.form.narrow { max-width: 520px; }
.form-section { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin: 8px 0 12px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.form-section:first-of-type { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.tight { grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .span-2 { grid-column: span 2; }
.field-wrap { display: contents; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--critical); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 42px; border: 1px solid #cfd8e3; border-radius: var(--radius-sm); padding: 0 12px; font: inherit; color: var(--text); background: #fff; transition: border .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,124,102,.15); outline: none; }
.has-error input, .has-error select, .has-error textarea, input.invalid { border-color: var(--critical); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.field-error { color: var(--critical); font-size: 12.5px; font-weight: 500; }
.help { color: var(--muted); font-size: 12px; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
.pw-toggle { position: absolute; right: 6px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; }
.switch-field { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.switch-field input { position: absolute; opacity: 0; }
.switch { width: 40px; height: 23px; border-radius: 20px; background: #cfd8e3; position: relative; flex-shrink: 0; transition: background .2s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch-field input:checked + .switch { background: var(--primary); }
.switch-field input:checked + .switch::after { transform: translateX(17px); }
.switch-field input:focus-visible + .switch { outline: 3px solid rgba(14,124,102,.4); outline-offset: 2px; }
.switch-field small { display: block; color: var(--muted); font-size: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.dirty-pill { position: absolute; top: -12px; right: 18px; background: var(--warning); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; display: inline-flex; gap: 5px; align-items: center; box-shadow: 0 4px 10px rgba(217,119,6,.35); }
.dirty-pill svg { width: 12px; height: 12px; }
.total-preview output { height: 42px; display: flex; align-items: center; font-weight: 800; font-size: 18px; color: var(--brand-900); font-variant-numeric: tabular-nums; }
.manual-value { margin-top: 14px; }
.test-box { display: flex; gap: 10px; align-items: flex-end; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 12px; margin-bottom: 6px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip-btn { border: 1px solid var(--border); background: #fff; border-radius: 20px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; font-weight: 600; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.inline { display: inline; }
form.inline { margin-left: 6px; }

/* ---------- Searchable combobox (dropdown com teclado) ---------- */
.combo { position: relative; }
.combo-input { padding-right: 34px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; margin: 0; padding: 4px; list-style: none; }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--primary-50); color: var(--primary-600); }
.combo-list li.current { font-weight: 700; }
.combo-list .none { color: var(--muted); cursor: default; background: none !important; }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid; flex-wrap: wrap; }
.alert.error { background: var(--critical-bg); color: #991b1b; border-color: #fecaca; }
.alert.success { background: var(--ok-bg); color: #166534; border-color: #bbf7d0; }
.alert.warning { background: var(--warning-bg); color: #92400e; border-color: #fde68a; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 36px); }
.toast { display: flex; gap: 10px; align-items: center; background: var(--brand-900); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); animation: slidein .25s ease; max-width: 420px; }
.toast.success svg { color: #6ee7b7; } .toast.error { background: #7f1d1d; } .toast.error svg { color: #fca5a5; }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(11,34,57,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; animation: fade .15s ease; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); position: relative; animation: pop .18s ease; }
.modal-card.sm { max-width: 420px; text-align: center; }
.modal-card h3 { font-size: 18px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.modal-card.sm h3 { justify-content: center; }
.modal-card p { color: var(--text-2); margin: 0 0 16px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.modal-icon svg { width: 26px; height: 26px; }
.modal-icon.danger { background: var(--critical-bg); color: var(--critical); }
.modal-icon.warn { background: var(--warning-bg); color: var(--warning); }
.modal-icon.ok { background: var(--ok-bg); color: var(--ok); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-card.sm .modal-actions { justify-content: center; }
.modal-x { position: absolute; right: 10px; top: 10px; }
.modal-card.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Empty / misc ---------- */
.empty { text-align: center; padding: 36px 16px; }
.empty img { margin-bottom: 8px; }
.empty h3 { font-size: 17px; color: var(--brand-900); }
.empty p { color: var(--muted); margin: 6px 0 16px; }
.asset-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.asset-id { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 240px; }
.asset-id h1 { font-size: 22px; } .asset-id p { margin: 2px 0 0; }
.asset-badge { width: 54px; height: 54px; border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.asset-price { display: flex; flex-direction: column; align-items: flex-end; }
.asset-price b { font-size: 26px; font-variant-numeric: tabular-nums; }
.asset-actions { display: flex; gap: 8px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; } .dl dd { margin: 0; font-weight: 600; text-align: right; }
.fx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.fx-title { display: flex; gap: 12px; align-items: center; }
.fx-now { display: flex; flex-direction: column; align-items: flex-end; } .fx-now b { font-size: 22px; }
.fx-card .seg { margin-bottom: 10px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.report-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.report-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.report-card span { color: var(--muted); font-size: 13.5px; }
.report-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-50); color: var(--primary) !important; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.report-go { color: var(--primary) !important; font-weight: 700; display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 8px; }
.rep-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.rep-summary div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.rep-summary small { display: block; color: var(--muted); font-size: 12px; }
.rep-summary b { font-size: 16px; font-variant-numeric: tabular-nums; }
.notif-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.notif { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); padding: 6px 10px 6px 6px; box-shadow: var(--shadow); }
.notif.unread { background: linear-gradient(90deg, #fff, var(--surface-2)); }
.notif.unread .notif-text b::after { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--critical); border-radius: 50%; margin-left: 8px; vertical-align: middle; }
.prio-border-critica { border-left-color: var(--critical); } .prio-border-alta { border-left-color: var(--high); } .prio-border-media { border-left-color: var(--warning); } .prio-border-baixa { border-left-color: var(--ok); }
.notif-main { flex: 1; display: flex; gap: 12px; padding: 8px; text-decoration: none; align-items: flex-start; min-width: 0; }
.notif-icon { width: 38px; height: 38px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text span { color: var(--text-2); }
.notif-text small { color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.notif form { margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Auth ---------- */
.auth-body { background: #fff; }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-art { background: linear-gradient(150deg, var(--brand-900), var(--brand-700) 60%, var(--primary)); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px; position: relative; overflow: hidden; }
.auth-art img { width: min(460px, 90%); position: relative; z-index: 1; }
.auth-art-text { max-width: 440px; text-align: center; position: relative; z-index: 1; }
.auth-art-text h2 { font-size: 28px; margin: 18px 0 8px; } .auth-art-text p { opacity: .8; margin: 0; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { height: 44px; margin-bottom: 26px; }
.auth-title { font-size: 24px; color: var(--brand-900); }
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.auth-foot { color: var(--muted); font-size: 12.5px; margin-top: 30px; }
.auth-done { text-align: center; } .auth-done .modal-icon { margin-bottom: 14px; }
.auth-done .btn { margin-top: 6px; }

/* ---------- Responsivo ---------- */
.show-sm { display: none; }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hide-md { display: none; }
}
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .span-2-lg { grid-row: auto; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-art { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,34,57,.5); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px 12px 90px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > :last-child:nth-child(odd) { grid-column: span 2; }
  .kpi-value { font-size: 18px; }
  .fx-strip { grid-template-columns: 1fr; gap: 8px; }
  .form-grid, .form-grid.cols-4, .form-grid.tight { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .page-head h1 { font-size: 19px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn, .page-head-actions form { flex: 1; }
  .page-head-actions form .btn { width: 100%; }
  .form-actions .btn { flex: 1; }
  .form-actions .spacer { display: none; }
  .hero { padding: 20px; }
  .hero-actions { width: 100%; } .hero-actions .btn { flex: 1; }
  .rep-summary { grid-template-columns: 1fr 1fr; }
  .asset-price { align-items: flex-start; }
  .asset-actions { width: 100%; } .asset-actions .btn { flex: 1; }
  .test-box { flex-direction: column; align-items: stretch; }
  .table th, .table td { padding: 10px 10px; }
  .movers a { grid-template-columns: 60px 1fr auto; } .movers .mv-name { display: none; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 18px 18px 0 0; max-width: none; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1; }
  .user-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
