/* ------------------------------------------------------------
   The Lexicon — Table (read-only)
   Includes: session-only zoom presets (S/M/L buttons)
   Default density: Small (headers 0.55rem, values 0.50rem)
   ------------------------------------------------------------ */

/* Single-column shell safety */
.tool-shell.tool-shell--single {
  display: grid;
  grid-template-columns: 1fr;
  overflow-x: hidden;
}

.tool-shell.tool-shell--single > * {
  grid-column: 1 / -1;
}

/* Panel container + zoom variables */
.lexicon-wrap {
  /* Zoom vars (defaults = Small) */
  --lex-body-rem: 0.50rem;
  --lex-head-rem: 0.55rem;
  --lex-h3-rem: 0.70rem;
  --lex-meta-rem: 0.60rem;

  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0.75rem;

  padding: 0.45rem 0.5rem;
  width: 100%;
  max-inline-size: min(1200px, 100%);
  margin-inline: auto;
  overflow-x: auto;
  overflow-y: auto;
}

/* Zoom presets (JS toggles class on .lexicon-wrap) */
.lexicon-wrap.zoom-small {
  --lex-body-rem: 0.50rem;
  --lex-head-rem: 0.55rem;
  --lex-h3-rem: 0.70rem;
  --lex-meta-rem: 0.60rem;
}

.lexicon-wrap.zoom-medium {
  --lex-body-rem: 0.62rem;
  --lex-head-rem: 0.66rem;
  --lex-h3-rem: 0.82rem;
  --lex-meta-rem: 0.72rem;
}

.lexicon-wrap.zoom-large {
  --lex-body-rem: 0.74rem;
  --lex-head-rem: 0.78rem;
  --lex-h3-rem: 0.94rem;
  --lex-meta-rem: 0.84rem;
}

/* Header bar */
.lexicon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.lexicon-header h3 {
  margin: 0;
  font-size: var(--lex-h3-rem);
  font-weight: 600;
  line-height: 1.05;
}

.lexicon-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* Hide the old meta display entirely (kept in DOM for future use) */
.lexicon-meta {
  display: none;
}

/* Zoom buttons: tiny, dense */
.lexicon-zoom-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.lexicon-zoom-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;

  padding: 0.10rem 0.28rem;
  line-height: 1.0;

  font-size: var(--lex-meta-rem);
  font-weight: 700;

  cursor: pointer;
  user-select: none;
}

.lexicon-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lexicon-zoom-btn.is-active,
.lexicon-zoom-btn[aria-pressed="true"] {
  background: rgba(181, 140, 255, 0.18);
  border-color: rgba(181, 140, 255, 0.45);
}

.lexicon-zoom-btn:focus {
  outline: 2px solid rgba(181, 140, 255, 0.55);
  outline-offset: 1px;
}

/* Scroll container */
.lexicon-table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: clamp(320px, 65vh, 900px);
  overflow-x: auto !important;
  overflow-y: auto;

  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

/* TABLE */
table.lexicon-table {
  width: max-content;
  min-width: 1000px;
  border-collapse: separate;
  border-spacing: 0;

  font-size: var(--lex-body-rem);
  line-height: 1.1;
  table-layout: auto; /* allow natural column sizing so width can overflow */

  position: relative;
}

/* COLUMN HEADERS */
table.lexicon-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;

  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(6px);

  border: 1px solid rgba(128, 40, 40, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(60, 18, 18, 0.45);
  border-radius: 0;

  font-size: var(--lex-head-rem);
  font-weight: 600;
  letter-spacing: 0.03em;

  white-space: nowrap;
  padding: 1.00rem 0.24rem 0.32rem;
  min-height: 2.6rem;

  overflow: visible;
  max-width: none;
  /* allow dropdown filter to render outside the cell height */
  position: sticky;
}

/* Freeze first two columns */
table.lexicon-table th:nth-child(1),
table.lexicon-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #0c0e12;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.08);
}

table.lexicon-table th:nth-child(2),
table.lexicon-table td:nth-child(2) {
  position: sticky;
  left: calc(var(--lex-freeze-col1, 180px) - 1px);
  z-index: 4;
  background: #0c0e12;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.08);
}

table.lexicon-table thead th:nth-child(1),
table.lexicon-table thead th:nth-child(2) {
  z-index: 7;
}

/* Ensure non-frozen cells sit beneath frozen columns */
table.lexicon-table td {
  position: relative;
  z-index: 1;
}

/* Keep frozen columns solid on row hover */
table.lexicon-table tbody tr:hover td:nth-child(1),
table.lexicon-table tbody tr:hover td:nth-child(2) {
  background: #0c0e12;
  z-index: 5;
}

