/* Nunito (SIL Open Font License 1.1, ver assets/fonts/OFL.txt), servida pelo próprio site: nenhum pedido a outros sites para desenhar o texto.
   Fonte variável (um ficheiro para os pesos 400 a 800); o latim alargado só se descarrega se a página tiver esses caracteres. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/assets/fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ==========================================================================
   NowoTrade — design tokens
   Cores de gráficos validadas (dataviz validate_palette): azul = valor da conta,
   verde/vermelho = ganho/perda (sempre com sinal +/− e posição como 2.º canal).
   ========================================================================== */
:root {
  --bg: #f3f3f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef1f5;
  --border: #e3e7ee;
  --border-strong: #cfd5df;
  --text: #0f1728;
  --text-2: #445066;
  --muted: #5f6a7d;
  --primary: #2468c0;
  --primary-hover: #1c5cab;
  --danger-solid: #c22f2e;
  --primary-solid: var(--primary);   /* fundo dos botões cheios: com texto branco tem de dar 4,5:1 */
  --primary-solid-hover: var(--primary-hover);
  --primary-soft: #e7f0fc;
  --primary-ink: #ffffff;
  --pos: #1baf7a;
  --pos-text: #0b7a52;
  --pos-soft: #e2f6ee;
  --neg: #e34948;
  --neg-text: #c22f2e;
  --neg-soft: #fdeceb;
  --warn: #94610f;
  --warn-soft: #fdf3e1;
  --pro: #955a06;
  --pro-soft: #fdf3e1;
  --grid: #e8ebf0;
  --focus: 0 0 0 3px rgba(42, 120, 214, .28);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 40, .05);
  --shadow: 0 1px 3px rgba(15, 23, 40, .06), 0 1px 2px rgba(15, 23, 40, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 40, .22);
  --sidebar-w: calc(var(--rail-w) + var(--menu-w));
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13;
    --surface: #171a21;
    --surface-2: #1c2028;
    --surface-3: #232833;
    --border: #272c37;
    --border-strong: #363c4a;
    --text: #eef1f6;
    --text-2: #b6bdca;
    --muted: #8a92a2;
    --primary: #4d94ec;
    --primary-hover: #5598e7;
  --danger-solid: #c13a3a;
  --primary-solid: #2b6bc6;
  --card-line: var(--border);
  --row-line: #232834;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
  --primary-solid-hover: #245fb3;
    --primary-soft: #182a45;
    --pos: #199e70;
    --pos-text: #3ccb95;
    --pos-soft: #10291f;
    --neg: #e66767;
    --neg-text: #ff8080;
    --neg-soft: #331b1d;
    --warn: #e0a64a;
    --warn-soft: #33270f;
    --pro: #f0b454;
    --pro-soft: #33270f;
    --grid: #242933;
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0f13;
  --surface: #171a21;
  --surface-2: #1c2028;
  --surface-3: #232833;
  --border: #272c37;
  --border-strong: #363c4a;
  --text: #eef1f6;
  --text-2: #b6bdca;
  --muted: #8a92a2;
  --primary: #4d94ec;
  --primary-hover: #5598e7;
  --danger-solid: #c13a3a;
  --primary-solid: #2b6bc6;
  --card-line: var(--border);
  --row-line: #232834;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
  --primary-solid-hover: #245fb3;
  --primary-soft: #182a45;
  --pos: #199e70;
  --pos-text: #3ccb95;
  --pos-soft: #10291f;
  --neg: #e66767;
  --neg-text: #ff8080;
  --neg-soft: #331b1d;
  --warn: #e0a64a;
  --warn-soft: #33270f;
  --pro: #f0b454;
  --pro-soft: #33270f;
  --grid: #242933;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
