/* TrueNorth Analytics — design system
   Fondo claro cálido, IBM Plex Sans/Mono + Instrument Serif, acento rojo maple. */

:root {
  --tn-paper: #f7f6f3;
  --tn-ink: #1c1b18;
  --tn-maple: #b3372b;
  --tn-maple-dark: #8f2b22;
  --tn-border: #e7e4dc;
  --tn-border-soft: #f0eee8;
  --tn-divider: #efede7;
  --tn-muted: #8a857a;
  --tn-muted-2: #6f6b60;
  --tn-faint: #a8a396;
  --tn-input-bg: #fbfaf8;
  --tn-pos: #1a7f4e;
  --tn-neg: #c23934;
}

body {
  margin: 0;
  background: var(--tn-paper);
  color: var(--tn-ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
}

a { color: var(--tn-maple); text-decoration: none; }
a:hover { color: var(--tn-maple-dark); }

.font-serif-display { font-family: 'Instrument Serif', Georgia, serif; }

.num {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.pos { color: var(--tn-pos); }
.neg { color: var(--tn-neg); }

.card {
  background: #ffffff;
  border: 1px solid var(--tn-border);
  border-radius: 10px;
}

.lbl {
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tn-muted);
  font-weight: 600;
}

.navlink {
  padding: 20px 2px;
  border-bottom: 2px solid transparent;
  color: var(--tn-muted-2);
}
.navlink:hover { color: var(--tn-ink); }
.navlink-active { color: var(--tn-ink); border-bottom: 2px solid var(--tn-maple); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid #d9d5cb;
  background: #ffffff;
  color: var(--tn-ink);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: #fbfaf8; }
.btn-primary { background: var(--tn-maple); border-color: var(--tn-maple); color: #ffffff; }
.btn-primary:hover { background: var(--tn-maple-dark); border-color: var(--tn-maple-dark); }

.tn-input {
  background: var(--tn-input-bg);
  border: 1px solid var(--tn-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--tn-ink);
  width: 100%;
}
.tn-input:focus { outline: none; border-color: var(--tn-maple); }

/* Searchable asset selector used by the manual-order form. */
.tn-combobox { position: relative; }
.tn-combobox-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 5px;
  background: #ffffff;
  border: 1px solid var(--tn-border);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(28, 27, 24, 0.14);
}
.tn-combobox-menu[hidden] { display: none; }
.tn-combobox-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tn-ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.tn-combobox-option:hover,
.tn-combobox-option.is-active { background: var(--tn-input-bg); }
.tn-combobox-symbol {
  flex: 0 0 68px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
}
.tn-combobox-company {
  min-width: 0;
  flex: 1;
}
.tn-combobox-name {
  overflow: hidden;
  color: var(--tn-muted-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tn-combobox-market {
  color: var(--tn-faint);
  font-size: 10.5px;
  white-space: nowrap;
}
.tn-combobox-empty {
  padding: 11px 10px;
  color: var(--tn-muted);
  font-size: 12.5px;
}

.tn-card-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tn-card-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tn-muted);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--tn-border);
}
.tn-card-table td { padding: 10px 12px; border-bottom: 1px solid var(--tn-border-soft); }
.tn-card-table tbody tr:hover { background: var(--tn-input-bg); }

.tn-alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tn-alert-success { background: #e9efe9; border-color: #cfe2d3; color: var(--tn-pos); }
.tn-alert-danger { background: #f7e9e8; border-color: #edd0cc; color: var(--tn-neg); }
.tn-alert-info { background: #eceef2; border-color: #d7dbe6; color: #4a6b8a; }

/* CSS-only modal: <a href="#id"> opens, <a href="#"> closes */
.tn-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(28, 27, 24, 0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tn-modal:target { display: flex; }
.tn-modal-box {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--tn-border);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

/* Lightweight <details> dropdown menu */
.tn-dropdown { position: relative; }
.tn-dropdown > summary { list-style: none; cursor: pointer; }
.tn-dropdown > summary::-webkit-details-marker { display: none; }
.tn-dropdown[open] > summary { }
.tn-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 170px;
  background: #ffffff;
  border: 1px solid var(--tn-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(28, 27, 24, 0.10);
  padding: 6px;
}
.tn-dropdown-menu a, .tn-dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--tn-ink);
  background: none;
  border: none;
  cursor: pointer;
}
.tn-dropdown-menu a:hover, .tn-dropdown-menu button:hover { background: var(--tn-input-bg); }

/* Compact range switch for the price chart (.btn is too heavy at this size). */
.tn-range {
  font-size: 11px;
  font-weight: 600;
  color: var(--tn-muted);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
}
.tn-range:hover { background: var(--tn-border-soft); color: var(--tn-ink); }
.tn-range-active, .tn-range-active:hover { background: var(--tn-ink); color: #ffffff; }

/* "Datos clave" rows: hairline-separated, like the design's key-stat list. */
.tn-keystat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tn-border-soft);
}
.tn-keystat-last { border-bottom: none; }

/* Indicator groups. Masonry rather than a row-aligned grid: the groups have
   very different tile counts (nine valuation ratios against three dividend
   ones), so a grid leaves a ragged block of white under every short group.
   Columns pack them tight; order runs down each column, which is fine for
   groups nobody reads in sequence. */
.tn-ind-groups { column-count: 1; column-gap: 22px; }
.tn-ind-group {
  break-inside: avoid;
  /* Safari still needs the old page-break alias. */
  page-break-inside: avoid;
  margin-bottom: 18px;
}
@media (min-width: 640px) { .tn-ind-groups { column-count: 2; } }
@media (min-width: 1024px) { .tn-ind-groups { column-count: 3; } }
@media (min-width: 1280px) { .tn-ind-groups { column-count: 4; } }

/* Tighter than the default .lbl: a tile is ~105px of usable width, and at
   .07em tracking half these names would need an ellipsis. Wrapping is the
   fallback for the longest ones — losing the end of "Pasivo/Activos" to a
   "…" defeats the point of labelling the tile at all. */
.tn-ind-label {
  font-size: 10.5px;
  letter-spacing: .03em;
  line-height: 1.3;
  /* Two lines reserved whether or not this label needs them, so the values
     underneath sit on the same baseline across a row of tiles. */
  min-height: 27px;
}

.ind {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--tn-divider);
  border-radius: 8px;
  background: var(--tn-input-bg);
}

/* Phase 5 insights: a compact score summary and traffic lights that keep the
   raw metric visible. Colour never carries the whole meaning: every dot has
   an aria-label/title and the score cards include their numeric values. */
.tn-score-card { border-top: 3px solid var(--tn-ink); }
.tn-score-ring {
  display: flex;
  align-items: baseline;
  justify-content: center;
  width: 62px;
  height: 62px;
  padding-top: 16px;
  border: 5px solid var(--tn-border);
  border-radius: 50%;
  background: #fff;
}
.tn-score-ring .num { font-size: 19px; font-weight: 700; line-height: 1; }
.tn-score-ring small { margin-left: 1px; color: var(--tn-muted); font-size: 9px; }
.tn-score-ring.tn-signal-green { border-color: #7fc49e; }
.tn-score-ring.tn-signal-yellow { border-color: #d8b75a; }
.tn-score-ring.tn-signal-red { border-color: #dc8b86; }
.tn-score-component {
  padding: 11px 12px;
  border: 1px solid var(--tn-divider);
  border-radius: 8px;
  background: var(--tn-input-bg);
}
.tn-score-track { height: 4px; overflow: hidden; border-radius: 4px; background: var(--tn-border); }
.tn-score-track span { display: block; height: 100%; border-radius: inherit; background: var(--tn-ink); }
.tn-signal {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 5px;
  border: 1px solid rgba(28, 27, 24, .12);
  border-radius: 50%;
  vertical-align: 1px;
}
.tn-signal-green { background: var(--tn-pos); }
.tn-signal-yellow { background: #c49316; }
.tn-signal-red { background: var(--tn-neg); }
.tn-signal-unavailable { background: var(--tn-border); }

/* Indicator help: a "?" next to a label, explained on hover, focus or tap. */
.tn-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 13px;
  height: 13px;
  margin-left: 4px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--tn-border);
  color: var(--tn-muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: normal;
  cursor: help;
  vertical-align: middle;
  transition: background-color .12s ease, color .12s ease;
}
.tn-help:hover, .tn-help.is-open, .tn-help:focus-visible {
  background: var(--tn-maple);
  color: #ffffff;
  outline: none;
}

.tn-help-bubble {
  display: none;
  /* JS moves visible bubbles to <body>. Keeping them outside the multicolumn
     indicator layout prevents Chromium from fragmenting a single tooltip
     between two columns. */
  position: fixed;
  z-index: 100;
  width: min(280px, calc(100vw - 24px));
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--tn-ink);
  color: #f2f0eb;
  box-shadow: 0 8px 24px rgba(28, 27, 24, 0.18);
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  white-space: normal;
  cursor: auto;
  pointer-events: none;
}
.tn-help-bubble.is-visible { display: block; }

/* Used by the "Datos clave" rows for their own layout. Tooltip positioning
   is viewport-relative and handled in help_tips.js. */
.tn-help-row { position: relative; }

/* Portfolio account filter chips */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 13px;
  border: 1px solid #d9d5cb;
  color: var(--tn-muted-2);
  background: #ffffff;
}
.chip:hover { color: var(--tn-ink); background: var(--tn-input-bg); }
.chip-on, .chip-on:hover { background: var(--tn-ink); color: #ffffff; border-color: var(--tn-ink); }

/* Account badge on a position row. Colours come from the route, which keys
   them off the account type. */
.acct {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 5px;
  padding: 2px 7px;
}

/* Totals strip: one card divided into cells, not five separate cards —
   they're facets of a single number, and the hairlines say so. */
.tn-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tn-total { padding: 16px 20px; border-right: 1px solid var(--tn-divider); border-top: 1px solid var(--tn-divider); }
.tn-total:nth-child(-n+2) { border-top: none; }
.tn-total:nth-child(2n) { border-right: none; }
@media (min-width: 768px) {
  .tn-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tn-total { border-top: none; border-right: 1px solid var(--tn-divider); }
  .tn-total:last-child { border-right: none; }
  .tn-total:nth-child(2n) { border-right: 1px solid var(--tn-divider); }
}

/* Positions table: numeric columns right-aligned, so the digits line up in
   a column you can scan down. */
.tn-positions { border-collapse: collapse; width: 100%; font-size: 13px; }
.tn-positions th {
  text-align: right;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tn-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--tn-border);
  white-space: nowrap;
}
.tn-positions td {
  text-align: right;
  padding: 11px 12px;
  border-bottom: 1px solid var(--tn-border-soft);
  white-space: nowrap;
}
.tn-positions th.l, .tn-positions td.l { text-align: left; }
.tn-positions .tn-edge-l { padding-left: 20px; }
.tn-positions .tn-edge-r { padding-right: 20px; }
.tn-positions tbody tr:hover td { background: var(--tn-input-bg); }
.tn-positions .tn-total-row td { background: var(--tn-input-bg); border-bottom: none; }
.tn-positions .tn-total-row:hover td { background: var(--tn-input-bg); }

/* Plan-vs-real bar: fill is the real weight, the tick is the target. */
.tn-bar { position: relative; height: 8px; background: #f0eee8; border-radius: 4px; }
.tn-bar-fill { height: 8px; border-radius: 4px; }
.tn-bar-target {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--tn-ink);
}

/* "Editar plan": the <summary> is the card's header row, so the disclosure
   triangle has to go — the "Editar plan" text is the affordance. */
/* Strategic portfolio editor and comparison panels. The editor opens over
   the card so changing a plan does not push every chart down the page. */
.tn-plan-editor { position: relative; }
.tn-plan-editor > summary::-webkit-details-marker { display: none; }
.tn-plan-editor > summary { list-style: none; }
.tn-plan-popover {
  position: absolute;
  z-index: 70;
  top: calc(100% + 8px);
  right: 0;
  width: min(760px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid var(--tn-border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(28, 27, 24, 0.14);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.tn-chart-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--tn-border-soft);
  border-radius: 9px;
  background: var(--tn-input-bg);
}
.tn-allocation-view-switch {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 2px;
  overflow-x: auto;
  border: 1px solid var(--tn-border);
  border-radius: 9px;
  background: var(--tn-input-bg);
}
.tn-allocation-view-tab {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tn-muted-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.tn-allocation-view-tab:hover { color: var(--tn-ink); }
.tn-allocation-view-tab:focus-visible {
  outline: 2px solid var(--tn-maple);
  outline-offset: 1px;
}
.tn-allocation-view-tab.is-active {
  background: #ffffff;
  color: var(--tn-ink);
  box-shadow: 0 1px 3px rgba(28, 27, 24, 0.1);
}
.tn-allocation-comparison-panel { min-height: 298px; }
[data-allocation-view][hidden] { display: none; }
.tn-rebalance-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--tn-border-soft);
}
.tn-rebalance-row:last-child { padding-bottom: 0; border-bottom: 0; }
.tn-allocation-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
}

/* Screener toolbar dropdown: the trigger looks like the design's "select"
   pill; the menu behind it is the shared .tn-dropdown-menu. */
.sel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid #d9d5cb;
  border-radius: 8px;
  padding: 7px 12px;
  background: #ffffff;
  color: var(--tn-ink);
  cursor: pointer;
}
.sel:hover { background: var(--tn-input-bg); }
/* A filter that is actually narrowing the list reads as set, not as another
   idle control — otherwise a toolbar of eight pills says nothing about which
   ones are doing something. */
