:root {
    color-scheme: dark;
    --bg: #07090d;
    --surface: #0d1118;
    --surface-2: #111722;
    --surface-3: #171e2b;
    --surface-hover: #1b2432;
    --border: #202938;
    --border-soft: #18202c;
    --text: #f2f5f9;
    --text-soft: #b1bdcc;
    --muted: #728094;
    --dim: #4b5667;
    --accent: #7c6df2;
    --accent-2: #a996ff;
    --accent-soft: rgba(124, 109, 242, 0.13);
    --positive: #36d4a2;
    --positive-soft: rgba(54, 212, 162, 0.11);
    --negative: #ff6b81;
    --negative-soft: rgba(255, 107, 129, 0.11);
    --blue: #49a8ff;
    --amber: #f4b860;
    --topbar: 68px;
    --sidebar: 218px;
    --radius: 12px;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

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

html {
    min-width: 320px;
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 79% -8%, rgba(124, 109, 242, 0.075), transparent 28rem),
        var(--bg);
    font-family: "DM Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select {
    color: inherit;
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

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

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

::selection {
    color: #fff;
    background: rgba(124, 109, 242, 0.55);
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: #090c12;
}

::-webkit-scrollbar-thumb {
    border: 2px solid #090c12;
    border-radius: 99px;
    background: #293447;
}

::-webkit-scrollbar-thumb:hover {
    background: #35435a;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 1000;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--accent);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 10px;
}

/* Top bar */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: var(--topbar);
    display: grid;
    grid-template-columns: var(--sidebar) minmax(280px, 560px) 1fr;
    align-items: center;
    gap: 28px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 9, 13, 0.9);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(124, 109, 242, 0.23));
}

.brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.05;
}

.brand-copy strong {
    font-size: 0.96rem;
    letter-spacing: 0.01em;
}

.brand-copy span {
    margin-top: 5px;
    color: var(--accent-2);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.global-search,
.add-company {
    position: relative;
}

.global-search > svg,
.add-company > svg,
.input-with-icon > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    width: 18px;
    height: 18px;
    color: var(--muted);
    transform: translateY(-50%);
}

.global-search input,
.add-company input {
    width: 100%;
    height: 42px;
    padding: 0 48px 0 43px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: 0;
    background: rgba(17, 23, 34, 0.82);
    font-size: 0.86rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.global-search input::placeholder,
.add-company input::placeholder,
.filter-group input::placeholder {
    color: #637086;
}

.global-search input:focus,
.add-company input:focus,
.filter-group input:focus,
.filter-group select:focus {
    border-color: rgba(124, 109, 242, 0.75);
    box-shadow: 0 0 0 3px rgba(124, 109, 242, 0.11);
    background: var(--surface-2);
}

.global-search kbd {
    position: absolute;
    top: 50%;
    right: 11px;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid #303a4b;
    border-radius: 6px;
    color: var(--muted);
    background: #171d27;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    transform: translateY(-50%);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 220;
    display: none;
    overflow: hidden;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #101620;
    box-shadow: var(--shadow);
}

.search-results.is-open,
.search-results:not(:empty) {
    display: block;
}

.search-result-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    text-align: left;
}

.search-result-item:hover,
.search-result-item:focus-visible {
    outline: 0;
    background: var(--surface-hover);
}

.search-result {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: inherit;
    background: transparent;
    text-align: left;
}

.search-result:hover,
.search-result:focus-visible,
.search-result[aria-selected="true"] {
    outline: 0;
    background: var(--surface-hover);
}

.search-result > span:last-child:not(.company-identity) {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    font-family: "IBM Plex Mono", monospace;
}

.search-result > span:last-child strong {
    font-size: 0.64rem;
}

.search-result > span:last-child small,
.search-result-action {
    margin-top: 2px;
    color: var(--accent-2);
    font-size: 0.56rem;
}

.search-empty {
    padding: 15px 12px;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: center;
}

.search-result-symbol {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #333e55;
    border-radius: 9px;
    color: #dcd7ff;
    background: var(--accent-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    font-weight: 600;
}

.search-result-copy {
    min-width: 0;
    flex: 1;
}

.search-result-copy strong,
.search-result-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-copy strong {
    font-size: 0.81rem;
}

.search-result-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

.data-state {
    display: flex;
    align-items: center;
    gap: 9px;
}

.data-state > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.data-state strong {
    color: var(--positive);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.data-state small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.64rem;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--positive);
    box-shadow: 0 0 0 4px rgba(54, 212, 162, 0.09), 0 0 13px rgba(54, 212, 162, 0.55);
}

