/* Self-hosted faces (OFL): Fraunces display serif, IBM Plex Sans/Mono. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/fraunces-var.woff2) format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/fraunces-var.woff2) format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/fraunces-var.woff2) format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/fraunces-italic-var.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-var.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-var.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/ibm-plex-sans-var.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/ibm-plex-mono-400.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/ibm-plex-mono-500.woff2) format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/ibm-plex-mono-600.woff2) format("woff2");
}

/* Design tokens — dark is the default theme; light derives from the same set.
   Mobile-first: phone <480, tablet 480–1023, desktop ≥1024 (the layout switch). */
:root {
  color-scheme: dark;
  --gutter: 16px;
  --page-width: 1320px;
  --bg: #12151a;
  --panel: #171b21;
  --panel-2: #1c2129;
  --line: #2a2f38;
  --line-soft: #22262e;
  --ink: #e8e6de;
  --ink-dim: #9ca1ac;
  --ink-faint: #6b7078;
  --green: #5fbf77;
  --green-dim: #3e5c46;
  --red: #d97066;
  --red-dim: #5c3c39;
  --amber: #e8b84b;
  --amber-dim: #4a3d22;
  --chart-line: #6c9bff;
  /* Series colours: slots 1-7 are the dataviz reference palette (the
     dividends tab uses only these); 8-13 extend it for allocation charts,
     picked for the widest separation from the rest in both themes, normal
     and colour-blind vision. Slot 0 is "Other" and cash. */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #fcbfc2;
  --series-9: #70e4fe;
  --series-10: #9050ab;
  --series-11: #a7b5fc;
  --series-12: #db8ac1;
  --series-13: #c9bc6e;
  --series-0: #5b6470;
  /* Label ink on each series fill: whichever of white/near-black contrasts more. */
  --series-ink-0: #fff;
  --series-ink-1: #111;
  --series-ink-2: #111;
  --series-ink-3: #111;
  --series-ink-4: #111;
  --series-ink-5: #111;
  --series-ink-6: #fff;
  --series-ink-7: #111;
  --series-ink-8: #111;
  --series-ink-9: #111;
  --series-ink-10: #fff;
  --series-ink-11: #111;
  --series-ink-12: #111;
  --series-ink-13: #111;
  --header-bg: rgba(18, 21, 26, 0.92);
  --shadow: rgba(0, 0, 0, 0.45);
  --radius-s: 3px;
  --radius-m: 6px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #efece4;
  --line: #d8d4c9;
  --line-soft: #e6e2d8;
  --ink: #1c2027;
  --ink-dim: #5a606b;
  --ink-faint: #8a8f99;
  --green: #2e7d43;
  --green-dim: #dcefe2;
  --red: #b4433a;
  --red-dim: #f3dcda;
  --amber: #9a741c;
  --amber-dim: #f0e6cb;
  --chart-line: #2962ff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #843b43;
  --series-9: #41d9f8;
  --series-10: #905aa7;
  --series-11: #9aaafd;
  --series-12: #eaafd5;
  --series-13: #cec691;
  --series-0: #a3a3a3;
  /* Label ink on each series fill: whichever of white/near-black contrasts more. */
  --series-ink-0: #111;
  --series-ink-1: #fff;
  --series-ink-2: #111;
  --series-ink-3: #111;
  --series-ink-4: #111;
  --series-ink-5: #111;
  --series-ink-6: #fff;
  --series-ink-7: #fff;
  --series-ink-8: #fff;
  --series-ink-9: #111;
  --series-ink-10: #fff;
  --series-ink-11: #111;
  --series-ink-12: #111;
  --series-ink-13: #111;
  --header-bg: rgba(245, 243, 238, 0.92);
  --shadow: rgba(28, 32, 39, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.region a:hover,
.site-footer a:hover {
  color: var(--amber);
  text-decoration: underline;
}

h1,
h2 {
  font-family: "Fraunces", serif;
  font-weight: 500;
  line-height: 1.2;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- shell row / header ---------- */

.shell-row {
  width: min(100% - 2 * var(--gutter), var(--page-width));
  margin-inline: auto;
}

.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .shell-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-block: 0.65rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.3rem;
  white-space: nowrap;
}

.brand .cairn {
  flex: none;
  margin-top: -0.1rem;
}

.cairn-top {
  fill: var(--amber);
}

.primary-nav a {
  text-decoration: none;
  color: var(--ink-dim);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-m);
  font-size: 0.92rem;
  white-space: nowrap;
}

.primary-nav a:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.primary-nav a.active {
  color: var(--ink);
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-toggle,
.nav-toggle,
.search-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.4rem 0.55rem;
}

.theme-toggle:hover,
.nav-toggle:hover,
.search-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* The face inside an avatar: the member's initials on their Member color
   (#160), or their uploaded avatar image. */
.avatar-face {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--member-color, var(--panel-2));
  color: #111;
  overflow: hidden;
}

.avatar:has(.avatar-face) {
  border-color: transparent;
}

.avatar-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A company's logo (#227), or its initial on a plain badge when it has none.
   Sized by --logo-size from the ticker_logo tag. */
.ticker-logo {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--logo-size, 20px);
  height: var(--logo-size, 20px);
  border-radius: 22%;
  background: var(--panel-2);
  color: var(--ink-dim);
  font-size: calc(var(--logo-size, 20px) * 0.5);
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  vertical-align: middle;
}

.ticker-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Account drawer: clicking the header avatar slides a panel in from the right
   at every breakpoint — the single home for account actions, so neither the
   mobile nav nor a desktop dropdown carries its own copy. */
.avatar-trigger {
  padding: 0;
  cursor: pointer;
}

.settings-scrim {
  position: fixed;
  inset: 0;
  background: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
  z-index: 40;
}

body.settings-open .settings-scrim {
  opacity: 1;
  pointer-events: auto;
}

body.settings-open {
  overflow: hidden;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85vw, 20rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 1rem var(--gutter) 1.25rem;
  transform: translateX(100%);
  transition: transform 0.18s ease-out, width 0.2s ease-out;
  z-index: 41;
}

body.settings-open .settings-drawer {
  transform: none;
}

/* Opening a section widens the drawer into a sheet: the menu stays as a rail
   on the left and the section fills the rest (#161, prototype variant C). */
