/* =========================================================
   IDX Screener v2 — "Workbench BEI" (Laravel 13)
   Konsep layout: module rail (navigasi ikon) + command strip
   (pencarian & sesi) + area panel dashboard. Token brand dari
   logo idx_screener.png (sumber kebenaran, §10).
   ========================================================= */

:root {
    /* Lingkaran teal-black logo (token brand — TIDAK diubah) */
    --brand-dark: #111e22;
    --brand-dark-2: #132025;
    --brand-dark-3: #182930;
    /* Panah naik / turun logo */
    --brand-up: #00ad51;
    --brand-down: #f22832;
    /* Garis chart logo */
    --brand-line: #7fa4bf;
    --brand-line-light: #9dc0da;
    --ink-900: #101f23;
    --ink-700: #223b3f;
    --ink-500: #5a6d70;
    --paper: #ecf1f0;
    --hair: #e2e9e8;
    /* Bright di atas panel gelap */
    --up-bright: #2be387;
    --down-bright: #ff6e79;

    /* ── Surface system ── */
    --bg: #0b1417;
    --panel: #0f1c20;
    --panel-2: #121f23;
    --panel-hover: #16262b;
    --edge: rgba(157, 192, 218, 0.16);
    --edge-soft: rgba(157, 192, 218, 0.09);
    --text: #e8f1ef;
    --muted: #9fb9c2;
    --amber: #ffd670;
    --grid: rgba(157, 192, 218, 0.045);
    --up-tint: rgba(43, 227, 135, 0.12);
    --down-tint: rgba(255, 110, 121, 0.12);
    --rail-w: 82px;
    --strip-h: 56px;

    --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'Roboto Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-font-smoothing: antialiased;
}

h1,
h4,
h5,
p {
    margin: 0;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

::selection {
    background: var(--up-bright);
    color: var(--ink-900);
}

:focus-visible {
    outline: 2px solid var(--brand-line-light);
    outline-offset: 2px;
}

/* ===== App shell ===== */
.appshell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* ── Module rail (navigasi ikon — signature nav) ── */
.rail {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100vh;
    background: linear-gradient(180deg, var(--ink-900) 0%, #0c171a 100%);
    border-right: 1px solid var(--edge-soft);
    z-index: 60;
}

.rail-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--strip-h);
    border-bottom: 1px solid var(--edge-soft);
    flex: 0 0 auto;
}

.rail-brand img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.rail-nav {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-block: 14px;
    overflow-y: auto;
    scrollbar-width: none;
}

.rail-nav::-webkit-scrollbar {
    display: none;
}

.rail-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 56px;
    padding: 8px 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.02em;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease;
}

.rail-item i {
    font-size: 1rem;
}

.rail-item:hover {
    color: var(--text);
    background: rgba(157, 192, 218, 0.07);
}

.rail-item.is-active {
    color: var(--up-bright);
    background: var(--up-tint);
}

.rail-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--up-bright);
}

.rail-foot {
    flex: 0 0 auto;
    padding: 12px 8px;
    border-top: 1px solid var(--edge-soft);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
}

.rail-foot b {
    display: block;
    margin-top: 3px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Main column ── */
.rail-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.rail-content {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ===== Command strip ===== */
.cmd-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--strip-h);
    padding-inline: 20px;
    background: linear-gradient(90deg, var(--ink-900) 0%, var(--brand-dark-2) 100%);
    border-bottom: 1px solid var(--edge-soft);
    flex: 0 0 auto;
}

.cmd-search {
    flex: 0 1 420px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(11, 20, 23, 0.66);
    border: 1px solid var(--edge);
    border-radius: 999px;
    padding: 7px 16px;
    transition: border-color 0.15s ease;
}

.cmd-search:focus-within {
    border-color: var(--brand-line-light);
}

.cmd-search i {
    color: var(--brand-line);
    font-size: 0.85rem;
}

.cmd-search input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.cmd-search input::placeholder {
    color: rgba(157, 192, 218, 0.5);
}

.cmd-search .kbd {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
    border: 1px solid var(--edge-soft);
    border-radius: 6px;
    padding: 1px 6px;
}

.cmd-mkt {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ms-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--edge-soft);
    background: rgba(11, 20, 23, 0.55);
    border-radius: 10px;
    min-width: 0;
    overflow: hidden;
}

.ms-clock {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
}