.back-link {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 0.76rem;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.back-link svg {
    width: 15px;
    height: 15px;
}

.back-link:hover {
    border-color: #3a465a;
    color: var(--text);
    background: var(--surface-2);
}

/* Shell and sidebar */
.app-shell {
    min-height: 100vh;
    padding-top: var(--topbar);
}

.sidebar {
    position: fixed;
    inset: var(--topbar) auto 0 0;
    z-index: 80;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    padding: 22px 15px 18px;
    border-right: 1px solid var(--border);
    background: rgba(9, 12, 18, 0.88);
}

.side-nav {
    display: grid;
    gap: 5px;
}

.nav-item {
    width: 100%;
    height: 45px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
    font-size: 0.83rem;
    font-weight: 600;
    text-align: left;
    transition: all 0.18s ease;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.nav-item:hover {
    color: var(--text-soft);
    background: var(--surface-2);
}

.nav-item.is-active {
    border-color: rgba(124, 109, 242, 0.23);
    color: #ddd8ff;
    background: linear-gradient(90deg, rgba(124, 109, 242, 0.18), rgba(124, 109, 242, 0.055));
    box-shadow: inset 2px 0 var(--accent);
}

.nav-count {
    min-width: 21px;
    height: 20px;
    display: grid;
    margin-left: auto;
    padding: 0 6px;
    place-items: center;
    border: 1px solid #303a4b;
    border-radius: 99px;
    color: var(--text-soft);
    background: #161d29;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.62rem;
}

.sidebar-card {
    display: flex;
    margin-top: 30px;
    padding: 15px;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(124, 109, 242, 0.08), rgba(17, 23, 34, 0.52));
}

.sidebar-card .eyebrow {
    color: var(--accent-2);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.58rem;
    letter-spacing: 0.13em;
}

.sidebar-card strong {
    margin-top: 9px;
    font-size: 0.78rem;
}

.sidebar-card > span:not(.eyebrow),
.sidebar-card small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.66rem;
}

.coverage-bar {
    height: 3px;
    margin-top: 15px;
    overflow: hidden;
    border-radius: 99px;
    background: #232c3b;
}

.coverage-bar span {
    display: block;
    width: 72%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #52b7ff);
}

.sidebar-footer {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: auto;
    padding: 13px 7px 0;
    border-top: 1px solid var(--border-soft);
}

.shield-icon {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    color: var(--accent-2);
    background: var(--accent-soft);
}

.shield-icon svg {
    width: 15px;
    height: 15px;
}

.sidebar-footer p {
    margin: 0;
    color: var(--dim);
    font-size: 0.61rem;
    line-height: 1.45;
}

.sidebar-footer strong {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
}

/* Main */
.main-content {
    min-width: 0;
    margin-left: var(--sidebar);
    padding: 34px clamp(22px, 3.1vw, 54px) 64px;
}

.view-panel {
    max-width: 1550px;
    margin: 0 auto;
    animation: viewIn 0.28s ease both;
}

.view-panel[hidden] {
    display: none !important;
}

@keyframes viewIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 25px;
}

.section-kicker,
.panel-eyebrow {
    color: var(--accent-2);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.63rem;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.page-heading h1 {
    max-width: 780px;
    margin: 8px 0 7px;
    font-size: clamp(1.65rem, 2.7vw, 2.65rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.compact-heading {
    align-items: center;
    margin-bottom: 27px;
}

.compact-heading h1 {
    font-size: clamp(1.55rem, 2.3vw, 2.2rem);
}

.heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 700;
    transition: all 0.18s ease;
}

.button svg {
    width: 15px;
    height: 15px;
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, #7362ec, #8f7aff);
    box-shadow: 0 8px 24px rgba(124, 109, 242, 0.2);
}

.button-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(124, 109, 242, 0.32);
}

.button-secondary {
    border-color: var(--border);
    color: var(--text-soft);
    background: var(--surface-2);
}

.button-secondary:hover {
    border-color: #394559;
    color: var(--text);
    background: var(--surface-hover);
}

.data-notice {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
    padding: 11px 14px;
    border: 1px solid rgba(73, 168, 255, 0.17);
    border-radius: 9px;
    color: #9ab5cf;
    background: rgba(73, 168, 255, 0.055);
}

.data-notice > svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--blue);
}

.data-notice p {
    margin: 0;
    flex: 1;
    font-size: 0.71rem;
    line-height: 1.45;
}

.data-notice strong {
    color: #c6dcf0;
}

.notice-close {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
    font-size: 1rem;
}

.notice-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

/* Overview */
.market-strip {
    display: grid;
    overflow: hidden;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
}

.index-card {
    position: relative;
    min-width: 0;
    padding: 15px 17px 13px;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.index-card:last-child {
    border-right: 0;
}

.index-card > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.index-card > div span {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 600;
}

.index-card > div small {
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.56rem;
}

.index-card > strong {
    display: inline-block;
    margin-top: 7px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.86rem;
    font-weight: 600;
}

.delta {
    margin-left: 9px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.62rem;
    font-weight: 500;
}

.positive {
    color: var(--positive) !important;
}

.negative {
    color: var(--negative) !important;
}

.is-positive {
    color: var(--positive) !important;
}

.is-negative {
    color: var(--negative) !important;
}

.is-neutral {
    color: var(--muted) !important;
}

.mini-line {
    position: absolute;
    right: 14px;
    bottom: 10px;
    width: 90px;
    height: 24px;
    opacity: 0.55;
    pointer-events: none;
}

.mini-line path {
    fill: none;
    vector-effect: non-scaling-stroke;
    stroke-width: 1.4;
}

.positive-line path { stroke: var(--positive); }
.negative-line path { stroke: var(--negative); }
.neutral-line path { stroke: var(--amber); }

.kpi-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
}

.kpi-icon {
    width: 39px;
    height: 39px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
}

.kpi-icon svg {
    width: 18px;
    height: 18px;
}

