/*
 * ============================================================================
 * LEGACY LOOK OVERRIDES (sidebar palette + page background)
 * ============================================================================
 * Metronic 8.3.3's stock colors are replaced here with the ones from the legacy
 * OneFinance app (C:\repos\onefinance, Metronic 7):
 *   - sidebar: assets/metro/css/themes/layout/aside/dark.css and brand/dark.css
 *   - page background: `body` in assets/metro/css/style.bundle.css
 * Colors only - Metronic 8 structure, spacing and typography are untouched.
 * This file loads after css/style.bundle.css (see themesettings.json), and the
 * sidebar selectors mirror the bundle's own in the bundle's order (idle, here,
 * show, hover, active), so they win on equal specificity. Keep that order.
 *
 * HOW TO SWITCH A SECTION OFF / ON
 * Every section is fenced by a one-line switch comment and an END marker:
 *
 *     (switch)  slash-star [ON] 2. Logo strip star-slash
 *               ...rules...
 *     (marker)  slash-star [END] 2 star-slash
 *
 *   - OFF: on the switch line, change [ON] to [OFF] and delete the closing
 *          star-slash. The comment then runs on to the END marker and swallows
 *          the rules. Section P below is an example of a section that is OFF.
 *   - ON:  change [OFF] back to [ON] and put the closing star-slash back.
 *
 * Never put a comment between a switch line and its END marker - it would close
 * the "off" comment early. Notes go in the comment above the switch line.
 * Sections are independent: any mix of ON / OFF is valid.
 *
 * COMMON SWITCHES
 *   - Stock Metronic 8 everywhere ........ sections 1-6 OFF
 *   - Look before the legacy match ....... sections 2-5 OFF, section P ON
 *     (and drop the [data-bs-theme=light] prefix in section 1)
 *   - Legacy sidebar, stock page color ... section 6 OFF
 */

/*
 * 1. Sidebar background, light mode only.   legacy #1e1e2d   |   stock #0D0E12
 *    In dark mode the stock near-black is kept: the legacy navy is lighter and
 *    bluer than the dark page (#0F1014) and clashes with it.
 */
/* [ON] 1. Sidebar background */
[data-bs-theme=light] [data-kt-app-layout=dark-sidebar] .app-sidebar {
  background-color: #1e1e2d;
}
/* [END] 1 */

/*
 * 2. Logo strip at the top of the sidebar: a slightly darker block, no divider.
 *    Light mode only, for the same reason as section 1.
 *    legacy #1a1a27, no border   |   stock: sidebar color + 1px dashed #1F212A
 */
/* [ON] 2. Logo strip */
[data-bs-theme=light] [data-kt-app-layout=dark-sidebar] .app-sidebar .app-sidebar-logo {
  background-color: #1a1a27;
  border-bottom: 0;
}
/* [END] 2 */

/*
 * 3. Idle text.
 *    section headings   legacy #4c4e6f   |   stock #636674
 *    top-level items    legacy #a2a3b7   |   stock #9A9CAE
 *    sub-items          legacy #9899ac   |   stock #9A9CAE
 */
/* [ON] 3. Idle text */
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-heading {
  color: #4c4e6f !important;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-title {
  color: #a2a3b7;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-sub .menu-item .menu-link,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-sub .menu-item .menu-link .menu-title {
  color: #9899ac;
}
/* [END] 3 */

/*
 * 4. Idle icons, sub-item bullets and accordion arrows.
 *    icons              legacy #494b74   |   stock #464852
 *    bullets, arrows    legacy #5c5e81   |   stock #464852
 */
/* [ON] 4. Idle icons, bullets, arrows */
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon i {
  color: #494b74;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-bullet .bullet,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-arrow:after {
  background-color: #5c5e81;
}
/* [END] 4 */

/*
 * 5. Highlighted rows: open parent (.here / .show), hovered item, current page
 *    (.active). All four share one treatment, as in legacy.
 *    row background     legacy #1b1b28   |   stock: none (current page #1C1C21)
 *    text, arrow        legacy #ffffff   |   stock #F5F5F5
 *    icon, bullet       #1B84FF          |   stock #F5F5F5
 *    Deliberate deviations from legacy:
 *      - the accent is this app's primary blue (#1B84FF) so the sidebar matches
 *        buttons and links; legacy used its own primary, #3699FF.
 *      - in dark mode the row background is the stock neutral #1C1C21 (last
 *        rule of the section), to sit on the stock dark sidebar of section 1.
 */