code { font-size: .88em; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
h1, h2, h3 { color: var(--text); letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.25; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15.5px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14.5px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.date-past { color: var(--pos-text); }
.date-upcoming { color: var(--warn); font-weight: 600; }
.lead { font-size: 17px; color: var(--text-2); max-width: 640px; }
.positive { color: var(--pos-text); }
.negative { color: var(--neg-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ==========================================================================
   App shell: barra estreita de ícones (secções) + menu da secção + barra de topo
   ========================================================================== */
.layout-app { display: flex; min-height: 100vh; }
:root { --rail-w: 72px; --menu-w: 250px; --topbar-h: 58px; --sidebar-w: var(--menu-w); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; display: flex; flex-direction: column; gap: 10px; padding: 16px 12px 14px;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden;
}
html.menu-collapsed { --sidebar-w: var(--rail-w); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 6px; min-height: 40px; }
.sidebar .sidebar-close { display: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-block; width: 30px; height: 30px; flex: none; filter: drop-shadow(0 2px 4px rgba(42, 120, 214, .25)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-weight: 800; letter-spacing: -.03em; }
.brand-name span { color: var(--primary); }
.btn-block { width: calc(100% - 12px); margin: 0 6px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 12px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px; color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.nav-item .icon { color: var(--muted); flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .icon { color: var(--primary); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; flex: none; }
/* Menu recolhido (só ícones) */
html.menu-collapsed .sidebar { padding-left: 8px; padding-right: 8px; }
html.menu-collapsed .brand-name, html.menu-collapsed .nav-item > span, html.menu-collapsed .nav-group, html.menu-collapsed .pillar-tab span { display: none; }
html.menu-collapsed .sidebar-top { justify-content: center; }
html.menu-collapsed .nav-item { justify-content: center; padding: 10px; position: relative; }
html.menu-collapsed .nav-item .nav-count { display: none; }
html.menu-collapsed .pillar-switch { grid-template-columns: 1fr; margin: 0 0 8px; }
html.menu-collapsed .sidebar > .ad-slot, html.menu-collapsed .sidebar .ad-slot { display: none; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

/* Barra de topo: menu, pesquisa, ação principal, tema e menu do utilizador */
.topbar {
  display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-brand { display: none; }
.topsearch { position: relative; flex: 0 1 380px; min-width: 0; }
.topsearch > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topsearch input { width: 100%; height: 38px; padding: 0 12px 0 36px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.topsearch-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.topsearch-results a { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.topsearch-results a:hover, .topsearch-results a:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.topsearch-results .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topsearch-results li.muted { padding: 8px 10px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .topbar-action-icon { display: none; }
.usermenu { position: relative; }
.usermenu-btn { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 99px; cursor: pointer; list-style: none; color: var(--text); }
.usermenu-btn::-webkit-details-marker { display: none; }
.usermenu-btn:hover, .usermenu[open] .usermenu-btn { background: var(--surface-3); }
.usermenu-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.usermenu-name strong { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; font-size: 13.5px; }
.usermenu[open] .abar-caret { transform: rotate(180deg); }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 260px; display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.usermenu-panel a, .usermenu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.usermenu-panel .icon { width: 16px; height: 16px; color: var(--muted); }
.usermenu-panel form { margin: 0; }
.usermenu-who { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.usermenu-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Migalhas de pão */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 8px; }
.crumbs li[aria-current] { color: var(--text-2); font-weight: 600; }


/* Topo fixo: barra do telemóvel (menu) + barra da conta, sempre visíveis ao fazer scroll */
html:has(.layout-app) { scroll-padding-top: 120px; }
.layout-app .toasts { top: 124px; } /* por baixo da barra de topo e da barra da conta */
.app-top { position: sticky; top: 0; z-index: 30; }
.account-bar {
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.account-bar-inner { max-width: 1280px; margin: 0 auto; padding: 8px 32px; display: flex; align-items: center; gap: 18px; }

/* Seletor de conta (o menu fica fora da zona que desliza, para não ser cortado) */
.abar-switch { position: relative; flex: none; }
.abar-account {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 8px; margin-left: -8px; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; white-space: nowrap; cursor: pointer; list-style: none;
}
.abar-account::-webkit-details-marker { display: none; }
.abar-account:hover, .abar-switch[open] .abar-account { background: var(--surface-2); border-color: var(--border); }
.abar-account:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.abar-account > .icon { width: 17px; height: 17px; color: var(--muted); }
.abar-account-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.abar-account strong { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.abar-caret { width: 15px !important; height: 15px !important; transition: transform .15s; }
.abar-switch[open] .abar-caret { transform: rotate(180deg); }
.abar-menu {
  position: absolute; top: calc(100% + 6px); left: -8px; z-index: 35; width: min(320px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.abar-menu form { margin: 0; }
.abar-menu ul { list-style: none; margin: 0; padding: 0; max-height: min(360px, 60vh); overflow-y: auto; }
.abar-menu-title { margin: 4px 8px 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.abar-option {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.abar-option:hover, .abar-option:focus-visible { background: var(--surface-2); outline: none; }
.abar-option.current { background: var(--primary-soft); }
.abar-option-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.abar-option-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abar-option-cur { font-size: 12px; font-weight: 600; color: var(--muted); }
.abar-check { width: 16px; height: 16px; flex: none; color: var(--primary); }
.abar-menu-foot { display: flex; flex-direction: column; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.abar-menu-foot a { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; text-decoration: none; }
.abar-menu-foot a:hover { background: var(--surface-2); text-decoration: none; }
.abar-menu-foot .icon { width: 16px; height: 16px; color: var(--muted); }

.abar-stats {
  display: flex; align-items: stretch; margin: 0 0 0 auto; padding: 0; list-style: none; min-width: 0;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.abar-stats::-webkit-scrollbar { display: none; }
.abar-stats li { display: flex; }
.abar-stats li + li { border-left: 1px solid var(--border); }
.abar-item {
  display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 2px 16px; border-radius: var(--radius-sm);
  color: var(--text); white-space: nowrap; text-decoration: none;
}
.abar-stats li:last-child .abar-item { padding-right: 0; }
.abar-item:hover { text-decoration: none; background: var(--surface-2); }
.abar-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.abar-value { font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.abar-value.positive { color: var(--pos-text); }
.abar-value.negative { color: var(--neg-text); }
.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 64px; }
.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  html.menu-collapsed { --sidebar-w: var(--menu-w); }
  html.menu-collapsed .brand-name, html.menu-collapsed .nav-item > span, html.menu-collapsed .nav-group, html.menu-collapsed .pillar-tab span { display: revert; }
  html.menu-collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
  html.menu-collapsed .sidebar-top { justify-content: space-between; }
  .sidebar .sidebar-close { display: inline-flex; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(8, 12, 20, .45); z-index: 39; }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand { display: inline-flex; }
  .topbar-brand .brand-mark { width: 28px; height: 28px; }
  html:has(.layout-app) { scroll-padding-top: 130px; }
  .layout-app .toasts { top: 128px; }
  /* Os números deslizam na horizontal; o esbatimento à direita indica que há mais */
  .account-bar-inner { padding: 6px 16px; gap: 8px; }
  .abar-account { margin-left: -6px; padding: 4px 6px; }
  .abar-account strong { max-width: 110px; }
  .abar-account > .icon:first-child { display: none; }
  .abar-stats {
    margin-left: 0;
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .abar-item { padding: 2px 12px; }
  .abar-stats li:last-child .abar-item { padding-right: 28px; }
  .abar-value { font-size: 14px; }
  .content { padding: 20px 16px 48px; }
  .topsearch { display: none; }
  .topbar-action { display: none; }
  .topbar .topbar-action-icon { display: inline-flex; }
  .usermenu-name, .usermenu-btn .abar-caret { display: none; }
  .usermenu-btn { padding: 2px; }
}

/* ==========================================================================
   Layout público
   ========================================================================== */
.layout-public { display: flex; flex-direction: column; min-height: 100vh; }
.public-bar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.public-bar-inner { max-width: 1160px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 28px; }
.public-nav { display: flex; gap: 20px; flex: 1; }
.public-nav a { color: var(--text-2); font-weight: 500; }
.public-nav a[aria-current] { color: var(--text); }
.public-nav .pn-short { display: none; }
.public-actions { display: flex; align-items: center; gap: 8px; }
.public-content { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 24px 20px 64px; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.site-footer-inner { max-width: 1160px; margin: 0 auto; padding: 22px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.site-footer-inner .brand { font-size: 15px; }
.site-footer-inner .brand-mark { width: 24px; height: 24px; }
.lang-links { display: flex; gap: 10px; margin-left: auto; }
@media (max-width: 700px) {
  .public-nav { gap: 12px; font-size: 13.5px; white-space: nowrap; }
  .public-nav .pn-secondary { display: none; }
  .public-nav .pn-full { display: none; }
  .public-nav .pn-short { display: inline; }
  .public-bar-inner { gap: 8px; padding: 12px 14px; }
  .public-nav { min-width: 0; }
  .public-bar .brand-name { display: none; }
  .public-nav a { overflow: hidden; text-overflow: ellipsis; }
  .public-actions { gap: 6px; flex-shrink: 0; }
}
@media (max-width: 480px) {
  .public-nav .pn-tertiary { display: none; }           /* o Calendar (a que se chega pelo Explore Market) cede o lugar ao «Log in» */
  .public-actions .btn { padding-inline: 10px; }
}
@media (max-width: 360px) {
  .public-actions .theme-toggle { display: none; }      /* em ecrãs muito estreitos o tema segue o do sistema (o botão volta a aparecer acima de 360 px) */
}

/* ==========================================================================
   Cabeçalho de página, cartões, grelhas
   ========================================================================== */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 + p, .page-head .subtitle { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { margin: 32px 0 14px; font-size: 17px; display: flex; gap: 10px; align-items: center; }

.panel, .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 2px 0 0; }
.panel-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 0 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.grid-main > * { margin-bottom: 0; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } }
.stack-gap > * + * { margin-top: 20px; }
.empty { color: var(--muted); }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .icon { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--border-strong); }
.empty-state strong { display: block; color: var(--text); font-size: 15.5px; margin-bottom: 4px; }
p.empty.panel { text-align: center; padding: 40px 20px; }

/* Tiles de números */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-sm); min-width: 0;
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-card .spark { margin-top: 8px; width: 100%; height: 34px; }

/* Cartão principal (valor da conta) */
.hero-stat { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 28px; }
.hero-figure { font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; padding-bottom: 6px; font-size: 13px; color: var(--muted); }
.hero-meta strong { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 99px; }
.delta-pos { background: var(--pos-soft); color: var(--pos-text); }
.delta-neg { background: var(--neg-soft); color: var(--neg-text); }

/* Barra ganhos/perdas (win rate) */
.split-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; margin-top: 10px; background: var(--surface); }
.split-bar span { display: block; height: 100%; }
.split-bar .win { background: var(--pos); border-radius: 99px 0 0 99px; }
.split-bar .loss { background: var(--neg); border-radius: 0 99px 99px 0; }
.split-bar .even { background: var(--border-strong); }
.split-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ==========================================================================
   Botões
   ========================================================================== */
.btn, :where(button[type="submit"]:not(.btn-link, .icon-btn, .toast-close)) {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--primary-solid); color: var(--primary-ink); border: 1px solid var(--primary-solid);
  padding: 9px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover, :where(button[type="submit"]:not(.btn-link, .icon-btn, .toast-close)):hover { background: var(--primary-solid-hover); border-color: var(--primary-solid-hover); text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-small, button.btn-small { padding: 6px 11px; font-size: 13px; }
.btn-secondary, button.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover, button.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger, button.btn-danger { background: var(--surface); color: var(--neg-text); border-color: var(--border-strong); }
.btn-danger:hover, button.btn-danger:hover { background: var(--neg-soft); border-color: var(--neg); }
.btn-danger-solid, button.btn-danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-danger-solid:hover, button.btn-danger-solid:hover { background: #a62625; border-color: #a62625; }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; font: inherit; }
.btn-link:hover { color: var(--neg-text); text-decoration: underline; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; padding: 0;
  font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

/* Controlo segmentado (períodos dos gráficos) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 9px; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ==========================================================================
   Formulários
   ========================================================================== */
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a92a2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input[type="color"] { padding: 3px; height: 38px; width: 56px; cursor: pointer; }
input[type="checkbox"] { width: auto; }
input[type="file"] { padding: 7px; background: var(--surface-2); }
textarea { resize: vertical; min-height: 80px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--text-2); }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
label.inline input { width: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
/* Formulário de compra, mais curto: quatro campos na mesma linha (data, quantidade, preço, comissões; a taxa de câmbio passa à linha seguinte), blocos recolhidos mais juntos */
.trade-form .form-row-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.trade-form fieldset.compact { padding: 0; border: 0; margin: 0 0 4px; min-width: 0; }
.trade-form .form-more { margin: 8px 0; }
.trade-form .form-more > summary { padding: 8px 0; }
.trade-form .form-more textarea { margin: 0 0 12px; }
.form-actions { flex-wrap: wrap; }
.trade-form .form-actions .btn-another { order: 1; }                   /* ordem visual: Cancelar, «Guardar e adicionar outra», Guardar (no HTML o principal vem primeiro: é o que o Enter aciona) */
.trade-form .form-actions .btn:not(.btn-secondary) { order: 2; }
.grow { flex: 1; }
.align-end { display: flex; align-items: flex-end; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-hint { grid-column: 1 / -1; margin: -2px 0 0; }
fieldset { border: none; padding: 0; margin: 0 0 20px; }
legend { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; padding: 0; }
legend .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { min-width: 140px; }
.inline-form label.grow { min-width: 200px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar input[type="search"], .filter-bar select, .filter-bar input[type="date"] { width: auto; min-width: 120px; padding-top: 7px; padding-bottom: 7px; }
.filter-bar.compact { margin: 0; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 32px; }

.trade-preview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin: -4px 0 20px;
}
.trade-preview div { display: flex; flex-direction: column; }
.trade-preview strong { font-variant-numeric: tabular-nums; font-size: 15px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-option { --tag: #4f6bed; flex-direction: row; align-items: center; cursor: pointer; }
.tag-option input { position: absolute; opacity: 0; }
.tag-option span { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--text-2); font-size: 13px; }
.tag-option input:checked + span { color: var(--tag); border-color: var(--tag); background: color-mix(in srgb, var(--tag) 13%, transparent); font-weight: 600; }
.tag-option input:focus-visible + span { box-shadow: var(--focus); }

/* ==========================================================================
   Mensagens
   ========================================================================== */
.flash { display: flex; gap: 8px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: var(--pos-soft); color: var(--pos-text); }
.flash-error { background: var(--neg-soft); color: var(--neg-text); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.flash-info { background: var(--primary-soft); color: var(--text); }
.error-list { color: var(--neg-text); font-size: 13.5px; max-height: 300px; overflow: auto; }

.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .2s ease;
}
.toast > span { flex: 1; padding-top: 1px; }
.toast .icon { color: var(--primary); margin-top: 1px; }
.toast-success { border-left-color: var(--pos); }
.toast-success .icon { color: var(--pos-text); }
.toast-error { border-left-color: var(--neg); }
.toast-error .icon { color: var(--neg-text); }
.toast-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.toast-close .icon { color: var(--muted); width: 16px; height: 16px; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: all .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Popups (dialog)
   ========================================================================== */
.modal { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; color: var(--text); }
.modal::backdrop { background: rgba(8, 12, 20, .5); backdrop-filter: blur(2px); }
.modal[open] { display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal-box {
  width: min(880px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: modal-in .18s ease; margin: auto 0;
}
.modal-narrow .modal-box, .modal-confirm .modal-box { width: min(500px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head-actions { display: flex; gap: 6px; }
.modal-body { padding: 20px; }
.modal-box:focus { outline: none; box-shadow: var(--shadow-lg); }
.modal-body > .panel:last-child, .modal-body > section:last-child { margin-bottom: 0; }
.modal-body .panel { box-shadow: none; }
.modal.loading .modal-body { opacity: .5; pointer-events: none; }
.modal-confirm[open] { align-items: center; }
.modal-confirm .modal-body { text-align: center; padding: 26px 24px 20px; }
.modal-confirm .form-actions { justify-content: center; border: 0; margin-top: 8px; padding-top: 0; }
.confirm-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--neg-soft); color: var(--neg-text); }
.confirm-icon .icon { width: 22px; height: 22px; }
#confirm-text { font-size: 15px; color: var(--text); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }
@media (max-width: 640px) {
  .modal[open] { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100%; border: 0; }
}

/* ==========================================================================
   Tabelas
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; position: relative; }   /* relative: o texto .sr-only das células fica dentro do scroll */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface);
}
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table.compact td { padding: 8px 10px; }
.data-table tr.row-link { cursor: pointer; }
.data-table tr.row-link:hover td { background: var(--surface-2); }
.data-table .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.symbol { font-weight: 700; color: var(--text); }
a.symbol:hover { color: var(--primary); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 4px; font-size: 13.5px; }
/* Paginação: anterior · 1 … 4 5 [6] 7 8 … 20 · seguinte */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none;
}
.page-btn .icon { width: 15px; height: 15px; }
a.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.active:hover { color: #fff; }
.page-btn[aria-disabled="true"] { opacity: .4; }
.page-gap { min-width: 20px; text-align: center; color: var(--muted); }
.pagination-narrow { display: none; }
@media (max-width: 640px) {
  .pagination-wide { display: none; }
  .pagination-narrow { display: flex; }
  .page-step span { display: none; }
  .page-btn { min-width: 32px; height: 32px; padding: 0 8px; }
}

/* Colunas ordenáveis (link no servidor ou botão no browser) */
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; margin: 0; border: 0; background: none;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-decoration: none;
}
.th-sort:hover { color: var(--text); text-decoration: none; }
.th-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
th.num .th-sort { flex-direction: row-reverse; }
.sort-icon { display: inline-block; width: 10px; font-size: 11px; line-height: 1; opacity: .35; }
.sort-icon::after { content: "↕"; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
th[aria-sort="ascending"] .sort-icon, th[aria-sort="descending"] .sort-icon { opacity: 1; color: var(--primary); }
th[aria-sort="ascending"] .sort-icon::after { content: "↑"; }
th[aria-sort="descending"] .sort-icon::after { content: "↓"; }

/* Barras de valor dentro das tabelas (P&L por grupo) */
.data-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.data-bar-track { position: relative; width: 90px; height: 6px; background: var(--surface-3); border-radius: 99px; flex: none; }
.data-bar-track i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.data-bar-track i.pos { left: 50%; background: var(--pos); }
.data-bar-track i.neg { right: 50%; background: var(--neg); }
.data-bar-track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border-strong); }
.data-bar-track.share i.pos { left: 0; }
.data-bar-track.share::after { display: none; }

/* ==========================================================================
   Etiquetas
   ========================================================================== */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.badge-open { background: var(--primary-soft); color: var(--primary); }
.badge-closed { background: var(--surface-3); color: var(--muted); }
.dir { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.dir-long { background: var(--pos-soft); color: var(--pos-text); }
.dir-long::before { content: "▲"; font-size: 8px; }
.dir-short { background: var(--neg-soft); color: var(--neg-text); }
.dir-short::before { content: "▼"; font-size: 8px; }
h1 .dir, h1 .badge, h2 .dir, h2 .badge { font-size: 11.5px; }
.tag-pill {
  --tag: #4f6bed; display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; margin: 0 4px 4px 0; border-radius: 99px;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 30%, transparent);
}
a.tag-pill:hover { text-decoration: none; background: color-mix(in srgb, var(--tag) 22%, transparent); }
.tx { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.tx-deposit { background: var(--pos-soft); color: var(--pos-text); }
.tx-withdrawal { background: var(--neg-soft); color: var(--neg-text); }
.tx-interest { background: var(--primary-soft); color: var(--primary); }
.tx-dividend { background: var(--pro-soft); color: var(--pro); }
.emotion { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.emotion-medo, .emotion-ansioso, .emotion-frustrado, .emotion-ganancia, .emotion-impaciente { background: var(--neg-soft); color: var(--neg-text); }
.emotion-calmo, .emotion-confiante, .emotion-focado { background: var(--pos-soft); color: var(--pos-text); }

/* ==========================================================================
   Detalhe de operação, notas, listas
   ========================================================================== */
.trade-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.trade-head h1, .trade-head h2 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trade-head p { margin: 4px 0 0; color: var(--muted); }
.trade-result { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; text-align: right; }
.trade-result small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.price-path { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 18px; }
.price-path .leg span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.price-path .leg strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.price-path .leg em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.price-path .leg:last-child { text-align: right; }
.price-path .arrow { color: var(--muted); }
.kv, .detail-list { margin: 0; display: grid; }
.kv > div, .detail-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child, .detail-list > div:last-child { border-bottom: none; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.notes { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; }
.notes li { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.notes p { margin: 6px 0 0; }
.note-meta { display: flex; align-items: center; gap: 10px; }
.note-meta form { margin-left: auto; }
.note-form { display: flex; flex-direction: column; gap: 12px; }
.tag-manage-list { list-style: none; padding: 0; margin: 0; }
.tag-manage-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tag-manage-list li:last-child { border-bottom: none; }
.tag-manage-list form { margin-left: auto; }
.instruments-table input, .instruments-table select { padding: 6px 9px; font-size: 13px; min-width: 110px; }
.account-card { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.account-card h2 { margin: 0; }
.account-figures { display: flex; gap: 28px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.account-figures strong { display: block; color: var(--text); font-size: 15px; }

/* ==========================================================================
   Gráficos
   ========================================================================== */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 210px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin: 0 0 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-line { width: 16px; height: 2px; border-radius: 2px; background: var(--primary); }
.legend-up, .legend-down { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.legend-up { border-bottom: 9px solid var(--pos); }
.legend-down { border-top: 9px solid var(--neg); }
.legend-box { width: 10px; height: 10px; border-radius: 3px; }
.legend-box.pos { background: var(--pos); }
.legend-box.neg { background: var(--neg); }
.legend-box.expected { background: color-mix(in srgb, var(--primary) 35%, transparent); border: 1.5px solid var(--primary); }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 9px 11px; font-size: 12.5px; transition: opacity .08s;
}
.chart-tooltip .tt-title { color: var(--muted); margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.chart-tooltip .tt-row + .tt-row { margin-top: 3px; }
.chart-tooltip .tt-key { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.chart-tooltip .tt-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.chart-tooltip .tt-label { color: var(--text-2); }
.chart-table { max-height: 320px; overflow: auto; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--border); }
.chart-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.chart-table td.num, .chart-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Calendário de P&L */
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.calendar-head h2 { margin: 0; }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-nav strong { min-width: 120px; text-align: center; font-size: 14px; }
.calendar-summary { font-size: 13px; color: var(--muted); }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, .9fr); gap: 6px; }
.calendar .dow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 4px 2px; }
.cal-day {
  position: relative; min-height: 74px; padding: 7px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--text);
}
a.cal-day:hover { border-color: var(--primary); text-decoration: none; }
.cal-day.outside { background: var(--surface-2); border-style: dashed; }
.cal-day.outside .d { color: var(--muted); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--primary); border-color: var(--primary); }
.cal-day .n.sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day .d { color: var(--muted); font-weight: 600; }
.cal-day .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.cal-day .n { color: var(--muted); font-size: 11px; }
.cal-day.pos { background: color-mix(in srgb, var(--pos) calc(var(--i) * 30%), var(--surface)); border-color: color-mix(in srgb, var(--pos) 35%, var(--border)); }
.cal-day.neg { background: color-mix(in srgb, var(--neg) calc(var(--i) * 30%), var(--surface)); border-color: color-mix(in srgb, var(--neg) 35%, var(--border)); }
.cal-day.pos .v { color: var(--pos-text); }
.cal-day.neg .v { color: var(--neg-text); }
.cal-week { background: var(--surface-2); border-style: solid; }
/* Calendar (calendar.php): resultados, datas ex-dividendo e pagamentos */
.cal-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.cal-filters .cal-filter { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; margin: 0; font-weight: 500; padding: 5px 12px 5px 9px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: 13px; cursor: pointer; user-select: none; }
.cal-filter input { position: absolute; opacity: 0; pointer-events: none; }
.cal-filter .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--ev, var(--primary)); }
.cal-filter .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-filter:has(input:focus-visible) { box-shadow: var(--focus); }
.cal-filter:has(input:not(:checked)) { opacity: .55; }
.cal-filter:has(input:not(:checked)) .swatch { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ev, var(--primary)); }
.ev-earnings { --ev: var(--primary); }
.ev-ex { --ev: var(--warn); }
.ev-pay { --ev: var(--pos); }
.calendar.calendar-events { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-events .cal-ev { justify-content: flex-start; gap: 5px; min-height: 96px; cursor: default; }
.calendar-events .cal-ev.has { cursor: pointer; }
.calendar-events .cal-ev:focus-visible { outline: none; box-shadow: var(--focus); }
.calendar-events .cal-ev.has:hover { border-color: var(--primary); }
.calendar-events .evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; line-height: 1.5; padding: 0 6px; border-radius: 5px;
  color: var(--text); background: color-mix(in srgb, var(--ev) 16%, var(--surface)); border-left: 3px solid var(--ev); }
.ev:hover { text-decoration: none; background: color-mix(in srgb, var(--ev) 28%, var(--surface)); }
.ev.pending { border-left-style: dashed; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ev) 40%, transparent); }
.ev.held { font-weight: 800; }
.ev-count { display: inline-block; align-self: flex-start; min-width: 22px; text-align: center; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; color: var(--text); background: color-mix(in srgb, var(--ev) 22%, var(--surface)); }
#agenda h2 .agenda-all { font-weight: 400; margin-left: 8px; }
.agenda-day { font-size: 13px; text-transform: capitalize; color: var(--muted); margin: 16px 0 6px; }
.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-row { display: grid; grid-template-columns: 150px minmax(0, 1.4fr) 100px minmax(0, 2fr); gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.agenda-row .who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.agenda-row .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.agenda-row .status { color: var(--text-2); }
.agenda-row.pending .status { font-style: italic; }
.ev-badge { background: color-mix(in srgb, var(--ev) 18%, var(--surface)); color: var(--text); justify-self: start; }
@media (max-width: 720px) {
  .calendar-events .cal-ev { min-height: 62px; }
  .calendar-events .ev { font-size: 9.5px; padding: 0 3px; }
  .agenda-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .agenda-row .who { flex: 1 1 0; min-width: 0; }
  .agenda-row .detail { flex: 1 1 100%; }
}
/* Analistas (instrument.php, separador Analysis): consenso e preço-alvo */
.analysts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 18px 0 8px; }
.analysts-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.analysts-card .small-heading { margin-top: 0; }
.consensus-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.consensus-label { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.consensus-label.tone-pos { color: var(--pos-text); }
.consensus-label.tone-mid { color: var(--warn); }
.consensus-label.tone-neg { color: var(--neg-text); }
.vote-strongBuy { --v: #0f8a5f; }
.vote-buy { --v: #1baf7a; }
.vote-hold { --v: #b9a24a; }
.vote-sell { --v: #e0893f; }
.vote-strongSell { --v: #e34948; }
.vote-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; gap: 2px; }
.vote-bar .vote { display: flex; align-items: center; justify-content: center; min-width: 22px; font-size: 12px; font-weight: 700; color: #fff; background: var(--v); }
.vote-legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; }
.vote-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--v); }
.trend-title { margin: 16px 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.vote-trend { display: flex; gap: 10px; align-items: flex-end; }
.trend-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; text-align: center; font-size: 11px; }
.trend-stack { display: flex; flex-direction: column; height: 70px; border-radius: 6px; overflow: hidden; gap: 1px; }
.trend-stack .vote { background: var(--v); min-height: 2px; }
.trend-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Preço-alvo: o intervalo mínimo–máximo dos analistas, com a média, a mediana e o preço */
.target-chart { position: relative; margin: 6px 0 8px; }
.tc-above, .tc-below { position: relative; height: 40px; font-size: 12px; white-space: nowrap; }
.tc-above { height: 46px; }
.tc-label { position: absolute; transform: translateX(-50%); color: var(--text-2); }
.tc-label strong { color: var(--text); font-variant-numeric: tabular-nums; }
.tc-above .tc-mean { top: 0; }
.tc-above .tc-price { bottom: 0; }
.tc-below .tc-label { top: 6px; }
.tc-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-3); }
.tc-range { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: color-mix(in srgb, var(--primary) 38%, var(--surface-3)); }
.tc-mark { position: absolute; transform: translateX(-50%); }
.tc-meanmark { top: -4px; width: 4px; height: 20px; border-radius: 2px; background: var(--primary); }
.tc-median { top: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--muted); transform: translateX(-50%); }
.tc-pricemark { top: -22px; height: 34px; width: 0; border-left: 2px dashed var(--text); }
.tc-end { position: absolute; top: 2px; bottom: 2px; width: 2px; transform: translateX(-50%); background: color-mix(in srgb, var(--primary) 70%, var(--text)); border-radius: 1px; }
/* Dividendos previstos: contorno tracejado e valor em itálico (os recebidos são cheios) */
.cal-day.expected { border-style: dashed; }
.cal-day.expected .v { font-style: italic; }
.calendar-legend { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 12px 0 0; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--pos) 35%, var(--border)); background: color-mix(in srgb, var(--pos) 24%, var(--surface)); vertical-align: -3px; }
.legend-swatch.expected { border-style: dashed; }
@media (max-width: 720px) {
  .calendar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .calendar .cal-week, .calendar .dow-week { display: none; }
  .cal-day { min-height: 54px; padding: 5px; }
  .cal-day .n { display: none; }
  .cal-day .v { font-size: 10.5px; }
}

/* ==========================================================================
   Página inicial, planos, autenticação
   ========================================================================== */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; padding: 48px 0 56px; }
.hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -.035em; display: block; margin: 0 0 16px; font-weight: 800; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--primary), #6b5bd6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 600; font-size: 13px; margin: 0 0 16px; padding: 4px 12px; border-radius: 99px; background: var(--primary-soft); }
.hero-actions { display: flex; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.hero-actions .btn { padding: 12px 20px; font-size: 15px; }
.mock {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 10px 10px 0; overflow: hidden; min-width: 0;
}
.mock-bar { display: flex; gap: 6px; padding: 6px 6px 10px; }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.mock img { display: block; width: 100%; height: auto; border-radius: 8px 8px 0 0; }

/* Screenshots reais (anónimos, dados de exemplo) na secção "See it in action" da página inicial */
.tour { display: flex; flex-direction: column; gap: 56px; margin-bottom: 44px; }
.tour-row { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; }
.tour-row.reverse .tour-shot { order: 2; }
.tour-row.reverse .tour-text { order: 1; }
.tour-text { min-width: 0; }
.tour-shot {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 8px 8px 0; overflow: hidden; min-width: 0;
}
.tour-shot img { display: block; width: 100%; height: auto; border-radius: 6px 6px 0 0; }
.tour-text h3 { font-size: 22px; margin: 0 0 10px; letter-spacing: -.02em; }
.tour-text p { color: var(--text-2); margin: 0; }
.tour-note { text-align: center; margin: -20px 0 0; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 36px; scroll-margin-top: 80px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); margin-bottom: 14px; }
.feature h2 { font-size: 16px; margin-bottom: 6px; }
.feature p { color: var(--text-2); margin: 0; }
.cta-panel { text-align: center; padding: 44px 24px; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.cta-panel h2 { font-size: 24px; }
.cta-panel p { max-width: 620px; margin: 0 auto 20px; color: var(--text-2); }
.auth-wrap { display: grid; place-items: center; padding: 40px 0; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card > p.muted { margin-bottom: 22px; }
.auth-card .btn, .auth-card button[type="submit"] { width: 100%; padding: 11px; }
.auth-card .auth-switch { text-align: center; margin: 18px 0 0; color: var(--muted); }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 16px; gap: 36px; }
  .hero h1 { font-size: 34px; }
  .tour-row, .tour-row.reverse { grid-template-columns: 1fr; gap: 20px; }
  .tour-row.reverse .tour-shot, .tour-row.reverse .tour-text { order: initial; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.icon-inline { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }
.trade-title { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .subtitle { max-width: 760px; }


/* Novidades */
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.whats-new-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 20px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); background: var(--primary-soft); border-radius: var(--radius); color: var(--text); }
.whats-new-banner:hover { text-decoration: none; border-color: var(--primary); }
.whats-new-banner .muted { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.changelog { list-style: none; margin: 0; padding: 0; position: relative; }
.changelog::before { content: ""; position: absolute; left: 118px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.changelog-entry { display: grid; grid-template-columns: 100px 1fr; gap: 36px; position: relative; }
.changelog-entry::before { content: ""; position: absolute; left: 113px; top: 22px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.changelog-meta { text-align: right; padding-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.changelog-meta time { font-weight: 600; font-size: 13px; }
.changelog-version { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.changelog-entry .panel h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.changelog-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.changelog-items li { display: flex; gap: 12px; align-items: baseline; }
.change-type { flex: none; min-width: 78px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; }
.change-new { background: var(--primary-soft); color: var(--primary); }
.change-improved { background: var(--pos-soft); color: var(--pos-text); }
.change-fixed { background: var(--pro-soft); color: var(--pro); }
@media (max-width: 720px) {
  .changelog::before, .changelog-entry::before { display: none; }
  .changelog-entry { grid-template-columns: 1fr; gap: 6px; }
  .changelog-meta { text-align: left; flex-direction: row; gap: 10px; padding-top: 0; }
  .changelog-items li { flex-direction: column; gap: 4px; }
}

/* Definições da conta */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 20px; align-items: start; }
.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-choice { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; color: var(--text); }
.theme-choice { position: relative; }
.theme-choice input { position: absolute; opacity: 0; }
.theme-choice:has(input:checked) { border-color: var(--primary); box-shadow: var(--focus); }
.theme-choice:has(input:focus-visible) { box-shadow: var(--focus); }
.theme-swatch { height: 44px; border-radius: 6px; border: 1px solid var(--border); }
.theme-swatch-light { background: linear-gradient(135deg, #ffffff 50%, #f4f6f9 50%); }
.theme-swatch-dark { background: linear-gradient(135deg, #171a21 50%, #0d0f13 50%); }
.theme-swatch-auto { background: linear-gradient(135deg, #ffffff 50%, #171a21 50%); }
.danger-zone { border-color: color-mix(in srgb, var(--neg) 35%, var(--border)); }
.danger-zone h2 { color: var(--neg-text); }

/* ==========================================================================
   Aviso do site e publicidade
   ========================================================================== */
.flash-warning { background: color-mix(in srgb, #d99a1e 16%, var(--surface)); color: var(--text); border-color: color-mix(in srgb, #d99a1e 40%, transparent); }
.site-notice { align-items: center; }
.ad-slot { position: relative; margin: 0 0 20px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); text-align: center; }
.ad-slot .ad-label { position: absolute; top: 6px; left: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ad-slot .ad-body { display: flex; justify-content: center; }
.ad-slot img { display: block; max-width: 100%; height: auto; max-height: 250px; border-radius: var(--radius-sm); }
.public-content > .ad-public_top { max-width: 1100px; margin: 20px auto; }
.ad-public_footer { max-width: 1100px; margin: 20px auto; }
.sidebar .ad-app_sidebar { margin: 12px 6px; padding: 18px 8px 8px; }
.not-found { max-width: 560px; margin: 40px auto; }

/* ==========================================================================
   Gestão do site
   ========================================================================== */
.layout-admin { background: var(--bg); }
.admin-bar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-bar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 32px; display: flex; align-items: center; gap: 20px; }
.admin-bar .brand { display: flex; align-items: center; gap: 8px; flex: none; text-decoration: none; }
.admin-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; background: var(--neg-soft); color: var(--neg-text); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; flex: 1; } /* sem overflow: cortaria os menus suspensos */
.admin-nav a { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.admin-nav a .icon { width: 16px; height: 16px; }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-nav a.active { background: var(--primary-soft); color: var(--primary); }
/* Grupos do menu: <details data-dropdown>, fecham ao clicar fora ou com Esc (app.js) */
.admin-dropdown { position: relative; }
.admin-dropdown > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; }
.admin-dropdown > summary::-webkit-details-marker { display: none; }
.admin-dropdown > summary .icon { width: 16px; height: 16px; }
.admin-dropdown > summary .admin-caret { width: 14px; height: 14px; transition: transform .15s; }
.admin-dropdown[open] > summary .admin-caret { transform: rotate(180deg); }
.admin-dropdown > summary:hover, .admin-dropdown[open] > summary { background: var(--surface-2); color: var(--text); }
.admin-dropdown.active > summary { background: var(--primary-soft); color: var(--primary); }
.admin-dropdown > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.admin-dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 190px; padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.admin-dropdown-menu a { padding: 8px 10px; }
/* Em ecrãs médios o menu perde os ícones para caber numa só linha (a partir de 960px passa para uma linha própria) */
@media (min-width: 961px) and (max-width: 1239px) { .admin-nav > a .icon, .admin-dropdown > summary > .icon:not(.admin-caret) { display: none; } }
.admin-me { display: flex; align-items: center; gap: 8px; flex: none; }
@media (max-width: 1439px) { .admin-me > .muted { display: none; } }
.admin-content { padding-top: 24px; }
/* Página de um instrumento da gestão: formulário à esquerda e o gráfico do TradingView à direita (para confirmar o símbolo) */
.admin-split { display: grid; grid-template-columns: minmax(0, 760px) minmax(340px, 1fr); gap: 20px; align-items: start; }
.admin-split-side { position: sticky; top: 76px; }
.tv-chart-admin { height: 520px; }
.tv-check h2 { margin-top: 0; }
@media (max-width: 1180px) { .admin-split { grid-template-columns: minmax(0, 1fr); } .admin-split-side { position: static; } }
.admin-narrow { max-width: 760px; }
.admin-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 12px; font-size: 13.5px; }
.admin-dl dt { color: var(--muted); }
.admin-dl dd { margin: 0; text-align: left; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-actions form { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 200px; }
.admin-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.admin-activity code, .data-table code { font-size: 12px; }
.admin-details { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-checks { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.admin-checks li { display: flex; align-items: center; gap: 8px; }
.admin-checks .icon { width: 16px; height: 16px; }
.admin-checks .ok .icon { color: var(--pos-text); }
.admin-checks .bad .icon { color: var(--neg-text); }
label.checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.checkbox input { width: auto; }
.signup-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 18px; }
.signup-bar { position: relative; flex: 1; height: max(var(--h), 2px); background: var(--primary); border-radius: 3px 3px 0 0; opacity: .85; }
.signup-bar b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); padding-bottom: 2px; }
.signup-axis { display: flex; justify-content: space-between; margin-top: 6px; }
@media (max-width: 960px) {
  .admin-bar-inner { padding: 8px 16px; flex-wrap: wrap; gap: 8px 12px; }
  .admin-nav { order: 3; flex-basis: 100%; }
  .admin-dropdown-menu { position: static; box-shadow: none; margin-top: 4px; }
  .admin-dropdown { flex-basis: 100%; }
  .admin-me { margin-left: auto; }
  .admin-me > .muted { display: none; }
}
.ad-frame { display: block; width: 100%; height: 120px; border: 0; }
.ad-app_sidebar .ad-frame { height: 250px; }
.inline-logout { display: inline-flex; margin: 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row a { font-weight: 500; }
.verify-banner, .tz-banner { align-items: center; flex-wrap: wrap; }
.verify-banner span, .tz-banner span { flex: 1; min-width: 200px; }
.verify-banner form, .verify-banner, .tz-banner { margin-bottom: 16px; }
.tz-banner[hidden] { display: none; }
.auth-card .btn-block { width: 100%; margin: 0; }
.auth-card form + p, .auth-card .btn + p, .auth-card .flash + p { margin-top: 16px; }
.auth-card .form-actions .btn { width: auto; }

/* Página do instrumento: separadores, linha temporal das operações e gráfico do TradingView */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] { flex: none; white-space: nowrap; }
.tabs [role=tab] { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tabs [role=tab] .icon { width: 16px; height: 16px; }
.tabs [role=tab][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs [role=tab]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 4px; }
.trade-timeline { position: relative; height: 440px; }
.trade-timeline .timeline-tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none; min-width: 200px; }
.trade-timeline .tt-row { justify-content: space-between; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 10px; }
.timeline-legend .lg-buy { color: var(--pos-text); } .timeline-legend .lg-sell { color: var(--neg-text); }
.lg-line { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 2px; }
.lg-pos { border-color: var(--pos); } .lg-neg { border-color: var(--neg); } .lg-open { border-top-style: dashed; border-color: var(--muted); }
.timeline-hint { flex-basis: 100%; }
.tv-chart { height: 560px; }
.tv-chart .tradingview-widget-container { height: 100%; }
.tv-chart .tradingview-widget-container__widget { height: calc(100% - 28px); }
.tradingview-widget-copyright { font-size: 12px; padding-top: 6px; }
.tv-note { margin: 10px 0 0; }
.stat-value.small-value { font-size: 18px; }
.range { position: relative; margin: 6px 4px 0; padding-top: 22px; }
.range-now { position: absolute; top: 0; transform: translateX(-50%); font-size: 12.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--text); color: var(--surface); white-space: nowrap; }
.range-bar { position: relative; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--neg), var(--warn) 50%, var(--pos)); opacity: .9; }
.range-bar i { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text); box-sizing: border-box; }
.range-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.range-ends span:last-child { text-align: right; }
.range-ends small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
@media (max-width: 640px) { .trade-timeline { height: 340px; } .tv-chart { height: 460px; } }
.trade-timeline .timeline-overlay { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 3; }

/* Três pilares: seletor no menu lateral e página pública */
.pillar-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin: 0 6px 12px; padding: 4px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.pillar-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: var(--radius-sm); color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; text-align: center; }
.pillar-tab .icon { width: 18px; height: 18px; }
.pillar-tab:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.pillar-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.abar-menu-group { margin: 8px 8px 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.abar-menu-group:first-of-type { margin-top: 4px; }
.badge.kind-trading { background: var(--primary-soft); color: var(--primary); }
.badge.kind-investing { background: var(--pos-soft); color: var(--pos-text); }
.kind-choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind-choice legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.kind-option { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.kind-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.kind-option input { width: auto; margin-top: 3px; }
.kind-option > span { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 560px) { .kind-choice { grid-template-columns: 1fr; } }
.price-form { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.price-form input { width: 92px; text-align: right; padding: 5px 8px; }
.holdings-table td { vertical-align: top; }
.gains-year summary { cursor: pointer; list-style: none; }
.gains-year summary::-webkit-details-marker { display: none; }
.gains-year summary h2 { display: inline; }
.gains-year[open] summary { margin-bottom: 12px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; margin: 0 0 40px; }
.pillar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.pillar-card h2 { margin: 12px 0 4px; font-size: 20px; }
.pillar-card ul { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.pillar-card li .icon { color: var(--pos-text); }
.section-title { text-align: center; font-size: 22px; margin: 0 0 20px; }
.holdings-table td:first-child { min-width: 170px; }
.holdings-table .holding-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holdings-table .data-bar-track { width: 48px; }
.holdings-table th, .holdings-table td { padding-left: 8px; padding-right: 8px; }
.subnav { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.subnav a .icon { width: 16px; height: 16px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.income-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.income-figures span { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.income-figures strong { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.income-figures strong.positive { color: var(--pos-text); }
.income-grid { margin-bottom: 0; }
.small-heading { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-2); }
.chart-box-small { height: 200px; }
.pillars { max-width: 900px; margin-left: auto; margin-right: auto; }

/* Formulário de compra (contas de investimento): resumo do ativo e secções recolhíveis */
.asset-summary { margin: 4px 0 10px; }
.form-more { margin: 12px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.form-more > summary { cursor: pointer; padding: 10px 0; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.form-more[open] > summary { color: var(--text); }
.form-more > .form-row { padding-bottom: 12px; }

/* Gráfico de preços do instrumento (velas + compras e vendas) e escolha da vista no separador Market */
.market-views { margin: 4px 0 12px; }
.price-chart { position: relative; height: 480px; }
.price-chart .tt-box { position: absolute; top: 6px; left: 8px; z-index: 5; pointer-events: none; padding: 6px 9px; font-size: 12px; line-height: 1.45; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
@media (max-width: 640px) { .price-chart { height: 380px; } }
.chart-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.chart-bar .timeline-legend { margin: 0; flex: 1 1 320px; min-width: 0; }
.chart-bar .range-tabs { margin-left: auto; }
.range-tabs button { padding-left: 10px; padding-right: 10px; }

/* Ideias */
.tabs-links { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.tabs-links { overflow-x: auto; scrollbar-width: none; }
.tabs-links .tab { padding: 9px 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs-links .tab .icon { width: 16px; height: 16px; }
.tabs-links .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ideas-table td { vertical-align: top; }
.score-badge { display: inline-block; min-width: 38px; padding: 3px 8px; border-radius: 99px; text-align: center; font-weight: 700; font-size: 15px; }
.score-high { background: var(--pos-soft); color: var(--pos-text); }
/* Nota em barra (como o intervalo de 52 semanas) */
.score-range { width: 168px; margin: 0 0 0 auto; padding-top: 24px; }
.score-range .range-bar { height: 10px; }
.score-range .range-bar b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--surface); opacity: .8; }
.score-range.sr-high .range-now { background: var(--pos-text); color: var(--surface); }
.score-range.sr-mid .range-now { background: var(--warn); color: var(--surface); }
.score-range.sr-low .range-now { background: var(--muted); color: var(--surface); }
.score-caption { text-align: right; margin-top: 4px; }
.score-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.score-legend span { display: inline-flex; align-items: center; gap: 6px; }
.score-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.score-legend .s-high { background: var(--pos); }
.score-legend .s-mid { background: var(--warn); }
.score-legend .s-low { background: var(--muted); }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.yield-cell strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.ideas-table .symbol { font-size: 15px; }
.ideas-table td.score-col { width: 188px; }
.ideas-table td.inst-col { min-width: 230px; }
.ideas-table td, .ideas-table th { padding-left: 10px; padding-right: 10px; }
@media (max-width: 1100px) { .score-range { width: 140px; } .ideas-table td.score-col { width: 160px; } }
@media (max-width: 760px) { .score-range { width: 130px; } .ideas-table td.score-col { width: auto; } }

.score-mid { background: var(--warn-soft); color: var(--warn); }
.score-low { background: var(--surface-3); color: var(--muted); }
.verdict { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: 12.5px; }
.verdict-buy { background: var(--pos-soft); color: var(--pos-text); }
.verdict-consider { background: var(--warn-soft); color: var(--warn); }
.verdict-skip { background: var(--surface-3); color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.score-breakdown { margin-top: 10px; max-width: none; }
.comp-list, .reason-list { list-style: none; margin: 0; padding: 0; }
.comp-list li { display: grid; grid-template-columns: 120px 1fr 62px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.comp-list li.assumed { opacity: .6; }
.comp-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.comp-bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.comp-points { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.reason-list li { font-size: 12.5px; padding: 3px 0 3px 18px; position: relative; color: var(--text-2); }
.reason-list li::before { content: "•"; position: absolute; left: 4px; color: var(--muted); }
.reason-list li.good::before { content: "✓"; color: var(--pos-text); left: 2px; }
.reason-list li.warn { color: var(--warn); }
.reason-list li.warn::before { content: "!"; color: var(--warn); font-weight: 700; left: 4px; }
.ideas-table .badge:not(.badge-warn) { background: var(--surface-3); color: var(--text-2); margin-left: 4px; }
.ideas-table .sub { display: block; }
/* Ideias: de onde vem a nota, destaques, ferramentas, linhas com a explicação por baixo, plano e a versão em cartões */
.score-how { margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.score-how > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.score-how > summary::-webkit-details-marker { display: none; }
.score-how > summary .icon { width: 16px; height: 16px; color: var(--muted); }
.score-how > summary span { flex: 1; }
.score-how > summary .icon:last-child { transition: transform .15s; }
.score-how[open] > summary .icon:last-child { transform: rotate(180deg); }
.score-how-body { display: grid; gap: 18px; padding: 2px 14px 14px; }
.score-how-body p { margin: 0; }
.score-weights .small-heading { margin: 0 0 8px; }
.sw-bar { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; }
.sw-bar span { background: color-mix(in srgb, var(--primary) var(--c), var(--surface-3)); }
.sw-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-2); }
.sw-legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw-legend i { width: 10px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--primary) var(--c), var(--surface-3)); }
.sw-legend strong { font-variant-numeric: tabular-nums; }

.idea-highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.idea-hl { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
a.idea-hl:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.hl-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.hl-label .icon { width: 15px; height: 15px; }
.hl-main { display: flex; align-items: center; gap: 10px; font-size: 22px; line-height: 1.3; }
.hl-main strong { font-weight: 700; letter-spacing: -.02em; }
.hl-figure { font-weight: 700; color: var(--pos-text); font-variant-numeric: tabular-nums; }
.hl-main .score-badge { font-size: 14px; }
.hl-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ideas-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.ideas-toolbar .score-legend { margin: 0; }
.ideas-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ideas-tools .search-field input { width: 190px; }
.ideas-tools select { width: auto; max-width: 100%; }
.ideas-tools .search-field input, .ideas-tools select, .ideas-tools .btn { height: 36px; padding-top: 0; padding-bottom: 0; }
.ideas-tools .segmented { height: 36px; }
.ideas-filters { margin-bottom: 12px; }
.ideas-panel { padding: 0 16px; }
.ideas-panel .table-wrap { margin: 0; padding: 0; }
.ideas-table .idea-row { transition: background .12s; }
.ideas-table .idea-row:hover { background: var(--surface-2); }
.tier-high .rank { background: var(--pos-soft); color: var(--pos-text); }
.tier-mid .rank { background: var(--warn-soft); color: var(--warn); }
.rank-top { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor; }
.ideas-table td.c-rank { width: 44px; padding-right: 0; }
.ideas-table .badge.badge-star { background: var(--warn-soft); color: var(--warn); }
.why-toggle { display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--primary); cursor: pointer; }
.why-toggle .icon { width: 14px; height: 14px; transition: transform .15s; }
.why-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.why-row td { padding: 14px 18px 18px; background: var(--surface-2); }
.why-row .score-breakdown { max-width: none; margin-top: 0; }
.ideas-none { margin: 0; padding: 28px 0; text-align: center; }
.ideas-notes { margin-top: 4px; }

.plan-form { padding: 16px 20px; }
.plan-form > p { margin: 0 0 14px; }
.plan-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.plan-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.plan-fields input[type=text] { width: 140px; }
.plan-fields input[type=number] { width: 90px; }
.plan-fields select { width: auto; }
.plan-split { padding: 14px 20px 18px; }
.plan-split h2 { margin: 0 0 10px; }
.split-bar { display: flex; gap: 2px; height: 36px; border-radius: 10px; overflow: hidden; }
.split-bar span { display: grid; place-items: center; min-width: 0; overflow: hidden; padding: 0 6px; font-size: 12.5px; font-weight: 700; color: var(--surface); }
.split-bar .tier-high { background: var(--pos-text); }
.split-bar .tier-mid { background: var(--warn); }
.split-bar .tier-low { background: var(--muted); }

@media (max-width: 760px) {
  .tabs-links .tab { padding: 9px 10px; }
  .tabs-links .tab .icon { display: none; }
  .idea-highlights { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 16px; margin: 0 -16px 14px; padding: 0 16px 4px; }
  .idea-hl { flex: 0 0 74%; scroll-snap-align: start; padding: 12px 14px; }
  .hl-main { font-size: 20px; }
  .ideas-tools { width: 100%; }
  .ideas-tools .search-field { flex: 1; min-width: 120px; }
  .ideas-tools .search-field input { width: 100%; }
  .ideas-panel { padding: 0 14px; }
  .ideas-table, .ideas-table tbody { display: block; }
  .ideas-table thead { display: none; }
  .ideas-table tr.idea-row { display: grid; align-items: center; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .ideas-table tr.idea-row td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; }
  .ideas-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .ideas-table td.c-act, .ideas-table td.c-yield, .ideas-table td.c-invest { text-align: right; }
  .ideas-table td.c-rank { width: auto; align-self: start; }
  .ideas-table td.score-col { width: auto; }
  .score-range { width: 100%; max-width: 190px; margin: 0; }
  .score-caption { text-align: left; }
  .t-shares tr.idea-row { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "rank inst act" "rank score yield"; }
  .t-etfs tr.idea-row { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "inst inst act" "verdict score score" "fee ret dd"; }
  .t-plan tr.idea-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "inst act" "score invest" "about about"; }
  .c-rank { grid-area: rank; } .c-inst { grid-area: inst; } .c-score { grid-area: score; } .c-yield { grid-area: yield; } .c-act { grid-area: act; }
  .c-verdict { grid-area: verdict; } .c-fee { grid-area: fee; } .c-ret { grid-area: ret; } .c-dd { grid-area: dd; } .c-invest { grid-area: invest; } .c-about { grid-area: about; }
  .ideas-table tr.why-row { display: block; }
  .ideas-table tr.why-row td { display: block; margin: -6px 0 12px; padding: 12px 14px; border-radius: var(--radius-sm); }
  .plan-fields { display: grid; grid-template-columns: 1fr 1fr; }
  .plan-fields .btn, .plan-fields label:nth-child(3) { grid-column: 1 / -1; }
  .plan-fields input[type=text], .plan-fields input[type=number], .plan-fields select { width: 100%; }
}
.ideas-table tr[hidden] { display: none !important; }
.kv-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 28px; }
.filter-bar select.filter-on { border-color: var(--primary); background-color: var(--primary-soft); }
.req-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.req-bar { flex: 1; height: max(var(--h), 2px); border-radius: 3px 3px 0 0; opacity: .9;
  background: linear-gradient(to top, var(--neg) 0, var(--neg) var(--e), var(--primary) var(--e), var(--primary) 100%); }
.req-key { display: inline-block; width: 9px; height: 9px; background: var(--neg); border-radius: 2px; vertical-align: middle; }
.tax-fields legend { font-weight: 600; margin-bottom: 8px; }
.combo-panel { position: fixed; z-index: 2000; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 4px; }
.combo-item { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.combo-item strong { flex: none; min-width: 64px; }
.combo-item span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-item.active, .combo-item:hover { background: var(--primary-soft); }
.combo-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* Posições */
.alloc-bar { height: 16px; }
.positions-panel { padding: 14px 16px 6px; }
.positions-panel .table-wrap { margin: 0; padding: 0; }
.positions-note { margin: 0; flex: 1 1 320px; max-width: 620px; }
.holdings-table .pos-row { transition: background .12s; }
.holdings-table .pos-row:hover { background: var(--surface-2); }
.holdings-table .holding-name { max-width: 170px; }
.holdings-table td:first-child { min-width: 150px; }
.holdings-table .c-price .sub { max-width: 170px; margin-left: auto; white-space: normal; }
.holdings-table .data-bar-track { width: 36px; }
.holdings-table .px-line { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.holdings-table .px-line + .px-line { margin-top: 4px; }
.px-sym { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.gain-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; background: var(--surface-3); }
.gain-pill.positive { background: var(--pos-soft); }
.gain-pill.negative { background: var(--neg-soft); }
.holdings-table td.c-gain .gain-pill { margin-bottom: 2px; }
.holdings-table tfoot td { padding-top: 12px; padding-bottom: 12px; border-top: 2px solid var(--border-strong); background: var(--surface-2); font-weight: 600; vertical-align: top; }
.holdings-table tr[hidden] { display: none !important; }
@media (max-width: 760px) {
  .positions-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .positions-stats .stat-card { padding: 14px; }
  .positions-stats .stat-value { font-size: 20px; }
  .holdings-table .c-weight .data-bar { justify-content: flex-start; }
  .positions-panel { padding: 12px 14px 4px; }
  .holdings-table, .holdings-table tbody, .holdings-table tfoot { display: block; }
  .holdings-table thead { display: none; }
  .holdings-table tr.pos-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "asset asset" "value gain" "qty cost" "price div" "weight weight"; gap: 10px 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .holdings-table tr.pos-row td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; }
  .holdings-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .holdings-table td:first-child { min-width: 0; }
  .holdings-table .holding-name { max-width: none; }
  .holdings-table .px-line { justify-content: flex-start; }
  .holdings-table .price-form input { width: 100%; max-width: 130px; }
  .holdings-table .c-asset { grid-area: asset; } .holdings-table .c-qty { grid-area: qty; } .holdings-table .c-cost { grid-area: cost; } .holdings-table .c-price { grid-area: price; }
  .holdings-table .c-value { grid-area: value; } .holdings-table .c-gain { grid-area: gain; } .holdings-table .c-weight { grid-area: weight; } .holdings-table .c-div { grid-area: div; }
  .holdings-table .c-value strong { font-size: 18px; }
  .holdings-table tr.pos-total { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 12px 0 4px; }
  .holdings-table tr.pos-total td { display: block; padding: 0; border: 0; background: none; text-align: left; }
  .holdings-table tr.pos-total td:empty, .holdings-table tr.pos-total td:nth-child(7), .holdings-table tr.pos-total td:nth-child(8) { display: none; }
}

.link-button { padding: 0; border: 0; background: none; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-button[hidden] { display: none; }

.link-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.link-results li.muted { padding: 8px 2px; }
.link-results button { width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; }
.link-results button:hover { background: var(--surface-2); }
.link-results button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.holdings-table .link-button { display: block; margin-left: auto; font-size: 12px; }

/* Ligações dentro de texto corrido distinguem-se por mais do que a cor */
.content p a:not(.btn):not(.symbol), .content ul:not([class]) a:not(.btn), .muted a:not(.btn):not(.symbol), .stat-sub a, .subtitle a, .form-hint a { text-decoration: underline; text-underline-offset: 2px; }

/* Dashboard: o que aí vem */
.coming-list { list-style: none; margin: 0; padding: 0; }
.coming-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.coming-list li:last-child { border-bottom: 0; }
.coming-date { min-width: 96px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.coming-amount { margin-left: auto; font-variant-numeric: tabular-nums; }
.panel .alloc-bar { margin-top: 4px; }
@media (max-width: 560px) { .coming-amount { margin-left: 0; } .coming-list li .btn { margin-left: auto; } }

.check-row { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; }
.check-row input[type=checkbox] { width: auto; margin-top: 3px; }
.check-row > span { display: flex; flex-direction: column; gap: 2px; }

/* ==========================================================================
   Aspeto dos cartões (inspirado em dashboards de administração): fundo mais frio, cartões leves, KPIs com ícone
   ========================================================================== */
:root { --card-line: transparent; --row-line: #eef0f5; --shadow-card: 0 1px 2px rgba(56, 65, 74, .15); }
.panel, .card, .stat-card { border-color: var(--card-line); box-shadow: var(--shadow-card); }
.stat-card:has(> .stat-icon) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: start; align-content: start; }
.stat-card > .stat-icon { grid-row: 1 / span 4; grid-column: 1; align-self: start; }
.stat-card:has(> .stat-icon) > :not(.stat-icon) { grid-column: 2; }
.stat-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.tone-pos { background: var(--pos-soft); color: var(--pos-text); }
.stat-icon.tone-neg { background: var(--neg-soft); color: var(--neg-text); }
.stat-icon.tone-warn { background: var(--warn-soft); color: var(--warn); }
.pct-pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-3); }
.pct-pill.positive { background: var(--pos-soft); }
.pct-pill.negative { background: var(--neg-soft); }
@media (max-width: 700px) {
  .topbar .topbar-action { display: none; }
  .stat-card:has(> .stat-icon) { grid-template-columns: minmax(0, 1fr); }
  .stat-card > .stat-icon { grid-row: auto; grid-column: 1; width: 36px; height: 36px; margin-bottom: 8px; }
  .stat-card:has(> .stat-icon) > :not(.stat-icon) { grid-column: 1; }
  .stat-icon .icon { width: 18px; height: 18px; }
  .stat-value { overflow-wrap: anywhere; }
}

/* ==========================================================================
   Aspeto dos conteúdos: cartões planos sobre fundo lavanda, cabeçalhos simples, tabelas leves, etiquetas suaves
   ========================================================================== */
.topbar { border-bottom: 0; box-shadow: 0 1px 2px rgba(56, 65, 74, .12); }
.account-bar { border-bottom: 0; box-shadow: 0 1px 2px rgba(56, 65, 74, .08); }
.panel, .card, .stat-card { border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.panel, .card { margin-bottom: 24px; padding: 20px; }
.panel h2, .card h2 { font-size: 16px; font-weight: 600; color: var(--text-2); }
.panel-head { margin-bottom: 12px; }
.grid-2, .grid-3 { gap: 0 24px; }
.grid-main { gap: 24px; margin-bottom: 24px; }
.stat-grid { gap: 20px; margin-bottom: 24px; }
.stat-card { padding: 18px 20px; }
.stat-card .stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-card .stat-value { font-size: 23px; font-weight: 700; margin: 2px 0; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.crumbs ol { justify-content: flex-end; margin-bottom: 6px; }

/* Tabelas: sem banda no cabeçalho, linhas finas */
.data-table th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--row-line); background: transparent; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--row-line); }
.data-table.compact td { padding: 9px 12px; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table th .sort-icon, .data-table th .th-sort { text-transform: none; }

/* Etiquetas suaves (fundo pastel e texto da mesma cor) */
.badge { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 3px 9px; }

/* Botões e campos mais compactos */
.btn, :where(button[type="submit"]:not(.btn-link, .icon-btn, .toast-close)) { padding: 8px 14px; border-radius: 6px; font-size: 13.5px; }
.btn-small { padding: 5px 10px; font-size: 12.5px; }
.segmented { border-radius: 6px; }
.segmented button { border-radius: 4px; }
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], input[type="datetime-local"], select, textarea { border-radius: 6px; }

/* Balão de ajuda (info_tip) na gestão: o resto do site usa as regras do tema (theme.css) */
.layout-admin .tip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 2px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: help; vertical-align: -3px; }
.layout-admin .tip .icon { width: 14px; height: 14px; }
.layout-admin .tip:hover, .layout-admin .tip:focus-visible { color: var(--primary); }
.layout-admin .tip::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 20; width: max-content; max-width: 260px; padding: 7px 10px; border-radius: 6px;
  background: var(--text); color: var(--surface); font-size: 12px; font-weight: 400; line-height: 1.4; text-align: left; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; pointer-events: none; }
.layout-admin .tip:hover::after, .layout-admin .tip:focus::after { opacity: 1; visibility: visible; }

/* Tabela «Why this score» (templates/score_breakdown.php): o que cada parte mede, os pontos e o porquê */
/* o cabeçalho de linha («th scope=row») não é o cabeçalho da tabela: sem fundo, maiúsculas nem linha única (senão o texto de ajuda passa por cima do valor) */
.comp-table th[scope=row], .fig-table th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); background: transparent; white-space: normal; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.comp-table tbody tr:last-child th[scope=row], .fig-table tbody tr:last-child th[scope=row] { border-bottom: none; }
.comp-table th[scope=row] { font-weight: 600; min-width: 190px; vertical-align: top; }
.comp-table td { vertical-align: top; }
.comp-help, .fig-help { display: block; font-weight: 400; margin-top: 2px; max-width: 44ch; line-height: 1.35; }
.comp-score { min-width: 150px; white-space: nowrap; }
.comp-score .comp-bar { display: block; width: 100%; max-width: 150px; margin-bottom: 4px; }
.comp-score .comp-points { display: block; text-align: left; font-weight: 600; color: var(--text); }
.comp-assumed { display: block; white-space: normal; max-width: 22ch; line-height: 1.3; margin-top: 2px; }
.comp-table tr.assumed .comp-bar span { background: var(--muted); opacity: .55; }
.comp-bar.comp-high span { background: var(--pos); }
.comp-bar.comp-mid span { background: var(--primary); }
.comp-bar.comp-low span { background: var(--warn-fill); }
.comp-why, .comp-why .reason-list li { white-space: normal; overflow-wrap: anywhere; }
.comp-why .reason-list li { padding-top: 0; padding-bottom: 4px; }
.reason-general { margin-top: 12px; }
.score-foot { margin: 8px 0 0; max-width: 70ch; }
.comp-table .comp-bar { margin: 0 0 4px; }

/* Tabela «Figures» (templates/figures_table.php): o número, a leitura, a mediana do setor e a referência */
.figures { margin-top: 4px; }
.fig-table caption { text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 0 6px; }
.fig-table th[scope=row] { font-weight: 500; text-align: left; vertical-align: middle; min-width: 0; white-space: normal; }
.fig-table td { vertical-align: middle; }
.reading { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.reading-good { background: var(--pos-soft); color: var(--pos-text); }
.reading-fair { background: var(--warn-soft); color: var(--warn); }
.reading-weak { background: var(--neg-soft); color: var(--neg-text); }
@media (max-width: 760px) {
  /* no telemóvel ficam o número, o valor e a leitura (o que interessa); a referência, a mediana e as explicações saem */
  .comp-help { display: none; }
  .comp-table, .comp-table tbody { display: block; width: 100%; }
  .score-breakdown .table-wrap { margin: 0; padding: 0; }
  .comp-table thead { display: none; }
  .comp-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .comp-table tbody tr:last-child { border-bottom: 0; }
  .comp-table th[scope=row], .comp-table td { display: block; padding: 2px 0; border: 0; min-width: 0; }
  .comp-score { white-space: normal; }
}
.score-breakdown + .small-heading, .score-breakdown + .figures { margin-top: 24px; }

/* Gestão → Database (admin/pages/database.php) */
.db-table { table-layout: fixed; }                                  /* as colunas alinham-se de uma área para a seguinte */
.db-table th:nth-child(1) { width: 22%; } .db-table th:nth-child(2) { width: 27%; } .db-table th:nth-child(3) { width: 9%; } .db-table th:nth-child(4), .db-table th:nth-child(5), .db-table th:nth-child(6) { width: 8%; } .db-table th:nth-child(7) { width: 18%; }
.db-table .inline-form { display: inline-flex; margin-left: 6px; vertical-align: middle; }
.db-table th[scope=row] { text-align: left; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); background: transparent; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
.db-table .db-what { min-width: 220px; max-width: 360px; }
.db-table .db-share { min-width: 150px; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li { padding: 4px 0; font-size: 13.5px; }
.stat-value.small-value { font-size: 17px; overflow-wrap: anywhere; }
@media (max-width: 760px) { .db-table { table-layout: auto; } .db-table th:nth-child(n) { width: auto; } .db-table .db-what, .db-table th.db-what, .db-table .db-share, .db-table th.db-share { display: none; } }

/* Gestão → um instrumento: os dados e a sua frescura */
.data-fresh th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); background: transparent; white-space: normal; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; text-align: left; vertical-align: top; min-width: 200px; width: 26%; }
.data-fresh tbody tr:last-child th[scope=row] { border-bottom: none; }
.data-fresh td { vertical-align: top; }
.data-help { display: block; font-weight: 400; margin-top: 2px; max-width: 46ch; line-height: 1.35; }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) { .data-help { display: none; } .data-fresh th[scope=row] { width: auto; min-width: 0; } }
.admin-content code { overflow-wrap: anywhere; }
.admin-dl dd { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .admin-dl { grid-template-columns: 1fr; gap: 2px 0; } .admin-dl dd { margin-bottom: 8px; } }
.layout-admin .tradingview-widget-copyright a, .layout-admin .tradingview-widget-copyright a:visited { color: var(--muted) !important; }       /* a ligação «Charts by TradingView» que o próprio widget acrescenta: com contraste (o widget põe a sua cor com um estilo seu) */

/* Lista de instrumentos da gestão: a idade de cada tipo de dado, com a cor do estado (admin/pages/instruments.php, InstrumentData::forList) */
.age { font-variant-numeric: tabular-nums; font-weight: 600; }
.age-ok { color: var(--pos-text); }
.age-aging { color: var(--warn); }
.age-stale, .age-error { color: var(--neg-text); }
.age-never { color: var(--muted); font-weight: 400; }
.list-wide th, .list-wide td { padding-left: 7px; padding-right: 7px; }
.list-wide td code { font-size: 12px; }
@media (max-width: 1759px) { .list-wide th:nth-last-child(2), .list-wide td:nth-last-child(2) { display: none; } }          /* a data de alteração do registo (a penúltima coluna) só cabe em ecrãs largos; vê-se na página do instrumento */

/* Figures em grelha: os grupos lado a lado, linhas baixas, a explicação na dica (templates/figures_table.php) */
.fig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 4px 28px; align-items: start; }
.fig-group { margin: 0 0 12px; min-width: 0; }                      /* sem «table-wrap»: não desliza, e a dica dos ícones não fica cortada */
@media (max-width: 520px) { .fig-table th[scope=row] { white-space: normal; } }
.fig-table { font-size: 13px; }
.figures .fig-table th, .figures .fig-table td { padding: 4px 8px; }
.figures .fig-table thead th { font-size: 10.5px; padding-top: 4px; padding-bottom: 4px; }
.fig-table caption { padding: 2px 0 4px; }
.fig-table .tip { vertical-align: -3px; }
.fig-table .reading { font-size: 11px; padding: 1px 8px; }
.fig-table th[scope=row] { position: relative; }                                         /* a dica do ícone abre por baixo do nome, dentro do próprio grupo (o balão do tema é absoluto: sem isto ia parar longe) */
.fig-table .tip::after { left: 8px; top: calc(100% - 2px); width: 280px; max-width: calc(100vw - 48px); white-space: normal; }

/* Cartão «52-week range» mais baixo: o intervalo como valor e uma barra fina (templates/range_52w.php) */
.stat-range .range-slim { margin-top: 8px; padding: 0 4px; }
.stat-range .range-bar { height: 6px; }
.stat-range .range-bar i { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-width: 2px; }
.stat-range .stat-label { white-space: nowrap; }

/* Os cartões do topo das páginas do instrumento: mais baixos (menos margem, ícone mais pequeno, valor e legenda numa linha) */
.stat-grid-compact .stat-card { padding: 14px 18px; }
.stat-grid-compact .stat-card:has(> .stat-icon) { column-gap: 12px; }
.stat-grid-compact .stat-icon { width: 40px; height: 40px; }
.stat-grid-compact .stat-card .stat-value { font-size: 20px; }
.stat-grid-compact .stat-sub { white-space: nowrap; }
.stat-grid-compact .stat-range .stat-value { white-space: nowrap; }
@media (max-width: 700px) { .stat-grid-compact .stat-card > .stat-icon { width: 32px; height: 32px; margin-bottom: 6px; } .stat-grid-compact .stat-sub { white-space: normal; } }

/* Gestão → News: os instrumentos de cada artigo como etiquetas pequenas */
.news-instruments { max-width: 360px; }
.news-instruments .chip-small { padding: 1px 9px; font-size: 12px; margin: 0 2px 3px 0; }
.data-table th.news-sym { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); background: transparent; border-bottom: 1px solid var(--border); padding: 8px 10px; }
.news-table td { vertical-align: top; }

/* «Data and freshness» na coluna da direita (por baixo do TradingView check): o detalhe sob o nome, a explicação na dica */
.data-fresh-side th[scope=row] { width: auto; min-width: 0; }
.data-fresh-side .data-detail { display: block; font-weight: 400; margin-top: 2px; line-height: 1.35; }
.data-fresh-side .data-age { display: block; }
.data-fresh-side .tip::after { left: 0; width: 260px; max-width: calc(100vw - 48px); white-space: normal; }
.data-fresh-side th[scope=row] { position: relative; }

/* Separador Results (templates/results_history.php) */
.results-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.res-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.res-label { font-size: 12.5px; color: var(--muted); }
.res-value { font-family: var(--font-head, inherit); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.res-value small { font-size: 12px; font-weight: 400; }
.eps-chart { margin: 0 0 20px; }
.eps-chart svg { display: block; width: 100%; height: auto; max-height: 260px; }
.eps-zero { stroke: var(--border); stroke-width: 1; }
.eps-x { font-size: 10.5px; fill: var(--muted); }
.eps-est { fill: var(--surface-3); stroke: var(--muted); stroke-width: 1; }
.eps-beat { fill: var(--pos); }
.eps-miss { fill: var(--neg); }
.eps-flat { fill: var(--muted); }
.eps-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; }
.eps-key i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.eps-key i.eps-est { background: var(--surface-3); border: 1px solid var(--muted); }
.results-table tr.upcoming th, .results-table tr.upcoming td { background: var(--primary-soft); }
.results-table th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text); background: transparent; font-weight: 500; white-space: nowrap; text-align: left; }
.results .small-heading { margin-top: 18px; }
.eps-key i.eps-beat { background: var(--pos); }
.eps-key i.eps-miss { background: var(--neg); }
.eps-key i.eps-flat { background: var(--muted); }
