/* invest-in.ai — brand reference: CLAUDE-brand-investin.md
   ("Burgundy & Champagne Gold") — keep in sync. */
:root {
    --bg: #F7F7F5;                          /* off-white */
    --text: #541A1A;                        /* dark-brown */
    --border: #DCC3AA;                      /* structural — tan */
    --text-secondary: #8A6A60;              /* structural — warm-brown */
    --brand: #810B38;                       /* burgundy */

    --layer-app:    #D9D3D0;                /* warm-gray */
    --layer-models: #C0A898;                /* beige */
    --layer-infra:  #2B4D7A;               /* softened-navy */
    --layer-chips:  #E8D5A3;                /* champagne-gold */
    --layer-energy: var(--brand);    /* burgundy */

    --font-ui: 'DM Sans', system-ui, sans-serif;
}

html {
    scrollbar-gutter: stable;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Playfair Display', serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── UI font overrides (DM Sans on all data/control elements; Playfair stays on body + reading text) ── */

.nav-link,
.logo-in,
.table th,
.table td,
.ai-badge,
.listing-badge,
.sentiment-pill,
.layer-filter__pill,
.layer-filter__label,
.search-input,
.search-clear,
.terminology-search__input,
.form-label,
.form-group input,
.btn,
.pager,
.pager__btn,
.pager__info,
.detail-ticker,
.detail-meta,
.detail-section-title,
.detail-section-dates,
.detail-table td,
.detail-description,
.detail-notice,
.price-chart-title,
.price-chart-btn,
.price-chart-change,
.sentiment-block-label,
.sentiment-block-text,
.stack-footnote,
.chip,
.layer-name,
.layer-desc,
.more-link,
.ai-stack-tooltip,
.identifier-line,
.identifier-label,
.xr-table,
.xr-strip__header,
.xr-sort-btn,
.xr-meta,
.xr-code,
.sort-link,
.terminology-item__brief,
.terminology-alpha-divider,
.terminology-empty,
.term-section-title,
.term-kp-table,
.term-summary-label,
.term-examples-list,
.message,
.footer {
    font-family: var(--font-ui);
}

/* ── Skip to content ── */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--brand);
    padding: 0.5rem 1.1rem;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    transition: top 0.1s;
}

.skip-link:focus {
    top: 0;
}

/* ── Header ── */

.header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
    letter-spacing: 0.06em;
}

.logo-word { font-size: 1.12em; }
.logo-in   { font-size: 0.74em; font-weight: 500; }

.nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--brand);
    padding: 0.3rem 0.75rem;
    border-radius: 0;
}

.nav-link {
    color: var(--bg);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(247,247,245,0.15);
    color: #F7F7F5;
}

.nav-link--active {
    background: var(--text);
    color: var(--bg);
}

.nav-link--button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.nav-link--auth {
    padding: 0.25rem 0.75rem;
    border: 1.5px solid rgba(247,247,245,0.5);
    border-radius: 0;
    color: var(--bg);
}

.nav-link--auth:hover {
    border-color: #F7F7F5;
    color: #F7F7F5;
    background: rgba(247,247,245,0.12);
}

.logout-form {
    display: inline;
}

/* ── Nav dropdown (Markets) ── */

.nav-dropdown {
    position: relative;
    display: flex;
}

.nav-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-dropdown__caret {
    font-size: 0.62em;
    transform: translateY(1px);
    transition: transform 0.15s;
}

.nav-dropdown:hover .nav-dropdown__caret,
.nav-dropdown--open .nav-dropdown__caret {
    transform: translateY(1px) rotate(180deg);
}

.nav-dropdown__menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: var(--brand);
    border: 1px solid rgba(247,247,245,0.25);
    box-shadow: 0 10px 24px rgba(84,26,26,0.25);
    padding: 0.4rem;
    z-index: 110;
    flex-direction: column;
}

/* Hover bridge so the pointer can travel from trigger to menu */
.nav-dropdown__menu::before {
    content: "";
    position: absolute;
    top: -0.6rem;
    left: 0;
    right: 0;
    height: 0.6rem;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu,
.nav-dropdown--open .nav-dropdown__menu {
    display: flex;
}

.nav-dropdown__link {
    color: var(--bg);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.nav-dropdown__link:hover {
    background: rgba(247,247,245,0.15);
}

.nav-dropdown__link--active {
    background: var(--text);
    color: var(--bg);
}

.nav-toggle {
    display: none;
}

/* ── Main ── */

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Page header ── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

/* ── Table ── */

.table-wrapper {
    overflow-x: auto;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(84,26,26,0.09);
}

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

.table thead {
    background: var(--bg);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    border-bottom: 1px solid rgba(84,26,26,0.22);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(84,26,26,0.22);
    color: var(--text);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: rgba(217,211,208,0.55);
    color: var(--text);
}

.table-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem !important;
    font-size: 0.95rem;
}

.grand-total-label {
    font-weight: 600;
    border-top: 2px solid var(--border);
    padding-top: 0.6rem;
}

.grand-total-value {
    font-weight: 600;
    border-top: 2px solid var(--border);
    padding-top: 0.6rem;
}

/* ── Sticky columns (Name, Ticker — cols 1–2) ── */

.table th:nth-child(-n+2),
.table td:nth-child(-n+2) {
    position: sticky;
    z-index: 1;
}

.table th:nth-child(1), .table td:nth-child(1) { left: 0;     min-width: 180px; }
.table th:nth-child(2), .table td:nth-child(2) { left: 180px; min-width: 80px;  }
.table th:nth-child(3), .table td:nth-child(3) { min-width: 90px; }
.table th:nth-child(4), .table td:nth-child(4) { min-width: 90px; }

.table thead th:nth-child(-n+2)          { background: var(--bg); }
.table tbody td:nth-child(-n+2)          { background: var(--bg); }
.table tbody tr:hover td:nth-child(-n+2) { background: rgba(217,211,208,0.55); }

.table th:nth-child(2),
.table td:nth-child(2) {
    border-right: 2px solid var(--border);
    box-shadow: 2px 0 4px rgba(84,26,26,0.09);
}

/* ── Top scrollbar mirror ── */
.scroll-mirror {
    overflow-x: auto;
    overflow-y: hidden;
    height: 8px;
    background: #F7F7F5;
    scrollbar-width: thin;
    scrollbar-color: #541A1A #F7F7F5;
}
.scroll-mirror-inner {
    height: 1px;
}
.scroll-mirror::-webkit-scrollbar { height: 8px; }
.scroll-mirror::-webkit-scrollbar-track { background: #F7F7F5; }
.scroll-mirror::-webkit-scrollbar-thumb { background: #541A1A; border-radius: 4px; }
.scroll-mirror::-webkit-scrollbar-thumb:hover { background: #810B38; }

/* ── Table wrapper scrollbar ── */
.table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: #541A1A #F7F7F5;
}
.table-wrapper::-webkit-scrollbar { height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: #F7F7F5; }
.table-wrapper::-webkit-scrollbar-thumb { background: #541A1A; border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: #810B38; }

/* ── Numeric columns (market cap, revenue, net income, EPS, price) ── */

th.market-cap-col,
td.market-cap-col,
th.num-col,
td.num-col {
    text-align: right;
    min-width: 90px;
    font-variant-numeric: tabular-nums;
}

/* ── Auth ── */

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 2rem;
}

.auth-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 2px 12px rgba(84,26,26,0.12);
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--brand);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg);
}

.form-errors ul {
    list-style: none;
}

.form-errors {
    color: var(--brand);
    font-size: 0.82rem;
    margin-top: 0.2rem;
}

.btn {
    padding: 0.75rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
    margin-top: 0.4rem;
    width: 100%;
}

.btn--primary {
    background: var(--layer-infra);
    color: var(--text);
}

.btn--primary:hover {
    background: #966A81;
}

/* ── Pager ── */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    font-size: 0.875rem;
}