.settings-drawer.is-wide {
  width: min(100vw, 48rem);
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.settings-avatar {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 0.95rem;
}

.settings-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-user {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings-role {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.settings-close {
  margin-left: auto;
  padding: 0.25rem 0.55rem;
}

.settings-sheet {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.settings-drawer.is-wide .settings-sheet {
  grid-template-columns: 13rem minmax(0, 1fr);
}

.settings-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.settings-drawer.is-wide .settings-rail {
  border-right: 1px solid var(--line-soft);
  padding-right: 0.8rem;
}

.settings-menu {
  display: flex;
  flex-direction: column;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-m);
  color: var(--ink);
  text-decoration: none;
}

.settings-row:hover,
.settings-row.active {
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
}

.settings-icon {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  flex: none;
  color: var(--ink-dim);
}

.settings-icon .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-label small {
  font-size: 0.76rem;
  color: var(--ink-faint);
}

.settings-chevron,
.settings-end {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-faint);
}

.settings-sep {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0.45rem 0;
}

.settings-foot {
  margin: auto 0 0;
  padding-top: 1rem;
}

.settings-logout {
  width: 100%;
}

.settings-pane {
  display: none;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.settings-drawer.has-section .settings-pane {
  display: block;
}

.settings-pane-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.settings-pane-head h2 {
  margin: 0;
}

.settings-back {
  display: none;
  background: none;
  border: 0;
  padding: 0.2rem 0.1rem;
  color: var(--ink-dim);
  cursor: pointer;
  font: inherit;
}

/* Phones: the sheet goes full screen and shows the list, then the section
   with a Back button, never both. */
@media (max-width: 639px) {
  .settings-drawer.is-wide {
    width: 100vw;
    border-left: 0;
  }

  .settings-drawer.is-wide .settings-sheet {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-drawer.is-wide .settings-rail {
    border: 0;
    padding: 0;
  }

  .settings-drawer.has-section .settings-rail {
    display: none;
  }

  .settings-back {
    display: inline-block;
  }
}

.settings-mini-avatar {
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.55rem;
}

/* Profile section: avatar with its crop step, Member color swatches and a
   preview of how both look (#162). */
.profile-block {
  margin: 0 0 1.4rem;
}

.profile-title {
  margin: 0 0 0.55rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.profile-block .sub {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.4rem 0 0;
}

.avatar-current {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.avatar.avatar-large {
  width: 5.5rem;
  height: 5.5rem;
  font-size: 1.7rem;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.button-like {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  color: var(--ink);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 0.92rem;
}

.button-like:hover,
.button-like:focus-within {
  border-color: var(--ink-faint);
}

.button-like:focus-within {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.avatar-crop {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.avatar-crop[hidden],
.avatar-current[hidden] {
  display: none;
}

.avatar-stage {
  position: relative;
  width: 240px;
  height: 240px;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: #000;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.avatar-stage:active {
  cursor: grabbing;
}

.avatar-stage img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
}

.avatar-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 400px rgba(0, 0, 0, 0.58);
  pointer-events: none;
}

.avatar-zoom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 240px;
  color: var(--ink-dim);
}

.avatar-zoom input {
  flex: 1;
  padding: 0;
}

.avatar-crop-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.muted-link {
  color: var(--ink-dim);
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 2rem);
  gap: 0.5rem;
  /* Room for the selected ring (outline + offset), which the scrolling
     settings pane would otherwise clip on the edge swatches. */
  padding: 4px;
}

.color-swatch {
  position: relative;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
}

.color-swatch:hover {
  border: 0;
  filter: brightness(1.1);
}

.color-swatch.selected {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.color-swatch.taken {
  opacity: 0.35;
  cursor: not-allowed;
}

.color-swatch.taken::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  top: 50%;
  border-top: 2px solid #111;
  transform: rotate(-45deg);
}

.profile-preview {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.profile-preview-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.profile-preview .post-author {
  color: var(--ink);
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--amber);
  color: #111;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Admin page (#163) ---------- */

.admin-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.admin-page > .region + .region,
.admin-page #provider-settings-panel > .region + .region {
  margin-top: 1rem;
}

.provider-settings fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 0.9rem;
}

.provider-settings legend {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.provider-settings fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.stacked-form input[type="radio"],
.stacked-form input[type="checkbox"] {
  width: auto;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}

.add-member > summary {
  list-style: none;
}

.add-member > summary::-webkit-details-marker {
  display: none;
}

.add-member-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: min(100%, 20rem);
  margin-top: 0.6rem;
}

.add-member-form label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin-top: 0.3rem;
}

.add-member-form button {
  align-self: flex-start;
  margin-top: 0.4rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.admin-table .num {
  text-align: right;
}

.admin-table tr.row-pending td {
  background: color-mix(in srgb, var(--amber-dim) 35%, transparent);
}

.admin-table tr.row-deactivated td {
  color: var(--ink-faint);
}

.admin-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.admin-intro {
  margin: 0.35rem 0 0;
  max-width: 48ch;
  color: var(--ink-dim);
  font-size: 0.85rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.avatar.admin-avatar {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 0.72rem;
}

.admin-row-actions {
  text-align: right;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  padding: 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.55;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

.tag-amber,
.tag.status-pending {
  color: var(--amber);
  border-color: var(--amber-dim);
  background: var(--amber-dim);
}

.tag.status-approved {
  color: var(--green);
  border-color: var(--green-dim);
  background: var(--green-dim);
}

.tag.status-deactivated {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-dim);
}

.primary-button {
  color: var(--amber);
  border-color: var(--amber);
}

.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.1rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  color: var(--ink-dim);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.row-menu > summary::-webkit-details-marker {
  display: none;
}

.row-menu > summary:hover,
.row-menu[open] > summary {
  border-color: var(--line);
  color: var(--ink);
}

.row-menu-pop {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
  min-width: 14rem;
  padding: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 30px var(--shadow);
  text-align: left;
}

.row-menu-pop form {
  display: block;
}

.row-menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--ink);
  padding: 0.45rem 0.6rem;
}

.row-menu-pop button:hover {
  background: var(--panel-2);
}

.danger-button {
  color: var(--red);
}

.row-menu-pop .danger-button {
  color: var(--red);
}

.admin-users .admin-foot {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.admin-dialog {
  width: min(100% - 2 * var(--gutter), 27rem);
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 16px 40px var(--shadow);
}

.admin-dialog::backdrop {
  background: var(--shadow);
}

.admin-dialog h2 {
  font-size: 1.15rem;
}

.admin-dialog form {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.8rem;
}

.secret {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  margin: 0 0 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.secret code {
  flex: 1;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

/* Phones: each member becomes a card. */
@media (max-width: 719px) {
  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr {
    display: block;
  }

  .admin-table tr {
    position: relative;
    margin: 0 0 0.6rem;
    padding: 0.45rem 0.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
  }

  .admin-table td {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border: 0;
    font-size: 0.84rem;
  }

  .admin-table tr.row-pending td {
    background: none;
  }

  .admin-table td:first-child {
    display: block;
    padding-right: 3rem;
  }

  .admin-table td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--ink-faint);
    font-size: 0.76rem;
  }

  .admin-table .admin-row-actions {
    position: absolute;
    top: 0.45rem;
    right: 0.3rem;
    padding: 0;
  }

  .admin-table tr.row-pending .admin-row-actions {
    position: static;
    display: block;
    text-align: left;
    padding: 0.35rem 0.5rem 0.15rem;
  }
}

.forced-password {
  max-width: 28rem;
  margin: 2rem auto;
}

.forced-logout {
  margin-top: 1rem;
}

.mod-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mod-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.7rem 0.85rem;
}

.mod-where {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.mod-text {
  margin: 0.35rem 0 0;
  overflow-wrap: anywhere;
}

.mod-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.mod-thumb {
  position: relative;
  width: 84px;
  height: 63px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.mod-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mod-thumb form {
  position: absolute;
  top: 2px;
  right: 2px;
  margin: 0;
}

.mod-thumb button {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
}

.mod-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.55rem;
  font-size: 0.85rem;
}

.admin-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.admin-log-list li {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.admin-log-list time {
  color: var(--ink-faint);
}

@media (max-width: 539px) {
  .admin-log-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

.account-form {
  max-width: 24rem;
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.85rem;
}

.account-field label {
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.account-field .inline-error,
.account-field .account-hint {
  margin: 0;
}

.account-field .account-hint {
  font-size: 0.78rem;
}

.account-field textarea {
  width: 100%;
  max-width: 340px;
  resize: vertical;
}

.account-field ul {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Mobile header (<1024): wordmark + search icon + avatar; the nav becomes a
   slide-down panel and the search an overlay row. */
.primary-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  padding: 0.75rem var(--gutter) 1rem;
}

body.nav-open .primary-nav {
  display: flex;
}

.primary-nav a {
  padding: 0.6rem 0.75rem;
}

.header-search {
  position: relative;
  display: none;
}

body.search-open .header-search {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  padding: 0.75rem var(--gutter) 1rem;
}

body.search-open .header-query {
  width: 100%;
}

@media (min-width: 480px) {
  :root {
    --gutter: 20px;
  }
}

/* Desktop (≥1024): inline nav, visible search field, no toggles. */
@media (min-width: 1024px) {
  :root {
    --gutter: 24px;
  }

  .nav-toggle,
  .search-toggle {
    display: none;
  }

  .primary-nav {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    background: transparent;
    border-bottom: none;
    padding: 0;
  }

  .header-search {
    display: block;
  }
}

/* ---------- ticker tape ---------- */

/* The strip shares the site-wide centered column (header row and main
   container), so in fullscreen it lines up with the rest of the page instead
   of running edge to edge. Framed like a .region panel: full border + radius,
   no shadow. */
.ticker-tape {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  width: min(100% - 2 * var(--gutter), var(--page-width));
  margin-inline: auto;
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
}

/* Only the viewport clips the marquee, so the trailing-edge drawer can drop
   below the strip without being cut off. Its left corners follow the frame's
   radius (inset by the border) so items never poke past it. */
.tape-viewport {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  border-start-start-radius: calc(var(--radius-m) - 1px);
  border-end-start-radius: calc(var(--radius-m) - 1px);
}

/* Trailing edge sits in a reserved column right of the clipped viewport, so
   scrolling items are cut off before they can reach it. */
.tape-controls {
  position: relative;
  display: flex;
  justify-content: flex-end;
  padding-left: 0.9rem;
  padding-right: 0.45rem;
}

/* The gear toggles the drawer (details/summary, like the account menu). */
.tape-cog {
  list-style: none;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 0.3rem 0.5rem;
}

.tape-cog::-webkit-details-marker {
  display: none;
}

.tape-cog:hover,
.tape-drawer[open] .tape-cog {
  color: var(--ink);
  border-color: var(--line);
}

.tape-panel {
  display: none;
}

.tape-drawer[open] .tape-panel {
  display: grid;
  gap: 0.5rem;
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 11rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.75rem 1rem;
  z-index: 30;
}

.tape-panel form,
.tape-panel .speed-control {
  display: grid;
  gap: 0.3rem;
}

/* The speed bar spans the panel (a bare range input renders narrower). */
.tape-panel .speed-control input[type="range"] {
  width: 100%;
}

.tape-panel label {
  font-size: 0.8rem;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tape-panel button {
  justify-self: end;
  font-size: 0.75rem;
}

.tape-asof {
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--ink-faint);
  white-space: nowrap;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.45rem;
}

/* The track holds the item set in repeated .tape-set copies; each item
   carries its own trailing padding + separator. tape.js measures one set's
   pixel width and stores it as --tape-shift, so the loop distance is exact
   (the -50% fallback only applies when JS never ran). The cycle duration is
   --tape-duration: tape.js sets it to the set's width over the drawer's
   px/s speed (stored per browser), so the 60s fallback only applies when JS
   never ran. */
.tape-track {
  display: inline-flex;
  margin: 0;
  padding: 0.6rem 0;
  width: max-content;
  white-space: nowrap;
  animation: tape-scroll var(--tape-duration, 60s) linear infinite;
}

/* Speed changes restart the animation (negative delay keeps the row's
   position); this class is toggled for one reflow to force that restart. */
.tape-track.speed-swap {
  animation: none;
}

.tape-set {
  display: inline-flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticker-tape:hover .tape-track {
  animation-play-state: paused;
}

@keyframes tape-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--tape-shift, -50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape-viewport {
    overflow-x: auto;
  }

  .tape-track {
    animation: none;
    min-width: 100%;
  }

  .settings-drawer,
  .settings-scrim {
    transition: none;
  }
}

.tape-item {
  display: inline-flex;
  gap: 0.6rem;
  align-items: baseline;
  white-space: nowrap;
  padding: 0 1.75rem;
  border-right: 1px solid var(--line-soft);
}

.tape-item a {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
}

.tape-exchange {
  margin-left: 0.4rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--ink-faint);
}

.tape-item a:hover {
  text-decoration: underline;
}

.tape-price {
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.tape-change {
  font-size: 0.95rem;
  color: var(--ink-faint);
}

.tape-change.up {
  color: var(--green);
}

.tape-change.down {
  color: var(--red);
}

/* ---------- footer / main container ---------- */

.site-footer {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* The rule sits on the constrained inner row, so it spans the site column
   instead of running edge to edge in fullscreen. */
.site-footer .foot-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line-soft);
  padding-block: 1rem;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--page-width));
  margin-inline: auto;
  margin-block: 2rem 3rem;
  display: grid;
  gap: 1.25rem;
}

/* ---------- regions (panels) ---------- */

.region {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 1.25rem 1.5rem;
}

.region h1,
.region h2 {
  margin-top: 0;
}

.empty-state {
  color: var(--ink-faint);
}

.allocation-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

@media (min-width: 960px) {
  .allocation-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

.allocation-stat {
  min-width: 0;
}

.allocation-stat dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.allocation-stat dd {
  display: grid;
  margin: 0;
}

.allocation-stat dd strong {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
}

.allocation-stat dd span {
  font-size: 0.75rem;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treemap-svg {
  display: block;
  width: 100%;
  height: auto;
}

.treemap-narrow {
  display: none;
}

@media (max-width: 639px) {
  .treemap-wide {
    display: none;
  }

  .treemap-narrow {
    display: block;
  }
}

.treemap-block {
  cursor: pointer;
  outline: none;
}

.treemap-block > .series-fill {
  stroke: transparent;
  stroke-width: 2;
}

.treemap-block:hover > .series-fill,
.treemap-block:focus-visible > .series-fill,
.treemap-block.is-picked > .series-fill {
  stroke: var(--ink);
}

.treemap-member {
  fill: rgba(0, 0, 0, 0.14);
}

.treemap-label,
.treemap-member-label {
  pointer-events: none;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.treemap-label {
  font-size: 12px;
  font-weight: 600;
}

.treemap-member-label {
  font-size: 10.5px;
}

.treemap-block[data-slot="0"] text { fill: var(--series-ink-0); }
.treemap-block[data-slot="1"] text { fill: var(--series-ink-1); }
.treemap-block[data-slot="2"] text { fill: var(--series-ink-2); }
.treemap-block[data-slot="3"] text { fill: var(--series-ink-3); }
.treemap-block[data-slot="4"] text { fill: var(--series-ink-4); }
.treemap-block[data-slot="5"] text { fill: var(--series-ink-5); }
.treemap-block[data-slot="6"] text { fill: var(--series-ink-6); }
.treemap-block[data-slot="7"] text { fill: var(--series-ink-7); }
.treemap-block[data-slot="8"] text { fill: var(--series-ink-8); }
.treemap-block[data-slot="9"] text { fill: var(--series-ink-9); }
.treemap-block[data-slot="10"] text { fill: var(--series-ink-10); }
.treemap-block[data-slot="11"] text { fill: var(--series-ink-11); }
.treemap-block[data-slot="12"] text { fill: var(--series-ink-12); }
.treemap-block[data-slot="13"] text { fill: var(--series-ink-13); }

.treemap-details {
  margin-top: 0.75rem;
}

.treemap-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.treemap-detail h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.treemap-detail-total {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-dim);
}

.treemap-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.treemap-detail-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.treemap-detail-table th,
.treemap-detail-table td {
  padding: 0.2rem 0.75rem 0.2rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.treemap-detail-table th:nth-child(n + 2) {
  text-align: right;
}

.treemap-detail-table td:nth-child(n + 2) {
  text-align: right;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.treemap-detail-table td:first-child {
  overflow-wrap: anywhere;
}

.etf-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--ink-dim);
  vertical-align: 1px;
}

.allocation-foot {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* Look-through tab (#123). */
.look-through td:nth-child(n + 2),
.look-through th:nth-child(n + 2) {
  text-align: right;
  white-space: nowrap;
}

.look-through td:nth-child(n + 2) {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.look-row.open .security-expand::after {
  transform: rotate(90deg);
}

.look-funds > td {
  background: var(--panel-2);
}

.look-fund-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.look-fund-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.look-fund-list li span:last-child {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.look-rest td {
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
}

.etf-tag.look-warn {
  color: var(--amber);
  border-color: var(--amber-dim);
}

/* Over time tab (#124): a 100% stacked area; the SVG stretches to its box,
   axis labels are HTML so they never distort. */
.history-chart {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  grid-template-rows: auto 1.4rem;
}

.history-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 0.4rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--ink-faint);
  text-align: right;
}

.history-y span:first-child {
  transform: translateY(-0.2rem);
}

.history-y span:last-child {
  transform: translateY(0.2rem);
}

.history-plot {
  position: relative;
  height: 300px;
  cursor: crosshair;
}

.history-plot svg {
  display: block;
  width: 100%;
  height: 100%;
}

.history-band {
  stroke: var(--panel);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.history-other {
  opacity: 0.55;
}

.history-cross {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed var(--ink);
  pointer-events: none;
}

.history-x {
  grid-column: 2;
  position: relative;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.history-x span {
  position: absolute;
  top: 0.3rem;
  transform: translateX(-50%);
}

.history-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.history-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

@container (max-width: 639px) {
  .history-plot {
    height: 220px;
  }
}

/* Phones: one card per position; sorting moves into a links row. */
@container (max-width: 639px) {
  .allocation-card .security-sort {
    display: flex;
  }

  .look-through > thead {
    display: none;
  }

  .look-through,
  .look-through > tbody {
    display: block;
  }

  .look-through .look-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.1rem 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .look-through .look-row td:nth-child(n) {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .look-through .look-row .col-name {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .look-through .look-row .security-label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .look-through .look-row td[data-label]::before {
    content: attr(data-label) " ";
    display: block;
    color: var(--ink-faint);
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    font-size: 0.72rem;
  }

  .look-through .look-funds,
  .look-through .look-funds > td {
    display: block;
    padding: 0.4rem 0.5rem;
  }

  .look-through .look-funds[hidden] {
    display: none;
  }
}

.total {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

/* ---------- tables ---------- */

.positions-table,
.cash-table,
.movements-table,
.transactions-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}

.positions-table th,
.cash-table th,
.movements-table th,
.transactions-table th {
  text-align: right;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-faint);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.positions-table th:first-child,
.cash-table th:first-child,
.movements-table th:first-child,
.transactions-table th:first-child {
  text-align: left;
}

.positions-table td,
.cash-table td,
.movements-table td,
.transactions-table td {
  text-align: right;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

.positions-table td:first-child,
.cash-table td:first-child,
.movements-table td:first-child,
.transactions-table td:first-child {
  text-align: left;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.positions-table tbody tr:last-child td,
.cash-table tbody tr:last-child td,
.movements-table tbody tr:last-child td,
.transactions-table tbody tr:last-child td {
  border-bottom: none;
}

.positions-table tbody tr:hover,
.cash-table tbody tr:hover,
.movements-table tbody tr:hover,
.transactions-table tbody tr:hover {
  background: var(--panel-2);
}

/* ---------- load more (#62) ---------- */

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-scroll th:first-child,
.table-scroll td:first-child {
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
}

.table-scroll tbody tr:hover td:first-child {
  background: var(--panel-2);
}

/* ---------- watch control, toast (#146) ---------- */

.watch-ctl {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.watch-ctl .inline-form {
  display: inline-flex;
}

.watch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.88rem;
}

.watch-glyph {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.watch-ctl.on .watch-toggle {
  color: var(--amber);
}

.watch-ctl.on .watch-glyph {
  fill: var(--amber);
  stroke: var(--amber);
}

.watch-ctl.compact {
  flex-wrap: nowrap;
  gap: 0.15rem;
}

.wl-page .tk-sub .link-button {
  color: var(--amber);
}

.watch-ctl.compact .watch-toggle {
  border-color: transparent;
  padding: 0.2rem 0.3rem;
}

.watch-ctl.compact .watch-toggle:hover {
  border-color: var(--line);
}

.watch-picker > summary {
  list-style: none;
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 0.72rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.watch-ctl.compact .watch-picker > summary {
  border-color: transparent;
}

.watch-picker > summary::-webkit-details-marker {
  display: none;
}

.watch-picker > summary:hover,
.watch-picker[open] > summary {
  color: var(--ink);
  border-color: var(--line);
}

.watch-pop {
  position: absolute;
  z-index: 40;
  right: 0;
  top: calc(100% + 6px);
  width: min(290px, 86vw);
  display: grid;
  gap: 0.35rem;
  padding: 0.7rem;
  text-align: left;
  white-space: normal;
  font-size: 0.88rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 30px var(--shadow);
}

.tk-actions .watch-pop {
  left: 0;
  right: auto;
}

.watch-pop-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.watch-pop-pin {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.watch-notice {
  display: grid;
  gap: 0.25rem;
  padding: 0.45rem 0.55rem;
  border-left: 3px solid var(--amber);
  background: var(--amber-dim);
  border-radius: var(--radius-s);
  font-size: 0.8rem;
}

.watch-notice .link-button,
.watch-as .link-button,
.toast .link-button {
  color: var(--amber);
  font-weight: 600;
}

.watch-lists {
  display: grid;
}

.watch-list-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.35rem;
  border-radius: var(--radius-s);
  cursor: pointer;
}

.watch-list-row:hover {
  background: var(--panel-2);
}

.watch-list-row input {
  accent-color: var(--amber);
}

.watch-new {
  display: flex;
  gap: 0.35rem;
}

.watch-new input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

.watch-new button,
.watch-done {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}

.watch-pop-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line-soft);
}

.watch-pop-foot .link-button {
  font-size: 0.85rem;
}

.watch-as {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.toast-slot {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 70;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
}

.toast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  border-radius: var(--radius-m);
  box-shadow: 0 8px 24px var(--shadow);
}

.toast.refuse {
  border-left-color: var(--amber);
}

.toast-close {
  border: 0;
  padding: 0 0.2rem;
  font-size: 1.1rem;
  line-height: 1;
}

/* ---------- watchlists page (#153, #154) ---------- */

.wl-page {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

/* Its sections stay the page's width; the tab strip scrolls inside them. */
.wl-page > * {
  min-width: 0;
}

.wl-page .up { color: var(--green); }
.wl-page .down { color: var(--red); }
.wl-page .faint { color: var(--ink-faint); }

.wl-page h1 {
  margin: 0;
}

.wl-tabbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  margin-bottom: 0.9rem;
}

.wl-tabs {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  margin-left: -0.25rem;
  padding: 0 0.25rem 0.25rem;
  scrollbar-width: thin;
}

.wl-new {
  position: relative;
  flex: none;
  margin-bottom: 0.25rem;
}

.wl-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.88rem;
  color: var(--ink-dim);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  user-select: none;
  cursor: pointer;
}

.wl-tab:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.wl-tab.active {
  color: var(--ink);
  font-weight: 600;
  background: var(--panel-2);
  border-color: var(--line);
}

.wl-tab.default {
  font-family: "Fraunces", serif;
  font-style: italic;
}

.wl-tab.add {
  color: var(--amber);
  border: 1px dashed var(--line);
  list-style: none;
}

.wl-tab.add::-webkit-details-marker {
  display: none;
}

.wl-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-faint);
}

.wl-grip {
  color: var(--ink-faint);
  cursor: grab;
  touch-action: none;
  padding: 0 0.1rem;
}

.wl-grip:hover {
  color: var(--ink);
}

.wl-dragging {
  opacity: 0.55;
  outline: 1px dashed var(--amber);
}

.wl-new-pop,
.wl-menu-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  display: grid;
  gap: 0.5rem;
  width: min(280px, 86vw);
  padding: 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 10px 30px var(--shadow);
  font-size: 0.88rem;
}

.wl-new-pop {
  left: 0;
}

/* On a phone the button may sit anywhere along the row: the popover hangs
   from the whole tab bar instead, so it starts at the page's edge. */
@media (max-width: 640px) {
  .wl-new {
    position: static;
  }

  .wl-new-pop {
    width: min(280px, 100%);
  }
}

.wl-menu-pop {
  right: 0;
}

.wl-new-form,
.wl-rename {
  display: flex;
  gap: 0.35rem;
  min-width: 0;
}

.wl-new-form input,
.wl-rename input {
  flex: 1;
  min-width: 0;
}

.wl-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-bottom: 0.6rem;
}

.wl-countline {
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.wl-grow {
  flex: 1;
}

.wl-select {
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
}

.wl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-dim);
  cursor: pointer;
  white-space: nowrap;
}

.wl-toggle input {
  accent-color: var(--amber);
}

.wl-menu {
  position: relative;
}

.wl-menu-button {
  list-style: none;
  cursor: pointer;
  color: var(--ink-dim);
  padding: 0.15rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  letter-spacing: 0.05em;
}

.wl-menu-button::-webkit-details-marker {
  display: none;
}

.wl-menu-button:hover,
.wl-menu[open] > .wl-menu-button {
  color: var(--ink);
  border-color: var(--line);
}

.wl-menu-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.wl-menu-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.wl-delete-slot .link-button,
.wl-delete-confirm .danger,
.watch-pop-foot .danger {
  color: var(--red);
}

.wl-delete-confirm p {
  margin: 0 0 0.4rem;
}

.wl-impact {
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.wl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.wl-table th {
  padding: 0.4rem 0.5rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.wl-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  vertical-align: middle;
}

.wl-table th:first-child,
.wl-table td:first-child {
  padding-left: 0;
}

.wl-table .num {
  text-align: right;
}

.wl-table tbody tr:hover td {
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
}

.wl-name {
  white-space: normal !important;
}

.wl-name a {
  font-weight: 500;
}

.wl-idline {
  display: block;
  font-size: 0.76rem;
  color: var(--ink-faint);
}

/* Held in the member's portfolio: a briefcase beside the name. */
.wl-held {
  display: inline-flex;
  vertical-align: -0.1em;
  color: var(--amber);
}

.wl-held svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.wl-chart {
  width: 110px;
}

.wl-spark {
  display: block;
  width: 96px;
  height: 26px;
  overflow: visible;
}

.wl-spark polyline {
  fill: none;
  stroke-width: 1.4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke: var(--ink-faint);
}

.wl-spark.up polyline {
  stroke: var(--green);
}

.wl-spark.down polyline {
  stroke: var(--red);
}

/* Day: the week before in grey, today's move in colour. */
.wl-spark.day polyline:not(.head) {
  stroke: var(--ink-faint);
  opacity: 0.55;
}

.wl-spark .head {
  stroke-width: 2.2;
}

.wl-spark-none {
  color: var(--ink-faint);
}

.wl-cur {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* The list's period: its column lit, its header underlined. */
.wl-table .sel {
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
}

.wl-table th.sel {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--amber);
}

.wl-table td.sel {
  font-weight: 600;
}

/* Header buttons: a period (picked again, sorts by it) or the A–Z sort. */
.wl-per {
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  background: none;
  border: 1px dashed transparent;
  border-radius: var(--radius-s);
  padding: 0.1rem 0.3rem;
  margin: -0.1rem -0.3rem;
  cursor: pointer;
  white-space: nowrap;
}

.wl-per:hover {
  color: var(--ink);
  border-color: var(--line);
}

.wl-per.on {
  color: var(--ink);
}

@container (max-width: 1100px) {
  .wl-table .wl-opt:not(.sel),
  .wl-table .wl-dg {
    display: none;
  }
}

.wl-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.wl-meta.has-posts {
  color: var(--ink-dim);
}

.wl-meta svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.wl-act {
  width: 1%;
  padding-right: 0 !important;
  text-align: right;
}

/* ---------- performance comparison (#58) ---------- */

.timeframe-picker {
  /* The year popover hangs from the whole row (not its own button) so it
     can be capped to the row's width and never reaches past a narrow card. */
  position: relative;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.tf-btn {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.tf-btn:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.tf-btn.active {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--ink-faint);
  font-weight: 600;
}


.year-popover summary {
  list-style: none;
}

.year-popover summary::-webkit-details-marker {
  display: none;
}

.year-grid {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 10;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  width: max-content;
  max-width: min(280px, 100%);
  box-sizing: border-box;
  padding: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.year-link {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.85rem;
}

.year-link:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

/* ---------- forms & buttons ---------- */

button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
}

button:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.cta {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-m);
  text-decoration: none;
  font-weight: 600;
}

.cta:hover {
  color: var(--amber);
  border-color: var(--ink-faint);
  text-decoration: none;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--red);
  cursor: pointer;
  font: inherit;
}

input,
select,
textarea {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--panel-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink-faint);
}

label {
  display: block;
  color: var(--ink-dim);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.stacked-form p {
  margin: 0.75rem 0;
}

.stacked-form input,
.stacked-form select {
  width: 100%;
  max-width: 340px;
}

.entry-form > * {
  display: block;
  margin: 0.6rem 0;
}

.entry-form input:not([type="hidden"]),
.entry-form select,
.entry-form textarea {
  width: 100%;
  max-width: 340px;
}

.cash-form {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
}

.cash-form > * {
  display: block;
}

.sharing-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.rename-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.rename-form input {
  max-width: 24rem;
}

.delete-confirm-text {
  color: var(--ink-dim);
  font-size: 0.92rem;
}

.danger-note {
  margin: 0;
  color: var(--red);
  font-size: 0.85rem;
}

.errorlist {
  color: var(--red);
  display: block;
  font-size: 0.85rem;
}

.notice {
  background: var(--amber-dim);
  border: 1px solid var(--amber);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-m);
  color: var(--ink);
}

.messages {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.message {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-m);
  color: var(--ink);
}

.message-error {
  background: var(--red-dim);
  border-color: var(--red);
}

/* ---------- ticker search (form typeahead) ---------- */

.ticker-search {
  position: relative;
}

.ticker-candidates {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0.1rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 4px 12px var(--shadow);
  max-height: 320px;
  overflow-y: auto;
}

.ticker-candidates li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  color: var(--ink);
}

/* One instrument's listings sit together: a rule between instruments, the
   name only on each instrument's first row. */
.ticker-candidates li.group-start {
  border-top: 1px solid var(--line);
}

.ticker-candidates li.group-cont {
  padding-top: 0.15rem;
}

.ticker-candidates li.group-cont .candidate-name {
  visibility: hidden;
}

.candidate-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-meta {
  flex-shrink: 0;
  color: var(--ink-faint);
  font-size: 0.85em;
  white-space: nowrap;
}

.ticker-candidates li:hover,
.ticker-candidates li.active {
  background: var(--panel-2);
}

/* Form typeaheads (.ticker-search) can be narrow: a row too tight for the
   whole name drops symbol, venue and currency onto a line of their own
   instead of cutting the name short. Continuation rows show only those. */
.ticker-search .ticker-candidates li {
  flex-wrap: wrap;
  row-gap: 0.1rem;
}

.ticker-search .candidate-meta {
  margin-left: auto;
}

.ticker-search .ticker-candidates li.group-cont .candidate-name {
  display: none;
}

.ticker-candidates li.search-error {
  color: var(--red);
  cursor: default;
}

.ticker-candidates li.search-error:hover {
  background: none;
}

.header-query {
  width: 14rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.9rem;
}

.header-query::placeholder {
  color: var(--ink-faint);
}

/* Header search rows carry the watch control; while its list picker is
   open the dropdown stops clipping so the picker can float over the page. */
.header-dropdown li {
  align-items: center;
}

.search-watch {
  display: inline-flex;
  margin-left: -0.35rem;
}

.header-dropdown:has(.watch-picker[open]) {
  overflow: visible;
  max-height: none;
}

.search-move {
  color: var(--amber);
  font-size: 0.78rem;
}

.header-dropdown {
  width: max-content;
  min-width: 100%;
  max-width: 34rem;
  left: auto;
  right: 0;
}

.ticker-selected {
  font-weight: 600;
  margin-left: 0.5rem;
}

.sharing-tier {
  color: var(--ink-faint);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cash-balance {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

/* ---------- ticker page ---------- */

.price-chart {
  width: 100%;
  height: clamp(240px, 38vw, 360px);
  margin: 1rem 0;
}

.chart-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.range-btn {
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}

.range-btn:hover {
  color: var(--ink);
  border-color: var(--line);
}

.range-btn.active {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
  font-weight: 600;
}

.chart-style-toggle {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}

.chart-style-toggle button {
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}

.chart-style-toggle button:hover {
  color: var(--ink);
  border-color: var(--line);
}

.chart-style-toggle button.active {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
  font-weight: 600;
}

/* ---------- social ---------- */

.post-text {
  overflow-wrap: anywhere;
}

.cancel-link {
  margin-left: 0.75rem;
}

/* ---------- activity: trade timeline ---------- */

.trade-timeline {
  margin: 0.75rem 0 1.75rem;
}

.timeline-sub {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.timeline {
  position: relative;
  margin-top: 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--panel);
  padding: 0.55rem 0.4rem 0.6rem;
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding: 0 0.35rem 0.35rem;
}

.timeline-ranges,
.timeline-zoom {
  display: inline-flex;
  gap: 0.25rem;
}

.timeline-zoom .range-btn {
  min-width: 1.9rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.timeline-count {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.timeline-plot {
  position: relative;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  border-radius: var(--radius-s);
  outline: none;
}

.timeline-plot:focus-visible {
  box-shadow: 0 0 0 2px var(--line);
}

.timeline-plot.is-dragging {
  cursor: grabbing;
}

.timeline-svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.tl-grid line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.tl-grid line.tl-grid-major {
  stroke: var(--line);
}

.tl-tick {
  fill: var(--ink-faint);
  font-size: 11px;
  text-anchor: middle;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.tl-tick-major {
  fill: var(--ink-dim);
  font-weight: 600;
}

.tl-axis {
  stroke: var(--ink-faint);
  stroke-width: 1;
}

.tl-today {
  stroke: var(--amber);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

.tl-mark {
  cursor: pointer;
}

.tl-mark path {
  stroke: var(--panel);
  stroke-width: 1.5;
  paint-order: stroke;
  transition: transform 100ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.tl-mark:hover path,
.tl-mark.is-active path,
.tl-mark:focus-visible path {
  transform: scale(1.45);
  stroke: var(--ink);
  stroke-width: 1;
}

.tl-mark:focus-visible {
  outline: none;
}

.tl-hit {
  fill: transparent;
}

.tl-more {
  fill: var(--ink-dim);
  font-size: 10px;
  text-anchor: middle;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.timeline-tip {
  position: absolute;
  z-index: 5;
  min-width: 12rem;
  max-width: 18rem;
  padding: 0.5rem 0.65rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: 0 4px 14px var(--shadow);
  font-size: 0.8rem;
  pointer-events: none;
  display: grid;
  gap: 0.2rem;
}

.timeline-tip[hidden] {
  display: none;
}

.tl-tip-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--ink);
}

.tl-tip-side {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.tl-tip-buy {
  color: var(--green);
}

.tl-tip-sell {
  color: var(--red);
}

.tl-tip-amount {
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}

.tl-tip-who,
.tl-tip-when {
  color: var(--ink-dim);
}

.tl-tip-who {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tl-tip-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.timeline-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.4rem 0.35rem 0;
}

.timeline-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
}

.timeline-member {
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 0.1rem 0.45rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.timeline-member:hover {
  border-color: var(--line);
  color: var(--ink);
}

.timeline-member .swatch {
  width: 0.65em;
  height: 0.65em;
  border-radius: 2px;
}

.timeline-member[aria-pressed="false"] {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.timeline-member[aria-pressed="false"] .swatch {
  opacity: 0.3;
}

.timeline-key {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
}

.key-buy,
.key-sell {
  font-size: 0.7rem;
  color: var(--ink-dim);
}

@container (max-width: 640px) {
  .timeline-hint {
    display: none;
  }
}

/* ---------- credits ---------- */

.credits-list {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.9rem;
}

.credits-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 600;
}

.credits-list dd {
  margin: 0.2rem 0 0;
  color: var(--ink-dim);
}

/* ---------- entrance: login and access requests ----------
   A membership card on a faint pinstripe, outside the site shell. */

.entrance {
  min-height: 100vh;
  min-height: 100svh;
  background:
    repeating-linear-gradient(
      135deg,
      transparent 0 11px,
      color-mix(in srgb, var(--line-soft) 28%, transparent) 11px 12px
    ),
    var(--bg);
}

.entrance-theme {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
}

.entrance-main {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 3rem var(--gutter);
}

.entrance-wrap {
  width: min(100%, 25rem);
}

.entrance-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2.6rem 2.2rem 2.2rem;
  box-shadow: 0 24px 60px -20px var(--shadow);
}

/* the inner amber hairline of the double frame */
.entrance-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
  pointer-events: none;
}

.entrance-head {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  margin-bottom: 1.9rem;
  text-align: center;
}

.cairn {
  display: block;
  color: var(--ink);
}

.entrance-word {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.entrance-ornament {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
}

.entrance-ornament::before,
.entrance-ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.entrance-ornament span,
.entrance-colophon,
.entrance-field label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.entrance-card h1 {
  margin: 0 0 1.2rem;
  font-size: 1.35rem;
  font-weight: 400;
  font-style: italic;
  text-align: center;
}

.entrance-lede {
  margin: -0.4rem 0 1.6rem;
  color: var(--ink-dim);
  font-size: 0.88rem;
  text-align: center;
}

.entrance-form {
  display: grid;
  gap: 1.15rem;
}

.entrance-field label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.entrance-field input,
.entrance-field textarea {
  width: 100%;
  padding: 0.45rem 0 0.55rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.entrance-field textarea {
  min-height: 4.6rem;
  resize: vertical;
}

.entrance-field input:focus,
.entrance-field textarea:focus {
  border-bottom-color: var(--amber);
}

.entrance-field .inline-error {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.entrance-hint {
  margin: 0.35rem 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  line-height: 1.4;
}

.entrance-alert,
.entrance-note {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-s);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
}

.entrance-alert p {
  margin: 0;
}

.entrance-alert {
  background: var(--red-dim);
  border-left: 2px solid var(--red);
}

.entrance-note {
  background: var(--amber-dim);
  border-left: 2px solid var(--amber);
}

.entrance-submit {
  width: 100%;
  height: 2.9rem;
  margin-top: 0.4rem;
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius-s);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.entrance-submit:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--panel);
}

.entrance-alt {
  margin: 1.6rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-dim);
  font-size: 0.86rem;
  text-align: center;
}

.entrance-alt a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.entrance-alt a:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.entrance-colophon {
  margin: 1.4rem 0 0;
  font-size: 0.6rem;
  color: var(--ink-faint);
  text-align: center;
}

@media (max-width: 479px) {
  .entrance-card {
    padding: 2.2rem 1.4rem 1.8rem;
  }
}

/* ---------- htmx spinners & inline errors ---------- */

.spinner,
.submit-spinner {
  display: none;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--ink-dim);
  vertical-align: -0.1em;
}

.spinner.htmx-request,
form[data-submit-spinner].is-submitting .submit-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.inline-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.inline-warning {
  color: var(--amber);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.inline-notice {
  color: var(--green);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.analytics-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.scope-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.grouping-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.grouping-switcher a {
  font-size: 0.8rem;
  color: var(--ink-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 0.15rem 0.55rem;
}

.grouping-switcher a:hover {
  color: var(--ink);
  border-color: var(--line);
  text-decoration: none;
}

.grouping-switcher a.active {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
  font-weight: 600;
}

.cash-toggle {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.cash-toggle a.active {
  color: var(--ink);
  font-weight: 600;
}

.donut {
  width: clamp(140px, 24vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--panel);
}

/* SVG donut (home allocation card): per-segment hover + tooltip */
.donut-chart {
  position: relative;
  width: clamp(140px, 24vw, 190px);
  flex-shrink: 0;
}

.donut-svg {
  display: block;
  width: 100%;
  height: auto;
}

.donut-seg {
  cursor: default;
  transition: opacity 120ms ease, stroke-width 120ms ease;
  outline: none;
}

.donut-chart.is-hovering .donut-seg:not(.is-active) {
  opacity: 0.45;
}

.donut-seg.is-active {
  stroke-width: 10.5;
}

.donut-tip {
  position: absolute;
  z-index: 5;
  /* The chart is narrower than the tip: without max-content the tip shrinks to
     the room left of its offset, so its width (and the clamp) shifts with
     every pointer move. */
  width: max-content;
  min-width: 11rem;
  max-width: 17rem;
  padding: 0.5rem 0.65rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: 0 4px 14px var(--shadow);
  color: var(--ink);
  font-size: 0.8rem;
  pointer-events: none;
  display: grid;
  gap: 0.2rem;
}

.donut-tip[hidden] {
  display: none;
}

.donut-tip-head,
.donut-tip-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.donut-tip-head {
  padding-bottom: 0.2rem;
}

.donut-tip-row {
  color: var(--ink-dim);
}

.donut-tip-row strong {
  color: var(--ink);
  font-weight: 600;
  min-width: 3.6em;
}

.donut-tip-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  align-self: center;
  flex-shrink: 0;
}

.donut-tip-value {
  margin-left: auto;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

.etf-toggle-form label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* The card stretches to the hero's height beside it; the donut takes all the
   room left over, as large as the smaller of its width and height allow. */
.allocation-card {
  display: flex;
  flex-direction: column;
}

.allocation-card .donut-chart {
  width: min(100cqw, 100cqh, 28rem);
}

.allocation-card .cash-toggle {
  margin-top: 1rem;
}

.ticker-sub {
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.sub {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin-top: -0.5rem;
}

/* Import wizard (#93) */
.import-wizard .iw-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius-m);
  padding: 1.6rem;
  text-align: center;
  color: var(--ink-dim);
  cursor: pointer;
  background: var(--panel);
}

.import-wizard .iw-drop.dragover {
  border-color: var(--chart-line);
  background: rgba(108, 155, 255, 0.06);
}

.iw-files {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.iw-chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
}

.iw-chip em {
  color: var(--ink-faint);
  font-style: normal;
  margin-left: 0.4rem;
}

.iw-chip-error {
  border-color: var(--red-dim);
  color: var(--red);
}

.iw-steps {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.iw-steps li {
  color: var(--ink-faint);
  font-size: 0.85rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
}

.iw-steps li.active {
  color: var(--ink);
  border-color: var(--chart-line);
  background: rgba(108, 155, 255, 0.07);
}

.iw-steps li.done {
  color: var(--green);
  border-color: var(--green-dim);
}

.iw-step-actions {
  margin-top: 1rem;
}

.iw-counts {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

.iw-status {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.iw-status-new {
  color: var(--green);
  border-color: var(--green-dim);
  background: rgba(95, 191, 119, 0.08);
}

.iw-status-attention {
  color: var(--amber);
  border-color: var(--amber-dim);
  background: rgba(232, 184, 75, 0.08);
}

.iw-status-imported {
  color: var(--ink-faint);
  border-color: var(--line-soft);
}

.iw-status-rejected {
  color: var(--red);
  border-color: var(--red-dim);
  background: rgba(217, 112, 102, 0.08);
}

.import-wizard tr[data-status="rejected"] td {
  opacity: 0.75;
}

.iw-reason {
  color: var(--red);
  font-size: 0.75rem;
  margin-top: 0.2rem;
  max-width: 30ch;
}

.iw-note {
  color: var(--ink-faint);
  font-size: 0.75rem;
  margin-top: 0.2rem;
  max-width: 30ch;
}

.iw-override {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.iw-bar {
  display: flex;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.9rem;
}

.import-wizard .iw-group {
  margin-top: 1rem;
}

.import-wizard .iw-group h3 {
  font-size: 0.9rem;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.35rem;
}

.iw-line {
  margin: 0.3rem 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.iw-done {
  color: var(--green);
}

.import-wizard .spacer {
  flex: 1;
}

.iw-resolve-search {
  width: 12rem;
}

/* Candidates render inline (not absolute) so the scrollable review table never clips them. */
.iw-resolve .ticker-candidates {
  position: static;
  margin-top: 0.3rem;
}

.iw-resolve-manual {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.iw-resolve-manual input[name="symbol"] {
  width: 7rem;
}

.iw-resolve-manual input[name="exchange"] {
  width: 6rem;
}

/* ---------- analytics tabs & dividends tab ---------- */

.analytics-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin: 0 0 1rem;
}

.analytics-tabs a {
  padding: 0.4rem 0.85rem;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.analytics-tabs a:hover {
  color: var(--ink);
  text-decoration: none;
}

.analytics-tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--amber);
  font-weight: 600;
}

/* Grid items default to min-width: auto, which lets a wide nested table
   stretch the whole card; the payments table scrolls inside instead. */
#dividend-securities {
  min-width: 0;
}

/* The member's dividend amount basis, set from the Dividends tab: each
   button submits its value, so it works without JS. */
.basis-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.dividend-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@container (min-width: 520px) {
  .dividend-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.dividend-tile {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.55rem 0.75rem;
  min-width: 0;
}

.dividend-tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.dividend-tile-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 600;
}

.dividend-tile-sub {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.dividend-tile-sub.up {
  color: var(--green);
}

.dividend-tile-sub.down {
  color: var(--red);
}

.dividend-tiles-foot {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.6rem 0 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.card-head h2 {
  margin: 0;
}

.card-head .timeframe-picker {
  margin-bottom: 0;
}

.series-key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}

.series-0 { background: var(--series-0); }
.series-1 { background: var(--series-1); }
.series-2 { background: var(--series-2); }
.series-3 { background: var(--series-3); }
.series-4 { background: var(--series-4); }
.series-5 { background: var(--series-5); }
.series-6 { background: var(--series-6); }
.series-7 { background: var(--series-7); }
.series-8 { background: var(--series-8); }
.series-9 { background: var(--series-9); }
.series-10 { background: var(--series-10); }
.series-11 { background: var(--series-11); }
.series-12 { background: var(--series-12); }
.series-13 { background: var(--series-13); }

.dividend-securities th a {
  color: inherit;
  white-space: nowrap;
}

.dividend-securities th a.active {
  color: var(--ink);
}

.security-expand {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  text-align: left;
}

.security-expand::after {
  content: "▸";
  color: var(--ink-faint);
  transition: transform 0.15s;
}

.security-row.open .security-expand::after {
  transform: rotate(90deg);
}

.security-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dividend-securities .col-name .ticker-sub {
  display: block;
  margin-left: calc(10px + 0.45rem);
}

.share-bar {
  display: inline-block;
  width: 56px;
  height: 6px;
  margin-right: 0.45rem;
  vertical-align: middle;
  background: var(--panel-2);
  border-radius: 3px;
  overflow: hidden;
}

.share-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.security-payments > td {
  background: var(--panel-2);
}

.security-full-name {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.payments-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.payments-table th {
  text-align: left;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 500;
  color: var(--ink-faint);
}

.payments-table th,
.payments-table td {
  padding: 0.15rem 0.75rem 0.15rem 0;
  white-space: nowrap;
}

.dividend-securities tfoot td {
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.security-sort {
  display: none;
  font-size: 0.8rem;
  color: var(--ink-faint);
  gap: 0.25rem 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.security-sort a.active {
  color: var(--ink);
  font-weight: 600;
}

/* Phones: one card per security; sorting moves from the header row into a
   links row, and the payments table scrolls inside its card. */
@container (max-width: 639px) {
  .security-sort {
    display: flex;
  }

  .dividend-securities > thead {
    display: none;
  }

  /* Date, per share, tax and net fit a phone; shares and gross stay on wider screens. */
  .payments-table th:nth-child(2),
  .payments-table td:nth-child(2),
  .payments-table th:nth-child(4),
  .payments-table td:nth-child(4) {
    display: none;
  }

  .dividend-securities,
  .dividend-securities > tbody,
  .dividend-securities > tfoot {
    display: block;
  }

  .dividend-securities .security-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.1rem 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .dividend-securities .security-row td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .dividend-securities .security-row .col-name {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .dividend-securities .security-row td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--ink-faint);
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    font-size: 0.75rem;
  }

  .dividend-securities .security-payments,
  .dividend-securities .security-payments > td {
    display: block;
    padding: 0.5rem;
  }

  .dividend-securities .security-payments[hidden] {
    display: none;
  }

  .security-payments > td {
    overflow-x: auto;
  }

  .dividend-securities tfoot tr {
    display: flex;
    gap: 1rem;
    padding-top: 0.5rem;
  }

  .dividend-securities tfoot td {
    border: 0;
    padding: 0;
  }

  .share-bar {
    display: none;
  }
}

/* ---------- dividends tab charts ---------- */

.dividend-card {
  min-width: 0;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.year-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.year-stepper .tf-btn {
  padding: 0.1rem 0.6rem;
  font: inherit;
  cursor: pointer;
}

.year-stepper .tf-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.year-stepper-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  min-width: 3rem;
  text-align: center;
}

.dividend-chart {
  width: 100%;
  min-height: 200px;
}

.chart-svg {
  display: block;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--ink-faint);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
}

.chart-hit {
  fill: transparent;
  cursor: default;
  outline: none;
}

.chart-hit:focus-visible {
  fill: var(--panel-2);
  fill-opacity: 0.6;
}

.series-fill.series-0 { fill: var(--series-0); }
.series-fill.series-1 { fill: var(--series-1); }
.series-fill.series-2 { fill: var(--series-2); }
.series-fill.series-3 { fill: var(--series-3); }
.series-fill.series-4 { fill: var(--series-4); }
.series-fill.series-5 { fill: var(--series-5); }
.series-fill.series-6 { fill: var(--series-6); }
.series-fill.series-7 { fill: var(--series-7); }
.series-fill.series-8 { fill: var(--series-8); }
.series-fill.series-9 { fill: var(--series-9); }
.series-fill.series-10 { fill: var(--series-10); }
.series-fill.series-11 { fill: var(--series-11); }
.series-fill.series-12 { fill: var(--series-12); }
.series-fill.series-13 { fill: var(--series-13); }

.chart-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-line-label {
  fill: var(--ink-dim);
  font-size: 11px;
}

.chart-tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  min-width: 180px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 6px 24px var(--shadow);
}

.chart-tip-title {
  color: var(--ink-dim);
  font-size: 0.75rem;
}

.chart-tip-total {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.chart-tip-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-tip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tip-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.chart-tip-note {
  margin-top: 0.25rem;
  color: var(--ink-faint);
  font-size: 0.75rem;
}

.series-legend {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.series-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  line-height: 1.6;
}

.series-legend-items.collapsed {
  max-height: 3.2em;
  overflow: hidden;
}

.series-legend-item {
  font: inherit;
  color: var(--ink-dim);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
}

.series-legend-item.static {
  cursor: default;
}

.series-legend-item:not(.static):hover,
.series-legend-item[aria-pressed="true"] {
  color: var(--ink);
}

.series-legend-item.dimmed {
  opacity: 0.4;
}

.series-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

.series-legend-more {
  font: inherit;
  font-size: 0.8rem;
  color: var(--amber);
  background: none;
  border: 0;
  padding: 0.2rem 0 0;
  cursor: pointer;
}

@container (max-width: 639px) {
  .series-legend-label {
    max-width: 11rem;
  }
}

/* ---------- dividends calendar heatmap ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dividend-card[data-granularity="m"] .heatmap-q,
.dividend-card[data-granularity="q"] .heatmap-m {
  display: none;
}

.granularity-toggle {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.granularity-toggle .tf-btn {
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.dividend-heatmap {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 2px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.dividend-heatmap th {
  color: var(--ink-faint);
  font-weight: 500;
  text-align: center;
}

.dividend-heatmap thead th:first-child,
.dividend-heatmap tbody th {
  width: 3.4rem;
  text-align: left;
}

.dividend-heatmap .heat-sum {
  width: 4.4rem;
  text-align: right;
  color: var(--ink-dim);
}

.dividend-heatmap .heat-sum.up {
  color: var(--green);
}

.dividend-heatmap .heat-sum.down {
  color: var(--red);
}

.heatmap-year {
  font: inherit;
  color: var(--ink-dim);
  background: none;
  border: 0;
  padding: 0.15rem 0;
  cursor: pointer;
}

.heatmap-year:hover,
tr.selected .heatmap-year {
  color: var(--amber);
}

/* Sequential shade: one hue (--series-1) mixed into the surface by --heat. */
.heat-cell {
  height: 30px;
  border-radius: 3px;
  text-align: center;
  color: var(--ink);
  background: color-mix(in oklab, var(--series-1) var(--heat), var(--panel-2));
}

.heat-cell.empty {
  background: var(--panel-2);
}

.heat-cell.future {
  background: transparent;
  outline: 1px dashed var(--line);
  outline-offset: -1px;
}

.heatmap-q .heat-cell {
  height: 36px;
  font-size: 0.8rem;
}

.label-short {
  display: none;
}

.to-date-mark {
  color: var(--ink-faint);
}

.card-foot {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* Narrow: month headers shrink to initials and month cells show colour only;
   the tooltip and the Year chart carry the amounts. */
@container (max-width: 719px) {
  .heatmap-m .label-long {
    display: none;
  }

  .heatmap-m .label-short {
    display: inline;
  }

  .heatmap-m .heat-text {
    display: none;
  }

  .dividend-heatmap .heat-sum {
    width: 3.6rem;
  }

  .heatmap-q .heat-cell {
    font-size: 0.64rem;
    letter-spacing: -0.03em;
    overflow: hidden;
  }

  .dividend-heatmap thead th:first-child,
  .dividend-heatmap tbody th {
    width: 2.9rem;
  }
}

/* The narrowest: the year-on-year column gives way to the months. */
@container (max-width: 320px) {
  .dividend-heatmap th:last-child,
  .dividend-heatmap td:last-child {
    display: none;
  }
}

/* ---------- dividends growth card ---------- */

.dividend-card[data-growth-mode="all"] .growth-yoy,
.dividend-card[data-growth-mode="yoy"] .growth-all {
  display: none;
}

.growth-all {
  height: 260px;
}

.growth-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.growth-current .growth-line {
  stroke: var(--chart-line);
  stroke-width: 2.5;
}

.growth-previous .growth-line {
  stroke: var(--ink-dim);
  stroke-width: 2;
}

.growth-older .growth-line {
  stroke: var(--ink-faint);
}

.growth-end {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  fill: var(--ink-faint);
}

.growth-end.growth-current {
  fill: var(--ink);
  font-weight: 600;
}

.growth-end.growth-previous {
  fill: var(--ink-dim);
}

.series-key.year.growth-current { background: var(--chart-line); }
.series-key.year.growth-previous { background: var(--ink-dim); }
.series-key.year.growth-older { background: var(--ink-faint); }

.chart-cross {
  stroke: var(--line);
  stroke-width: 1;
}

/* ---------- dividends forecast ---------- */

.series-fill.estimate-ghost {
  fill-opacity: 0.35;
}

.series-fill.estimate-soft {
  fill-opacity: 0.75;
}

.series-key.estimate-key {
  opacity: 0.35;
}

.chart-line.projected,
.growth-line.projected {
  stroke-dasharray: 4 4;
}

.heat-cell.estimated {
  outline: 1px dashed var(--ink-faint);
  outline-offset: -1px;
  color: var(--ink-dim);
  font-style: italic;
  background: color-mix(in oklab, var(--series-1) calc(var(--heat) * 0.55), var(--panel-2));
}

.forecast-year .heatmap-year {
  font-style: italic;
}

.forecast-mark {
  margin-left: 0.2rem;
  font-size: 0.65rem;
  color: var(--ink-faint);
}

.forecast-method summary {
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.forecast-method p {
  font-size: 0.85rem;
  color: var(--ink-dim);
  max-width: 70ch;
}

.table-scroll {
  overflow-x: auto;
}

.forecast-assumptions {
  font-size: 0.82rem;
}

.forecast-assumptions tr.excluded td {
  color: var(--ink-faint);
}

.forecast-assumptions .security-label {
  display: inline-block;
  max-width: 18rem;
  vertical-align: bottom;
}

.confidence {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.confidence-high { color: var(--green); }
.confidence-medium { color: var(--amber); }
.confidence-low { color: var(--red); }
.confidence-none { color: var(--ink-faint); }

@container (min-width: 820px) {
  .dividend-tiles {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@container (max-width: 639px) {
  .forecast-assumptions .col-source,
  .forecast-assumptions .col-per-year {
    display: none;
  }

  .forecast-assumptions .security-label {
    max-width: 9rem;
  }

  .dividend-securities .security-row .col-growth,
  .dividend-securities .security-row .col-yield_on_cost {
    display: none;
  }
}

/* ---------- ticker page (#145) ----------
   Header across the full width; below it, on desktop (≥1024) a two-column
   grid with the Instrument's discussion as a sticky right column spanning
   every row; on phones a sticky tab bar (Overview · Discussion · Details)
   shows one group of panels at a time. */

.tk-page {
  --tk-header-offset: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  /* Grid items default to their min-content width; the chart's canvas would
     otherwise hold the page wider than a phone screen. */
  min-width: 0;
}

.tk-discussion,
.tk-discussion .post {
  scroll-margin-top: calc(var(--tk-header-offset) + 3.5rem);
}

.tk-page .up {
  color: var(--green);
}

.tk-page .down {
  color: var(--red);
}

.tk-page .dim {
  color: var(--ink-dim);
}

.tk-page .faint {
  color: var(--ink-faint);
}

.tk-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: start;
}

.tk-head h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.tk-idline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin: 0.35rem 0 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.tk-isin {
  font: inherit;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: inherit;
  background: none;
  border: 1px dashed transparent;
  border-radius: var(--radius-s);
  padding: 0 0.25rem;
  cursor: copy;
}

.tk-isin:hover {
  border-color: var(--line);
  color: var(--ink);
}

.tk-isin.copied::after {
  content: " Copied";
  color: var(--green);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 0.75rem;
}

.tk-listings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tk-listings-label {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.tk-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  text-decoration: none;
  cursor: pointer;
}

.tk-chip:hover {
  border-color: var(--ink-faint);
}

.tk-chip.untracked {
  background: transparent;
  border-style: dashed;
  color: var(--ink-dim);
}

.tk-quote {
  display: grid;
  justify-items: end;
  gap: 0.15rem;
}

.tk-price {
  font-size: 1.7rem;
  font-weight: 500;
}

.tk-price small {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin-left: 0.3rem;
}

.tk-change {
  font-size: 0.95rem;
}

.tk-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--amber);
  font-size: 0.88rem;
}

.tk-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.75rem;
}

.tk-post-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-dim);
  font-size: 0.88rem;
}

.tk-post-hint svg {
  width: 16px;
  height: 16px;
}

.tk-post-hint:hover {
  color: var(--ink);
}

.tk-data-through {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.tk-tabs {
  display: none;
}

/* Narrow screens stack the panels in source order (chart, discussion, stake,
   fundamentals, history, edit); only the desktop grid names areas, so a
   hidden tab's panels leave no empty rows behind. */
.tk-body {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.tk-body > .region {
  min-width: 0;
}

.tk-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.tk-section-head h2 {
  margin: 0;
}

.tk-sub {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.tk-label {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 1rem 0 0.5rem;
}

.tk-hint {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0.4rem 0 0;
}

/* chart */

.tk-chart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.tk-chart-tools .chart-style-toggle {
  margin-bottom: 0;
}

.tk-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-dim);
  cursor: pointer;
}

.tk-toggle input {
  accent-color: var(--amber);
}

.tk-chart .price-chart {
  margin: 0.5rem 0 0;
}

.tk-readout {
  min-height: 1.4rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.tk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.tk-legend-item {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tk-legend-item:hover {
  color: var(--ink-dim);
}

.tk-legend-item[aria-pressed="false"] {
  opacity: 0.4;
  text-decoration: line-through;
}

.tk-page .dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.tk-page .dot.own { background: var(--amber); }
.tk-page .dot.exdate { background: var(--ink-faint); }
.tk-page .dot.beat { background: var(--green); }
.tk-page .dot.missed { background: var(--red); }
.tk-page .dot.estimate { border: 1.5px solid var(--ink-faint); }

/* stake */

.tk-stake .tk-label:first-of-type {
  margin-top: 0;
}

.tk-you {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--panel-2);
  border-radius: var(--radius-m);
}

.tk-you dt,
.tk-facts dt {
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.tk-you dd,
.tk-facts dd {
  margin: 0;
}

.tk-past {
  margin: 0 0 0.5rem;
  font-size: 0.86rem;
  color: var(--ink-dim);
}

.tk-lookthrough {
  margin: 0.6rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-dim);
}

.tk-group {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tk-group li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line-soft);
}

.tk-group li:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.tk-who {
  min-width: 0;
}

.tk-tier,
.tk-via {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0 0.3rem;
  margin-left: 0.4rem;
}

.tk-via {
  text-transform: none;
  letter-spacing: 0;
}

.tk-watchers {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

/* fundamentals & history */

.tk-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}

.tk-fund-grid,
.tk-hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.5rem 2rem;
  margin-top: 0.5rem;
}

.tk-hist-grid .tk-label:first-child {
  margin-top: 0;
}

.tk-holdings {
  list-style: none;
  counter-reset: holding;
  margin: 0;
  padding: 0;
}

.tk-holdings li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}

.tk-holdings li::before {
  counter-increment: holding;
  content: counter(holding);
  color: var(--ink-faint);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
}

.tk-holdings a {
  border-bottom: 1px dotted var(--ink-faint);
}

.tk-holdings a:hover {
  color: var(--amber);
}

.tk-bars {
  display: grid;
  gap: 0.35rem;
}

.tk-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 3.4rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.86rem;
}

.tk-bar-row .mono {
  text-align: right;
  font-size: 0.82rem;
}

.tk-track {
  height: 8px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}

.tk-fill {
  display: block;
  height: 100%;
  background: var(--chart-line);
  border-radius: 4px;
}

.tk-fill.other {
  background: var(--ink-faint);
}

.tk-svg {
  display: block;
  width: 100%;
  height: auto;
}

.tk-grid-line {
  stroke: var(--line-soft);
}

.tk-axis,
.tk-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  fill: var(--ink-faint);
}

.tk-value {
  fill: var(--ink-dim);
}

.tk-bar {
  fill: var(--chart-line);
}

.tk-bar.partial {
  fill-opacity: 0.45;
}

.tk-estimate {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
}

.tk-actual {
  fill: var(--ink-dim);
}

.tk-actual.beat {
  fill: var(--green);
}

.tk-actual.missed {
  fill: var(--red);
}

.tk-payments {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  font-size: 0.86rem;
}

.tk-payments li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.tk-all-payments summary,
.tk-edit-details summary {
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--amber);
  margin-top: 0.4rem;
}

.tk-splits {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.tk-edit-details summary {
  color: var(--ink-dim);
  margin: 0;
}

.tk-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
  margin-top: 1rem;
}

.tk-field-label {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

/* A field whose control needs room: the Underlying search lists names with
   symbol, venue and currency beside them, so it takes the whole row. */
.tk-field-wide {
  grid-column: 1 / -1;
}

.underlying-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.underlying-form .ticker-search {
  flex: 0 1 30rem;
  min-width: 0;
}

.underlying-form .ticker-query {
  width: 100%;
  box-sizing: border-box;
}

.underlying-form .ticker-selected {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

/* discussion */

.composer {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.composer:focus-within {
  border-color: var(--ink-faint);
}

.composer.dragging {
  border-color: var(--amber);
  border-style: dashed;
  background: var(--amber-dim);
}

.composer-label {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.composer textarea {
  width: 100%;
  min-height: 3.2rem;
  resize: vertical;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0.15rem;
}

.composer textarea:focus {
  outline: none;
}

.composer-errors,
.composer-error {
  color: var(--red);
  font-size: 0.82rem;
  margin: 0;
}

.composer-errors ul {
  margin: 0;
  padding-left: 1rem;
}

.composer-error:empty {
  display: none;
}

.composer-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.composer-thumbs:empty {
  display: none;
}

.composer-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--panel-2);
}

.composer-thumb video,
.composer-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
}

.composer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.composer-add {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}

.composer-add:hover,
.composer-add:focus-within {
  border-color: var(--ink-faint);
}

.composer-add input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.composer-count {
  flex: 1;
  font-size: 0.76rem;
  color: var(--ink-faint);
}

.composer-post:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.disc-stream {
  display: grid;
}

.tk-discussion .post {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.tk-discussion .post:last-child {
  border-bottom: 0;
}

.post:target {
  animation: post-target 2s ease-out;
}

@keyframes post-target {
  from {
    background: var(--amber-dim);
  }
}

.post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  font-size: 0.84rem;
}

.post-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.post-avatar {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--ink-faint);
  color: #111;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: -0.2rem;
}

/* An uploaded avatar on a post card keeps the author's Member color as a
   thin ring (#162). */
.post-avatar.has-image {
  background: none;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--member-color, var(--ink-faint));
}

.post-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.post-time {
  color: var(--ink-faint);
}

.edited-mark {
  font-size: 0.76rem;
  color: var(--ink-faint);
}

.deactivated-mark {
  font-weight: 400;
  color: var(--ink-faint);
}

.post-via {
  font-size: 0.76rem;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0 0.3rem;
}

.post-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.tk-discussion .post-text {
  margin-top: 0.3rem;
  font-size: 0.93rem;
}

.post-text a {
  color: var(--amber);
  text-decoration: underline;
}

.post-edit {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.post-edit textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.4rem;
}

.post-edit-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.post-video {
  display: block;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  margin-top: 0.5rem;
  border-radius: 8px;
  background: #000;
}

.yt-card {
  display: block;
  max-width: 480px;
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
}

.yt-card:hover .yt-title,
.yt-card:focus-visible .yt-title {
  text-decoration: underline;
}

.yt-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
}

.yt-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: rgba(23, 23, 23, 0.8);
  transition: background 0.15s;
}

.yt-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}

.yt-card:hover .yt-play,
.yt-card:focus-visible .yt-play {
  background: #f00;
}

.yt-meta {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.6rem 0.5rem;
}

.yt-title {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.yt-channel {
  font-size: 0.85em;
  color: var(--ink-dim);
}

.yt-player {
  max-width: 480px;
  margin-top: 0.5rem;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.yt-card + .post-text,
.yt-player + .post-text {
  margin-top: 0.5rem;
}

.yt-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.post-images {
  display: grid;
  gap: 4px;
  max-width: 560px;
  margin-top: 0.55rem;
  border-radius: var(--radius-m);
  overflow: hidden;
}

.post-images.n2,
.post-images.n4 {
  grid-template-columns: 1fr 1fr;
}

.post-images.n3 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.post-images.n3 > :first-child {
  grid-row: 1 / span 2;
}

.post-image {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: var(--panel-2);
  cursor: zoom-in;
  overflow: hidden;
}

.post-image picture,
.post-image img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.post-images.n1 .post-image img {
  max-height: 420px;
  object-fit: contain;
}

.post-images:not(.n1) .post-image {
  aspect-ratio: 4 / 3;
}

.post-images:not(.n1) .post-image picture,
.post-images:not(.n1) .post-image img {
  height: 100%;
  object-fit: cover;
}

.gif-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-s);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.disc-more {
  display: flex;
  justify-content: center;
}

.disc-more:not(:empty) {
  padding-top: 0.6rem;
}

.lightbox {
  max-width: min(96vw, 1400px);
  max-height: 94dvh;
  padding: 0;
  border: 0;
  background: transparent;
  color: #eee;
}

.lightbox::backdrop {
  background: rgba(6, 8, 10, 0.88);
}

.lightbox-inner {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

.lightbox img {
  display: block;
  max-width: min(96vw, 1400px);
  max-height: 84dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-s);
}

.lightbox-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.85rem;
}

.lightbox-bar a {
  color: #ddd;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .post:target {
    animation: none;
  }
}

@media (max-width: 599px) {
  .tk-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .tk-quote {
    justify-items: start;
  }

  /* The quote now starts at the page's left edge: the list picker hangs
     rightwards from the bookmark instead of off the screen. */
  .tk-head .watch-pop {
    left: 0;
    right: auto;
  }

  .tk-data-through {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 1023px) {
  .tk-tabs {
    position: sticky;
    top: var(--tk-header-offset);
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    overflow: hidden;
  }

  .tk-tabs button {
    font: inherit;
    font-size: 0.88rem;
    color: var(--ink-dim);
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.5rem 0.4rem;
  }

  .tk-tabs button + button {
    border-left: 1px solid var(--line);
  }

  .tk-tabs button.active {
    color: var(--ink);
    background: var(--panel);
    font-weight: 600;
  }

  .tk-page[data-tab="overview"] [data-tab-panel]:not([data-tab-panel="overview"]),
  .tk-page[data-tab="discussion"] [data-tab-panel]:not([data-tab-panel="discussion"]),
  .tk-page[data-tab="details"] [data-tab-panel]:not([data-tab-panel="details"]) {
    display: none;
  }
}

@media (min-width: 1024px) {
  .tk-chart { grid-area: chart; }
  .tk-discussion { grid-area: disc; }
  .tk-stake { grid-area: stake; }
  .tk-fund { grid-area: fund; }
  .tk-hist { grid-area: hist; }
  .tk-edit { grid-area: edit; }

  .tk-body {
    grid-template-columns: minmax(0, 1fr) 420px;
    grid-template-areas:
      "chart disc"
      "stake disc"
      "fund disc"
      "hist disc"
      "edit disc";
  }

  .tk-discussion {
    grid-row: 1 / span 5;
    position: sticky;
    top: calc(var(--tk-header-offset) + 0.75rem);
    max-height: calc(100dvh - var(--tk-header-offset) - 1.5rem);
    display: flex;
    flex-direction: column;
  }

  .tk-disc-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin-inline: -0.5rem;
    padding-inline: 0.5rem;
  }
}

.tk-chart .chart-toolbar {
  flex-wrap: wrap;
}

/* ---------- portfolio page (#181) ---------- */

.pf-page {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}
.pf-page .up { color: var(--green); }
.pf-page .down { color: var(--red); }
.pf-page .faint { color: var(--ink-faint); }
.pf-back { margin: 0; font-size: 0.9rem; }
.pf-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: start;
}
.pf-head h1 { margin: 0; }
.pf-idline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin: 0.4rem 0 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.pf-note { font-size: 0.8rem; color: var(--ink-faint); }

.pf-tip { border-bottom: 1px dotted var(--ink-faint); cursor: help; }
@media (max-width: 719px) {
  .pf-head { grid-template-columns: minmax(0, 1fr); }
}

.pf-tabs {
  display: flex;
  gap: 0.15rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.pf-tabs::-webkit-scrollbar { display: none; }
.pf-tabs a {
  padding: 0.5rem 0.85rem;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.pf-tabs a:hover { color: var(--ink); text-decoration: none; }
.pf-tabs a.active { color: var(--ink); border-bottom-color: var(--amber); font-weight: 600; }
@media (max-width: 719px) {
  .pf-tabs { position: sticky; top: 56px; z-index: 15; background: var(--bg); }
}

.pf-body { display: grid; gap: 1.25rem; min-width: 0; }
.pf-body > .region, .pf-grid > .region { min-width: 0; }
/* Side-by-side cards end level: the shorter one stretches, and Performance's
   chart grows into the extra room. */
.pf-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
.pf-grid > .widget .pf-chart { flex: 1 0 260px; }
@media (min-width: 1024px) {
  .pf-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
  .pf-grid-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.pf-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.8rem;
}
.pf-section-head h2 { margin: 0; }

.pf-windows { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.pf-seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  max-width: 100%;
}
.pf-seg a, .pf-seg button {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  color: var(--ink-dim);
  background: none;
  border: 0;
  border-radius: 0;
  white-space: nowrap;
  cursor: pointer;
}
.pf-seg > * + * { border-left: 1px solid var(--line); }
.pf-seg a:hover { text-decoration: none; color: var(--ink); }
.pf-seg .active { background: var(--panel-2); color: var(--ink); font-weight: 600; }
/* The narrowest Widgets keep the window switch on one line. */
@container (max-width: 300px) {
  .pf-seg a, .pf-seg button { padding: 0.25rem 0.36rem; font-size: 0.74rem; }
}
.pf-years { position: relative; font-size: 0.78rem; }
.pf-years summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.25rem 0.55rem;
  color: var(--ink-dim);
}
.pf-years summary::-webkit-details-marker { display: none; }
.pf-years summary.active { color: var(--ink); font-weight: 600; background: var(--panel-2); }
.pf-years-pop {
  position: absolute;
  right: 0;
  z-index: 20;
  margin-top: 0.25rem;
  display: grid;
  min-width: 5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.25rem;
  box-shadow: 0 8px 24px var(--shadow, rgba(0, 0, 0, 0.4));
}
.pf-years-pop a { padding: 0.25rem 0.5rem; color: var(--ink-dim); }
.pf-years-pop a.active { color: var(--ink); font-weight: 600; }

.pf-chart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.5rem; }
.pf-chart-tools .chart-style-toggle { margin-bottom: 0; }
.pf-chart { height: 260px; min-width: 0; }
.pf-chart-small { height: 130px; }
.pf-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.8rem; color: var(--ink-dim); margin-top: 0.4rem; }
.pf-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: 0.2em; margin-right: 0.35rem; background: var(--swatch); }
.pf-legend i.dashed { background: repeating-linear-gradient(90deg, var(--swatch) 0 4px, transparent 4px 7px); }

.pf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.6rem; margin-top: 0.9rem; }
.pf-tile { border: 1px solid var(--line-soft); background: var(--panel-2); border-radius: var(--radius-m); padding: 0.55rem 0.7rem; min-width: 0; display: grid; gap: 0.1rem; }
.pf-tile .k { font-size: 0.75rem; color: var(--ink-dim); justify-self: start; }
.pf-tile .v { font-size: 1.08rem; }
.pf-tile .s { font-size: 0.72rem; color: var(--ink-faint); }

.pf-list { list-style: none; margin: 0; padding: 0; }
.pf-list li { border-bottom: 1px solid var(--line-soft); }
.pf-list li:last-child { border-bottom: 0; }
.pf-list-link, .pf-tx-list li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.15rem; padding: 0.55rem 0; color: inherit; }
.pf-list-link:hover { text-decoration: none; background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.pf-list-top, .pf-list-sub { display: flex; justify-content: space-between; gap: 0.75rem; }
.pf-list-top > :first-child, .pf-list-sub > :first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-list-top > :last-child:not(:first-child), .pf-list-sub > :last-child:not(:first-child) { flex: none; white-space: nowrap; }
.pf-list-sub { font-size: 0.8rem; color: var(--ink-dim); }
.pf-type { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-dim); }
.pf-type-buy { color: var(--green); }
.pf-type-sell { color: var(--red); }
.pf-type-dividend { color: var(--amber); }

/* portfolio index cards */
.pf-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.pf-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  color: inherit;
}
.pf-card:hover { text-decoration: none; border-color: var(--ink-faint); }
.pf-card h2 { margin: 0; font-size: 1.15rem; }
.pf-card-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.75rem; }
.pf-card-value { font-size: 1.25rem; }
.pf-card-meta { font-size: 0.78rem; color: var(--ink-faint); }
.pf-card-all { border-color: var(--amber-dim); }
.pf-card-new { place-items: center; border-style: dashed; color: var(--ink-dim); min-height: 8.5rem; }
.pf-spark { width: 120px; height: 32px; flex: none; }
.pf-spark path { fill: none; stroke: var(--chart-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* holdings tab (#182) */
.pf-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.pf-table th { text-align: left; font-weight: 500; color: var(--ink-dim); font-size: 0.76rem; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pf-table td { padding: 0.5rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pf-table .num { text-align: right; white-space: nowrap; }
.pf-cell-sub { display: block; font-size: 0.74rem; color: var(--ink-faint); }
.pf-table .pf-cell-sub.up { color: var(--green); }
.pf-table .pf-cell-sub.down { color: var(--red); }
.pf-caret-cell { width: 1.5rem; }
.pf-caret { font: inherit; background: none; border: 0; color: var(--ink-faint); cursor: pointer; padding: 0 0.2rem; transition: transform 0.15s; }
.pf-caret[aria-expanded="true"] { transform: rotate(90deg); }
.pf-lot { display: none; }
.pf-holding.open .pf-lot { display: table-row; }
.pf-lot td { background: var(--panel-2); font-size: 0.8rem; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.pf-narrow { display: none; }
.pf-list-head.pf-narrow { display: none; }
@container (max-width: 560px) {
  .pf-wide { display: none; }
  .pf-narrow { display: block; }
  .pf-list-head.pf-narrow { display: flex; }
}
/* sortable column heads: the active one carries its direction's arrow */
.pf-sort { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.pf-sort:hover, .pf-sort.active { color: var(--ink); }
.pf-sort-arrow { margin-left: 0.2em; color: var(--amber); }
.pf-sort-arrow:empty { display: none; }
.pf-list-head { display: flex; gap: 0.75rem; padding: 0.15rem 0 0.35rem; border-bottom: 1px solid var(--line); font-size: 0.74rem; font-weight: 500; color: var(--ink-dim); }
.pf-list-head > :first-child { flex: 1; }
.pf-holding-card { padding-bottom: 0.4rem; }
.pf-lots-details summary { font-size: 0.78rem; color: var(--ink-dim); cursor: pointer; padding: 0.1rem 0 0.3rem; }
.pf-lots-details .pf-list-sub { padding: 0.15rem 0 0.15rem 0.8rem; }
.js .pf-nojs-lots { display: none; }

.pf-bars { display: grid; gap: 0.35rem; }
.pf-bar-row { display: grid; grid-template-columns: minmax(6rem, 13rem) minmax(0, 1fr) minmax(5rem, auto); gap: 0.6rem; align-items: center; font-size: 0.85rem; }
.pf-bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pf-bar-row .amt { text-align: right; font-size: 0.8rem; white-space: nowrap; }
.pf-bar-track { position: relative; height: 12px; }
.pf-bar-track .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--line); }
.pf-bar-track .fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--ink-faint); }
.pf-bar-track .fill.up { left: 50%; background: var(--green); }
.pf-bar-track .fill.down { right: 50%; background: var(--red); }
@media (max-width: 719px) {
  .pf-bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pf-bar-row .pf-bar-track { grid-column: 1 / -1; grid-row: 2; }
}

@container (max-width: 560px) {
  .pf-bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pf-bar-row .pf-bar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* performance tab (#183) */
.pf-benchmark-form select { font-size: 0.82rem; padding: 0.2rem 0.4rem; }
.pf-label { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); margin: 1.1rem 0 0.4rem; }
.pf-heat { border-collapse: separate; border-spacing: 2px; font-size: 0.76rem; width: 100%; }
.pf-heat th { color: var(--ink-faint); font-weight: 500; padding: 0.15rem; }
.pf-heat td { text-align: center; padding: 0.35rem 0.1rem; border-radius: 3px; }
.pf-heat td.total { font-weight: 600; border: 1px solid var(--line); }

/* transactions tab (#184) */
.pf-fold summary { cursor: pointer; list-style: none; }
.pf-fold summary::-webkit-details-marker { display: none; }
.pf-fold summary h2 { display: inline; margin: 0; }
.pf-fold summary::after { content: " ▾"; color: var(--ink-faint); }
.pf-fold details[open] summary { margin-bottom: 0.9rem; }
.pf-form-grid { display: grid; gap: 0.7rem 1rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.pf-field { display: grid; gap: 0.25rem; align-content: start; min-width: 0; position: relative; }
.pf-field label { font-size: 0.82rem; color: var(--ink-dim); }
.pf-field input, .pf-field select { width: 100%; box-sizing: border-box; }
.pf-field-wide { grid-column: span 2; }
@media (max-width: 539px) { .pf-field-wide { grid-column: auto; } }
.pf-form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.9rem; }
.pf-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.8rem; }
.pf-filters select { font-size: 0.84rem; padding: 0.25rem 0.4rem; max-width: 14rem; }
.pf-confirm { border-color: var(--red-dim); }
.link-button.danger, .pf-page .danger { color: var(--red); }

/* accounting tab (#186) */
.pf-statement-total { margin: 0.8rem 0 0; font-size: 0.95rem; }
@media print {
  .site-header, .ticker-tape, .tape, .pf-back, .pf-tabs, .pf-noprint, .pf-invested, .site-footer, .messages, .toast, [data-tape] { display: none !important; }
  body { background: #fff; color: #000; }
  .region { border: 0; box-shadow: none; background: #fff; padding: 0; }
  .pf-page .up, .pf-page .down { color: #000; }
  .pf-bar-track .fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* settings tab, start page, archived (#188) */
.pf-archived > summary { cursor: pointer; color: var(--ink-dim); padding: 0.3rem 0 0.8rem; }
.pf-card-archived { opacity: 0.75; }
.pf-choices { display: grid; gap: 0.7rem; margin: 1rem 0; }
.pf-choice { display: grid; gap: 0.2rem; padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel-2); color: var(--ink); }
.pf-choice:hover { text-decoration: none; border-color: var(--amber); }
.pf-choice span { font-size: 0.85rem; color: var(--ink-dim); }
.pf-delete-form { display: grid; gap: 0.4rem; max-width: 28rem; }

/* ---------- Compare (#195–#198): the Group and Head to head tabs ---------- */
.cmp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 0.6rem 1rem; }
.cmp-head h1 { margin: 0; }
.cmp-sub { margin: 0.3rem 0 0; color: var(--ink-dim); font-size: 0.9rem; }
.cmp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; }
.cmp-market-form { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--ink-dim); }
.cmp-market-form select { font-size: 0.82rem; padding: 0.2rem 0.4rem; max-width: 14rem; }
.cmp-body { display: grid; gap: 1.5rem; min-width: 0; }
.cmp-body > *, .cmp-grid > *, .cmp-head > * { min-width: 0; }
.cmp-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .cmp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cmp-chips form { display: contents; }
.cmp-chip { font: inherit; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.7rem 0.2rem 0.45rem; cursor: pointer; color: var(--ink-dim); }
.cmp-chip:hover { border-color: var(--ink-faint); }
.cmp-chip.on { color: var(--ink); border-color: var(--ink-faint); background: var(--panel-2); }
.cmp-chip:not(.on) .cmp-dot { filter: grayscale(1); opacity: 0.4; }
.cmp-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--c); flex: none; }
.cmp-you { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--amber); margin-left: 0.35rem; }
.cmp-swatch { display: inline-block; width: 18px; height: 3px; border-radius: 1px; flex: none; background: var(--c); }
.cmp-line-dotted { background: repeating-linear-gradient(90deg, var(--c) 0 2px, transparent 2px 4px); }
.cmp-line-dashed-long { background: repeating-linear-gradient(90deg, var(--c) 0 7px, transparent 7px 10px); }
.cmp-line-sparse { background: repeating-linear-gradient(90deg, var(--c) 0 2px, transparent 2px 6px); }
.cmp-line-market { background: repeating-linear-gradient(90deg, var(--ink-dim) 0 4px, transparent 4px 7px); }
.cmp-who { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.cmp-who-text { display: grid; min-width: 0; line-height: 1.25; }
.cmp-who-line { display: flex; align-items: baseline; min-width: 0; }
.cmp-who-text a, .cmp-who-text > span:not(.cmp-who-line) { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.cmp-who-line .cmp-you { flex: none; }
.cmp-who-text small { font-size: 0.74rem; color: var(--ink-faint); white-space: nowrap; }
.cmp-table td { vertical-align: middle; }
.cmp-table th.num { text-align: right; }
.cmp-sort { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; white-space: nowrap; }
.cmp-sort:hover { color: var(--ink); }
.cmp-sort[aria-sort]::after { content: " ↓"; }
.cmp-sort[aria-sort="ascending"]::after { content: " ↑"; }
.cmp-rank { width: 2rem; text-align: center; color: var(--ink-faint); }
.cmp-table td.cmp-best { color: var(--green); font-weight: 600; }
.cmp-table sup { color: var(--ink-faint); font-size: 0.7em; }
.cmp-you-row td { background: color-mix(in srgb, var(--amber-dim) 35%, var(--panel)); }
.cmp-market-row td { color: var(--ink-dim); border-top: 1px dashed var(--ink-faint); border-bottom: 1px dashed var(--ink-faint); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line-soft) 60%, transparent) 6px 7px), var(--panel); }
.cmp-market-row td.up, .cmp-market-row td.down { color: var(--ink-dim); }
.cmp-trend { width: 120px; }
.cmp-spark { display: block; width: 120px; height: 32px; }
.cmp-spark path { fill: none; stroke: var(--c); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cmp-spark-market path { stroke: var(--ink-dim); stroke-dasharray: 4 3; }
@media (max-width: 719px) {
  .cmp-table .cmp-trend { display: none; }
  .cmp-table .cmp-name { min-width: 8rem; max-width: 9.5rem; position: sticky; left: 2rem; z-index: 1; background: var(--panel); }
  .cmp-table .cmp-rank { width: 2rem; min-width: 2rem; max-width: 2rem; padding-left: 0; padding-right: 0; }
  .cmp-table .cmp-you-row .cmp-name { background: color-mix(in srgb, var(--amber-dim) 35%, var(--panel)); }
  .cmp-table .cmp-market-row .cmp-name { background: var(--panel); }
  .cmp-table th, .cmp-table td { padding-left: 0.3rem; padding-right: 0.3rem; }
  .cmp-matrix th.l { max-width: 7.5rem; }
  .cmp-holders td:first-child { max-width: 9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@container (max-width: 719px) {
  .cmp-table .cmp-trend { display: none; }
  .cmp-table .cmp-name { min-width: 8rem; max-width: 9.5rem; position: sticky; left: 2rem; z-index: 1; background: var(--panel); }
  .cmp-table .cmp-rank { width: 2rem; min-width: 2rem; max-width: 2rem; padding-left: 0; padding-right: 0; }
  .cmp-table .cmp-you-row .cmp-name { background: color-mix(in srgb, var(--amber-dim) 35%, var(--panel)); }
  .cmp-table .cmp-market-row .cmp-name { background: var(--panel); }
  .cmp-table th, .cmp-table td { padding-left: 0.3rem; padding-right: 0.3rem; }
  .cmp-matrix th.l { max-width: 7.5rem; }
  .cmp-holders td:first-child { max-width: 9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.cmp-chart { height: 300px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.8rem; color: var(--ink-dim); margin-top: 0.4rem; }
.cmp-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.cmp-scatter { display: block; width: 100%; max-width: 760px; height: auto; overflow: visible; }
.cmp-scatter-narrow, .cmp-scatter-small { display: none; }
@media (max-width: 719px) { .cmp-scatter-wide { display: none; } .cmp-scatter-narrow { display: block; } }
/* The drawing whose size suits the Widget, so its text stays readable. */
@container (min-width: 501px) { .cmp-scatter-wide { display: block; } .cmp-scatter-narrow { display: none; } }
@container (max-width: 500px) { .cmp-scatter-wide { display: none; } .cmp-scatter-narrow { display: block; } }
@container (max-width: 300px) { .cmp-scatter-narrow { display: none; } .cmp-scatter-small { display: block; } }
.cmp-body .table-scroll table { min-width: 0; }
.cmp-scatter text { font: 10px "IBM Plex Mono", ui-monospace, monospace; fill: var(--ink-faint); }
.cmp-scatter text.lbl { font: 600 11px "IBM Plex Sans", system-ui, sans-serif; fill: var(--c); }
.cmp-scatter line.grid { stroke: var(--line-soft); }
.cmp-scatter line.zero { stroke: var(--ink-faint); stroke-width: 0.8; }
.cmp-scatter line.guide { stroke: var(--ink-faint); stroke-dasharray: 3 3; }
.cmp-scatter rect.shade { fill: var(--green); opacity: 0.08; }
.cmp-scatter .dot circle, .cmp-scatter .dot rect, .cmp-scatter .dot polygon { fill: var(--c); }
.cmp-scatter .dot.market circle { fill: none; stroke: var(--ink-dim); stroke-width: 1.6; stroke-dasharray: 2 2; }
.cmp-scatter .dot.market text.lbl { fill: var(--ink-dim); }
.cmp-matrix { border-collapse: separate; border-spacing: 2px; font-size: 0.78rem; }
.cmp-matrix th { color: var(--ink-faint); font-weight: 500; padding: 0.2rem 0.3rem; white-space: nowrap; text-align: center; }
.cmp-matrix th.l { text-align: left; color: var(--ink-dim); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
.cmp-matrix-col { display: none; }
.cmp-matrix td { text-align: center; padding: 0.35rem 0.4rem; min-width: 2.9rem; border-radius: 3px; background: color-mix(in srgb, var(--amber) var(--s, 0%), transparent); }
.cmp-matrix td.self { background: var(--line-soft); }
.cmp-stack-rows { display: grid; gap: 0.5rem; }
.cmp-stack-row { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr); gap: 0.75rem; align-items: center; font-size: 0.86rem; }
.cmp-stack-bar { display: flex; height: 18px; border-radius: 3px; overflow: hidden; background: var(--line-soft); align-items: center; }
.cmp-stack-bar i { display: block; height: 100%; }
.cmp-stack-bar i + i { box-shadow: inset 1px 0 0 var(--bg); }
.cmp-stack-bar .pf-note { padding: 0 0.5rem; }
.cmp-key { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; font-size: 0.76rem; color: var(--ink-dim); margin-top: 0.7rem; }
.cmp-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.3rem; vertical-align: -1px; }
.cmp-holders td, .cmp-holders th { vertical-align: middle; }
.cmp-holders .c { text-align: center; }
.cmp-weight { display: inline-block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--c); vertical-align: middle; }

/* ---------- tables fitting their Widget (fitTable in widgets.js) ---------- */
[data-fit] .fit-dropped { display: none; }
.fit-tight th, .fit-tight td { padding-left: 0.3rem; padding-right: 0.3rem; }
.fit-tight th { white-space: normal; }

.cmp-matrix th.l .cmp-dot { width: 0.55rem; height: 0.55rem; margin-right: 0.35rem; vertical-align: baseline; }
.fit-tight .cmp-matrix { font-size: 0.7rem; }
.fit-tight .cmp-matrix td { min-width: 2.1rem; padding: 0.3rem 0.15rem; }
.fit-tight .cmp-matrix th.l { max-width: 6.5rem; }
/* Colour only: the value stays in each cell's tooltip. */
.fit-dots .cmp-matrix td { min-width: 1.15rem; height: 1.15rem; padding: 0; font-size: 0; }
.fit-dots .cmp-matrix th { padding: 0.2rem 0.1rem; }
.fit-dots .cmp-matrix th.l { max-width: 5.5rem; padding-right: 0.3rem; }

.fit-tight .cmp-holders td:first-child { white-space: normal; max-width: none; overflow-wrap: anywhere; }
.fit-small .cmp-holders .c { padding-left: 0.1rem; padding-right: 0.1rem; }
.fit-small .cmp-holders .cmp-weight { width: calc(var(--d) * 0.7); height: calc(var(--d) * 0.7); }
.fit-small .cmp-holders .cmp-dot { width: 0.55rem; height: 0.55rem; }

.fit-tight .pf-heat { font-size: 0.68rem; }
.fit-tight .pf-heat td { padding: 0.3rem 0; }
/* Each year folds into two rows of six months, each cell labelled. */
.fit-stack .pf-heat,
.fit-stack .pf-heat tbody { display: block; }
.fit-stack .pf-heat thead { display: none; }
.fit-stack .pf-heat tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin-bottom: 0.6rem; }
.fit-stack .pf-heat tr > th { grid-column: 1 / -1; text-align: left; padding: 0.1rem 0; position: static; }
.fit-stack .pf-heat td { display: block; font-size: 0.74rem; padding: 0.25rem 0; min-height: 2.2rem; }
.fit-stack .pf-heat td::before { content: attr(data-m); display: block; font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 0.62rem; color: var(--ink-faint); }
.fit-stack .pf-heat td.total { grid-column: 1 / -1; display: flex; justify-content: space-between; min-height: 0; padding: 0.25rem 0.5rem; }
.fit-stack .pf-heat td.total::before { display: inline; font-size: 0.7rem; }
[data-shared-only] .cmp-solo { display: none; }
@container (max-width: 719px) { .cmp-stack-row { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; } }
.cmp-duel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.75rem; align-items: stretch; }
.cmp-fighter { display: grid; gap: 0.45rem; align-content: start; min-width: 0; padding: 0.9rem 1rem; border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius-m); background: var(--panel); }
.cmp-fighter-b { text-align: right; justify-items: end; }
.cmp-fighter select { width: 100%; min-width: 0; max-width: 100%; font-size: 0.85rem; padding: 0.25rem 0.4rem; text-overflow: ellipsis; }
.cmp-fighter > * { max-width: 100%; }
.cmp-big { font-size: 2rem; line-height: 1.1; }
.cmp-vs { display: grid; place-items: center; align-content: center; gap: 0.3rem; text-align: center; }
.cmp-vs small { font-size: 0.72rem; color: var(--ink-faint); }
.cmp-score { font-size: 1.8rem; white-space: nowrap; }
.cmp-swap { font-size: 0.8rem; color: var(--ink-dim); }
.cmp-board { display: grid; gap: 0.1rem; }
.cmp-board-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) minmax(6rem, 9rem) minmax(0, 1fr) 5.5rem; gap: 0.5rem; align-items: center; font-size: 0.86rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line-soft); }
.cmp-board-row .lv { text-align: right; color: var(--ink-dim); }
.cmp-board-row .rv { text-align: left; color: var(--ink-dim); }
.cmp-board-row .win { font-weight: 700; }
.cmp-board-row .k { text-align: center; color: var(--ink-dim); font-size: 0.78rem; }
.cmp-board-row .bar { position: relative; height: 8px; }
.cmp-board-row .bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.cmp-board-row .bar.l i { right: 0; }
.cmp-board-row .bar.r i { left: 0; }
.cmp-board-row .bar i.dim { opacity: 0.35; }
.cmp-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.cmp-strip div { border-radius: 3px; padding: 0.35rem 0.1rem; text-align: center; font-size: 0.7rem; font-weight: 600; color: #111; background: var(--c); }
.cmp-strip div.tie { background: var(--line-soft); color: var(--ink-dim); }
.cmp-strip .yr { font-weight: 400; opacity: 0.75; }
.cmp-strip small { display: block; font-weight: 400; font-size: 0.64rem; }
.cmp-three { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); }
.cmp-three h3 { font-size: 0.88rem; margin: 0 0 0.4rem; }
.cmp-three ul { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.cmp-three li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px solid var(--line-soft); }
.cmp-three li a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cmp-three .w { font-size: 0.78rem; color: var(--ink-dim); white-space: nowrap; }
.cmp-duel-link { font-size: 0.8rem; padding: 0.15rem 0.55rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--panel-2); color: var(--ink); white-space: nowrap; }
.cmp-duel-link:hover { border-color: var(--ink-faint); text-decoration: none; }
.pf-h2h { font-size: 0.85rem; }
@media (max-width: 719px) {
  .cmp-duel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cmp-vs { grid-column: 1 / -1; grid-row: 1; grid-auto-flow: column; gap: 0.8rem; }
  .cmp-fighter { padding: 0.7rem; }
  .cmp-big { font-size: 1.5rem; }
  .cmp-board-row { grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem; }
  .cmp-board-row .bar { display: none; }
  .cmp-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cmp-three { grid-template-columns: minmax(0, 1fr); }
  .cmp-hide-phone { display: none; }
}