.sel-on { border-color: var(--tn-ink); }
.sel-on .sel-value { font-weight: 600; }

/* Menus open leftwards from their trigger, unlike the right-anchored account
   menu in the nav. */
.tn-dropdown-menu-l { left: 0; right: auto; }
.tn-dropdown-menu .tn-dropdown-item-on { font-weight: 600; background: var(--tn-input-bg); }

/* Sector badge on a screener card. */
.sector {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  border-radius: 5px;
  padding: 3px 9px;
  background: var(--tn-border-soft);
  color: var(--tn-muted-2);
}

/* Company mark shared by the screener and company-detail headers. The
   surrounding tile keeps favicons with transparent or white canvases legible
   without changing the rhythm of either layout. */
.company-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--tn-border-soft);
  border-radius: 8px;
  background: #ffffff;
}
.company-icon-sm { width: 30px; height: 30px; }
.company-icon-md { width: 36px; height: 36px; }
.company-icon-lg { width: 48px; height: 48px; border-radius: 10px; }
.company-icon img { width: 72%; height: 72%; object-fit: contain; }
.company-icon-fallback {
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--tn-input-bg);
  color: var(--tn-muted-2);
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
}
.company-icon-lg .company-icon-fallback { font-size: 22px; }

/* One indicator inside a screener card. */
.stat {
  background: var(--tn-input-bg);
  border: 1px solid var(--tn-border-soft);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat .lbl { font-size: 10px; }

/* Lista / Cards switch: two halves of one bordered pill. */
.tn-seg { display: flex; border: 1px solid #d9d5cb; border-radius: 8px; overflow: hidden; background: #ffffff; }
.tn-seg > a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  color: var(--tn-muted-2);
}
.tn-seg > a + a { border-left: 1px solid #d9d5cb; }
.tn-seg > a:hover { color: var(--tn-ink); }
.tn-seg > a.tn-seg-on, .tn-seg > a.tn-seg-on:hover { background: var(--tn-ink); color: #ffffff; }

/* Numbered pagination. The arrows keep their border at both ends; the page
   numbers only get a background once they're the current page. */
.tn-page { padding: 5px 11px; border-radius: 6px; color: var(--tn-muted-2); }
.tn-page:hover { background: var(--tn-border-soft); color: var(--tn-ink); }
.tn-page-on, .tn-page-on:hover { background: var(--tn-ink); color: #ffffff; font-weight: 600; }
.tn-page-arrow {
  padding: 5px 10px;
  border: 1px solid var(--tn-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--tn-muted-2);
}
.tn-page-arrow:hover { background: var(--tn-input-bg); color: var(--tn-ink); }
.tn-page-gap { padding: 5px 4px; color: var(--tn-faint); }

/* Rows and cards that navigate as a whole (see js/row_links.js). The inner
   link stays the accessible target; these are the pointer affordances. */
[data-row-href] { cursor: pointer; }
.card[data-row-href] { transition: border-color .15s ease, box-shadow .15s ease; }
.card[data-row-href]:hover { border-color: #d9d5cb; box-shadow: 0 4px 14px rgba(28, 27, 24, 0.06); }

/* Phase 5 rankings and comparator. The comparison grid shares row tracks so
   a metric label and every company value stay aligned while the whole table
   can scroll horizontally on narrow screens. */
.tn-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ece9e2;
  color: var(--tn-muted-2);
  font-size: 10px;
  font-weight: 700;
}
.tn-rank-1 { background: #f6d77b; color: #6f4d00; }
.tn-rank-2 { background: #d9dde0; color: #4d565c; }
.tn-rank-3 { background: #e8b184; color: #72401c; }
.tn-rank-empty { width: 20px; height: 20px; flex: 0 0 auto; }

.tn-compare-scroll { overflow-x: auto; }
.tn-compare-grid {
  display: grid;
  grid-template-columns: 190px repeat(var(--compare-count), minmax(210px, 1fr));
  min-width: calc(190px + var(--compare-count) * 210px);
}
.tn-compare-corner,
.tn-compare-company {
  min-height: 124px;
  padding: 16px;
  border-bottom: 1px solid var(--tn-border);
}
.tn-compare-corner {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  background: var(--tn-input-bg);
}
.tn-compare-company {
  border-left: 1px solid var(--tn-border);
  border-top: 4px solid var(--compare-color);
  background: #ffffff;
}
.tn-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--tn-border);
  border-radius: 7px;
  color: var(--tn-muted-2);
  background: #ffffff;
}
.tn-icon-button:hover { color: var(--tn-neg); background: #fff7f6; }
.tn-icon-button .material-symbols-outlined { font-size: 18px; }
.tn-compare-group-title,
.tn-compare-group-spacer {
  padding: 12px 14px 7px;
  border-bottom: 1px solid var(--tn-border);
  background: var(--tn-input-bg);
}
.tn-compare-group-title {
  color: var(--tn-maple);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tn-compare-group-spacer { border-left: 1px solid var(--tn-border); }
.tn-compare-label,
.tn-compare-value {
  min-height: 45px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tn-border-soft);
}
.tn-compare-label {
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
  color: var(--tn-muted-2);
  font-size: 12px;
  font-weight: 600;
}
.tn-compare-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-left: 1px solid var(--tn-border);
  background: #ffffff;
  font-size: 13px;
}
.tn-compare-ranges {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--tn-border);
  border-radius: 999px;
  background: var(--tn-input-bg);
}
.tn-compare-range {
  min-width: 42px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tn-muted-2);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.tn-compare-range:hover { color: var(--tn-ink); }
.tn-compare-range:focus-visible { outline: 2px solid var(--tn-maple); outline-offset: 1px; }
.tn-compare-range.is-active { background: var(--tn-ink); color: #ffffff; }
.tn-investment-calculator {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--tn-border-soft);
}
.tn-investment-result {
  padding: 14px 16px;
  border: 1px solid var(--tn-border-soft);
  border-radius: 8px;
  background: var(--tn-input-bg);
}
.tn-chart-swatch { width: 12px; height: 12px; border-radius: 2px; }
.tn-input-icon {
  position: absolute;
  z-index: 1;
  left: 11px;
  top: 9px;
  color: var(--tn-muted);
  font-size: 18px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .tn-compare-grid {
    grid-template-columns: 135px repeat(var(--compare-count), minmax(180px, 1fr));
    min-width: calc(135px + var(--compare-count) * 180px);
  }
  .tn-compare-corner, .tn-compare-company { padding: 12px; }
  .tn-compare-label, .tn-compare-value { padding: 9px 10px; }
}

/* Column-based comparator v2: faithful to the supplied reference. Each
   company is its own elevated strip, while the left rail carries labels. */
.tn-compare-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--tn-border);
  border-radius: 9px;
  background: #ffffff;
}
.tn-compare-board-scroll {
  overflow-x: auto;
  padding: 4px 4px 18px;
}
.tn-compare-board {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: max-content;
  min-width: 100%;
}
.tn-compare-rail {
  flex: 0 0 260px;
  background: transparent;
}
.tn-compare-rail-head,
.tn-compare-stock-head {
  height: 132px;
  box-sizing: border-box;
}
.tn-compare-rail-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 8px 12px 0;
}
.tn-compare-performance-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  border-radius: 3px;
  background: #008f83;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(28, 27, 24, .14);
}
.tn-compare-performance-link:hover { background: #00766d; color: #ffffff; }
.tn-compare-rank-label,
.tn-compare-overall-rank {
  height: 58px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--tn-border);
}
.tn-compare-rank-label {
  display: flex;
  align-items: center;
  padding: 0 10px 0 0;
  color: var(--tn-muted-2);
  font-size: 12px;
  font-weight: 700;
}
.tn-compare-stock-column {
  flex: 0 0 220px;
  overflow: hidden;
  border: 1px solid #ddd9d0;
  border-radius: 5px 5px 0 0;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(28, 27, 24, .13);
}
.tn-compare-stock-head {
  padding: 10px 11px 12px;
  background: #334c5a;
  border-top: 5px solid var(--compare-color);
}
.tn-compare-symbol {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 7px;
  border-radius: 3px;
  background: #d94710;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
}
.tn-compare-symbol:hover { background: #bd390c; color: #ffffff; }
.tn-compare-symbol .material-symbols-outlined { font-size: 14px; }
.tn-compare-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e43b08;
  color: #ffffff;
}
.tn-compare-remove:hover { background: #c83207; color: #ffffff; }
.tn-compare-remove .material-symbols-outlined { font-size: 19px; }
.tn-compare-stock-head .company-icon {
  border-color: rgba(255, 255, 255, .5);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .18);
}
.tn-compare-overall-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
}
.tn-compare-medal-count { display: inline-flex; flex-direction: column; align-items: center; }
.tn-compare-medal-count .tn-rank-badge { width: 19px; height: 19px; }
.tn-compare-medal-count small { margin-top: -2px; color: var(--tn-muted-2); font-size: 9px; }
.tn-compare-section-label,
.tn-compare-column-section {
  height: 38px;
  box-sizing: border-box;
}
.tn-compare-section-label {
  display: flex;
  align-items: flex-end;
  padding: 0 10px 7px 0;
  color: var(--tn-ink);
  font-size: 12px;
  font-weight: 700;
}
.tn-compare-column-section {
  display: flex;
  align-items: flex-end;
  padding: 0 10px 7px;
  border-bottom: 1px solid var(--tn-border);
  color: transparent;
  font-size: 1px;
}
.tn-compare-metric-label,
.tn-compare-column-value {
  height: 45px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--tn-border-soft);
}
.tn-compare-metric-label {
  display: flex;
  align-items: center;
  padding-right: 12px;
  color: #007c73;
  font-size: 12px;
  font-weight: 700;
}
.tn-compare-column-value {
  display: grid;
  grid-template-columns: 22px 1fr 10px;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  text-align: right;
}
.tn-compare-column-value .num { justify-self: end; }
.tn-compare-add-column {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex: 0 0 190px;
  min-height: 720px;
  border: 1px dashed #cfcac0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .55);
  color: var(--tn-muted-2);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}