.ms-clock b {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.ms-timeline {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    min-width: 96px;
    background: rgba(157, 192, 218, 0.08);
}

.ms-timeline .seg {
    height: 100%;
    background: rgba(157, 192, 218, 0.14);
}

.ms-timeline .seg + .seg {
    box-shadow: inset 1px 0 0 rgba(11, 20, 23, 0.9);
}

.ms-timeline .seg.on {
    background: var(--up-tint);
    box-shadow: inset 1px 0 0 rgba(11, 20, 23, 0.9);
}

.ms-timeline .seg.rest {
    background: rgba(255, 214, 112, 0.18);
}

.ms-dot {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--up-bright);
    box-shadow: 0 0 0 3px rgba(43, 227, 135, 0.25);
    transform: translate(-50%, -50%);
    transition: left 0.4s ease;
}

.ms-state {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--up-bright);
    white-space: nowrap;
}

.cmd-data {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cmd-data i {
    color: var(--brand-line);
}

/* ===== Panel system ===== */
.panel-container {
    padding: 18px 20px 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 0 0 auto;
}

/* Toolbar console untuk halaman data */
.toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-block: 4px;
}

.toolbar .tb-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.toolbar .tb-sub {
    margin-top: 4px;
    font-size: 0.86rem;
    color: var(--muted);
}

.tb-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.state-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--up-bright);
    border: 1px solid rgba(43, 227, 135, 0.35);
    background: var(--up-tint);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
}

.state-chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--up-bright);
    box-shadow: 0 0 0 3px rgba(43, 227, 135, 0.2);
    animation: pulse-dot 2.4s ease-in-out infinite;
}

.asof-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    border: 1px solid var(--edge-soft);
    background: rgba(11, 20, 23, 0.45);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
}

.asof-chip i {
    color: var(--brand-line);
}

/* Panel */
.panel {
    background: linear-gradient(168deg, rgba(18, 31, 35, 0.72), rgba(15, 28, 32, 0.72));
    border: 1px solid var(--edge-soft);
    border-radius: 14px;
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 0;
}

.panel-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.panel-label i {
    color: var(--brand-line);
    font-size: 0.75rem;
}

.panel-meta {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: rgba(157, 192, 218, 0.65);
    white-space: nowrap;
}

.panel-body {
    padding: 12px 16px 16px;
}

/* Dashboard grid */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

/* Quote utama (IHSG) */
.quote-panel .quote-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.quote-panel .quote-value {
    font-family: var(--font-mono);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.quote-panel .quote-pct {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
}

.quote-panel .quote-pct.up {
    color: var(--ink-900);
    background: var(--up-bright);
}

.quote-panel .quote-pct.down {
    color: #1a0709;
    background: var(--down-bright);
}

.spark-embed {
    margin-top: 10px;
    display: block;
    width: 100%;
}

.spark-embed svg {
    width: 100%;
    height: 96px;
    display: block;
}

/* Breadth */
.breadth-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 2px;
}

.breadth-row .b-num {
    font-family: var(--font-mono);
    font-size: 1.55rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.breadth-row .b-word {
    font-size: 0.78rem;
    color: var(--muted);
}

.meter {
    margin-top: 12px;
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--down-tint);
}

.meter span {
    background: var(--brand-up);
    height: 100%;
}

.meter-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--muted);
}

.mini-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.84rem;
}

.mini-stat .k {
    color: var(--muted);
}

.mini-stat .v {
    font-family: var(--font-mono);
    font-weight: 700;
}

/* Movers row (mini) */
.movers {
    display: flex;
    flex-direction: column;
}

.mover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-block: 8px;
    border-bottom: 1px dashed rgba(157, 192, 218, 0.1);
}

.mover-row:last-child {
    border-bottom: 0;
}

.mover-row .m-code {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
}

.mover-row .m-code a:hover {
    color: var(--up-bright);
}

.mover-row .m-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.76rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mover-row .m-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
}

/* Heat chips (sektor) */
.heat-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 8px;
}

.heat-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--edge-soft);
    background: rgba(11, 20, 23, 0.4);
    transition: border-color 0.15s ease;
}

.heat-chip:hover {
    border-color: var(--edge);
}

.heat-chip .h-sector {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heat-chip .h-pct {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
}

.heat-chip .h-sub {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    color: var(--muted);
}

/* Module strip */
.module-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.module-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--edge-soft);
    background: rgba(11, 20, 23, 0.4);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.module-link:hover {
    border-color: var(--edge);
    background: var(--panel-hover);
}

.module-link i {
    color: var(--brand-line-light);
    font-size: 0.9rem;
}