.kpi-icon.purple { color: #aa9eff; background: rgba(124, 109, 242, 0.13); }
.kpi-icon.blue { color: #72bcff; background: rgba(73, 168, 255, 0.12); }
.kpi-icon.green { color: var(--positive); background: var(--positive-soft); }
.kpi-icon.amber { color: var(--amber); background: rgba(244, 184, 96, 0.12); }

.kpi-card > div {
    min-width: 0;
    display: grid;
    grid-template: auto auto / auto 1fr;
    align-items: baseline;
    column-gap: 8px;
}

.kpi-card div > span {
    grid-column: 1 / -1;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-card strong {
    margin-top: 2px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.26rem;
    letter-spacing: -0.04em;
}

.kpi-card small {
    overflow: hidden;
    color: var(--dim);
    font-size: 0.6rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel,
.idea-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(17, 23, 34, 0.88), rgba(11, 15, 22, 0.93));
}

.overview-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.6fr) minmax(330px, 0.78fr);
}

.performance-panel,
.movers-panel {
    min-height: 342px;
    overflow: hidden;
}

.panel-header {
    min-height: 69px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.panel-header h2,
.ideas-heading h2 {
    margin: 3px 0 0;
    font-size: 0.96rem;
    letter-spacing: -0.012em;
}

.panel-eyebrow {
    color: var(--muted);
    font-size: 0.56rem;
}

.chart-legend {
    display: flex;
    gap: 15px;
    color: var(--muted);
    font-size: 0.63rem;
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend i {
    width: 14px;
    height: 2px;
    display: block;
    border-radius: 99px;
}

.legend-watchlist { background: var(--accent-2); }
.legend-benchmark { background: #4b6079; }

.chart-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 17px 20px 0;
}

.chart-summary strong {
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.3rem;
}

.chart-summary span {
    font-size: 0.65rem;
}

.performance-chart {
    height: 229px;
    padding: 2px 11px 5px;
}

.performance-chart svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.performance-svg .chart-line {
    fill: none;
    vector-effect: non-scaling-stroke;
}

.performance-svg .chart-line-primary {
    stroke: var(--accent-2);
    stroke-width: 2.4;
    filter: drop-shadow(0 2px 5px rgba(169, 150, 255, 0.2));
}

.performance-svg .chart-line-secondary {
    stroke: #4b6079;
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
}

.performance-svg .chart-grid,
.fundamental-svg .chart-grid {
    stroke: #202938;
    stroke-dasharray: 3 5;
    stroke-width: 1;
}

.performance-svg .chart-axis,
.fundamental-svg .chart-axis {
    fill: #657286;
    stroke: none;
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
}

.performance-svg .chart-legend text {
    fill: #68768a;
    stroke: none;
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
}

.performance-svg .legend-primary {
    fill: var(--accent-2);
    stroke: none;
}

.performance-svg .legend-secondary {
    fill: #4b6079;
    stroke: none;
}

.chart-grid line {
    stroke: #202938;
    stroke-dasharray: 3 5;
    stroke-width: 1;
}

.chart-label,
.chart-axis-label {
    fill: #657286;
    stroke: none;
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
}

.chart-watchlist-line,
.detail-series-line {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 2.2;
    vector-effect: non-scaling-stroke;
}

.chart-benchmark-line {
    fill: none;
    stroke: #50627a;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.chart-area {
    fill: url(#watchlistGradient);
    stroke: none;
}

.text-button {
    cursor: pointer;
    color: var(--accent-2);
    background: transparent;
    font-size: 0.67rem;
}

.text-button:hover {
    color: #d0c9ff;
}

.compact-table-wrap {
    overflow: hidden;
}

.compact-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.compact-table th,
.compact-table td {
    height: 53px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.7rem;
    text-align: right;
}

.compact-table th {
    height: 35px;
    color: var(--dim);
    font-size: 0.56rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.compact-table th:first-child,
.compact-table td:first-child {
    text-align: left;
}

.compact-table tr:last-child td {
    border-bottom: 0;
}

.movers-panel .mover-price {
    min-width: auto;
}

.movers-panel .mover-price .sparkline {
    width: 42px;
}

.symbol-pair,
.mover-company {
    display: flex;
    align-items: center;
    gap: 9px;
}

.symbol-avatar,
.ticker-avatar {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #303b50;
    border-radius: 8px;
    color: #dad5ff;
    background: rgba(124, 109, 242, 0.1);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.54rem;
    font-weight: 600;
}

.symbol-pair span,
.mover-company span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.symbol-pair strong,
.mover-company strong {
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.67rem;
}

.symbol-pair small,
.mover-company small {
    max-width: 130px;
    overflow: hidden;
    color: var(--dim);
    font-size: 0.58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ideas-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 29px 2px 13px;
}

.ideas-heading p {
    max-width: 380px;
    margin: 0;
    color: var(--dim);
    font-size: 0.66rem;
    text-align: right;
}

.idea-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.idea-panel {
    overflow: hidden;
}

.idea-panel > header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.idea-panel h3,
.idea-panel p {
    margin: 0;
}

.idea-panel h3 {
    font-size: 0.78rem;
}

.idea-panel p {
    margin-top: 2px;
    color: var(--dim);
    font-size: 0.59rem;
}

.idea-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
    font-weight: 600;
}

.idea-icon.quality { color: var(--positive); background: var(--positive-soft); }
.idea-icon.value { color: var(--accent-2); background: var(--accent-soft); }
.idea-icon.growth { color: var(--blue); background: rgba(73, 168, 255, 0.11); }

.ranking-list {
    min-height: 179px;
}

.rank-item,
.ranking-item {
    width: 100%;
    min-height: 59px;
    display: grid;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-soft);
    cursor: pointer;
    color: inherit;
    background: transparent;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    text-align: left;
    transition: background 0.18s;
}

.rank-item:last-child,
.ranking-item:last-child {
    border-bottom: 0;
}

.rank-item:hover,
.ranking-item:hover {
    background: rgba(255, 255, 255, 0.022);
}

.rank-number {
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.57rem;
}

.rank-company {
    min-width: 0;
}

.rank-company strong,
.rank-company small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-company strong {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.67rem;
}

.rank-company small {
    margin-top: 2px;
    color: var(--dim);
    font-size: 0.57rem;
}

.rank-score {
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
}

.rank-item > strong {
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.6rem;
    font-weight: 500;
}

/* Screener filters */
.screener-layout {
    display: grid;
    align-items: start;
    gap: 14px;
    grid-template-columns: 235px minmax(0, 1fr);
}

.filter-panel {
    position: sticky;
    top: calc(var(--topbar) + 18px);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border-soft);
}

.filter-heading > div {
    display: flex;
    flex-direction: column;
}

.filter-heading span {
    color: var(--accent-2);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.54rem;
    letter-spacing: 0.13em;
}

.filter-heading strong {
    margin-top: 4px;
    font-size: 0.75rem;
}

.filter-heading button {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--muted);
    background: var(--surface-3);
    font-size: 1.1rem;
}