/* ---------- widgets (ADR 0001) ---------- */

.widget {
  min-width: 0;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
}

.widget-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.9rem 1.1rem;
}

.widget-head {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  min-height: 1.6rem;
}

.widget-title {
  margin: 0;
  font-size: 1.02rem;
  margin-right: auto;
  min-width: 0;
}

.widget-badge {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.45rem;
}

.widget-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.widget-chips {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.widget-chip {
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.widget-chip:hover {
  color: var(--ink);
}

.widget-chip.on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-2);
}

.widget-select {
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.15rem 0.35rem;
}

.widget-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.widget-placeholder {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.widget-placeholder p {
  margin: 0;
}

.widget-retry,
.widget-remove,
.widget-more {
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}

.widget-retry:hover,
.widget-remove:hover,
.widget-more:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.widget-more {
  align-self: flex-start;
  margin-top: 0.75rem;
}

.widget-foot-link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--amber);
  text-decoration: none;
}

.widget-foot-link:hover {
  text-decoration: underline;
}

/* ---------- Group page (#209) ---------- */

.group-page {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.group-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
}

.group-head h1 {
  margin: 0;
  font-size: 1.7rem;
}

.group-head p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.group-head .period-switch {
  margin-left: auto;
}

.group-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.25rem;
  align-items: start;
}