.pager__info {
    color: var(--text-secondary);
    font-weight: 500;
}

.pager__controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.4rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    transition: border-color 0.15s, color 0.15s;
}

.pager__btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.pager__btn--active {
    background: var(--layer-infra);
    border-color: var(--layer-infra);
    color: #F7F7F5;
}

.pager__btn--disabled {
    color: var(--border);
    border-color: var(--border);
    cursor: default;
}

.pager__ellipsis {
    color: var(--text-secondary);
    padding: 0 0.2rem;
}

/* ── Sortable column headers ── */

.sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s;
}

.sort-link:hover {
    color: var(--brand);
}

.sort-link--active {
    color: var(--brand);
}

.sort-arrow {
    font-size: 0.8em;
}

/* ── Identifiers cell ── */

.identifiers-cell {
    white-space: nowrap;
}

.identifier-line {
    display: block;
    font-size: 0.66rem;
    line-height: 1.7;
}

.identifier-label {
    display: inline-block;
    width: 3.2rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── AI Layer badges ── */

.table th.ai-col-header {
    text-align: center;
    cursor: default;
}

/* ── AI Stack tooltip ── */
.ai-stack-tooltip {
    display: none;
    position: fixed;
    z-index: 300;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(84,26,26,0.18);
    padding: 0.7rem 0.9rem;
    width: 220px;
    pointer-events: none;
}
.ai-stack-tooltip--visible { display: block; }

.ai-stack-tooltip__title {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.ai-stack-tooltip__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.ai-stack-tooltip__list li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--text);
}

.ai-col-group {
    display: inline-flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.ai-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.864rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.ai-badge--energy  { background: var(--layer-energy); color: var(--bg); }
.ai-badge--chips   { background: var(--layer-chips);  color: var(--text); border: 1px solid rgba(84,26,26,0.15); }
.ai-badge--infra   { background: var(--layer-infra);  color: var(--bg); }
.ai-badge--models  { background: var(--layer-models); color: var(--text); border: 1px solid rgba(84,26,26,0.15); }
.ai-badge--app     { background: var(--layer-app);    color: var(--text); border: 1px solid rgba(84,26,26,0.15); }
.ai-badge--hidden  { visibility: hidden; }

/* ── Country flag ── */

.country-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.country-flag {
    flex-shrink: 0;
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid var(--border);
}

/* ── Layer filter ── */

.layer-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.layer-filter__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-right: 0.15rem;
}

.layer-filter__pill {
    display: inline-block;
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.03em;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    border: 1.5px solid transparent;
    cursor: pointer;
}

.layer-filter__pill--all {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
    color: var(--bg);
}
.layer-filter__pill--all:hover     { box-shadow: 0 1px 8px rgba(138,106,96,0.60); }
.layer-filter__pill--all.is-active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-secondary); }

/* inactive = exact badge fill (mirrors .ai-badge--* and landing page layer colors) */
.layer-filter__pill--energy  { background: var(--layer-energy); color: var(--bg);   border-color: var(--layer-energy); }
.layer-filter__pill--chips   { background: var(--layer-chips);  color: var(--text); border-color: rgba(84,26,26,0.20); }
.layer-filter__pill--infra   { background: var(--layer-infra);  color: var(--bg);   border-color: var(--layer-infra); }
.layer-filter__pill--models  { background: var(--layer-models); color: var(--text); border-color: var(--layer-models); }
.layer-filter__pill--app     { background: var(--layer-app);      color: var(--text); border-color: rgba(84,26,26,0.20); }

/* hover = soft shadow lift */
.layer-filter__pill--energy:hover  { box-shadow: 0 1px 8px rgba(129,11,56,0.55); }
.layer-filter__pill--chips:hover   { box-shadow: 0 1px 8px rgba(232,213,163,0.90); }
.layer-filter__pill--infra:hover   { box-shadow: 0 1px 8px rgba(170,120,146,0.65); }
.layer-filter__pill--models:hover  { box-shadow: 0 1px 8px rgba(192,168,152,0.70); }
.layer-filter__pill--app:hover     { box-shadow: 0 1px 8px rgba(84,26,26,0.25); }

/* active = outer ring (white gap + layer-colour ring) to signal selection */
.layer-filter__pill--energy.is-active  { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--layer-energy); }
.layer-filter__pill--chips.is-active   { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--layer-chips); }
.layer-filter__pill--infra.is-active   { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--layer-infra); }
.layer-filter__pill--models.is-active  { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--layer-models); }
.layer-filter__pill--app.is-active     { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--layer-app); }

.layer-filter__pill--not-ai     { background: var(--bg);      border-color: var(--border); color: var(--text-secondary); }
.layer-filter__pill--not-ai:hover, .layer-filter__pill--not-ai.is-active { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: 0 1px 4px rgba(84,26,26,0.25); }

.layer-filter__pill--listed     { background: rgba(220,195,170,0.25); border-color: var(--border);    color: var(--text); }
.layer-filter__pill--non-listed { background: var(--bg);               border-color: var(--border); color: var(--text-secondary); }