.filter-group {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 13px 15px;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
}

.filter-group > label,
.filter-group legend,
.filter-label label {
    color: var(--text-soft);
    font-size: 0.65rem;
    font-weight: 600;
}

.filter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-label > span {
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.53rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon > svg {
    left: 11px;
    width: 15px;
    height: 15px;
}

.input-with-icon input,
.filter-group select,
.dual-fields input,
.number-field input {
    width: 100%;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: 0;
    background: #0c1118;
    font-size: 0.68rem;
}

.input-with-icon input {
    padding: 0 10px 0 34px;
}

.select-wrap {
    position: relative;
}

.select-wrap select {
    padding: 0 33px 0 10px;
    appearance: none;
}

.select-wrap svg {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 14px;
    height: 14px;
    color: var(--muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.range-group legend {
    width: 100%;
    margin-bottom: 9px;
}

.dual-fields {
    display: grid;
    gap: 7px;
    grid-template-columns: 1fr 1fr;
}

.dual-fields label,
.number-field {
    display: grid;
    gap: 5px;
}

.dual-fields label > span,
.number-field > span:first-child {
    color: var(--muted);
    font-size: 0.56rem;
}

.dual-fields input,
.number-field input {
    padding: 0 9px;
    font-family: "IBM Plex Mono", monospace;
}

.input-suffix {
    position: relative;
}

.input-suffix input {
    padding-right: 28px;
}

.input-suffix i {
    position: absolute;
    top: 50%;
    right: 10px;
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.6rem;
    font-style: normal;
    transform: translateY(-50%);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
}

.switch-row > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.switch-row strong {
    color: var(--text-soft);
    font-size: 0.64rem;
}

.switch-row small {
    margin-top: 2px;
    color: var(--dim);
    font-size: 0.53rem;
}

.switch-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-row i {
    position: relative;
    width: 33px;
    height: 19px;
    flex: 0 0 auto;
    border: 1px solid #384457;
    border-radius: 99px;
    background: #202837;
    transition: all 0.2s ease;
}

.switch-row i::after {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #8190a5;
    content: "";
    transition: all 0.2s ease;
}

.switch-row input:checked + i {
    border-color: var(--accent);
    background: var(--accent);
}

.switch-row input:checked + i::after {
    left: 16px;
    background: #fff;
}

.switch-row input:focus-visible + i {
    box-shadow: 0 0 0 3px rgba(124, 109, 242, 0.25);
}

.reset-button {
    width: calc(100% - 30px);
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 0.65rem;
}

.reset-button svg {
    width: 14px;
    height: 14px;
}

.reset-button:hover {
    border-color: #384559;
    color: var(--text-soft);
}

.mobile-filter-button {
    display: none;
}

.results-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.results-toolbar {
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 15px;
    border-bottom: 1px solid var(--border);
}

.results-toolbar > div:first-child {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.results-toolbar strong {
    flex: 0 0 auto;
    font-size: 0.75rem;
}

.filter-chips {
    display: flex;
    overflow: hidden;
    align-items: center;
    gap: 5px;
}

.filter-chip {
    max-width: 140px;
    overflow: hidden;
    padding: 4px 7px;
    border: 1px solid rgba(124, 109, 242, 0.2);
    border-radius: 99px;
    color: #bbb2fb;
    background: rgba(124, 109, 242, 0.09);
    font-size: 0.54rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.filters-empty {
    color: var(--dim);
    font-size: 0.57rem;
}

.toolbar-meta {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
}

.toolbar-meta > span,
.watchlist-tools > span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--dim);
    font-size: 0.58rem;
}

.toolbar-meta > span .status-dot,
.watchlist-tools > span .status-dot {
    width: 5px;
    height: 5px;
}

.toolbar-meta button,
.watchlist-tools button {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 0.61rem;
}

.toolbar-meta button svg,
.watchlist-tools button svg {
    width: 14px;
    height: 14px;
}

.table-shell {
    position: relative;
    overflow: auto;
}

.data-table {
    min-width: 1410px;
}

.data-table th,
.data-table td {
    height: 52px;
    padding: 0 12px;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.64rem;
    text-align: right;
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 37px;
    color: var(--muted);
    background: #101620;
    font-family: "DM Sans", sans-serif;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.data-table th button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    cursor: pointer;
    color: inherit;
    background: transparent;
    font: inherit;
}

.data-table th button:hover,
.data-table th[aria-sort] button {
    color: var(--text-soft);
}

.data-table th button span {
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.48rem;
}

.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr:hover td {
    background: #141b26;
}

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

.data-table th:last-child,
.data-table td:last-child {
    border-right: 0;
}

.data-table .star-column {
    left: 0;
    z-index: 6;
    width: 41px;
    min-width: 41px;
    max-width: 41px;
    text-align: center;
}

.data-table td.star-column,
.data-table td:first-child:not(.company-column) {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: center;
}

.data-table .company-column {
    left: 41px;
    z-index: 5;
    min-width: 183px;
    text-align: left;
    box-shadow: 1px 0 var(--border);
}

.data-table td.company-column,
.data-table td:nth-child(2) {
    position: sticky;
    left: 41px;
    z-index: 2;
    min-width: 183px;
    text-align: left;
    box-shadow: 1px 0 var(--border);
}

.watchlist-table {
    min-width: 960px;
}

.watchlist-table .company-column,
.watchlist-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 210px;
    text-align: left;
    box-shadow: 1px 0 var(--border);
}

.watchlist-table td:first-child {
    z-index: 2;
}

.watchlist-star,
.star-button,
.watch-toggle,
.remove-watchlist {
    display: inline-grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 7px;
    cursor: pointer;
    color: #4e5a6c;
    background: transparent;
    font-size: 1rem;
    transition: color 0.18s, background 0.18s;
}

.watchlist-star:hover,
.star-button:hover,
.watch-toggle:hover,
.watchlist-star.is-active,
.star-button.is-active,
.watch-toggle.is-active {
    color: var(--amber);
    background: rgba(244, 184, 96, 0.08);
}

.watch-toggle span {
    line-height: 1;
}

.remove-watchlist:hover {
    color: var(--negative);
    background: var(--negative-soft);
}

.company-cell,
.table-company {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: "DM Sans", sans-serif;
}

.company-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.company-avatar {
    width: 31px;
    height: 31px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #303b50;
    border-radius: 8px;
    color: #dad5ff;
    background: rgba(124, 109, 242, 0.1);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.52rem;
    font-weight: 600;
}

.company-identity .company-copy {
    min-width: 0;
}

.company-identity .company-copy strong,
.company-identity .company-copy > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-identity .company-copy strong {
    color: var(--text);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.64rem;
}

.company-identity .company-copy > span {
    max-width: 125px;
    margin-top: 2px;
    color: var(--dim);
    font-family: "DM Sans", sans-serif;
    font-size: 0.56rem;
}

.rank-item .company-avatar {
    display: none;
}

.company-cell > span:last-child,
.table-company > span:last-child,
.company-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.company-cell strong,
.table-company strong,
.company-copy strong {
    color: var(--text);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.65rem;
}

.company-cell small,
.table-company small,
.company-copy small {
    max-width: 118px;
    overflow: hidden;
    color: var(--dim);
    font-size: 0.57rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price-cell {
    min-width: 125px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.price-with-chart,
.mover-price {
    min-width: 116px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.price-with-chart > strong,
.mover-price > strong {
    font-size: 0.62rem;
    font-weight: 500;
}

.price-cell strong {
    font-weight: 500;
}

.sparkline {
    width: 50px;
    height: 21px;
}

.sparkline-empty {
    color: var(--dim);
}

.sparkline path,
.sparkline polyline {
    fill: none;
    vector-effect: non-scaling-stroke;
    stroke-width: 1.35;
}

.sparkline.positive path,
.sparkline.positive polyline { stroke: var(--positive); }
.sparkline.negative path,
.sparkline.negative polyline { stroke: var(--negative); }

.change-pill,
.metric-pill {
    display: inline-flex;
    min-width: 62px;
    height: 26px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 0.59rem;
}

.change-pill.positive { background: var(--positive-soft); }
.change-pill.negative { background: var(--negative-soft); }

.metric-strong {
    color: var(--text-soft);
}

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

.metric-positive {
    color: var(--positive);
}

.metric-negative {
    color: var(--negative);
}

.empty-state {
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    flex-direction: column;
    text-align: center;
}

.empty-state[hidden] {
    display: none;
}

.empty-state > span {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--accent-2);
    background: var(--accent-soft);
    font-size: 1.4rem;
}

.empty-state h3 {
    margin: 15px 0 5px;
    font-size: 0.93rem;
}

.empty-state p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.72rem;
}

.table-footnote {
    min-height: 37px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-soft);
    color: var(--dim);
    font-size: 0.54rem;
}

.mobile-filter-overlay {
    display: none;
}

/* Watchlist */
.add-company {
    width: min(100%, 300px);
}

.add-company .plus {
    position: absolute;
    top: 50%;
    right: 13px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 6px;
    color: #d9d3ff;
    background: var(--accent-soft);
    font-size: 0.9rem;
    transform: translateY(-50%);
}

.watchlist-stats {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.watch-stat {
    position: relative;
    overflow: hidden;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
}

.watch-stat::after {
    position: absolute;
    right: -20px;
    bottom: -30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(124, 109, 242, 0.05);
    content: "";
}

.watch-stat span,
.watch-stat strong,
.watch-stat small {
    display: block;
}

.watch-stat span {
    color: var(--muted);
    font-size: 0.64rem;
}

.watch-stat strong {
    margin-top: 4px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.2rem;
}

.watch-stat small {
    margin-top: 4px;
    color: var(--dim);
    font-size: 0.56rem;
}

.watchlist-panel {
    overflow: hidden;
}

.watchlist-panel-header {
    min-height: 71px;
}

.watchlist-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.watchlist-help {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    grid-template-columns: repeat(3, 1fr);
}

.watchlist-help > div {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: rgba(17, 23, 34, 0.45);
}

.watchlist-help svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--accent-2);
}

.watchlist-help span {
    display: flex;
    color: var(--dim);
    flex-direction: column;
    font-size: 0.56rem;
}

.watchlist-help strong {
    margin-bottom: 2px;
    color: var(--text-soft);
    font-size: 0.65rem;
}

/* Company detail drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(1, 3, 7, 0.66);
    backdrop-filter: blur(4px);
}

.drawer-overlay[hidden] {
    display: none;
}

.company-drawer {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 310;
    width: min(570px, 100vw);
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background: #0b0f16;
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.43);
    transform: translateX(102%);
    transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.32, 1);
}

.company-drawer.is-open,
.company-drawer[aria-hidden="false"] {
    transform: translateX(0);
}

.drawer-close {
    position: sticky;
    top: 16px;
    z-index: 5;
    width: 34px;
    height: 34px;
    display: grid;
    margin: 16px 16px -50px auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    color: var(--muted);
    background: rgba(17, 23, 34, 0.92);
    backdrop-filter: blur(10px);
}

.drawer-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.drawer-close svg {
    width: 16px;
    height: 16px;
}

.detail-inner,
.company-detail-inner {
    padding-bottom: 40px;
}

#companyDetail {
    min-height: 100%;
    padding: 27px 27px 44px;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 46px 22px 0;
    border-bottom: 1px solid var(--border);
}

.detail-header > div {
    min-width: 0;
}

.detail-header .company-avatar {
    width: 45px;
    height: 45px;
    border-color: rgba(124, 109, 242, 0.35);
    border-radius: 12px;
    font-size: 0.64rem;
}

.detail-header .company-copy strong {
    font-size: 0.88rem;
}

.detail-header .company-copy > span {
    max-width: 260px;
    margin-top: 4px;
    font-size: 0.66rem;
}

.detail-header > div > p {
    margin: 9px 0 0 54px;
    color: var(--muted);
    font-size: 0.58rem;
}

.detail-hero {
    position: relative;
    overflow: hidden;
    padding: 38px 28px 24px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(circle at 15% 10%, rgba(124, 109, 242, 0.15), transparent 15rem),
        #0d121b;
}

.detail-hero::after {
    position: absolute;
    top: -70px;
    right: -60px;
    width: 220px;
    height: 220px;
    border: 1px solid rgba(124, 109, 242, 0.08);
    border-radius: 50%;
    content: "";
}

.detail-company {
    display: flex;
    align-items: center;
    gap: 13px;
}

.detail-avatar {
    width: 48px;
    height: 48px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(124, 109, 242, 0.36);
    border-radius: 13px;
    color: #e3dfff;
    background: rgba(124, 109, 242, 0.13);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    font-weight: 600;
}

.detail-company h2,
.detail-company p {
    margin: 0;
}

.detail-company h2 {
    font-size: 1.16rem;
}

.detail-company p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.65rem;
}

.detail-quote {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
}

#companyDetail > .detail-quote {
    align-items: baseline;
    margin: 22px 0 19px;
}

#companyDetail > .detail-quote > strong {
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.65rem;
    letter-spacing: -0.04em;
}

#companyDetail > .detail-quote > span {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.73rem;
}

#companyDetail > .detail-quote small {
    display: block;
    margin-top: 3px;
    color: var(--dim);
    font-family: "DM Sans", sans-serif;
    font-size: 0.52rem;
    text-align: right;
}

.detail-price strong {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
}

.detail-price span {
    display: inline-block;
    margin-top: 4px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
}

.detail-watch-button {
    min-height: 37px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid rgba(124, 109, 242, 0.3);
    border-radius: 8px;
    cursor: pointer;
    color: #cfc8ff;
    background: var(--accent-soft);
    font-size: 0.67rem;
    font-weight: 600;
}

.detail-watch-button:hover,
.detail-watch-button.is-active {
    color: #fff;
    background: rgba(124, 109, 242, 0.23);
}

.detail-body {
    padding: 22px 27px;
}

.detail-section {
    margin-bottom: 24px;
}

#companyDetail .detail-section {
    padding-top: 21px;
    border-top: 1px solid var(--border-soft);
}

#companyDetail .detail-section:first-of-type {
    border-top: 0;
}

#companyDetail .detail-section > h3,
#companyDetail .section-heading h3 {
    margin: 0 0 12px;
    color: var(--text-soft);
    font-size: 0.75rem;
}

#companyDetail .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

#companyDetail .section-heading h3 {
    margin: 0;
}

#companyDetail .section-heading > span {
    color: var(--dim);
    font-size: 0.53rem;
}

.detail-price-chart {
    height: 135px;
    display: flex;
    align-items: stretch;
    padding: 12px 6px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background:
        linear-gradient(rgba(32, 41, 56, 0.38) 1px, transparent 1px) 0 0 / 100% 33.33%,
        var(--surface);
}

.detail-price-chart .sparkline {
    width: 100%;
    height: 100%;
}

.detail-price-chart .sparkline polyline {
    stroke-width: 2;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.detail-section h3 {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.detail-section-header span {
    color: var(--dim);
    font-size: 0.56rem;
}

.detail-metrics,
.detail-metric-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
}

.metric-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    background: var(--surface);
}

.metric-card > span,
.metric-card > strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-card > span {
    color: var(--muted);
    font-size: 0.52rem;
}

.metric-card > strong {
    margin-top: 6px;
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    font-weight: 500;
}

.metric-card.is-positive > strong { color: var(--positive); }
.metric-card.is-negative > strong { color: var(--negative); }

.detail-metric {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    background: var(--surface);
}

.detail-metric span,
.detail-metric strong,
.detail-metric small {
    display: block;
}

.detail-metric span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.57rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-metric strong {
    margin-top: 6px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
}

.detail-metric small {
    margin-top: 4px;
    color: var(--dim);
    font-size: 0.51rem;
}

.fundamental-chart,
.detail-chart {
    min-height: 220px;
    padding: 12px 6px 4px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface);
}

.fundamental-chart-wrap {
    padding: 11px 9px 3px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface);
}

.fundamental-chart-wrap .chart-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 6px 8px;
    color: var(--dim);
    font-size: 0.52rem;
}

.chart-legend-inline {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-legend-inline i {
    width: 8px;
    height: 2px;
    display: inline-block;
    margin-left: 5px;
    border-radius: 99px;
}

.key-revenue { background: var(--accent-2); }
.key-income { background: var(--positive); }
.key-fcf { background: var(--blue); }

.fundamental-svg {
    width: 100%;
    height: auto;
}

.fundamental-line {
    fill: none;
    vector-effect: non-scaling-stroke;
    stroke-width: 2;
}

.line-revenue { stroke: var(--accent-2); }
.line-income { stroke: var(--positive); }
.line-fcf { stroke: var(--blue); }

.chart-empty {
    padding: 30px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    color: var(--muted);
    background: var(--surface);
    font-size: 0.65rem;
    text-align: center;
}

.detail-disclaimer {
    margin: 24px 0 0;
    padding: 11px 12px;
    border: 1px solid rgba(73, 168, 255, 0.12);
    border-radius: 8px;
    color: #7890a7;
    background: rgba(73, 168, 255, 0.04);
    font-size: 0.56rem;
    line-height: 1.5;
}

.fundamental-chart svg,
.detail-chart svg {
    width: 100%;
    height: 205px;
}

.fundamental-bars {
    display: grid;
    align-items: end;
    gap: 10px;
    height: 170px;
    padding: 15px 12px 0;
    grid-template-columns: repeat(5, 1fr);
}

.fundamental-year {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-direction: column;
}

.fundamental-year .bar {
    width: min(23px, 42%);
    min-height: 3px;
    border-radius: 4px 4px 1px 1px;
    background: linear-gradient(180deg, var(--accent-2), #6555d7);
}

.fundamental-year small {
    margin-top: 5px;
    color: var(--dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.5rem;
}

.quality-bars {
    display: grid;
    gap: 11px;
}

.quality-row {
    display: grid;
    align-items: center;
    gap: 10px;
    grid-template-columns: 105px 1fr 42px;
}

.quality-row > span,
.quality-row > strong {
    font-size: 0.58rem;
}

.quality-row > span {
    color: var(--muted);
}

.quality-row > strong {
    color: var(--text-soft);
    font-family: "IBM Plex Mono", monospace;
    text-align: right;
}

.quality-track {
    height: 5px;
    overflow: hidden;
    border-radius: 99px;
    background: #212a39;
}

.quality-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--positive));
}

.detail-note {
    padding: 12px 13px;
    border: 1px solid rgba(73, 168, 255, 0.13);
    border-radius: 9px;
    color: #8196aa;
    background: rgba(73, 168, 255, 0.045);
    font-size: 0.59rem;
    line-height: 1.5;
}

/* Toast */
.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 500;
    max-width: min(360px, calc(100vw - 32px));
    padding: 11px 15px;
    border: 1px solid #354155;
    border-radius: 9px;
    color: var(--text-soft);
    background: rgba(20, 27, 38, 0.96);
    box-shadow: var(--shadow);
    font-size: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px);
    transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible,