/* Body cells */
table.lexicon-table th,
table.lexicon-table td {
  padding: 0.18rem 0.28rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;

  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Hover */
table.lexicon-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Long text columns */
.lexicon-cell--text {
  white-space: normal;
  min-width: 180px;
  max-width: 300px;
  overflow-wrap: anywhere;
}

/* Non-text cells */
table.lexicon-table td:not(.lexicon-cell--text) {
  white-space: nowrap;
}

/* Mono-ish IDs */
.lexicon-cell--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

.lexicon-cell--number {
  text-align: center;
}

.lexicon-empty {
  opacity: 0.7;
  font-style: italic;
}

/* Sortable headers */
.lexicon-th {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.lexicon-th:focus {
  outline: 2px solid rgba(181, 140, 255, 0.55);
  outline-offset: -2px;
}

.lexicon-th__glyph {
  margin-left: 0.15rem;
  font-size: 0.6em;
  opacity: 0.8;
}

.lexicon-th.is-sorted {
  box-shadow: inset 0 -1px 0 rgba(181, 140, 255, 0.45);
}

.lexicon-th.is-filtering {
  z-index: 30;
}


/* Export button (compact) */
.lexicon-export-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0.55rem;

  padding: 0.10rem 0.45rem;
  line-height: 1.0;

  font-size: var(--lex-meta-rem);
  font-weight: 650;

  cursor: pointer;
  user-select: none;
}

.lexicon-export-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lexicon-export-btn:focus {
  outline: 2px solid rgba(181, 140, 255, 0.55);
  outline-offset: 1px;
}

/* ------------------------------------------------------------
   Lexicon — Two-column shell + 2x2 tiles + Theater mode
   (Overrides appended to preserve existing table styling)
   ------------------------------------------------------------ */

/* Two-column shell */
.tool-shell.lexicon-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

/* Reset any inherited top offsets so sidebar and main align at the top */
.tool-shell.lexicon-shell > .lexicon-sidebar,
.tool-shell.lexicon-shell > .lexicon-main {
  margin-top: 0;
}

/* Single main column (table dominates) */
.lexicon-main {
  width: 100%;
  min-width: 0;
}

.lex-tile--full {
  height: calc(100vh - 180px);
  min-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
}

@media (max-width: 920px) {
  .lex-tile--full {
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 920px) {
  .tool-shell.lexicon-shell {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.lexicon-sidebar {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0.75rem;
  padding: 0.9rem;
}

.lexicon-sidebar__header h3 {
  margin: 0 0 0.25rem 0;
}

.lexicon-sidebar__sub {
  margin: 0 0 0.75rem 0;
  opacity: 0.78;
  font-size: 0.9rem;
}

.lexicon-modules {
  display: grid;
  gap: 0.6rem;
}

.lexicon-module-card {
  text-align: left;
  border-radius: 0.85rem;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  padding: 0.75rem 0.8rem;
  cursor: pointer;
}

.lexicon-module-card__title {
  font-weight: 900;
  letter-spacing: 0.01em;
}

.lexicon-module-card__meta {
  margin-top: 0.15rem;
  opacity: 0.78;
  font-size: 0.85rem;
}

.lexicon-module-card.is-active {
  border-color: rgba(181, 140, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(181, 140, 255, 0.18);
  background: linear-gradient(
    90deg,
    rgba(112, 70, 168, 0.22) 0%,
    rgba(0, 0, 0, 0.22) 62%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

.lexicon-module-card[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Tiles grid (2x2) — constrained to viewport so all 4 tiles fit */


/* ------------------------------------------------------------
   Lexicon — Top edge alignment with sidebar
   Home.css adds margin-top to .tool-shell section/article; Lexicon's right grid
   is a <section>, so it gets pushed down. Zero it here.
   ------------------------------------------------------------ */
.tool-shell.lexicon-shell > .lexicon-grid {
  margin-top: 0;
}

/* ------------------------------------------------------------
   Lexicon — Grid alignment reset
   Ensure left sidebar and right grid align at the very top by
   removing any UA/framework margins on <article>.
   ------------------------------------------------------------ */
.lexicon-grid > .lex-tile {
  margin: 0;
}

.lexicon-main > .lex-tile {
  margin: 0;
}

.lexicon-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.9rem;
  align-items: stretch;

  /* Fit 4 tiles within the viewport (hero + nav above, footer below) */
  height: calc(100vh - 360px);
  min-height: 0;
}

@media (max-width: 920px) {
  .lexicon-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.lex-tile {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0; /* critical: allow grid rows to constrain height */
}

/* Allow the table tile to show scrollbars fully */
/* Keep tile overflow clipped; scroll happens in the inner wrap */
.lex-tile[data-tile="table"] {
  overflow: hidden;
  padding-bottom: 0.05rem !important; /* tighten bottom only; leave other sides as default */
}

.lex-tile__header {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.15rem;
  padding: 0.28rem 0.40rem;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Table tile: trim header bottom padding so the grid can sit higher */
.lex-tile[data-tile="table"] .lex-tile__header {
  padding: 0.16rem 0.35rem 0.05rem;
  margin-bottom: 0.05rem;
}





.lex-tile__header-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.lex-tile[data-tile="table"] .lex-tile__header-main {
  align-items: center;
}

.lex-table-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
}

.lex-tile[data-tile="table"] .lex-tile__actions {
  align-items: center;
}

.lex-tile__header-main h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

input.lexicon-search,
.lexicon-search[type="search"],
.lexicon-search {
  min-width: 180px;
  max-width: 260px;
  width: 100%;
  height: 28px !important;
  padding: 0 8px !important;
  border-radius: 0.35rem !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  background: rgba(0, 0, 0, 0.20) !important;
  color: #f5f7fb !important;
  font-size: 0.78rem !important;
  line-height: 28px !important;
  margin: 0 !important;
  font-family: inherit;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  align-self: center;
  vertical-align: middle;
  transform: translateY(0);
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

.lexicon-search::-webkit-search-decoration,
.lexicon-search::-webkit-search-cancel-button,
.lexicon-search::-webkit-search-results-button,
.lexicon-search::-webkit-search-results-decoration {
  display: none;
}

.lex-tile[data-tile="table"] .lexicon-search {
  height: 28px !important;
  padding: 0 8px !important;
  align-self: center;
}

.lexicon-search::placeholder {
  color: rgba(245, 247, 251, 0.7);
}

.lexicon-search:focus {
  outline: 2px solid rgba(181, 140, 255, 0.55);
  outline-offset: 2px;
}





.lex-tile__header-sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: unset;
  margin-top: -0.1rem;
  margin-bottom: 0.18rem; /* add slight breathing room below subheader */
}





.lex-tile__subtext {
  font-size: 0.78rem;
  opacity: 0.78;
  line-height: 1.1;
}






.lex-tile__header-sub .lexicon-meta {
  font-size: 0.85rem;
  opacity: 0.72;
  white-space: nowrap;
}

.lex-tile__subtitle {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  opacity: 0.78;
}

.lex-tile__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.lexicon-th__inner {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: start;
  row-gap: 0.22rem;
  width: 100%;
}

.lexicon-th__label {
  display: block;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  line-height: 1.05;
  font-size: clamp(0.58rem, 1vw, var(--lex-head-rem));
  transform: translate(0.22rem, 0.04rem) rotate(-16deg);
  transform-origin: bottom left;
  padding-bottom: 0.16rem;
  padding-top: 0.14rem;
  margin-bottom: 0.08rem;
  align-self: center;
}

.lexicon-th__controls {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  margin-left: 0;
  align-self: start;
  width: 100%;
  padding-top: 0.20rem;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: -0.10rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  justify-content: flex-start;
}

.lexicon-col-filter {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0.35rem;
  width: 1.05rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  align-self: center;
}

.lexicon-col-filter svg {
  width: 0.62rem;
  height: 0.62rem;
  stroke: rgba(220,220,240,0.95);
  stroke-width: 1.7;
  stroke-linejoin: round;
  fill: none;
}

.lexicon-col-filter.is-active,
.lexicon-col-filter:focus {
  outline: 1px solid rgba(181, 140, 255, 0.55);
  outline-offset: 1px;
  border-color: rgba(181, 140, 255, 0.45);
  background: rgba(181, 140, 255, 0.16);
}

.lexicon-col-filter.is-open {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.26);
}

.lexicon-th.has-filter {
  box-shadow: inset 0 -1px 0 rgba(181, 140, 255, 0.45);
}

.lexicon-th.is-sorted {
  box-shadow: inset 0 -2px 0 rgba(181, 140, 255, 0.8);
  background: linear-gradient(180deg, rgba(181, 140, 255, 0.16) 0%, rgba(12, 14, 18, 0.92) 90%);
  color: #f5f1ff;
}

table.lexicon-table thead th.is-sorted .lexicon-col-filter {
  border-color: rgba(181, 140, 255, 0.65);
}

table.lexicon-table td.lexicon-td--sorted {
  background: rgba(181, 140, 255, 0.05);
}

/* Ensure sorted headers (including frozen ones) show the gradient */
table.lexicon-table thead th.is-sorted {
  background-color: #0c0e12;
  background-image: linear-gradient(180deg, rgba(181, 140, 255, 0.16) 0%, rgba(12, 14, 18, 0.92) 90%);
  background-blend-mode: normal;
}

/* Keep sorted frozen cells fully opaque and above neighbors */
table.lexicon-table td.lexicon-td--sorted:nth-child(1),
table.lexicon-table td.lexicon-td--sorted:nth-child(2) {
  background: #0c0e12;
  z-index: 6;
}

.lexicon-col-filter-input {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  transform: none;
  width: 100%;
  min-width: 150px;
  max-width: 240px;
  display: inline-block;
  padding: 0.06rem 0.32rem !important;
  height: 1.05rem !important;
  min-height: 0 !important;
  line-height: 1 !important;
  border-radius: 0.22rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 10, 0.96);
  color: #f5f7fb;
  font-size: 0.68rem;
  box-sizing: border-box;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  z-index: 50;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: none !important;
}

.lexicon-col-filter-input[hidden],
.lexicon-col-filter-input[aria-hidden="true"] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.lexicon-floating-filter {
  position: absolute;
  top: 0;
  left: 0;
  transform: none;
  width: auto;
  min-width: 150px;
  max-width: 260px;
  display: inline-block;
  padding: 0.06rem 0.32rem !important;
  height: 1.05rem !important;
  min-height: 0 !important;
  line-height: 1 !important;
  border-radius: 0.22rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 7, 10, 0.96);
  color: #f5f7fb;
  font-size: 0.68rem;
  box-sizing: border-box;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  z-index: 2000;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: none !important;
}

.lex-tile__expand svg {
  width: 0.98rem;  /* 30% smaller than 1.4rem */
  height: 0.98rem; /* 30% smaller than 1.4rem */
  stroke: rgba(220,220,240,0.95);
  stroke-width: 2;
  fill: none;
}



.lex-tile__expand:hover {
  border-color: rgba(181,140,255,0.45);
  box-shadow: 0 0 0 2px rgba(181,140,255,0.15);
  transform: translateY(-1px);
}

.lex-tile__expand:hover svg {
  stroke: #ffffff;
}

.lex-tile__expand:active {
  transform: translateY(0);
}

.lex-tile__body {
  padding: 0.08rem 0.10rem;
  flex: 1 1 auto;
  min-height: 0;   /* critical: enables inner scrollers */
  overflow: hidden;
}

/* Table tile: remove extra chrome and let the table scroll within the tile */
.lex-tile[data-tile="table"] .lex-tile__body {
  padding: 0.04rem 0.04rem 0.02rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lex-tile[data-tile="table"] .lexicon-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 0 0.02rem 0;
  max-inline-size: none;
  margin-inline: 0;
  width: 100%;
  display: block;
  overflow-x: auto !important;
  overflow-y: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

/* Data table footer */
.lex-table__footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 0.5rem 0.6rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0, 0, 0, 0.18);
}

.lex-table__footer .lexicon-export-btn {
  font-size: 0.82rem;
}

/* Override the old vh-based max-height: table should fill the tile body */
.lex-tile[data-tile="table"] .lexicon-table-wrap {
  height: 100%;
  max-height: 100%;
  overflow-x: auto !important;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0; /* remove extra bottom inset for tight fit */
}

.lexicon-grid.is-theater .lex-tile.is-expanded[data-tile="table"] .lexicon-table-wrap {
  height: 100%;
  max-height: 100%;
  overflow-x: auto !important;
  overflow-y: auto;
}

.lexicon-grid.is-theater .lex-tile.is-expanded[data-tile="table"] .lexicon-wrap {
  height: 100%;
  max-height: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
}

/* Downloads tile */
.lex-downloads {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .lex-downloads {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

.lex-downloads__section {
  display: grid;
  gap: 0.35rem;
  align-items: start;
  padding: 0.5rem 0.55rem 0.6rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.55rem;
  box-shadow: 0 10px 22px rgba(0,0,0,0.24);
}

.lex-downloads__section-title {
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 0.94rem;
  padding: 0.4rem 0.48rem;
  border-radius: 0.35rem;
  background: linear-gradient(135deg, rgba(122,96,210,0.42), rgba(74,60,150,0.34));
  border: 1px solid rgba(181,140,255,0.28);
}

.lex-downloads__actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lex-downloads__list {
  display: grid;
  gap: 0.35rem;
}

.lex-downloads__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.14rem;
  padding: 0.16rem 0.34rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.35rem;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 6px 14px rgba(0,0,0,0.22);
  color: inherit;
  text-decoration: none;
}

.lex-downloads__item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.lex-downloads__item-row--desc {
  align-items: center;
  gap: 0.75rem;
}

.lex-downloads__item:hover {
  border-color: rgba(181,140,255,0.55);
  background: rgba(181,140,255,0.12);
}

.lex-downloads__item-title {
  font-weight: 750;
  font-size: 0.86rem;
}

.lex-downloads__item-meta {
  font-size: 0.64rem;
  opacity: 0.78;
  white-space: nowrap;
}

.lex-downloads__item-desc {
  font-size: 0.7rem;
  opacity: 0.82;
  line-height: 1.3;
  flex: 1 1 auto;
}

.lex-downloads__item-download {
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
  min-width: 1.35rem;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: linear-gradient(145deg, rgba(222,206,255,0.28), rgba(120,96,190,0.28));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 4px 10px rgba(0,0,0,0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e9e2ff;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.lex-downloads__item-download::before {
  content: "";
  position: absolute;
  width: 0.2rem;
  height: 0.65rem;
  top: 0.25rem;
  background: currentColor;
  border-radius: 0.12rem;
}

.lex-downloads__item-download::after {
  content: "";
  position: absolute;
  bottom: 0.2rem;
  width: 0;
  height: 0;
  border-left: 0.36rem solid transparent;
  border-right: 0.36rem solid transparent;
  border-top: 0.48rem solid currentColor;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.25));
}

.lex-downloads__item:hover .lex-downloads__item-download {
  background: linear-gradient(145deg, rgba(181,140,255,0.28), rgba(181,140,255,0.14));
  border-color: rgba(181,140,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 6px 14px rgba(0,0,0,0.34);
  transform: translateY(-1px) scale(1.05);
}

.lex-downloads__empty {
  font-size: 0.9rem;
  opacity: 0.78;
}

.lexicon-export-btn.secondary {
  background: linear-gradient(135deg, #5b3c9f 0%, #8f6bd8 55%, #2b1a4f 100%);
  color: #f5f0ff;
  border-color: rgba(180, 150, 255, 0.55);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.lexicon-export-btn.secondary:hover {
  filter: brightness(1.05);
  border-color: rgba(200, 175, 255, 0.80);
}

.lexicon-export-btn.secondary:active {
  filter: brightness(0.97);
}

.lexicon-export-btn.secondary:focus-visible {
  outline-color: rgba(200, 175, 255, 0.90);
}

.lex-tile__help {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
  opacity: 0.78;
}

/* Docs tile */
.lex-docs h4 {
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
}

.lex-docs__disclaimer {
  opacity: 0.9;
}

/* Insights tile */
.lex-insights__placeholder {
  opacity: 0.78;
}

.lex-insights__kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.lex-kpi {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 0.75rem;
  padding: 0.7rem 0.75rem;
}

.lex-kpi__label {
  font-size: 0.82rem;
  opacity: 0.78;
}

.lex-kpi__value {
  font-size: 1.15rem;
  font-weight: 900;
  margin-top: 0.15rem;
}

.lex-insights__table {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 0.75rem;
  overflow: hidden;
}

.lex-insights__table table {
  width: 100%;
  border-collapse: collapse;
}

.lex-insights__table th,
.lex-insights__table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: left;
  font-size: 0.9rem;
}

.lex-insights__table th {
  opacity: 0.85;
  font-weight: 900;
  white-space: nowrap;
}

.lex-insights__table td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
}

/* Theater mode: one tile expands; others hidden */
.lexicon-grid.is-theater .lex-tile {
  display: none;
}

.lexicon-grid.is-theater .lex-tile.is-expanded {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  height: calc(100vh - 360px);
  min-height: 0;
}

/* Header-row expand alignment */
.lex-tile__header-main {
  position: relative;
}

.lex-tile__header-main .lex-tile__header-main:hover

/* ------------------------------------------------------------
   Lexicon — Expand icon (hard reset, icon-only)
   ------------------------------------------------------------ */

.lex-tile__expand svg {
  width: 100%;
  height: 100%;
  stroke: rgba(220,220,240,0.95);
  stroke-width: 2;
  fill: none;
}

/* Expand icon — final cleanup */
.lex-tile__expand svg {
  width: 200%;
  height: 200%;
}

/* Expand icon — square hitbox + proper scaling */
.lex-tile__expand svg {
  width: 1.8rem;
  height: 1.8rem;
}

/* ------------------------------------------------------------
   Lexicon — Header row vertical alignment fix
   ------------------------------------------------------------ */

.lex-tile__header-main {
  display: flex;
  align-items: center; /* force true vertical centering */
}

/* Prevent title line-height from pulling the row */
.lex-tile__header-main h3,
.lex-tile__header-main .lex-tile__title {
  line-height: 1.1;
}

/* Optical nudge for expand icon (baseline compensation) */

/* ------------------------------------------------------------
   Lexicon — Expand control (non-button, framework-safe)
   ------------------------------------------------------------ */

.lex-tile__expand {
  display: grid;
  place-items: center;
  width: 1.575rem;  /* 30% smaller than 2.25rem */
  height: 1.575rem; /* 30% smaller than 2.25rem */
  aspect-ratio: 1 / 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 120ms ease, transform 120ms ease;
}



.lex-tile__expand:hover {
  opacity: 1;
  transform: scale(1.05);
}

.lex-tile__expand:focus-visible {
  outline: 2px solid rgba(181,140,255,0.6);
  outline-offset: 2px;
}

.lex-tile__expand svg {
  width: 1.8rem;
  height: 1.8rem;
  stroke: rgba(220,220,240,0.95);
  stroke-width: 2;
  fill: none;
}

/* ------------------------------------------------------------
   Lexicon — Header controls normalization
   ------------------------------------------------------------ */

.lex-tile__controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lex-tile__controls > * {
  align-self: center;
}

/* ------------------------------------------------------------
   Lexicon — Canonical header alignment (safe)
   ------------------------------------------------------------ */

.lex-tile__header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lex-tile__controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* ------------------------------------------------------------
   Lexicon — FINAL: header control alignment + expand centering
   (wins over earlier rules; avoids framework baseline quirks)
   ------------------------------------------------------------ */

.lex-tile__header .lex-tile__header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lex-tile__header .lex-tile__controls,
.lex-tile__header .lex-tile__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lex-tile__header .lex-tile__controls > *,
.lex-tile__header .lex-tile__actions > * {
  align-self: center;
}

/* Expand: true square, centered icon, no background bleed */
.lex-tile__expand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  line-height: 0;
  border-radius: 8px;
  border: 1px solid rgb(1, 114, 173);
  background: transparent;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 120ms ease, transform 120ms ease, border-color 120ms ease;
  transform: none;
}

.lex-tile__expand:hover {
  opacity: 1;
  transform: scale(1.05);
}

.lex-tile__expand:focus-visible {
  outline: 2px solid rgba(181,140,255,0.6);
  outline-offset: 2px;
}

.lex-tile__expand svg {
  display: block;
  width: 32px;
  height: 32px;
  stroke: rgba(220, 220, 240, 0.95);
  stroke-width: 2;
  fill: none;
}

/* Header: keep S/M/L vertically centered with expand square */
.lex-tile__header .lexicon-zoom-buttons {
  height: 44px;            /* match expand hitbox */
  display: inline-flex;
  align-items: center;
}

/* Header downloads button aligns to S/M/L height */
.lex-tile__actions .lexicon-export-btn {
  height: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.8rem;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
}

.lex-tile__header .lexicon-zoom-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 0.35rem;      /* keep pill width, but remove vertical padding */
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------
   Lexicon — FINAL: S/M/L zoom button centering (wins)
   ------------------------------------------------------------ */

.lexicon-zoom-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 0.35rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ------------------------------------------------------------
   Lexicon — Zoom buttons (S/M/L) hard-centering + remove drift
   ------------------------------------------------------------ */

.lexicon-zoom-buttons {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
}

.lexicon-zoom-btn {
  width: 28px;
  height: 28px;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  font-size: 14px;
}

/* ------------------------------------------------------------
   Override (last wins): shrink expand icon to match S/M/L scale
   ------------------------------------------------------------ */
.lex-tile__expand {
  width: 31px;
  height: 31px;
}

.lex-tile__expand svg {
  width: 22px;
  height: 22px;
}


/* ------------------------------------------------------------
   Final header controls sizing (last wins)
   ------------------------------------------------------------ */
.lex-tile__expand {
  width: 31px;
  height: 31px;
}

.lex-tile__expand svg {
  width: 22px;
  height: 22px;
}


/* ------------------------------------------------------------
   Lexicon — Card Art Controls (sidebar tiles)
   Match hero-style controls: zoom + x + y
   ------------------------------------------------------------ */

.lexicon-sidebar {
  /* Canonical-style controls for card art */
  --card-art-zoom: 0.9;
  --card-art-x: 60%;
  --card-art-y: 50%;
}

/* Disable Home tile background-image in Lexicon sidebar; we render art via ::after */
.lexicon-sidebar .app-tile {
  background-image: none !important;
  background-color: transparent;
}

/* Art layer */
.lexicon-sidebar .app-tile::after {
  content: "";
  position: absolute;
  inset: 0;

  background-image: var(--card-art-src);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;

  /* hero-like anchor + scale */
  left: var(--card-art-x);
  top: var(--card-art-y);
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;

  transform: translate(-50%, -50%) scale(var(--card-art-zoom));
  transform-origin: center;

  pointer-events: none;
  z-index: 0;
}

/* Ensure overlay sits above art, and text above overlay (Lexicon only) */
.lexicon-sidebar .app-tile::before { z-index: 1; }
.lexicon-sidebar .app-tile__text  { z-index: 2; }

/* ------------------------------------------------------------
   Lexicon — Left sidebar app tiles (Home card style)
   ------------------------------------------------------------ */

.lexicon-apps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-content: start;
}

.lexicon-apps .app-tile {
  width: 100%;
  text-align: left;
  cursor: pointer;

  /* Button reset so it behaves like the Home link tile */
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background-color: transparent; /* image is via background-image */
}

.lexicon-sidebar .app-tile {
  min-height: 120px; /* slightly tighter than Home */
}

.lexicon-apps .app-tile:focus-visible {
  outline: 2px solid rgba(255,255,255,0.28);
  outline-offset: 2px;
}

.lexicon-apps .lexicon-module-card.is-active {
  border-color: rgba(255,255,255,0.26);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10) inset;
}


/* ------------------------------------------------------------
   Lexicon — Sidebar card stacking fix (text above art)
   ------------------------------------------------------------ */
.lexicon-sidebar .app-tile {
  position: relative;
  isolation: isolate;
}

.lexicon-sidebar .app-tile::after {
  z-index: 0;
}

.lexicon-sidebar .app-tile::before {
  z-index: 1;
}

.lexicon-sidebar .app-tile__text {
  position: relative;
  z-index: 2;
}


/* ------------------------------------------------------------
   Lexicon — Sidebar card stacking (override, last-wins)
   Force art + overlay behind all content in the button.
   ------------------------------------------------------------ */
.lexicon-sidebar .app-tile {
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.lexicon-sidebar .app-tile::after {
  z-index: -2;
}

.lexicon-sidebar .app-tile::before {
  z-index: -1;
}

.lexicon-sidebar .app-tile__meta,
.lexicon-sidebar .app-tile__text {
  position: relative;
  z-index: 1;
}


/* ------------------------------------------------------------
   Lexicon v2 — Sidebar tiles: half height, title-only, bottom-left
   ------------------------------------------------------------ */

.lexicon-sidebar .app-tile {
  min-height: 60px;                 /* ~half of prior 120px */
  padding: 0.55rem 0.65rem;         /* tighter vertical space */
}

/* Make the tile content sit at the bottom-left */
.lexicon-sidebar .app-tile__meta {
  margin-top: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.lexicon-sidebar .app-tile__text {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
}

/* Remove subheader/secondary line inside the tile */
.lexicon-sidebar .app-tile__text > div:not(.app-tile__title) {
  display: none;
}

/* Keep the title crisp in the smaller tile */
.lexicon-sidebar .app-tile__title {
  margin: 0;
}

/* ------------------------------------------------------------
   Lexicon v3 — Sidebar tiles: tighter vertical spacing
   ------------------------------------------------------------ */

/* Reduce vertical gap between sidebar cards */
.lexicon-apps {
  gap: 0.4rem; /* tighter than prior ~0.75rem */
}

/* ------------------------------------------------------------
   Lexicon v7 — Sidebar card art controls (X/Y/Zoom) with bleed
   Restore X control by returning to element-anchor panning,
   but oversize the art layer so panning can't reveal blank edges.
   ------------------------------------------------------------ */

/* Art layer (override, last wins) */
.lexicon-sidebar .app-tile::after {
  content: "";
  position: absolute;

  /* Oversize the layer so X/Y panning never exposes empty space */
  width: 220%;
  height: 220%;

  /* Anchor point driven by controls */
  left: var(--card-art-x);
  top: var(--card-art-y);

  /* Center on anchor, then zoom */
  transform: translate(-50%, -50%) scale(var(--card-art-zoom));
  transform-origin: center;

  background-image: var(--card-art-src);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;

  pointer-events: none;

  /* Keep art behind overlay + text */
  z-index: -2;
}

/* Overlay behind text, above art */
.lexicon-sidebar .app-tile::before { z-index: -1; }

/* ------------------------------------------------------------
   Lexicon v8 — Increase art bleed further to prevent zoom cutoff
   (tiles are short; zoom needs more overscan headroom)
   ------------------------------------------------------------ */

.lexicon-sidebar .app-tile::after {
  width: 340%;
  height: 340%;
}

/* ------------------------------------------------------------
   Lexicon v9 — Sidebar cards: REMOVE image logic (Lexicon only)
   Keep existing card sizing/spacing; apply active/inactive gradients.
   ------------------------------------------------------------ */

/* Kill any tile images coming from Home styles (Lexicon sidebar only) */
.lexicon-sidebar .app-tile {
  background-image: none !important;
  /* Inactive gradient */
  background: linear-gradient(
    90deg,
    rgba(22, 24, 30, 0.85) 0%,
    rgba(14, 16, 20, 0.95) 100%
  );
}

/* Remove the Lexicon-only art layer entirely */
.lexicon-sidebar .app-tile::after {
  content: none !important;
}

/* Active module gradient */
.lexicon-sidebar .lexicon-module-card.is-active {
  background: linear-gradient(
    90deg,
    rgba(112, 70, 168, 0.45) 0%,
    rgba(60, 30, 95, 0.55) 45%,
    rgba(10, 10, 16, 0.75) 100%
  );
}

/* ------------------------------------------------------------
   Lexicon v10 — Sidebar gradients actually visible
   Home card overlay (::before) was still masking backgrounds.
   Remove overlay ONLY for Lexicon sidebar cards.
   ------------------------------------------------------------ */

/* Remove dark overlay layer so gradients show */
.lexicon-sidebar .app-tile::before {
  content: none !important;
}

/* Re-assert inactive gradient (last-wins safety) */
.lexicon-sidebar .app-tile {
  background: linear-gradient(
    90deg,
    rgba(22, 24, 30, 0.85) 0%,
    rgba(14, 16, 20, 0.95) 100%
  ) !important;
}

/* Re-assert active gradient */
.lexicon-sidebar .lexicon-module-card.is-active {
  background: linear-gradient(
    90deg,
    rgba(112, 70, 168, 0.45) 0%,
    rgba(60, 30, 95, 0.55) 45%,
    rgba(10, 10, 16, 0.75) 100%
  ) !important;
}

/* ------------------------------------------------------------
   Lexicon v11 — Sidebar cards: visible inactive gradient + centered text
   ------------------------------------------------------------ */

/* Make inactive gradient more perceptible */
.lexicon-sidebar .app-tile {
  background: linear-gradient(
    90deg,
    rgba(32, 36, 44, 0.95) 0%,
    rgba(18, 20, 26, 0.95) 100%
  ) !important;
}

/* Center title horizontally + vertically */
.lexicon-sidebar .app-tile__meta {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lexicon-sidebar .app-tile__text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Keep active gradient as-is */
.lexicon-sidebar .lexicon-module-card.is-active {
  background: linear-gradient(
    90deg,
    rgba(112, 70, 168, 0.45) 0%,
    rgba(60, 30, 95, 0.55) 45%,
    rgba(10, 10, 16, 0.75) 100%
  ) !important;
}

/* ------------------------------------------------------------
   Lexicon v12 — Sidebar cards: left-align text, keep vertical centering
   ------------------------------------------------------------ */

.lexicon-sidebar .app-tile__meta {
  justify-content: flex-start;
}

.lexicon-sidebar .app-tile__text {
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

/* ------------------------------------------------------------
   Lexicon — Modal (downloads)
   ------------------------------------------------------------ */

.lex-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.lex-modal.is-open {
  display: flex;
}

.lex-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.lex-modal__card {
  position: relative;
  width: min(92vw, 860px);
  max-height: min(90vh, 900px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.85rem;
  background: rgba(12, 14, 18, 0.9);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.lex-modal--info .lex-modal__card {
  width: min(86vw, 540px);
}

.lex-info__row {
  margin: 0.15rem 0;
  font-size: 0.9rem;
  line-height: 1.3;
}



.lex-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lex-modal__title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.lex-modal__body {
  padding: 0.4rem 0.95rem 0.8rem;
  overflow: auto;
  max-height: calc(90vh - 120px);
}

.lex-modal__close {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.2);
  border-radius: 0.6rem;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f5f7fb;
  margin: 0;
}

.lex-modal__close:hover {
  border-color: rgba(181, 140, 255, 0.45);
  background: rgba(181, 140, 255, 0.16);
}

.lex-modal__close:focus-visible {
  outline: 2px solid rgba(181, 140, 255, 0.6);
  outline-offset: 2px;
}

/* Column header info icon */
.lexicon-col-info {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  border-radius: 50%;
  width: 0.95rem;
  height: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 1;
  font-size: 0.62rem;
  color: rgba(220,220,240,0.95);
}

.lexicon-col-info:hover,
.lexicon-col-info:focus-visible {
  border-color: rgba(181, 140, 255, 0.45);
  background: rgba(181, 140, 255, 0.16);
  outline: none;
}