.layer-filter__pill--listed:hover,     .layer-filter__pill--listed.is-active     { background: var(--border); border-color: var(--border); color: var(--text); box-shadow: 0 1px 6px rgba(220,195,170,0.60); }
.layer-filter__pill--non-listed:hover, .layer-filter__pill--non-listed.is-active { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: 0 1px 4px rgba(84,26,26,0.25); }

.category-filter__select {
    height: 1.85rem;
    padding: 0 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    outline: none;
    max-width: 260px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.category-filter__select:focus { border-color: var(--text-secondary); box-shadow: 0 1px 4px rgba(84,26,26,0.14); }

/* ── Dashboard search ── */

.search-form { display: contents; }

.search-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-input {
    height: 1.85rem;
    padding: 0 1.6rem 0 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    outline: none;
    width: 240px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder { color: var(--text-secondary); font-weight: 500; }
.search-input:focus { border-color: var(--text-secondary); box-shadow: 0 1px 4px rgba(84,26,26,0.14); }
.search-input--active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(129,11,56,0.10); }
.search-input--active:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(129,11,56,0.15); }

.layer-filter--search { margin-bottom: 0.35rem; }

.search-input::-webkit-search-cancel-button { display: none; }

.search-clear {
    position: absolute;
    right: 0.6rem;
    font-size: 0.65rem;
    color: var(--border) !important;
    text-decoration: none !important;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.search-clear:hover { color: var(--brand) !important; }

.search-list-mode-badge { font-size: 0.72rem; font-weight: 600; color: var(--brand); background: rgba(129,11,56,.07); border: 1px solid rgba(129,11,56,.22); border-radius: 3px; padding: 1px 6px; letter-spacing: .02em; white-space: nowrap; }
.search-not-found { margin: .35rem 0 .6rem; font-size: .8rem; color: var(--text-secondary); }
.search-not-found code { font-family: inherit; color: var(--brand); background: rgba(129,11,56,.07); border: 1px solid rgba(129,11,56,.22); border-radius: 3px; padding: 0 5px; margin: 0 1px; }

/* ── Listing status badge ── */

.listing-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.listing-badge--listed     { background: rgba(220,195,170,0.30); color: var(--text);         border: 1px solid rgba(220,195,170,0.80); }
.listing-badge--non-listed { background: transparent;            color: var(--text-secondary);        border: 1px solid var(--border); }
.listing-badge--stock      { background: rgba(129,11,56,0.10);  color: var(--brand); border: 1px solid rgba(129,11,56,0.30); }
.listing-badge--fund       { background: rgba(220,195,170,0.50); color: var(--text);         border: 1px solid rgba(220,195,170,0.80); }

th.type-col,
td.type-col { width: 4rem; }

.exchange-name,
.exchange-ticker {
    display: block;
    line-height: 1.3;
}
.exchange-ticker {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.exchange-ticker::before { content: "("; }
.exchange-ticker::after  { content: ")"; }

.exchange-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.category-tag {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(220,195,170,0.25);
    border: 1px solid rgba(220,195,170,0.70);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}

/* ── Messages ── */

.messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.message--error {
    background: rgba(129, 11, 56, 0.08);
    border: 1px solid var(--layer-chips);
    color: var(--brand);
}

.message--success {
    background: rgba(220,195,170,0.25);
    border: 1px solid var(--border);
    color: var(--text);
}

.message--warning {
    background: rgba(220,195,170,0.40);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ── Page subtitle (shared: companies + terminology) ── */

.page-subtitle {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    line-height: 1.5;
}

/* ── Wide main override (companies page) ── */

.main--wide {
    max-width: 1800px;
}

/* ── Master / Detail layout ── */

.companies-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.companies-master {
    flex: 0 1 auto;
    min-width: 0;
}

.companies-header {
    margin-bottom: 0.9rem;
}

.companies-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.1;
    animation: heroFadeUp 0.5s ease-out both;
}

.companies-controls {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem 0.5rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 4px rgba(84,26,26,0.07);
}

.companies-controls .layer-filter {
    margin-bottom: 0.55rem;
}

.companies-controls .layer-filter:last-child {
    margin-bottom: 0;
}

.company-detail-panel {
    flex: 1 1 300px;
    min-width: 300px;
    position: sticky;
    top: 68px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    scrollbar-width: none;
    padding-right: 2px;
}
.company-detail-panel::-webkit-scrollbar {
    display: none;
}

/* ── Detail placeholder ── */

.detail-placeholder {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem 1.5rem 1.75rem;
    text-align: center;
}

.detail-placeholder__arrow {
    font-size: 1.25rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
}

.detail-placeholder__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    display: block;
    margin-bottom: 1.25rem;
}

.detail-placeholder__toc {
    list-style: none;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.detail-placeholder__toc li {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.detail-placeholder__toc li::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}

/* ── Detail placeholder: featured chips ── */

.detail-placeholder__featured {
    margin-top: 1.1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
}

.detail-placeholder__featured-label {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

.detail-placeholder__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.featured-chip {
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.13s, background 0.13s, color 0.13s;
}

.featured-chip:hover {
    border-color: var(--brand);
    background: rgba(129,11,56,0.05);
    color: var(--brand);
}

/* ── Detail card ── */

.detail-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(84,26,26,0.10);
    overflow: hidden;
    animation: detailCardIn 0.22s ease-out both;
}

@keyframes detailCardIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.detail-header {
    padding: 1.1rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.detail-company-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.detail-ticker {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--brand);
    padding: 0.22rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

/* Header name + ticker are links to the full company page */
a.detail-company-name,
a.detail-ticker {
    text-decoration: none;
}

a.detail-company-name:hover {
    color: var(--brand);
    text-decoration: underline;
}

a.detail-ticker:hover {
    background: var(--layer-infra);
}

.detail-meta {
    padding: 0.5rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.detail-meta span + span::before {
    content: '·';
    margin-right: 0.5rem;
}

.detail-meta-country {
    display: inline-flex;
    align-items: center;
}

.detail-meta-country .country-flag {
    width: 18px;
    height: 12px;
}

.detail-description {
    padding: 0.75rem 1.25rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-bottom: 1px solid var(--border);
}

.detail-notice {
    padding: 1.5rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.detail-notice--error {
    color: var(--brand);
}

.detail-section {
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section-title {
    padding: 0.45rem 1.25rem 0.25rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand);
    background: rgba(129,11,56,0.04);
}

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

.detail-table td {
    padding: 0.4rem 1.25rem;
    font-size: 0.83rem;
    border-bottom: 1px solid var(--bg);
}

.detail-table tr:last-child td {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    width: 55%;
}

.detail-value {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}

.detail-section-dates {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.4rem;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Price chart in detail panel ── */

.price-chart-section {
    padding: 0.75rem 1.25rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.price-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
}

.price-chart-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-chart-title {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
}

.price-chart-change {
    font-size: 0.75rem;
    font-weight: 700;
}
.price-chart-change--pos  { color: var(--text); }
.price-chart-change--neg  { color: var(--brand); }
.price-chart-change--flat { color: var(--text-secondary); }

.price-chart-periods {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.price-chart-btn {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.15rem 0.38rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.5;
    transition: border-color 0.1s, color 0.1s, background 0.1s;
}
.price-chart-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}
.price-chart-btn.is-active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.price-chart-canvas {
    width: 100%;
    display: block;
}

.price-chart-empty {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 1.5rem 0 0.75rem;
}

/* ── Sentiment blocks in detail panel ── */

.sentiment-block {
    padding: 0.55rem 1.25rem;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--bg);
}
.sentiment-block:last-child { border-bottom: none; }
.sentiment-block--pos { border-left-color: var(--border); }
.sentiment-block--neu { border-left-color: #C0A898; }
.sentiment-block--neg { border-left-color: var(--brand); }
.sentiment-block--bottom { border-left-color: var(--text-secondary); }

.sentiment-block-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}
.sentiment-block-text {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.5;
}

/* ── Selected master row ── */

.table tbody tr {
    cursor: pointer;
}

.table tbody tr.is-selected td {
    background: #D9D3D0;
    color: var(--text);
    border-bottom-color: rgba(84,26,26,0.38);
}

.table tbody tr.is-selected td:nth-child(-n+2) {
    background: #D9D3D0;
}

/* loading state while HTMX fetches */
.table tbody tr.htmx-request td {
    opacity: 0.6;
}

/* suppress browser outline on programmatically-focused rows (is-selected bg handles it) */
#master-table tbody tr:focus {
    outline: none;
}

/* ── Markets Dashboard strips layout ── */

.markets-strips {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-start;
}

/* ── Exchange rate strip ── */

.xr-strip {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(84,26,26,0.06);
    display: inline-block;
}

.xr-strip__header {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.xr-table {
    border-collapse: collapse;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.xr-table td {
    padding: 0.1rem 1.25rem 0.1rem 0;
    white-space: nowrap;
    color: var(--text);
}

.xr-table tr td:last-child {
    padding-left: 1.25rem;
    border-left: 1px solid var(--border);
}

.xr-meta {
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.xr-table th {
    padding: 0.1rem 1.25rem 0.35rem 0;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.xr-table tr th:last-child {
    padding-left: 1.25rem;
    border-left: 1px solid var(--border);
}

.xr-sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0;
}

.xr-code {
    color: var(--text-secondary);
    font-weight: 600;
    display: inline-block;
    position: relative;
}

.xr-code[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 10;
}

.xr-code[data-tooltip]:hover::after {
    opacity: 1;
}

.xr-rate {
    font-weight: 700;
}

/* ── Master table compact overrides ── */

#master-table {
    font-size: 0.78rem;
}

#master-table th {
    padding: 0.45rem 0.75rem;
    font-size: 0.67rem;
}

#master-table td {
    padding: 0.28rem 0.75rem;
}

#master-table .ai-badge {
    font-size: 0.72rem;
    padding: 0.1rem 0.45rem;
}

#master-table .listing-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.45rem;
}

#master-table .country-flag {
    width: 20px;
    height: 13px;
}

#master-table .identifier-line {
    font-size: 0.62rem;
    line-height: 1.6;
}