.toast.show {
    opacity: 1;
    transform: none;
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 1180px) {
    :root {
        --sidebar: 76px;
    }

    .topbar {
        grid-template-columns: var(--sidebar) minmax(240px, 480px) 1fr;
        gap: 18px;
        padding: 0 17px;
    }

    .brand-copy,
    .nav-item > span:not(.nav-count),
    .sidebar-card,
    .sidebar-footer {
        display: none;
    }

    .brand {
        justify-content: center;
    }

    .sidebar {
        padding: 20px 10px;
    }

    .nav-item {
        justify-content: center;
        padding: 0;
    }

    .nav-count {
        position: absolute;
        margin: -25px -32px 0 0;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        font-size: 0.52rem;
    }

    .overview-grid {
        grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.75fr);
    }

    .screener-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-panel {
        position: fixed;
        top: var(--topbar);
        bottom: 0;
        left: 0;
        z-index: 250;
        width: min(310px, calc(100vw - 35px));
        overflow-y: auto;
        border-width: 0 1px 0 0;
        border-radius: 0;
        box-shadow: 20px 0 70px rgba(0, 0, 0, 0.45);
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }

    .filter-panel.is-open {
        transform: translateX(0);
    }

    .filter-heading button {
        display: block;
    }

    .mobile-filter-button {
        display: inline-flex;
    }

    .mobile-filter-overlay {
        position: fixed;
        inset: var(--topbar) 0 0;
        z-index: 240;
        background: rgba(1, 3, 7, 0.66);
        backdrop-filter: blur(3px);
    }

    .mobile-filter-overlay.is-open {
        display: block;
    }
}