.group-rail {
  display: grid;
  gap: 1rem;
  /* top level with the first post card, below Latest's head row */
  padding-top: calc(2.4rem + 0.6rem);
}

.group-rail:empty {
  display: none;
}

@media (max-width: 1023px) {
  .group-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .group-rail {
    padding-top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .group-rail {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The Trade timeline inside a Widget card: one border, not two. */
.widget-card .timeline {
  border: 0;
  background: none;
  padding: 0;
  margin-top: 0.4rem;
}

.widget .timeline-sub {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* Latest */

.latest-filters {
  display: flex;
  gap: 0.6rem 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.latest-members {
  display: inline-flex;
  gap: 0.3rem;
}

.latest-member {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}

.latest-member[aria-pressed="false"] .member-avatar {
  opacity: 0.25;
}

.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--ink-faint);
  color: #111;
  font: 600 0.68rem "IBM Plex Mono", monospace;
}

.member-avatar.has-image {
  background: none;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--member-color, var(--ink-faint));
}

.member-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.member-avatar.sm {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.55rem;
}

.latest-feed {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}

/* On the Dashboard: the entries that fit, then the link (latest.js). */
.board > .widget > .widget-body:has(> .latest-fit) {
  overflow: hidden;
}

.latest-fit {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-content: start;
  /* room for the 2px avatar rings, which the clip would cut at the edge */
  padding-inline: 2px;
}

.latest-fit > [hidden] {
  display: none;
}

.latest-day {
  margin: 0.4rem 0 -0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.latest-day:first-child {
  margin-top: 0;
}

.latest-post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.75rem 1rem 0.85rem;
  min-width: 0;
}

.latest-thread {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}

.latest-thread a {
  color: var(--ink);
  font-weight: 600;
}

.latest-thread a:hover {
  color: var(--amber);
}

.latest-sym {
  font-size: 0.72rem;
}

.latest-post .post-text {
  margin: 0.4rem 0 0;
  font-size: 0.93rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.latest-post .post-time {
  color: var(--ink-faint);
}

.latest-trades {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
  font-size: 0.86rem;
  min-width: 0;
}

.latest-trades-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.6rem;
}

.trade-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
}

.trade-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.trade-chip a {
  color: var(--ink);
  font-weight: 600;
}

.trade-chip a:hover {
  color: var(--amber);
}

.trade-side {
  margin-right: 0.25rem;
}

.trade-chip.buy .trade-side {
  color: var(--green);
}

.trade-chip.sell .trade-side {
  color: var(--red);
}

.trade-amount,
.trade-since {
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.trade-since.up {
  color: var(--green);
}

.trade-since.down {
  color: var(--red);
}

/* Latest inside a card (the Dashboard): rows, not cards. */
.widget-card .latest-feed {
  gap: 0;
}

.widget-card .latest-post,
.widget-card .latest-trades {
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 0.6rem 0;
  background: none;
}

.widget-card .latest-day + .latest-post,
.widget-card .latest-day + .latest-trades {
  border-top: 0;
}

/* Group signals (#210): one row grammar for every card: rank or avatar ·
   name over one muted line · one right-aligned value. */

.widget-tag {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.signal-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.signal-rows li {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr) auto;
  column-gap: 0.65rem;
  align-items: center;
  min-height: 2.8rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line-soft);
}

.signal-rows li:first-child {
  border-top: 0;
}

.signal-lead {
  justify-self: center;
  font: 500 0.75rem "IBM Plex Mono", monospace;
  color: var(--ink-faint);
}

.signal-name {
  min-width: 0;
  font-size: 0.87rem;
  line-height: 1.3;
}

.signal-name > a,
.signal-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-name > a {
  color: var(--ink);
  font-weight: 600;
}

.signal-name > a:hover {
  color: var(--amber);
}

.signal-sub {
  font-size: 0.73rem;
  color: var(--ink-faint);
  margin-top: 0.1rem;
}

.signal-sub .up,
.signal-value .up {
  color: var(--green);
}

.signal-sub .down,
.signal-value .down {
  color: var(--red);
}

.signal-value {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 500 0.88rem "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.signal-value b {
  font-weight: 500;
  min-width: 1.1rem;
  text-align: right;
}

.signal-faint {
  color: var(--ink-faint);
}

.member-avatars {
  display: inline-flex;
}

.member-avatars .member-avatar {
  margin-left: -0.3rem;
  box-shadow: 0 0 0 2px var(--panel);
}

.member-avatars .member-avatar:first-child {
  margin-left: 0;
}

.signal-flow {
  gap: 0.35rem;
  font-size: 0.78rem;
}

.flow-sell {
  color: var(--red);
  width: 1.7rem;
  text-align: right;
}

.flow-buy {
  color: var(--green);
  width: 1.7rem;
}

.flow-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 64px;
  height: 8px;
}