/* col 6 = Financials group, col 11 = Performance group */
#master-table th:nth-child(6),
#master-table td:nth-child(6),
#master-table th:nth-child(11),
#master-table td:nth-child(11) {
    border-left: 1.5px solid var(--border);
}

/* ── Column group header row ── */
/*
 * Specificity 1-1-2 (#master-table tr.col-group-row th) beats all the
 * .table th:nth-child rules (0-2-1) so we can safely reset sticky/left/border here.
 */
#master-table tr.col-group-row th {
    position: static;
    left: auto;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    padding: 0.55rem 0.75rem 0.1rem;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    background: var(--bg);
    color: transparent;   /* identity group: no label, just structure */
}

#master-table tr.col-group-row th.col-group--financials,
#master-table tr.col-group-row th.col-group--performance {
    color: var(--brand);
    border-left: 1.5px solid var(--border);
}

/* ── Sentiment pill ── */
/*
 * Each pill uses a CSS gradient fill driven by --fill (0–1, set via inline style).
 * The filled portion reads left-to-right at `calc(var(--fill) * 100%)`.
 * Three distinct fill hues: tan (positive) · dusty-pink (neutral) · maroon (negative).
 */
.sentiment-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.sentiment-pill--positive {
    background: linear-gradient(to right,
        rgba(220,195,170,0.80) calc(var(--fill, 0) * 100%),
        rgba(220,195,170,0.14) calc(var(--fill, 0) * 100%)
    );
    color: var(--text);
    border-color: rgba(220,195,170,0.95);
}

.sentiment-pill--neutral {
    background: linear-gradient(to right,
        rgba(170,120,146,0.52) calc(var(--fill, 0) * 100%),
        rgba(170,120,146,0.10) calc(var(--fill, 0) * 100%)
    );
    color: var(--text);
    border-color: rgba(170,120,146,0.55);
}

.sentiment-pill--negative {
    background: linear-gradient(to right,
        rgba(129,11,56,0.48) calc(var(--fill, 0) * 100%),
        rgba(129,11,56,0.07) calc(var(--fill, 0) * 100%)
    );
    color: var(--brand);
    border-color: rgba(129,11,56,0.45);
}

.sentiment-pill--stale { opacity: 0.5; }

/* ── Price percentage change cells ── */
.price-pct-cell--pos { color: var(--text); }
.price-pct-cell--neg { color: var(--brand); }

/* ── Landing / AI Stack Diagram ── */

.stack-diagram {
    padding: 0.25rem 0 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}

.stack-diagram::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 260px;
    background: radial-gradient(ellipse at 50% 30%, rgba(170,120,146,0.08) 0%, transparent 68%);
    pointer-events: none;
    z-index: 0;
}