.tn-compare-add-column:hover { border-color: #008f83; color: #00766d; background: #ffffff; }
.tn-compare-add-column .material-symbols-outlined { margin-bottom: 8px; font-size: 28px; }
.tn-compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 40px 24px;
  text-align: center;
}
.tn-compare-empty > .material-symbols-outlined { color: #008f83; font-size: 44px; }

/* Reusable company selector for comparator entry points. */
.tn-asset-picker-dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  color: var(--tn-ink);
  box-shadow: 0 24px 70px rgba(28, 27, 24, .24);
}
.tn-asset-picker-dialog::backdrop {
  background: rgba(28, 27, 24, .52);
  backdrop-filter: blur(2px);
}
.tn-asset-picker-panel { padding: 22px; }
.tn-asset-picker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.tn-asset-picker-heading h2 {
  margin-top: 3px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 25px;
  line-height: 1.1;
}
.tn-asset-picker-kicker {
  color: #008f83;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tn-asset-picker-copy {
  margin-top: 9px;
  color: var(--tn-muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.tn-asset-picker-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--tn-border);
  border-radius: 50%;
  background: #ffffff;
  color: var(--tn-muted-2);
  cursor: pointer;
}
.tn-asset-picker-close:hover { border-color: #c9c4b9; background: var(--tn-input-bg); color: var(--tn-ink); }
.tn-asset-picker-close:focus-visible { outline: 2px solid var(--tn-maple); outline-offset: 2px; }
.tn-asset-picker-close .material-symbols-outlined { font-size: 19px; }
.tn-asset-picker-search {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--tn-border);
  border-radius: 10px;
  background: #fbfaf8;
}
.tn-asset-picker-search .tn-input { min-height: 44px; background: #ffffff; }
.tn-asset-picker-search .tn-input-icon { top: 12px; }
.tn-asset-picker-search .tn-combobox-menu { top: calc(100% + 6px); z-index: 120; }
.tn-asset-picker-current {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--tn-border-soft);
}
.tn-asset-picker-current > span {
  color: var(--tn-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tn-asset-picker-current > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tn-asset-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid var(--tn-border-soft);
  border-radius: 999px;
  background: var(--tn-input-bg);
  color: var(--tn-muted-2);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tn-asset-picker-chip strong { color: var(--tn-ink); }
.tn-asset-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  color: var(--tn-faint);
  font-size: 11px;
}

@media (max-width: 640px) {
  .tn-compare-rail { flex-basis: 165px; }
  .tn-compare-stock-column { flex-basis: 190px; }
  .tn-compare-metric-label { font-size: 10.5px; }
  .tn-compare-column-value { padding-left: 9px; padding-right: 9px; }
  .tn-asset-picker-dialog { width: calc(100vw - 24px); }
  .tn-asset-picker-panel { padding: 18px; }
  .tn-asset-picker-search { padding: 13px; }
  .tn-asset-picker-footer { align-items: flex-end; }
}

/* ── Comunidad ────────────────────────────────────────────────────────────
   Market strip, ticker chips, category badges and vote controls. */

.tn-market-strip {
  height: 34px;
  background: var(--tn-ink);
  color: #c9c4b8;
  font-size: 11.5px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}
.tn-market-track {
  display: flex;
  align-items: center;
  width: max-content;
  height: 100%;
  will-change: transform;
  animation: tn-market-scroll 30s linear infinite;
  animation-delay: var(--tn-market-animation-delay, 0s);
}
.tn-market-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 52px;
  width: max-content;
  min-width: 100vw;
  height: 100%;
  padding: 0 36px;
  box-sizing: border-box;
}
.tn-market-indicators {
  display: flex;
  align-items: center;
  gap: 26px;
}
.tn-market-item,
.tn-market-session {
  flex: none;
}
.tn-market-session {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tn-market-strip:hover .tn-market-track,
.tn-market-strip:focus-within .tn-market-track {
  animation-play-state: paused;
}
@keyframes tn-market-scroll {
  to { transform: translate3d(-50%, 0, 0); }
}
/* The strip sits on ink, where the light-background pos/neg pair goes muddy. */
.tn-market-pos { color: #5fbf8f; }
.tn-market-neg { color: #e88a80; }
.tn-market-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fbf8f;
  flex-shrink: 0;
}
.tn-market-dot-closed { background: #8a857a; }

/* A `$TICKER` mention, inline in a post body or standing alone as a chip. */
.tick {
  display: inline-flex;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  background: #e9efe9;
  color: var(--tn-pos);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
a.tick:hover { background: #dde8dd; color: #15633d; }

/* Category badge. Its colours come from POST_CATEGORY_STYLES. */
.cat {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: 5px;
  padding: 2px 8px;
}

.vote {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tn-muted-2);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.vote:hover { color: var(--tn-ink); }
.vote-on-up, .vote-on-up:hover { color: var(--tn-pos); }
.vote-on-down, .vote-on-down:hover { color: var(--tn-neg); }

/* Author initial. Hue is derived from the username so the same person keeps
   the same colour across the feed without storing an avatar. */
.tn-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 600;
  flex-shrink: 0;
}

.tn-composer {
  flex: 1;
  border: 1px solid var(--tn-border);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--tn-muted);
  background: var(--tn-input-bg);
  text-align: left;
  cursor: pointer;
}
.tn-composer:hover { border-color: #d9d5cb; }

@media (max-width: 640px) {
  .tn-market-track { animation-duration: 34s; }
  .tn-market-group { gap: 36px; padding: 0 16px; }
  .tn-market-indicators { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .tn-market-strip {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tn-market-strip::-webkit-scrollbar { display: none; }
  .tn-market-track { animation: none; }
  .tn-market-group[aria-hidden="true"] { display: none; }
}

/* Tailwind's display utilities (`flex`, `grid`, `block`) out-specify the
   browser's built-in `[hidden] { display: none }`, so an element carrying
   both `hidden` and `flex` renders anyway. Progressive-disclosure panels
   (the composer, inline comment editing) rely on `hidden` being honoured. */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------
   Landing pública y pantallas de acceso
   --------------------------------------------------------------------- */

/* The marketing CTAs and the auth forms need a bigger target than the
   13px .btn the app's toolbars use — 44px tall, which is also the minimum
   comfortable tap target on a phone. */
.btn-lg { font-size: 14.5px; padding: 12px 22px; border-radius: 9px; }
.btn-auth { font-size: 13.5px; padding: 11px 16px; }
.btn-block { width: 100%; justify-content: center; }

/* .btn on an ink panel: the default #d9d5cb border disappears against it. */
.btn-onink { background: #ffffff; border-color: #ffffff; color: var(--tn-ink); }
.btn-onink:hover { background: #f2f0eb; border-color: #f2f0eb; }

.tn-eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tn-muted);
  font-weight: 600;
}

/* Password field with a show/hide control. One field with a toggle instead
   of a second "confirm" field: it catches the same typos without asking
   anyone to type their password twice. */
.tn-password { position: relative; }
.tn-password .tn-input { padding-right: 68px; }
.tn-password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--tn-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.tn-password-toggle:hover { color: var(--tn-ink); background: var(--tn-border-soft); }

.tn-checkbox {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid #d9d5cb;
  accent-color: var(--tn-maple);
  cursor: pointer;
}

/* Tailwind's CDN build is v3; text-wrap landed in 3.4 but this keeps the
   landing's headline wrapping sane even if that build ever moves. */
.text-pretty { text-wrap: pretty; }