/* [ON] 5. Highlighted rows */
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link {
  background-color: #1b1b28;
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-title {
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-icon i {
  color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-bullet .bullet {
  background-color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link .menu-arrow:after {
  background-color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link {
  background-color: #1b1b28;
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-title {
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-icon i {
  color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-bullet .bullet {
  background-color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link .menu-arrow:after {
  background-color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here),
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) {
  background-color: #1b1b28;
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-title,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-title {
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-icon i,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-icon i {
  color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-bullet .bullet,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-bullet .bullet {
  background-color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here) .menu-arrow:after,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) .menu-arrow:after {
  background-color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active {
  background-color: #1b1b28;
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-title {
  color: #ffffff;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-icon i {
  color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-bullet .bullet {
  background-color: #1B84FF;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active .menu-arrow:after {
  background-color: #ffffff;
}

[data-bs-theme=dark] [data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.here > .menu-link,
[data-bs-theme=dark] [data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.show > .menu-link,
[data-bs-theme=dark] [data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here) > .menu-link:not(.disabled):not(.active):not(.here),
[data-bs-theme=dark] [data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here),
[data-bs-theme=dark] [data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active {
  background-color: #1C1C21;
}
/* [END] 5 */

/*
 * P. Previous palette - what this file had before the legacy match: light grey
 *    icons and a lighter current-page row, everything else stock. Normally OFF.
 *    To go back to it: switch sections 2-5 OFF and this one ON.
 */
/* [OFF] P. Previous palette
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon .svg-icon,
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link .menu-icon i {
  color: #C5C5D8;
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active {
  background-color: #2A2A3C;
}
/* [END] P */

/*
 * 6. Page background, light mode only (dark mode is left stock).
 *    The legacy page is a cool light grey, so the white cards stand out more.
 *    page               legacy #EEF0F8   |   stock #fcfcfc
 *    The stock header and footer are transparent and would turn grey with the
 *    page; legacy keeps both white, so they are pinned to white here.
 */
/* [ON] 6. Page background */
[data-bs-theme=light] {
  --bs-app-bg-color: #EEF0F8;
  --bs-app-header-base-bg-color: #ffffff;
  --bs-app-footer-bg-color: #ffffff;
}
/* [END] 6 */

/*
 * Light/dark logo swap. The header and auth card follow the user's data-bs-theme
 * toggle (light background in light mode, near-black in dark mode), so both logo
 * variants are rendered and CSS shows only the one that matches.
 */
[data-bs-theme="dark"] .logo-for-light {
  display: none;
}

[data-bs-theme="light"] .logo-for-dark {
  display: none;
}

/*
 * Mobile header logo: below 360px the wordmark doesn't fit beside the navbar
 * (toggle + wordmark + plan badge + three buttons ≈ 366px), so the small logo
 * takes its place — Metronic's own mobile header uses an icon-only logo.
 */
.header-logo-small {
  display: none;
}

@media (max-width: 359.98px) {
  .header-logo-full {
    display: none !important;
  }

  .header-logo-small {
    display: inline;
  }
}
/*
 * KPI card row: column count follows the row's own width (container query),
 * so a KPI value (one unbreakable number beside a 45px icon) never gets
 * squeezed below ~235px when the sidebar narrows the content. Rows stay
 * balanced per card count instead of leaving a lone card on the last row:
 *   - any count: 1 column, then 2 (an odd last card takes the full row)
 *   - .kpi-grid-4: 2 + 2, then 4 across (skips 3 + 1)
 *   - .kpi-grid-5: 3 + 2 (bottom pair shares the row), then 5 across
 *   - .kpi-grid-6: 2 + 2 + 2, then 3 + 3, then 6 across
 * The grid sits inside .kpi-grid-wrap because a container can't query itself.
 */
.kpi-grid-wrap {
  container: kpi / inline-size;
}

.kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@container kpi (min-width: 500px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container kpi (500px <= width < 780px) {
  .kpi-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@container kpi (min-width: 780px) {
  .kpi-grid-5 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .kpi-grid-5 > * {
    grid-column: span 2;
  }

  .kpi-grid-5 > :nth-child(n + 4) {
    grid-column: span 3;
  }
}

@container kpi (min-width: 780px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container kpi (min-width: 1040px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

  .kpi-grid-5 > *,
  .kpi-grid-5 > :nth-child(n + 4) {
    grid-column: auto;
  }
}

@container kpi (min-width: 1490px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/*
 * Adaptive tables (Holdings, Closed trades) — width-adaptive layout driven by
 * container queries. Breakpoints follow the card's own width (not the
 * viewport), so collapsing or expanding the sidebar re-flows the table
 * correctly. Tiers:
 *   - wide:    every column (Holdings: allocation as bar + %)
 *   - medium:  secondary columns drop out (allocation bar, then the
 *              allocation and quantity columns)
 *   - compact: each row becomes a list item (security left, figures right,
 *              optional footer lines); column headers are hidden, so the
 *              card header's sort select takes over.
 * Cells are identified by their `cell-*` role class; the compact row layout
 * is picked by which cells a row contains. Cards whose header carries controls
 * (search, filters, sort) mark it .adaptive-header to get the compact header
 * grid; its areas come from --adaptive-header-areas, set per page on the card.
 */
.adaptive-table-card {
  container-type: inline-size;
}

.adaptive-search {
  width: 200px;
}

.adaptive-sort {
  display: none;
  width: 12rem;
}

.table-adaptive .cell-compact-only {
  display: none;
}

.table-adaptive td {
  font-variant-numeric: tabular-nums;
}

/* Security absorbs the leftover width and truncates the name; numeric columns stay nowrap. */
.table-adaptive .cell-security {
  width: 100%;
  max-width: 0;
  min-width: 150px;
}

@container (max-width: 1000px) {
  .table-adaptive .allocation-bar {
    display: none;
  }
}

@container (max-width: 820px) {
  .table-adaptive .cell-allocation,
  .table-adaptive .cell-qty {
    display: none;
  }
}

@container (max-width: 700px) {
  /*
   * Header controls laid out on a grid (areas per page). The title/toolbar
   * wrappers step aside (display: contents) so their children can be placed
   * directly.
   */
  .adaptive-table-card .card-header.adaptive-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: var(--adaptive-header-areas, "search search" "view view" "platform sort");
    gap: 0.75rem;
  }

  /*
   * Three classes deep to outrank Metronic's `.card .card-header .card-toolbar { display: flex }`;
   * direct children only, since a heading inside the title wrapper may carry .card-title too.
   */
  .adaptive-table-card .adaptive-header > .card-title,
  .adaptive-table-card .adaptive-header > .card-toolbar {
    display: contents;
  }

  .adaptive-title {
    grid-area: title;
    margin: 0 !important;
  }

  /* my-1 / mw-*px are !important utilities. */
  .adaptive-search-wrap {
    grid-area: search;
    margin: 0 !important;
  }

  .adaptive-search {
    width: 100%;
  }

  /* Plain headers (no control grid): the title area takes its own row so the search can fill it. */
  .adaptive-table-card .card-header:not(.adaptive-header) > .card-title {
    flex: 1 1 100%;
    min-width: 0;
    margin-right: 0;
  }

  .adaptive-search-wrap {
    width: 100%;
  }

  .adaptive-view {
    grid-area: view;
  }

  .adaptive-view > .btn {
    flex: 1 1 0;
    white-space: nowrap;
  }

  .adaptive-platform {
    grid-area: platform;
    max-width: none !important;
  }

  .adaptive-year {
    grid-area: year;
    max-width: none !important;
  }

  /* A whole filter form (date range + filter menu button) as one header cell. */
  .adaptive-filters {
    grid-area: filters;
  }

  .adaptive-sort {
    display: block;
    grid-area: sort;
    width: auto;
  }

  .table-adaptive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table-adaptive,
  .table-adaptive tbody {
    display: block;
  }

  .table-adaptive tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "security value"
      "security pnl";
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.15rem;
    padding: 0.85rem 0;
  }

  /* .table prefix outranks Metronic's `.table:not(.table-bordered) td` border inheritance. */
  .table.table-adaptive tbody td {
    padding: 0 !important;
    border: 0;
  }

  .table-adaptive tbody td[colspan] {
    grid-column: 1 / -1;
  }

  .table-adaptive .cell-security { grid-area: security; width: auto; max-width: none; min-width: 0; }
  .table-adaptive .cell-value    { grid-area: value; }
  .table-adaptive .cell-pnl      { grid-area: pnl; }
  .table-adaptive .cell-proceeds { grid-area: money; }

  /* Holdings rows open the instrument page, which carries every row-menu action. */
  .table-adaptive .cell-position,
  .table-adaptive .cell-allocation,
  .table-adaptive .cell-actions,
  .table-adaptive .cell-detail,
  .table-adaptive .cell-value .cell-sub {
    display: none;
  }

  /* P&L amount and % side by side on one line. */
  .table-adaptive .cell-pnl {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.4rem;
  }

  .table-adaptive .cell-pnl .fs-8 {
    font-size: 0.85rem !important;
  }

  /* Two-part secondary lines ("€x gross · €y VAT"); skipped when the first part is compact-hidden (dividends). */
  .table-adaptive .cell-pnl.cell-secondary > div:not(.cell-compact-hidden) + div::before {
    content: "· ";
  }

  /* Rows with no value cell (closed trades): P&L, stacked over its %, takes the whole right side. */
  .table-adaptive tbody tr:not(:has(.cell-value)) {
    grid-template-areas:
      "security pnl"
      "security pnl";
  }

  .table-adaptive tr:not(:has(.cell-value)) .cell-pnl {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }

  /* Rows with no P&L cell (instrument orders): the qty × price line takes the second right-hand slot. */
  .table-adaptive tbody tr:has(.cell-position):not(:has(.cell-pnl)) {
    grid-template-areas:
      "security value"
      "security position";
  }

  .table-adaptive tr:has(.cell-position):not(:has(.cell-pnl)) .cell-position {
    display: block;
    grid-area: position;
  }

  /* Footer line under the row (Holdings detailed: acquired; Closed: sold), labelled via data-footer-label. */
  .table-adaptive tbody tr:has(.cell-footer) {
    grid-template-areas:
      "security value"
      "security pnl"
      "footer   footer";
  }

  .table-adaptive .cell-footer {
    grid-area: footer;
    display: flex;
    flex-wrap: wrap;
    column-gap: 0.3rem;
    margin-top: 0.25rem;
  }

  .table-adaptive .cell-footer::before {
    content: attr(data-footer-label);
  }

  .table-adaptive .cell-footer > div + div::before {
    content: "· ";
  }

  .table-adaptive .cell-footer:not([data-footer-label])::before {
    content: none;
  }

  /* Footer rows whose other right-hand line is qty × price (orders list). */
  .table-adaptive tbody tr:has(.cell-footer):has(.cell-position):not(:has(.cell-pnl)) {
    grid-template-areas:
      "security value"
      "security position"
      "footer   footer";
  }

  /*
   * Row actions that must stay reachable in compact (edit/delete where the
   * edit page can't delete): they sit at the right end of the footer line,
   * so they don't narrow the security column.
   */
  .table-adaptive tbody tr:has(.cell-footer):has(.cell-row-actions) {
    grid-template-areas:
      "security value"
      "security pnl"
      "footer   actions";
  }

  .table-adaptive tbody tr:has(.cell-footer):has(.cell-position):not(:has(.cell-pnl)):has(.cell-row-actions) {
    grid-template-areas:
      "security value"
      "security position"
      "footer   actions";
  }

  /* Rows with row actions but no footer line (reference lists): actions take a third column on the right. */
  .table-adaptive tbody tr:has(.cell-row-actions):not(:has(.cell-footer)) {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "security value actions"
      "security pnl   actions";
  }

  .table-adaptive .cell-row-actions {
    grid-area: actions;
    justify-self: end;
    align-self: center;
  }

  /*
   * Closed trades: profit stacked over return on the right, then a full-width
   * "cost → proceeds · fees" line (proceeds cell with its compact-only cost
   * prefix), so no wide cell sits in the right column and squeezes the security.
   */
  .table-adaptive tbody tr:has(.cell-proceeds) {
    grid-template-areas:
      "security pnl"
      "footer   footer"
      "money    money";
  }

  .table-adaptive .cell-cost {
    display: none;
  }

  .table-adaptive .cell-compact-only {
    display: inline;
  }

  .table-adaptive div.cell-compact-only {
    display: block;
  }

  .table-adaptive .cell-compact-hidden {
    display: none !important;
  }

  .table-adaptive .cell-proceeds {
    display: flex;
    flex-wrap: wrap;
    column-gap: 0.3rem;
  }

  .table-adaptive .cell-proceeds > div + div::before {
    content: "· ";
  }

  /* Secondary lines share the subline size (fs-7); fs-8 on inner lines is !important, so this must be too. */
  .table.table-adaptive .cell-footer,
  .table.table-adaptive .cell-footer > div,
  .table.table-adaptive .cell-proceeds,
  .table.table-adaptive .cell-proceeds > div,
  .table.table-adaptive .cell-secondary,
  .table.table-adaptive .cell-secondary > div,
  .table.table-adaptive tr:not(:has(.cell-pnl)) .cell-position {
    font-size: 0.95rem !important;
    color: var(--bs-gray-600) !important;
  }

  .table-adaptive .cell-footer::before {
    color: var(--bs-gray-500);
  }
}