.stack-header {
    text-align: center;
    margin-bottom: 1.75rem;
    position: relative;
    z-index: 1;
}

.stack-title {
    font-size: 3.8rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-bottom: 0.65rem;
    animation: heroFadeUp 0.6s ease-out both;
}

.stack-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    animation: heroFadeUp 0.6s 0.1s ease-out both;
}

.stack-hook {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.65;
    margin-top: 0.85rem;
    animation: heroFadeUp 0.6s 0.2s ease-out both;
}

.stack-hook strong {
    color: var(--text);
    font-weight: 700;
}

.stack {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    border: 0.5px solid #C0A898;
    box-shadow: 0 6px 40px rgba(84,26,26,0.13);
    position: relative;
    z-index: 1;
    counter-reset: layer-num 6;
}

.layer {
    display: flex;
    align-items: stretch;
    min-height: 72px;
    animation: layerReveal 0.45s ease-out both;
    counter-increment: layer-num -1;
}

.stack .layer:nth-child(1) { animation-delay: 0.22s; }
.stack .layer:nth-child(2) { animation-delay: 0.32s; }
.stack .layer:nth-child(3) { animation-delay: 0.42s; }
.stack .layer:nth-child(4) { animation-delay: 0.52s; }
.stack .layer:nth-child(5) { animation-delay: 0.62s; }

@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes layerReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .stack-title, .stack-subtitle, .layer {
        animation: none !important;
    }
}

.layer + .layer {
    border-top: 0.5px solid rgba(0,0,0,0.08);
}

.layer-label {
    width: 120px;
    min-width: 120px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 16px 14px;
    border-right: 0.5px solid rgba(0,0,0,0.08);
}

.layer-label::before {
    content: counter(layer-num);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}

/* Numeral colour: same hue as layer text, faded */
.l-app    .layer-label::before,
.l-models .layer-label::before,
.l-chips  .layer-label::before { color: rgba(84,26,26,0.35); }
.l-infra  .layer-label::before,
.l-energy .layer-label::before { color: rgba(247,247,245,0.45); }

.layer-name {
    display: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.layer-desc {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.layer-companies {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 99px;
    white-space: nowrap;
    text-decoration: none;
    transition: transform 0.13s ease, box-shadow 0.13s ease, filter 0.13s ease;
}

.chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.20);
    filter: brightness(1.10);
}

.more-link {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    padding: 3px 10px;
    cursor: pointer;
    text-decoration: none;
    border-radius: 99px;
    border: 1.5px solid currentColor;
    opacity: 0.65;
    transition: opacity 0.13s ease, transform 0.13s ease;
}