.module-link .ml-label {
    font-size: 0.78rem;
    font-weight: 700;
}

.module-link .ml-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
}

/* Teks semantik */
.t-up { color: var(--up-bright); }
.t-down { color: var(--down-bright); }

.pv-up { color: var(--up-bright); }
.pv-down { color: var(--down-bright); }

/* ===== Ticker tape (bar atas, berjalan seamless) ===== */
.ticker-wrap {
    position: relative;
    z-index: 40;
    background: linear-gradient(135deg, var(--ink-900) 0%, var(--brand-dark-2) 78%, var(--brand-dark-3) 100%);
    border-bottom: 1px solid var(--edge-soft);
    overflow: hidden;
    padding-block: 9px;
    flex: 0 0 auto;
}

.ticker-wrap::before,
.ticker-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 48px;
    z-index: 2;
    pointer-events: none;
}

.ticker-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(16, 31, 35, 0.92), transparent);
}

.ticker-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(16, 31, 35, 0.92), transparent);
}

/* Gerak dilakukan JS requestAnimationFrame (tahan prefers-reduced-motion);
   hover pause by JS. */
.ticker-movement {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    will-change: transform;
}

.ticker-group {
    display: flex;
    flex: 0 0 auto;
}

.ticker-item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding-inline: 14px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    white-space: nowrap;
    color: var(--muted);
}

.ticker-symbol {
    font-weight: 700;
    color: var(--text);
}

.ticker-price {
    font-weight: 600;
    color: var(--text);
}

.ticker-up { color: var(--up-bright); }
.ticker-down { color: var(--down-bright); }

@media (prefers-reduced-motion: reduce) {
    .state-chip .dot {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ===== Footer (compact satu baris) ===== */
.site-footer {
    background: linear-gradient(135deg, var(--ink-900) 0%, var(--brand-dark-2) 78%, var(--brand-dark-3) 100%);
    color: rgba(223, 236, 233, 0.78);
    border-top: 1px solid var(--edge-soft);
    padding-block: 12px;
}

.site-footer .container {
    max-width: 100%;
    padding-inline: 20px;
}

.footer-compact {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.78rem;
}

.brand-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.brand-row img {
    border-radius: 50%;
}

.brand-row b {
    font-weight: 800;
}

.brand-row em {
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--brand-line-light);
}

.fc-sep {
    width: 1px;
    height: 18px;
    background: var(--edge-soft);
    flex: 0 0 auto;
}

.fc-links {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}

.fc-links a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: rgba(223, 236, 233, 0.75);
    white-space: nowrap;
}

.fc-links a:hover {
    color: var(--up-bright);
}

.fc-legal {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: rgba(157, 192, 218, 0.7);
    margin-left: auto;
    white-space: nowrap;
}

@media (max-width: 899.98px) {
    .fc-legal {
        margin-left: 0;
        white-space: normal;
    }
}

/* ===== Responsive ===== */
@media (max-width: 1099.98px) {
    .dash-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .span-8 { grid-column: span 6; }
    .span-4 { grid-column: span 3; }
    .span-5 { grid-column: span 3; }
    .span-3 { grid-column: span 6; }
}

@media (max-width: 900px) {
    .appshell {
        grid-template-columns: minmax(0, 1fr);
    }

    .rail {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        border-right: 0;
        border-bottom: 1px solid var(--edge-soft);
        padding-inline: 8px;
        height: 54px;
        order: -1;
    }

    .rail-brand {
        height: 44px;
        border-bottom: 0;
        padding-right: 8px;
    }

    .rail-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-block: 6px;
        gap: 2px;
        flex: 1 1 auto;
    }

    .rail-item {
        flex-direction: row;
        gap: 6px;
        height: auto;
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.66rem;
        line-height: 1.4;
        white-space: nowrap;
    }

    .rail-item.is-active::before {
        top: auto;
        bottom: 2px;
        left: 10px;
        right: 10px;
        height: 3px;
        width: auto;
        border-radius: 3px;
    }

    .rail-foot {
        display: none;
    }

    .cmd-strip {
        padding-inline: 12px;
        gap: 10px;
    }

    .cmd-mkt .cmd-data {
        display: none;
    }

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

    .dash-grid > .span-8,
    .dash-grid > .span-6,
    .dash-grid > .span-5,
    .dash-grid > .span-4,
    .dash-grid > .span-3,
    .dash-grid > .span-12 {
        grid-column: span 2;
    }
}