@media (max-width: 1500px) {
    .movers-panel .compact-table th,
    .movers-panel .compact-table td {
        padding-right: 10px;
        padding-left: 10px;
    }

    .movers-panel .mover-price .sparkline {
        display: none;
    }
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: 46px minmax(200px, 1fr) auto;
    }

    .data-state {
        display: none;
    }

    .back-link span {
        display: none;
    }

    .back-link {
        width: 37px;
        padding: 0;
        justify-content: center;
    }

    .market-strip {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(210px, 1fr));
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .movers-panel {
        min-height: 0;
    }

    .idea-grid {
        grid-template-columns: 1fr;
    }

    .ranking-list {
        min-height: 0;
    }

    .watchlist-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    :root {
        --topbar: 62px;
        --sidebar: 0px;
    }

    body {
        padding-bottom: 68px;
    }

    .topbar {
        grid-template-columns: 40px minmax(0, 1fr) 36px;
        gap: 9px;
        padding: 0 12px;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .global-search input {
        height: 39px;
        padding-right: 12px;
        font-size: 0.78rem;
    }

    .global-search kbd {
        display: none;
    }

    .sidebar {
        inset: auto 0 0 0;
        z-index: 190;
        width: 100%;
        height: 66px;
        padding: 7px 10px;
        border-top: 1px solid var(--border);
        border-right: 0;
        background: rgba(9, 12, 18, 0.96);
        backdrop-filter: blur(18px);
    }

    .side-nav {
        height: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-item {
        height: 52px;
        flex-direction: column;
        gap: 3px;
        border: 0;
        border-radius: 8px;
        font-size: 0.57rem;
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
    }

    .nav-item > span:not(.nav-count) {
        display: block;
    }

    .nav-item.is-active {
        box-shadow: none;
        background: var(--accent-soft);
    }

    .nav-count {
        position: absolute;
        margin: -29px -27px 0 0;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 14px 34px;
    }

    .page-heading,
    .compact-heading,
    .watchlist-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }

    .page-heading h1 {
        font-size: 1.72rem;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1;
    }

    .data-notice {
        align-items: flex-start;
    }

    .market-strip {
        margin-right: -14px;
        border-radius: 10px 0 0 10px;
        grid-template-columns: repeat(4, 195px);
    }

    .index-card {
        padding: 14px;
    }

    .kpi-grid {
        gap: 8px;
    }

    .kpi-card {
        align-items: flex-start;
        gap: 10px;
        padding: 13px;
        flex-direction: column;
    }

    .kpi-icon {
        width: 32px;
        height: 32px;
    }

    .kpi-card strong {
        font-size: 1.05rem;
    }

    .panel-header {
        padding: 13px 14px;
    }

    .performance-panel {
        min-height: 320px;
    }

    .chart-legend {
        align-items: flex-end;
        gap: 5px;
        flex-direction: column;
    }

    .performance-chart {
        height: 210px;
    }

    .ideas-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .ideas-heading p {
        text-align: left;
    }

    .compact-heading .heading-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .results-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-meta {
        width: 100%;
        justify-content: space-between;
    }

    .filter-chips {
        flex-wrap: wrap;
    }

    .data-table th,
    .data-table td {
        height: 49px;
    }

    .table-footnote {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .add-company {
        width: 100%;
    }

    .watchlist-stats {
        gap: 8px;
    }

    .watch-stat {
        padding: 13px;
    }

    .watchlist-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .watchlist-tools {
        width: 100%;
        justify-content: space-between;
    }

    .watchlist-help {
        grid-template-columns: 1fr;
    }

    .company-drawer {
        top: var(--topbar);
        bottom: 66px;
        height: auto;
        width: 100%;
    }

    .detail-hero {
        padding: 28px 18px 20px;
    }

    .detail-body {
        padding: 19px 17px;
    }

    .detail-metrics,
    .detail-metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .toast {
        right: 16px;
        bottom: 82px;
    }
}

@media (max-width: 430px) {
    .global-search input::placeholder {
        color: transparent;
    }

    .kpi-card small {
        display: none;
    }

    .page-heading .heading-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .page-heading .button {
        padding: 0 9px;
        font-size: 0.68rem;
    }

    .watchlist-tools > span {
        max-width: 160px;
    }

    .detail-metric {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