.more-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Layer backgrounds — top (light) to bottom (dark) */
.l-app    { background: #D9D3D0; }
.l-models { background: #C0A898; }
.l-infra  { background: linear-gradient(155deg, #162540 0%, #264870 28%, #4472aa 48%, #264870 70%, #162540 100%); }
.l-chips  { background: linear-gradient(155deg, #c4a84a 0%, #dcc870 28%, #f5e6b0 48%, #dcc870 70%, #c4a84a 100%); }
.l-energy { background: linear-gradient(155deg, #3c0518 0%, #6e0a2e 28%, #ae1850 48%, #6e0a2e 70%, #3c0518 100%); }

/* Label colors per layer — light bg: dark text; dark bg: off-white */
.l-app    .layer-name, .l-models .layer-name, .l-chips .layer-name { color: #541A1A; }
.l-infra  .layer-name, .l-energy .layer-name { color: #F7F7F5; }
.l-app    .layer-desc, .l-models .layer-desc, .l-chips .layer-desc { color: #541A1A; }
.l-infra  .layer-desc, .l-energy .layer-desc { color: #F7F7F5; }

/* Chips per layer */
.l-app    .chip { background: #F7F7F5; border: 0.5px solid #C0A898; color: #541A1A; }
.l-models .chip { background: rgba(255,255,255,0.5); border: 0.5px solid rgba(138,106,96,0.3); color: #541A1A; }
.l-infra  .chip { background: rgba(255,255,255,0.20); border: 0.5px solid rgba(255,255,255,0.30); color: #F7F7F5; }
.l-chips  .chip { background: rgba(84,26,26,0.10); border: 0.5px solid rgba(84,26,26,0.25); color: #541A1A; }
.l-energy .chip { background: rgba(255,255,255,0.20); border: 0.5px solid rgba(255,255,255,0.32); color: #F7F7F5; }

/* More links per layer */
.l-app    .more-link, .l-models .more-link, .l-chips .more-link { color: #541A1A; }
.l-infra  .more-link, .l-energy .more-link { color: #F7F7F5; }

/* Non-listed chips — dashed border signals "not publicly traded" */
.chip.chip--non-listed {
    border-style: dashed;
    border-width: 1px;
    opacity: 0.85;
}

/* Flag in chips */
.stack-chip__flag {
    width: 14px;
    height: auto;
    border-radius: 2px;
    flex-shrink: 0;
}

.stack-empty {
    color: var(--border);
    font-size: 0.82rem;
    font-style: italic;
}

.stack-no-data {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.92rem;
    background: var(--bg);
}

/* Footnote */
.stack-footnote {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ── Landing: explore CTA cards ── */

.stack-cta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem auto 0;
    max-width: 640px;
}

.stack-cta-card {
    display: block;
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1rem 1.4rem 1.2rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.stack-cta-card:hover {
    border-color: var(--brand);
    box-shadow: 0 3px 16px rgba(84,26,26,0.13);
}

.stack-cta-eyebrow {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--brand);
    display: block;
    margin-bottom: 0.3rem;
}

.stack-cta-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    display: block;
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.stack-cta-desc {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: block;
    margin-bottom: 0.7rem;
}

.stack-cta-arrow {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand);
    display: block;
}

/* ── Single-row table: always transpose to vertical key-value layout ── */

.table-wrapper--single {
    width: 100%;
    overflow: hidden;
}
.master-table--single {
    width: 100%;
}
.master-table--single thead {
    display: none;
}
.master-table--single tbody tr {
    display: block;
}
.master-table--single tbody td {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.25rem;
    border-bottom: 1px solid var(--bg);
    font-size: 0.88rem;
}
.master-table--single tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 110px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.master-table--single tbody td:nth-child(2) {
    border-right: none;
    box-shadow: none;
}
.master-table--single .exchange-name,
.master-table--single .exchange-ticker {
    display: inline;
}
.master-table--single .exchange-ticker::before { content: "("; }
.master-table--single .exchange-ticker::after  { content: ")"; }
.master-table--single .identifiers-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}
.master-table--single .identifiers-cell .identifier-line {
    display: block;
}

/* ── Narrow (hamburger nav) ── */

@media (max-width: 900px) {

    .header {
        padding: 0 1rem;
        height: auto;
        min-height: 52px;
        align-items: flex-start;
    }
    .header-inner {
        flex-wrap: wrap;
        min-height: 52px;
        align-items: center;
    }
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        flex-shrink: 0;
    }
    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text-secondary);
        border-radius: 2px;
    }
    .nav {
        display: none;
        position: static;
        width: 100%;
        background: var(--brand);
        border-top: 1px solid rgba(247,247,245,0.15);
        border-radius: 0;
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    .header-inner.nav-open .nav {
        display: flex;
    }

    /* Dropdown flattens to an always-open, indented group in the mobile menu */
    .nav-dropdown {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .nav-dropdown__caret {
        display: none;
    }
    .nav-dropdown__menu {
        display: flex;
        position: static;
        transform: none;
        min-width: 0;
        width: 100%;
        border: none;
        box-shadow: none;
        padding: 0 0 0 1rem;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    .nav-dropdown__menu::before {
        display: none;
    }

    /* ── Landing / AI Stack ── */
    .stack-title {
        font-size: 2.8rem;
    }

    /* ── Company list: stack master + detail vertically ── */
    .companies-layout {
        flex-direction: column;
        align-items: stretch;
    }
    .company-detail-panel {
        position: static;
        min-width: 0;
        max-height: none;
    }

}

/* ── Mobile ── */

@media (max-width: 600px) {

    /* Main */
    .main {
        padding: 1rem;
    }

    /* ── Landing / AI Stack ── */
    .stack-diagram {
        padding: 1rem 0 1.5rem;
    }
    .stack-title {
        font-size: 2.2rem;
    }
    .stack-header {
        margin-bottom: 1.25rem;
    }
    .layer-label {
        width: 76px;
        min-width: 76px;
        padding: 8px 10px;
    }
    .layer-name {
        font-size: 10px;
    }
    .layer-name {
        display: block;
    }
    .layer-desc {
        display: none;
    }
    .chip {
        font-size: 10px;
        padding: 3px 8px;
        gap: 3px;
    }
    .layer-companies {
        padding: 8px 10px;
        gap: 4px;
    }
    .layer {
        min-height: 56px;
    }

    /* ── Markets: full-width strips ── */
    .markets-strips {
        flex-direction: column;
    }
    .xr-strip {
        display: block;
        width: 100%;
    }

    /* ── Pager ── */
    .pager {
        flex-direction: column;
        gap: 0.6rem;
        align-items: flex-start;
    }

    /* ── Companies table: card layout ── */

    .scroll-mirror { display: none; }

    .table-wrapper { overflow-x: hidden; }

    #master-table { width: 100%; }

    #master-table .col-group-row,
    #master-table thead { display: none; }

    #master-table,
    #master-table tbody { display: block; }

    #master-table tbody tr {
        display: grid;
        grid-template-areas:
            "name ticker"
            "layer mktcap";
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 0.2rem 0.5rem;
        padding: 0.65rem 0.85rem;
        border-bottom: 1px solid rgba(84,26,26,0.22);
        cursor: pointer;
        background: var(--bg);
    }

    #master-table tbody tr:last-child { border-bottom: none; }
    #master-table tbody tr:hover { background: rgba(217,211,208,0.55); }
    #master-table tbody tr.is-selected { background: #D9D3D0; }

    /* tr handles all backgrounds in card layout */
    #master-table tbody td {
        padding: 0;
        border-bottom: none;
        background: transparent !important;
    }

    #master-table tbody td:nth-child(1) {
        grid-area: name;
        position: static !important;
        left: auto !important;
        min-width: 0 !important;
        box-shadow: none !important;
        border-right: none !important;
        align-self: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
        font-weight: 600;
    }

    #master-table tbody td:nth-child(2) {
        grid-area: ticker;
        position: static !important;
        left: auto !important;
        min-width: 0 !important;
        box-shadow: none !important;
        border-right: none !important;
        justify-self: end;
        align-self: start;
    }

    /* Mobile ticker: inline "AAOI · Nasdaq" format */
    #master-table tbody td:nth-child(2) .exchange-name,
    #master-table tbody td:nth-child(2) .exchange-ticker {
        display: inline;
        font-size: 0.78rem;
        line-height: 1.4;
    }
    #master-table tbody td:nth-child(2) .exchange-name {
        color: var(--text);
        font-weight: 500;
    }
    #master-table tbody td:nth-child(2) .exchange-ticker {
        color: var(--text-secondary);
    }
    #master-table tbody td:nth-child(2) .exchange-ticker::before { content: " · "; }
    #master-table tbody td:nth-child(2) .exchange-ticker::after  { content: ""; }

    #master-table tbody td:nth-child(3) { display: none; }

    /* Exchange cell hidden — exchange name is now combined in the ticker cell */
    #master-table tbody td:nth-child(4) { display: none; }

    /* AI Layer badge moves to bottom-left */
    #master-table tbody td:nth-child(5) {
        grid-area: layer;
        align-self: center;
        overflow: hidden;
    }

    #master-table tbody td:nth-child(5) .ai-col-group { flex-wrap: wrap; gap: 2px; }

    #master-table tbody td:nth-child(6) {
        grid-area: mktcap;
        align-self: center;
        justify-self: end;
    }

    #master-table tbody td:nth-child(n+7) { display: none; }

    /* ── Stack CTA: single column on mobile ── */

    .stack-cta { grid-template-columns: 1fr; }
}

/* ── Footer ── */

.footer {
    background: var(--brand);
    padding: 2.25rem 2rem 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-tagline {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(247,247,245,0.90);
    letter-spacing: 0.01em;
    padding-bottom: 0.85rem;
    position: relative;
}

.footer-tagline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 1px;
    background: rgba(247,247,245,0.25);
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem;
}

.footer-nav__link {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(247,247,245,0.60);
    text-decoration: none;
    padding: 0.2rem 0.65rem;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.footer-nav__link:hover {
    color: rgba(247,247,245,0.95);
    background: rgba(247,247,245,0.10);
}

.footer-legal {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: rgba(247,247,245,0.55);
    margin-top: 0.25rem;
}

/* ── AI Terminology ── */

.terminology-header {
    margin-bottom: 0.9rem;
}

.terminology-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.1;
    animation: heroFadeUp 0.5s ease-out both;
}

.terminology-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.terminology-master {
    flex: 0 0 300px;
    min-width: 220px;
}

.terminology-search {
    margin-bottom: 0.4rem;
}

.terminology-count {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-height: 1.3rem;
    margin-bottom: 0.35rem;
    padding-left: 0.2rem;
}

/* ── Terminology A–Z jump bar ── */

.terminology-alpha-jumper {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    margin-bottom: 0.4rem;
}

.alpha-jump-btn {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.5;
    transition: color 0.12s, background 0.12s;
}

.alpha-jump-btn:hover {
    color: var(--brand);
    background: rgba(129,11,56,0.06);
}

.terminology-search__input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 0.84rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.terminology-search__input::placeholder { color: var(--text-secondary); }

.terminology-search__input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(129,11,56,0.08);
}

.terminology-list {
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 212px);
    box-shadow: 0 2px 8px rgba(84,26,26,0.09);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    position: relative;
}
.terminology-list::-webkit-scrollbar { width: 5px; }
.terminology-list::-webkit-scrollbar-track { background: transparent; }
.terminology-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.terminology-alpha-divider {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.22rem 1rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand);
    background: rgba(247,247,245,0.96);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.terminology-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(84,26,26,0.22);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.terminology-item:last-child {
    border-bottom: none;
}

.terminology-item:hover {
    background: rgba(217,211,208,0.55);
}

.terminology-item.is-selected {
    background: var(--brand);
    border-left: 3px solid rgba(247,247,245,0.25);
    padding-left: calc(1rem - 3px);
}

.terminology-item.is-selected .terminology-item__term {
    color: var(--bg);
}

.terminology-item.is-selected .terminology-item__brief {
    color: rgba(247,247,245,0.58);
}

/* keyboard focus ring — inset so it doesn't affect layout */
.terminology-item:focus {
    outline: none;
    background: rgba(217,211,208,0.65);
    box-shadow: inset 3px 0 0 var(--brand);
}

.terminology-item.is-selected:focus {
    background: var(--brand);
    box-shadow: inset 3px 0 0 rgba(247,247,245,0.45);
}

/* make the list container keyboard-focusable but without a visible ring
   (focus moves immediately to the first/selected item) */
.terminology-list:focus {
    outline: none;
}

.terminology-item__term {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.terminology-item__brief {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.terminology-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1.5rem 0;
}

.terminology-detail-panel {
    flex: 1 1 0;
    min-width: 0;
    position: sticky;
    top: 68px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    scrollbar-width: none;
    transition: opacity 0.15s;
}

.terminology-detail-panel.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

.terminology-detail-panel::-webkit-scrollbar {
    display: none;
}

/* ── Term detail card ── */

.term-detail-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(84,26,26,0.10);
    overflow: hidden;
    animation: detailCardIn 0.22s ease-out both;
}

.term-header {
    padding: 1.4rem 1.5rem 1.1rem;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.term-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.term-brief {
    padding: 1rem 1.5rem 1.1rem;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.72;
    border-bottom: 1px solid var(--border);
}

.term-brief code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.88em;
    font-family: 'Menlo', 'Courier New', monospace;
    color: var(--text);
}

/* ── Four-section grid ── */

.term-sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.term-section-card {
    padding: 1rem 1.25rem 1.1rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.term-section-card:nth-child(2n) {
    border-right: none;
}

.term-section-card:nth-last-child(-n+2) {
    border-bottom: none;
}

.term-section-title {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--brand);
    margin-bottom: 0.6rem;
}

.term-section-body {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.6;
}

.term-section-body code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.85em;
    font-family: 'Menlo', 'Courier New', monospace;
    color: var(--text);
}

/* ── Key Points table ── */

.term-kp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.term-kp-table thead th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 0.6rem 0.35rem 0;
}

.term-kp-table thead th:last-child {
    padding-right: 0;
}

.term-kp-table tbody td {
    padding: 0.35rem 0.6rem 0.35rem 0;
    border-bottom: 1px solid var(--bg);
    vertical-align: top;
    color: var(--text);
    line-height: 1.5;
}

.term-kp-table tbody tr:last-child td {
    border-bottom: none;
}

.term-kp-aspect {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    padding-right: 0.75rem !important;
    min-width: 6rem;
}

.term-kp-desc code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.85em;
    font-family: 'Menlo', 'Courier New', monospace;
    color: var(--text);
}

/* ── Examples list ── */

.term-examples-list {
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.term-examples-list li {
    line-height: 1.5;
}

.term-examples-list code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.85em;
    font-family: 'Menlo', 'Courier New', monospace;
    color: var(--text);
}

.term-empty-field {
    color: var(--border);
}

/* ── Summary ── */

.term-summary {
    padding: 1rem 1.5rem 1.25rem;
}

.term-summary-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--brand);
    margin-bottom: 0.5rem;
}

.term-summary-body {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.65;
    border-left: 3px solid var(--brand);
    padding-left: 1rem;
}

.term-summary-body code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.88em;
    font-family: 'Menlo', 'Courier New', monospace;
    color: var(--text);
}