.flow-bar i {
  display: block;
  height: 100%;
}

.flow-l {
  justify-self: end;
  background: var(--red);
  border-radius: 3px 0 0 3px;
}

.flow-r {
  background: var(--green);
  border-radius: 0 3px 3px 0;
}

.flow-bar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: var(--ink-faint);
}

.signal-more,
.signal-note {
  font-size: 0.74rem;
  color: var(--ink-faint);
  margin: 0.5rem 0 0;
}

.period-switch {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  align-items: center;
}

.period-switch a {
  font-size: 0.78rem;
  color: var(--ink-dim);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  white-space: nowrap;
}

.period-switch a:hover {
  color: var(--ink);
  text-decoration: none;
}

.period-switch a.on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-2);
}

/* ---------- the Dashboard board (#211) ---------- */

.dashboard {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.board-greeting {
  min-width: 0;
}

.board-greeting h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.board-greeting p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.board-bar {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 2rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 100px;
  gap: 16px;
  grid-auto-flow: dense;
}

.board > .widget {
  grid-column: span var(--w, 6);
  grid-row: span var(--h, 4);
  overflow: hidden;
  min-height: 0;
}

.board > .widget > .widget-body {
  overflow: auto;
  min-height: 0;
}

.board-loading {
  flex: 1;
  border-radius: var(--radius-s);
  background: linear-gradient(90deg, var(--panel-2), var(--line-soft), var(--panel-2));
  background-size: 200% 100%;
  animation: board-shimmer 1.4s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes board-shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board-loading {
    animation: none;
  }
}

@media (max-width: 1023px) {
  .board {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .board > .widget {
    grid-column: span 6;
  }

  .board > .widget[style*="--w: 4;"] {
    grid-column: span 3;
  }
}

@media (max-width: 639px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }

  .board > .widget,
  .board > .widget[style*="--w: 4;"] {
    grid-column: auto;
    grid-row: auto;
  }

  .board > .widget > .widget-body {
    overflow: visible;
  }

  .board-slot {
    min-height: 8rem;
  }
}

/* ---------- portfolio Widgets (#212) ---------- */

.pf-grid > .widget,
.pf-body > .widget {
  min-width: 0;
}

.pf-body-head {
  display: flex;
  justify-content: flex-end;
}

.pf-head {
  grid-template-columns: minmax(0, 1fr);
}

/* The page's h1 names the portfolio; the Widget's own title stays for
   screen readers only. */
.pf-head .widget-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.kn {
  display: grid;
  gap: 0.6rem 2rem;
  grid-template-columns: minmax(0, 1fr);
}

@container (min-width: 720px) {
  .kn {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
}

.kn-value {
  font-size: 1.7rem;
  font-weight: 500;
  white-space: nowrap;
}

.kn-sub {
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.kn-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}

@container (min-width: 520px) {
  .kn-tiles {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  }
}

.kn-tile {
  min-width: 0;
}

.kn-tile dt {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.kn-tile dt small {
  color: var(--ink-faint);
}

.kn-tile dd {
  margin: 0.1rem 0 0;
  font-size: 1.02rem;
  white-space: nowrap;
}

.kn-tile dd.up,
.widget .up {
  color: var(--green);
}

.kn-tile dd.down,
.widget .down {
  color: var(--red);
}

.kn-cash {
  border-left: 1px solid var(--line);
  padding-left: 0.75rem;
}

/* Charts fill their box on the Dashboard. */
.board .widget .pf-chart {
  flex: 1;
  height: auto;
  min-height: 140px;
}

.board .widget .pf-chart-small {
  min-height: 90px;
}

.widget .pf-label {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0.9rem 0 0.3rem;
  font-weight: 600;
}

/* ---------- Allocation and Look-through Widgets (#213) ---------- */

/* A Widget's options menu in its head row (the three dots). */
.widget-menu {
  position: relative;
  font-size: 0.78rem;
  /* Right end of its line even when the head wraps: the pop opens leftwards
     from here, and from the left edge it would hang outside the Widget. */
  margin-left: auto;
}

.widget-menu-button {
  list-style: none;
  cursor: pointer;
  color: var(--ink-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  padding: 0 0.5rem;
  line-height: 1.5;
  font-size: 1.1rem;
}

.widget-menu-button::-webkit-details-marker {
  display: none;
}

.widget-menu-button:hover,
.widget-menu[open] .widget-menu-button {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
}

.widget-menu-pop {
  position: absolute;
  right: 0;
  z-index: 20;
  margin-top: 0.25rem;
  display: grid;
  gap: 0.5rem;
  min-width: 11rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.6rem 0.7rem;
  box-shadow: 0 8px 24px var(--shadow, rgba(0, 0, 0, 0.4));
}

.widget-menu-row {
  display: grid;
  gap: 0.2rem;
}

.widget-menu-label {
  color: var(--ink-faint);
}

.alloc {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  flex: 1;
  min-height: 0;
}

.alloc:not(.alloc-with-figures):has(> .alloc-donut) {
  grid-template-rows: minmax(0, 1fr);
}

/* Figures above the chart: the chart row takes whatever height is left. */
.alloc-with-figures {
  grid-template-rows: auto minmax(0, 1fr);
}

@container (min-width: 900px) {
  .alloc-with-figures {
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .alloc-with-figures .alloc-figures {
    grid-template-columns: minmax(0, 1fr);
  }
}

.alloc-figures {
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}

.alloc-donut {
  display: flex;
  align-items: flex-start;
  container-type: size;
  gap: 1rem;
  min-width: 0;
  min-height: 9rem;
  height: 100%;
}

/* The donut is a square as big as the widget body's height allows, but at most
   55% of its width (all of it without a legend), pinned under the header. */
.alloc-donut .donut-chart {
  width: min(100cqh, 55cqw);
  height: auto;
  aspect-ratio: 1;
  flex: 0 1 auto;
  min-width: 0;
}

.alloc-donut .donut-svg {
  height: 100%;
}

/* Centred on the donut, not on the widget body. */
.alloc-donut .alloc-legend {
  height: min(100cqh, 55cqw);
  align-content: center;
}

.alloc-donut-bare {
  justify-content: center;
}

.alloc-donut-bare .donut-chart {
  width: min(100cqh, 100cqw);
}

.alloc-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.alloc-legend li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.alloc-legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alloc-legend-more {
  color: var(--ink-faint);
}

.alloc-map {
  min-width: 0;
}

.treemap-only {
  display: block;
}

@container (max-width: 360px) {
  /* Stacked: the Widget may be as tall as its content, so no size containment
     and no height-derived sizes. */
  .alloc-donut {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    container-type: normal;
  }

  /* As wide as the Widget (up to a cap); only a fixed height shrinks it. */
  .alloc-donut .donut-chart {
    flex: 0 1 auto;
    align-self: center;
    height: auto;
    width: min(100%, 28rem);
    max-width: 100%;
    min-height: 7rem;
    aspect-ratio: 1;
  }

  .alloc-donut .alloc-legend {
    height: auto;
    flex: none;
  }
}

/* ---------- Your portfolios, Today's map, Movers (#214) ---------- */

.pf-card-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: "Fraunces", serif;
}

.yp-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.yp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 0.7rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.86rem;
}

.yp-row:first-child {
  border-top: 0;
}

.yp-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-weight: 600;
}

.yp-value {
  text-align: right;
}

.yp-sub {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.yp-cash {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.todays-map {
  position: relative;
  flex: 1;
  min-height: 180px;
  aspect-ratio: 960 / 380;
}

.board .todays-map {
  aspect-ratio: auto;
}

.map-block {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--panel);
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.25;
}

.map-block:hover,
.map-block:focus-visible {
  border-color: var(--ink);
  text-decoration: none;
}

.map-block b {
  display: block;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-block.small > .mono {
  display: none;
}

/* Logo labels (the Show: Logo chip): sized to the block, which is a size
   container; a tiny block keeps the logo and drops the move. */
.map-block:has(.map-logo) {
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.map-logo .ticker-logo {
  width: clamp(12px, 45cqmin, 48px);
  height: clamp(12px, 45cqmin, 48px);
}

.movers-head {
  margin: 0.2rem 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.movers-head + .movers-list + .movers-head {
  margin-top: 0.7rem;
}

.movers-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.84rem;
}

.mover:first-child {
  border-top: 0;
}

.mover-name {
  min-width: 0;
}

.mover-name a,
.mover-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mover-name a {
  color: var(--ink);
}

.mover-sub {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.mover-value {
  text-align: right;
  white-space: nowrap;
}

.mover-value small {
  display: block;
  font-size: 0.72rem;
  opacity: 0.8;
}

/* The index page's own h1 names it. */
.pf-index .widget-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Dividend year and Coming up (#215) ---------- */

.dy-head {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.board .dy-chart {
  flex: 1;
  min-height: 140px;
}

/* The Year card's two views; the wrapper stays out of the board's flex column. */
.dy {
  display: contents;
}

.dy[data-view="year"] .dy-forecast-view,
.dy[data-view="forecast"] .dy-year-view {
  display: none;
}

.coming-up {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cu-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.38rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.84rem;
}

.cu-row:first-child {
  border-top: 0;
}

.cu-date {
  display: grid;
  text-align: center;
  line-height: 1.1;
}

.cu-date b {
  font: 600 1rem "IBM Plex Mono", monospace;
}

.cu-date span {
  font-size: 0.58rem;
  text-transform: uppercase;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}

.cu-name {
  min-width: 0;
}

.cu-name a,
.cu-kind {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cu-name a {
  color: var(--ink);
}

.cu-kind {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.cu-value {
  white-space: nowrap;
  font-size: 0.8rem;
}

/* ---------- Group performance and Watchlist Widgets (#216) ---------- */

.gp-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gp-row {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.gp-row:first-child {
  border-top: 0;
}

.gp-you {
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  border-radius: var(--radius-s);
}

.gp-market {
  color: var(--ink-faint);
  font-style: italic;
}

.gp-rank {
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.gp-name {
  min-width: 0;
  color: var(--ink);
}

.gp-name,
.gp-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-sub {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-style: normal;
}

.gp-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.gp-value {
  white-space: nowrap;
}

.wl-cards {
  min-width: 0;
}

.wl-periods {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.1rem 0 0.45rem;
}

.wl-chip {
  font: 500 0.8rem "IBM Plex Mono", ui-monospace, monospace;
  color: var(--ink-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
}

.wl-chip:hover {
  color: var(--ink);
}

.wl-chip.on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-2);
}

.wl-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wl-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 96px;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.wl-card-list .wl-card:first-child {
  border-top: 0;
}

.wl-card-head {
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.wl-card-head .num {
  text-align: right;
}

.wl-card-name {
  min-width: 0;
}

.wl-card-name a {
  color: var(--ink);
  font-weight: 600;
}

/* The name gives way before the Held tag does. */
.wl-card-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.wl-card-title .wl-held {
  flex: none;
}

.wl-card-name a,
.wl-card-name .wl-idline {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl-card .wl-spark {
  width: 64px;
  height: 24px;
}

/* The period's change, the price under it. */
.wl-card-fig {
  display: grid;
  text-align: right;
  white-space: nowrap;
}

.wl-card-change {
  font-size: 0.95rem;
  font-weight: 600;
}

.wl-card-price {
  font-size: 0.76rem;
  color: var(--ink-dim);
}

.widget .wl-tools {
  margin-bottom: 0.5rem;
}

.wl-cards-phone {
  display: none;
}

@container (max-width: 560px) {
  .widget .wl-table {
    display: none;
  }

  .widget .wl-cards-phone {
    display: block;
  }
}

/* ---------- Customize (#217) ---------- */

.board-btn {
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.board-btn:hover {
  border-color: var(--ink-faint);
}

.board-btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #111;
  font-weight: 600;
}

.board-btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.board-bar-grow {
  flex: 1;
}

.board-editing-note {
  font-size: 0.9rem;
  font-weight: 600;
}

.board-editing-note small {
  font-weight: 400;
  color: var(--ink-faint);
}

.board-error {
  flex-basis: 100%;
  margin: 0;
  text-align: right;
  color: var(--red);
  font-size: 0.85rem;
}

.board-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

[data-editing] .board > .widget {
  outline: 1px dashed var(--ink-faint);
  outline-offset: 3px;
  position: relative;
}

[data-editing] .board > .widget > .widget-head {
  cursor: grab;
  user-select: none;
  touch-action: none;
  padding-right: 15rem;
}

.board-tools {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 0.8rem);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.2rem 0.3rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.board-tools button,
.board-tools select {
  font: inherit;
  font-size: 0.78rem;
  min-width: 1.9rem;
  min-height: 1.9rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  cursor: pointer;
}

.board-tools button:hover,
.board-tools button:focus-visible,
.board-tools select:focus-visible {
  border-color: var(--amber);
  color: var(--amber);
}

.board-grip {
  cursor: grab;
  color: var(--ink-faint);
  padding: 0 0.2rem;
}

.board-tools-name {
  display: none;
}

.board-dragging {
  opacity: 0.55;
}

[data-editing] .board > .widget.board-dragging {
  outline: 2px solid var(--amber);
}

.board-drag-active,
.board-drag-active * {
  cursor: grabbing !important;
  user-select: none;
}

.board-drop {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 30%, transparent);
}

.board-drag-chip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 51;
  pointer-events: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--amber);
  border-radius: var(--radius-s);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.board-new {
  animation: board-new 2s ease-out;
}

@keyframes board-new {
  from {
    box-shadow: 0 0 0 3px var(--amber);
  }

  to {
    box-shadow: 0 0 0 0 transparent;
  }
}

.board-drawer {
  background: var(--panel);
  border: 1px dashed var(--amber);
  border-radius: var(--radius-m);
  padding: 0.9rem 1.1rem;
  display: grid;
  gap: 0.6rem;
}

.board-drawer h2 {
  margin: 0;
  font-size: 1rem;
}

.board-drawer-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.board-filter {
  flex: 1;
  min-width: 10rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.3rem 0.5rem;
}

.board-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.board-group {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.board-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.6rem;
}

.board-tile {
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
}

.board-tile:hover:not([disabled]),
.board-tile:focus-visible {
  border-color: var(--amber);
}

.board-tile b {
  font-size: 0.86rem;
}

.board-tile span {
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.board-tile.on-board {
  opacity: 0.55;
  cursor: default;
}

.board-tile-member {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
}

.board-tile-text {
  display: grid;
}

.board-tile-text b {
  color: var(--ink);
}

.board-chooser {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.6rem;
  position: relative;
}

.board-chooser h3 {
  margin: 0;
  font-size: 0.9rem;
  flex-basis: 100%;
}

.board-chooser select,
.board-chooser input,
.widget-ticker-query {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.3rem 0.5rem;
  min-width: 12rem;
}

.board-candidates {
  list-style: none;
  margin: 0;
  padding: 0;
  flex-basis: 100%;
  max-height: 16rem;
  overflow: auto;
}

.board-candidates li {
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  border-radius: var(--radius-s);
}

.board-candidates li:hover,
.board-candidates li:focus {
  background: var(--panel-2);
}

.widget-ticker-pick {
  display: grid;
  gap: 0.4rem;
  width: 100%;
}

@media (max-width: 639px) {
  [data-editing] .board > .widget > .widget-head {
    padding-right: 0;
    padding-top: 2.6rem;
  }

  .board-tools {
    left: 0.4rem;
    justify-content: flex-start;
  }
}

/* ---------- Admin Presets (#219) ---------- */

.preset-rename {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.preset-rename input[name="description"] {
  min-width: 16rem;
  flex: 1;
}

.board-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

.board-welcome p {
  margin: 0;
}

/* ---------- Holdings, Contribution, Transactions (#220) ---------- */

.pf-holdings-actions {
  display: flex;
  justify-content: flex-end;
}

.pf-holdings-actions:empty,
.pf-holdings-actions:not(:has(*)) {
  display: none;
}

.widget .pf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.widget .pf-filters .pf-note {
  margin-left: auto;
}

/* ---------- Ticker page on Widgets (#223) ---------- */

/* The header's auto column sizes to the quote, which an inline-size
   container would collapse to zero width. */
.tk-head-quote .widget {
  container-type: normal;
}

.tk-head-quote .widget-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tk-body > div {
  min-width: 0;
}

.tk-discussion > .widget {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.quote-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.board .widget-quote {
  justify-items: start;
  text-align: left;
}

/* ---------- Compare on Widgets (#224) ---------- */

.cmp-widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.4rem;
}

.cmp-widget-head .pf-note {
  margin: 0;
}

.cmp-grid > .widget {
  min-width: 0;
}

/* ---------- Segment returns: the Analytics Performance tab (#228) ---------- */
.seg-page {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.seg-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 860px) {
  .seg-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

.seg-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
}

.seg-tile {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.55rem 0.75rem;
  min-width: 0;
}

.seg-tile-label,
.seg-tile-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.seg-tile-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 600;
}

.seg-tile-sub {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.seg-tile-value.up,
.seg-table .up,
.seg-parts .up {
  color: var(--green);
}

.seg-tile-value.down,
.seg-table .down,
.seg-parts .down {
  color: var(--red);
}

.seg-note {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0 0 0.5rem;
}

.seg-note.stale {
  color: var(--amber);
}

.seg-map .map-block.tiny > b,
.seg-map .map-block.tiny > .mono {
  display: none;
}

.seg-map .map-block.on {
  border-color: var(--ink);
}

.seg-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}

.seg-legend-bar {
  width: 140px;
  height: 8px;
  border-radius: 4px;
}

.seg-lines {
  height: 320px;
}

.seg-lines-detail {
  height: 200px;
  margin: 0.8rem 0;
}

.seg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.seg-chip {
  font: inherit;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink-dim);
  cursor: pointer;
}

.seg-chip i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid var(--line);
}

.seg-chip.on {
  color: var(--ink);
}

.seg-chip.on i {
  background: var(--c);
  border-color: transparent;
}

.seg-chip.focus {
  border-color: var(--ink);
}

.seg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.seg-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--ink-dim);
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.seg-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.seg-table .num {
  text-align: right;
  white-space: nowrap;
}

.seg-table td:first-child {
  overflow-wrap: anywhere;
}

.seg-table tr.sold a {
  color: var(--ink-dim);
}

.seg-table tr.on td {
  background: var(--panel-2);
}

.seg-pill {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.4rem;
  vertical-align: 0.1em;
}

.seg-held {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.seg-held-line {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin: 0 0 0.6rem;
}

.seg-parts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.4rem 1rem;
  margin: 0;
}

.seg-parts dt {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.seg-parts dd {
  margin: 0;
}

.seg-made-of {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin: 0.6rem 0 0;
}

.seg-share {
  color: var(--ink-faint);
}