/* ── Term full-page (mobile navigation) ── */

.term-detail-page {
    max-width: 860px;
}

.term-back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.term-back-link:hover {
    color: var(--brand);
}

/* ── Terminology responsive ── */

@media (max-width: 900px) {
    .terminology-layout {
        flex-direction: column;
    }
    .terminology-master {
        flex: none;
        width: 100%;
    }
    .terminology-list {
        max-height: 60vh;
    }
    .terminology-detail-panel {
        position: static;
        max-height: none;
        width: 100%;
    }
    .term-sections-grid {
        grid-template-columns: 1fr;
    }
    .term-section-card {
        border-right: none;
    }
    .term-section-card:nth-last-child(-n+2) {
        border-bottom: 1px solid var(--border);
    }
    .term-section-card:last-child {
        border-bottom: none;
    }
}

/* ── Contact Form ─────────────────────────────────────────────── */

.contact-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 1.25rem 4rem;
}

.contact-heading {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.contact-subheading {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    margin-bottom: 2.5rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.contact-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.contact-form .form-group input,
.contact-form .form-group textarea {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.15s;
    resize: vertical;
}

.contact-form .form-group input:focus,
.contact-form .form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
}

/* Markdown editor */
.md-editor {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s;
}

.md-editor:focus-within {
    border-color: var(--brand);
}

.md-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    line-height: 1;
}

.md-btn:hover {
    background: var(--border);
    color: var(--text);
    border-color: var(--border);
}

.md-btn--sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    border: none;
    margin: 0 4px;
    cursor: default;
    align-self: center;
}

.md-textarea {
    display: block;
    width: 100%;
    min-height: 160px;
    padding: 0.75rem 0.85rem;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
}

.md-preview-wrap {
    border-top: 1px solid var(--border);
    padding: 0.75rem 0.85rem;
}

.md-preview-label {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #C0A898;
    margin-bottom: 0.5rem;
}

.md-preview-content {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.6;
}

.md-preview-content p { margin: 0 0 0.6em; }
.md-preview-content p:last-child { margin-bottom: 0; }
.md-preview-content strong { font-weight: 700; }
.md-preview-content em { font-style: italic; }
.md-preview-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    background: rgba(84,26,26,0.07);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}
.md-preview-content ul, .md-preview-content ol {
    padding-left: 1.4em;
    margin: 0 0 0.6em;
}
.md-preview-content a { color: var(--brand); }

.contact-honeypot {
    position: absolute;
    left: -9999px;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.contact-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 2rem;
    background: var(--brand);
    color: #F7F7F5;
    border: none;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    align-self: flex-start;
}

.contact-submit-btn:hover {
    background: var(--text);
}

.contact-field-error {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--brand);
    margin-top: 0.25rem;
}

.contact-success {
    background: rgba(220,195,170,0.25);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .contact-row-2 {
        grid-template-columns: 1fr;
    }
}

/* ── AI Infrastructure (Clouds) ───────────────────────────────── */

.clouds-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.clouds-master {
    flex: 0 0 560px;
    min-width: 260px;
}

.clouds-header {
    margin-bottom: 0.9rem;
}

.clouds-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.1;
    animation: heroFadeUp 0.5s ease-out both;
}

.clouds-table-wrap {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(84,26,26,0.09);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.clouds-table-wrap::-webkit-scrollbar { width: 5px; }
.clouds-table-wrap::-webkit-scrollbar-track { background: transparent; }
.clouds-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

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

.clouds-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.55rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand);
    background: rgba(247,247,245,0.96);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.clouds-row {
    border-bottom: 1px solid rgba(84,26,26,0.22);
    cursor: pointer;
    transition: background 0.12s;
}

.clouds-row:last-child {
    border-bottom: none;
}

.clouds-row:hover {
    background: rgba(217,211,208,0.55);
}

.clouds-row.is-selected {
    background: var(--brand);
}

.clouds-row.is-selected td {
    color: var(--bg);
}

.clouds-row td {
    padding: 0.65rem 1rem;
    font-size: 0.87rem;
    color: var(--text);
    vertical-align: middle;
}

.clouds-company-link {
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    transition: color 0.12s;
}

.clouds-company-link:hover {
    text-decoration: underline;
}

.clouds-row.is-selected .clouds-company-link {
    color: rgba(247,247,245,0.85);
}

.clouds-cell-name {
    font-weight: 500;
}

.clouds-cell-year {
    font-family: var(--font-ui);
    color: var(--text-secondary);
    white-space: nowrap;
}

.clouds-row.is-selected .clouds-cell-year {
    color: rgba(247,247,245,0.7);
}

.clouds-empty {
    padding: 1.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Type badges ── */

.cloud-type-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cloud-type-badge--hyperscaler {
    background: var(--layer-infra);
    color: var(--bg);
}

.cloud-type-badge--neocloud {
    background: var(--layer-chips);
    color: var(--text);
    border: 1px solid rgba(84,26,26,0.15);
}

.cloud-type-badge--internal {
    background: var(--text-secondary);
    color: var(--bg);
}

.clouds-type-cell {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: nowrap;
}

/* ── Right detail panel ── */

.clouds-detail-panel {
    flex: 1 1 0;
    min-width: 0;
    position: sticky;
    top: 68px;
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    scrollbar-width: none;
    transition: opacity 0.15s;
}

.clouds-detail-panel.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

.clouds-detail-panel::-webkit-scrollbar {
    display: none;
}

/* ── Cloud detail card ── */

.cloud-detail-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(84,26,26,0.10);
    overflow: hidden;
    animation: detailCardIn 0.22s ease-out both;
}

.cloud-detail-header {
    padding: 1.4rem 1.5rem 1.1rem;
    border-bottom: 2px solid var(--border);
}

.cloud-detail-name {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-bottom: 0.7rem;
}

.cloud-detail-meta {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    flex-wrap: wrap;
    font-family: var(--font-ui);
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.cloud-detail-meta a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.cloud-detail-meta a:hover {
    text-decoration: underline;
}

.cloud-detail-body {
    padding: 1.5rem;
}

.cloud-detail-description {
    font-size: 0.97rem;
    color: var(--text);
    line-height: 1.75;
    white-space: pre-wrap;
    margin: 0;
}

.cloud-detail-empty {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* ── Compute clusters table inside detail panel ── */

.cloud-clusters {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1.2rem;
}

.cloud-clusters-title {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.cloud-clusters-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cloud-clusters-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 0.82rem;
}

.cloud-clusters-table thead th {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(84,26,26,0.18);
    padding: 0.3rem 0.6rem 0.5rem;
    white-space: nowrap;
}

.cloud-clusters-table tbody td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid rgba(84,26,26,0.10);
    color: var(--text);
    vertical-align: middle;
}

.cloud-clusters-table tbody tr:last-child td {
    border-bottom: none;
}

.cloud-clusters-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Responsive ── */

@media (max-width: 900px) {
    .clouds-layout {
        flex-direction: column;
    }
    .clouds-master {
        flex: none;
        width: 100%;
    }
    .clouds-table-wrap {
        max-height: 60vh;
    }
    .clouds-detail-panel {
        position: static;
        max-height: none;
        width: 100%;
    }
}

/* ── 404 ──────────────────────────────────────────────────────── */

.not-found {
    max-width: 640px;
    margin: 0 auto;
    padding: 4rem 1.25rem 5rem;
    text-align: center;
}
.not-found__code {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 0.75rem;
}
.not-found__title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.not-found__body {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.not-found__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem 1.1rem;
}
.not-found__nav a {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--navy);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.not-found__nav a:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
