:root {
    --bg-0: #070b14;
    --bg-1: #0c1220;
    --bg-2: #121c31;
    --bg-3: #1a2742;
    --line: #243558;
    --line-soft: #1b2a46;
    --text: #e8f0ff;
    --text-dim: #9db1d8;
    --text-muted: #6f86b2;
    --blue: #53a7ff;
    --cyan: #4cd6c8;
    --green: #32d67b;
    --amber: #ffbf5f;
    --red: #ff6b6b;
}

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

body {
    font-family: "Roboto", "Lato", "SF Mono", "IBM Plex Mono", "JetBrains Mono", monospace;
    font-size: 15px;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -20%, #1b2e55 0%, transparent 55%),
        radial-gradient(circle at 85% -20%, #153447 0%, transparent 45%),
        var(--bg-0);
    min-height: 100vh;
    line-height: 1.45;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.btn-primary,
.btn-secondary,
.btn-small {
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg-3);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-small:hover {
    transform: translateY(-1px);
    border-color: var(--blue);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #1f4d89 0%, #173a67 100%);
    border-color: #285e9f;
}

.btn-secondary,
.btn-small {
    padding: 10px 14px;
    background: var(--bg-2);
}

.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: #d7e8ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress-container {
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: #12203a;
    border: 1px solid var(--line-soft);
}

.progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--blue));
    transition: width 0.35s ease;
}

.progress-text {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-dim);
}

.report-content {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #0f1727 0%, #0c1322 100%);
    padding: 16px;
    white-space: pre-wrap;
    font-size: 0.8rem;
    max-height: 52vh;
    overflow-y: auto;
    color: #d6e5ff;
}

.market-radar-page .radar-shell {
    max-width: 1280px;
    margin: 14px auto;
    padding: 10px;
}

.market-radar-page .radar-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #101a2d 0%, #0d1524 100%);
}

.market-radar-page .eyebrow {
    color: var(--amber);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.market-radar-page h1 {
    font-size: 1.25rem;
    margin-top: 3px;
}

.market-radar-page .subtitle {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.market-radar-page .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    background: #0f1a2d;
}

.nav-link:hover {
    color: var(--text);
    border-color: var(--blue);
}

.nav-link.active {
    color: var(--text);
    border-color: var(--blue);
    background: #12243f;
}

.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-tab {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-tab .caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.7;
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #0f1a2d;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    z-index: 60;
}

.profile-menu[hidden] {
    display: none;
}

.profile-item {
    display: block;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 0.74rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.profile-item:hover {
    background: #152238;
    color: var(--blue);
}

.profile-divider {
    margin: 6px 4px;
    border-top: 1px solid var(--line);
}

.status {
    font-size: 0.72rem;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #0f1a2d;
    color: var(--text-dim);
}

.status.healthy {
    color: var(--green);
    border-color: #1e5b45;
}

.status.error {
    color: var(--red);
    border-color: #633030;
}

.clock {
    color: var(--text-dim);
    font-size: 0.72rem;
}

.ticker-strip,
.control-strip {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0e1628;
    padding: 10px 12px;
}

.ticker-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ticker-label {
    color: var(--amber);
    border: 1px solid #5a4625;
    background: #2e2516;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
}

.ticker-item {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    color: var(--text-dim);
    border: 1px solid var(--line-soft);
    background: #101c33;
}

.control-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chip-group {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.chip {
    font-size: 0.68rem;
    color: var(--text-dim);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 4px 8px;
    background: #101c33;
}

.chip {
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.chip:hover {
    color: var(--blue);
    border-color: var(--blue);
    background: rgba(83, 167, 255, 0.12);
}

.chip.active {
    color: #0a1424;
    border-color: var(--blue);
    background: var(--blue);
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(83, 167, 255, 0.35);
}

.chip.active:hover {
    color: #0a1424;
    background: #6cb4ff;
}

.chip.danger {
    color: #ff9f9f;
    border-color: #6f3535;
    background: #2a1518;
}

.chip.danger:hover {
    color: #ffbfbf;
    border-color: #a05050;
    background: #3a1d20;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.grid-panels {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
}

.panel {
    grid-column: span 3;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #10192c 0%, #0d1524 100%);
    min-height: 150px;
}

.panel.wide {
    grid-column: span 6;
    min-height: 128px;
}

.panel h3 {
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: #dcebff;
}

.panel-sub {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-bottom: 8px;
}

.metric-list {
    list-style: none;
    display: grid;
    gap: 6px;
}

.metric-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 7px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    background: #0f1a30;
    font-size: 0.7rem;
}

.metric-list span {
    color: var(--text-dim);
}

.metric-list strong {
    color: #cce2ff;
    font-weight: 500;
    text-align: right;
}

.metric-list.mini li {
    padding: 5px 6px;
    font-size: 0.66rem;
}

.metric-label {
    display: flex;
    align-items: center;
    gap: 7px;
}

.sparkline {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: #14243d;
    overflow: hidden;
    border: 1px solid #203253;
}

.sparkline-fill {
    display: block;
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, #36d17b, #59d7bf);
}

.metric-value {
    display: flex;
    align-items: center;
    gap: 7px;
}

.value {
    color: #d8e8ff;
}

.change {
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid var(--line-soft);
    font-size: 0.62rem;
}

.change.up {
    color: #79f0a7;
    border-color: #2a6a4a;
    background: #163325;
}

.change.down {
    color: #ff9d9d;
    border-color: #6a3232;
    background: #31191b;
}

.change.flat {
    color: #d2ddf1;
    border-color: #405475;
    background: #192741;
}

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

.mini-title {
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.option-table-wrap {
    margin-top: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    overflow: auto;
}

.option-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.68rem;
}

.trade-board .option-table {
    min-width: 860px;
}

.option-table thead {
    background: #13213b;
}

.option-table th,
.option-table td {
    border-bottom: 1px solid var(--line-soft);
    padding: 7px;
    text-align: left;
    color: var(--text-dim);
}

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

.option-table td strong {
    color: #d8e8ff;
}

.warning-note {
    color: #ffbcbc;
}

.signal-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.signal {
    border: 1px solid #2a456d;
    color: #9ec5ff;
    background: #11203a;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 0.7rem;
}

.report-mini-list {
    list-style: none;
    display: grid;
    gap: 6px;
}

.report-mini-list li {
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    background: #0f1a30;
}

.report-mini-list a,
.report-mini-list span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    text-decoration: none;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.report-mini-list strong {
    color: var(--cyan);
}

.report-stage {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #0f1727 0%, #0c1322 100%);
    padding: 20px;
}

.empty-state {
    text-align: center;
}

.empty-state h2 {
    font-size: 1rem;
}

.empty-state p {
    margin: 10px auto 0;
    max-width: 840px;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.sections-preview {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.sections-preview span {
    font-size: 0.68rem;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 4px 9px;
    background: #111d32;
    color: var(--text-dim);
}

/* Shared pages (history/report) */
.container {
    width: min(1120px, 96vw);
    margin: 18px auto;
}

header {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f1829;
    padding: 14px;
}

header h1 {
    font-size: 1rem;
}

main {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f1829;
    padding: 14px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-input {
    min-width: 220px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #12203a;
    color: var(--text);
    padding: 8px 10px;
    font: inherit;
    font-size: 0.8rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--blue);
}

.report-list {
    display: grid;
    gap: 10px;
}

.report-card {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #111d32;
    padding: 12px;
}

.report-meta {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.report-preview {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.report-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.btn-outline {
    background: transparent;
}

.btn-danger {
    color: #ffc2c2;
    border-color: #62353d;
    background: #2a1518;
}

.btn-link {
    color: var(--blue);
    text-decoration: none;
    font-size: 0.78rem;
}

.pagination {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.page-info,
.report-count {
    color: var(--text-muted);
    font-size: 0.72rem;
}

@media (max-width: 1000px) {
    .panel,
    .panel.wide {
        grid-column: span 6;
    }

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

@media (max-width: 700px) {
    .market-radar-page .radar-shell {
        padding: 8px;
    }

    .market-radar-page .radar-header {
        flex-direction: column;
    }

    .panel,
    .panel.wide {
        grid-column: span 12;
    }

    .controls {
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        flex: 1;
        justify-content: center;
    }

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

/* Fyers page */
.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-item {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101c33;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.status-item.healthy {
    border-color: #1e5b45;
    color: var(--green);
}

.status-item.error {
    border-color: #633030;
    color: var(--red);
}

.section-divider {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}

.section-title {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: #dcebff;
}

.option-chain-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.chain-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.chain-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 1px solid var(--blue);
    border-radius: 999px;
    background: rgba(83, 167, 255, 0.1);
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.chain-tab:hover {
    background: rgba(83, 167, 255, 0.2);
    color: #d6ecff;
    transform: translateY(-1px);
}

.chain-tab-active {
    background: var(--blue);
    color: #0a1424;
    box-shadow: 0 4px 18px rgba(83, 167, 255, 0.35);
}

.chain-tab-active:hover {
    background: #6cb4ff;
    color: #0a1424;
}

.chain-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #10192c 0%, #0d1524 100%);
}

.im-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.im-panel { border: 1px solid var(--line); border-radius: 10px; background: #0e1628; padding: 12px; }
.im-panel h3 { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.im-panel h3 .panel-sub { text-transform: none; }
.im-sig { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.im-sig .big { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.04em; }
.im-sig .big.bu { color: #79f0a7; }
.im-sig .big.sel { color: #ff9d9d; }
.im-sig .big.neut { color: var(--text-dim); }
.im-sig .meta { font-size: 0.78rem; color: var(--text-dim); }
.im-cone { width: 120px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #ff6b6b, #ffbf5f, #32d67b); position: relative; }
.im-cone .mark { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: #fff; transform: translateX(-50%); }
.im-table-wrap { overflow-x: auto; }
table.im-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.im-table th, table.im-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.im-table th { color: var(--text-muted); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.im-bias { padding: 2px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; }
.im-bias.buy { color: #79f0a7; background: #163325; }
.im-bias.sell { color: #ff9d9d; background: #331616; }
.im-bias.neutral { color: var(--text-dim); background: #1a2438; }
.im-bar { width: 60px; height: 5px; background: #1a2438; border-radius: 3px; overflow: hidden; }
.im-bar-fill { height: 100%; border-radius: 3px; }
.im-pivo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
table.pivo-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.pivo-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.im-health { display: flex; flex-wrap: wrap; gap: 10px; }
.im-health .h { flex: 1; min-width: 120px; border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px; }
.im-health .h label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; display: block; }
.im-health .h b { font-size: 1rem; }
@media (max-width: 760px) {
    .im-grid { grid-template-columns: 1fr; }
}

.chain-full {
    width: 100%;
    margin: 0 auto;
}

.chain-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.chain-logo {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cyan);
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border: 1px solid rgba(83, 167, 255, 0.35);
    border-radius: 999px;
    background: rgba(83, 167, 255, 0.08);
}

.chain-card h4 {
    font-size: 0.82rem;
    margin-bottom: 6px;
    color: var(--cyan);
}

.chain-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chain-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.chain-split .option-table {
    min-width: 0;
}

.chain-split-title {
    font-size: 0.72rem;
    margin-bottom: 6px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

.chain-split-ce .chain-split-title {
    color: #53a7ff;
}

.chain-split-pe .chain-split-title {
    color: #ff9b6b;
}

.option-table.symmetric {
    min-width: 640px;
    text-align: right;
}

.option-table.symmetric th,
.option-table.symmetric td {
    text-align: right;
}

.option-table.symmetric thead th {
    border-bottom: 1px solid var(--line);
    padding: 6px 8px;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.option-table.symmetric .col-strike {
    text-align: center;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: #13213b;
}

.option-table.symmetric td.col-strike {
    font-size: 0.72rem;
}

.option-table.symmetric .col-ce th,
.option-table.symmetric th.col-ce {
    color: #53a7ff;
}

.option-table.symmetric .col-pe th,
.option-table.symmetric th.col-pe {
    color: #ff9b6b;
}

.option-table.symmetric tbody tr:hover {
    background: #101c33;
}

.option-table.symmetric tbody tr.chain-atm {
    background: rgba(83, 167, 255, 0.08);
    border-top: 1px solid rgba(83, 167, 255, 0.4);
    border-bottom: 1px solid rgba(83, 167, 255, 0.4);
}

.option-table.symmetric tbody tr.chain-atm td {
    font-weight: 600;
}

.option-table.symmetric td.col-ce,
.option-table.symmetric td.col-pe {
    color: var(--text-dim);
}

.option-table.symmetric td.col-pe {
    text-align: left;
}

@media (max-width: 800px) {
    .chain-split {
        grid-template-columns: 1fr;
    }
}

.option-table.compact th,
.option-table.compact td {
    padding: 4px 6px;
    font-size: 0.65rem;
}

@media (max-width: 800px) {
    .option-chain-grid {
        grid-template-columns: 1fr;
    }
}

/* Fyers price cards */
.price-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    background: linear-gradient(180deg, #10192c 0%, #0d1524 100%);
}

.price-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.price-card-header h3 {
    font-size: 0.9rem;
    color: #dcebff;
    margin: 0;
}

.price-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--cyan);
}

.range-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.range-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 65px;
}

.range-label.high {
    text-align: right;
}

.range-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: #14243d;
    border: 1px solid #203253;
    position: relative;
}

.range-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
    width: 50%;
}

.range-dot {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cyan);
    border: 2px solid #d7e8ff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(76, 214, 200, 0.5);
    transition: left 0.3s ease;
}

.atm-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.atm-label {
    border-color: var(--blue) !important;
    color: var(--blue) !important;
}

.otm-grid {
    display: flex;
    gap: 14px;
}

.otm-grid > div {
    flex: 1;
}

.otm-call {
    border-color: #2a6a4a !important;
    color: #79f0a7 !important;
    background: #163325 !important;
    display: inline-block;
    margin: 3px;
}

.otm-put {
    border-color: #6a3232 !important;
    color: #ff9d9d !important;
    background: #31191b !important;
    display: inline-block;
    margin: 3px;
}

.otm-table-wrap {
    margin-top: 6px;
}

/* Strike chips with trade buttons */
.strike-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    padding: 3px 6px;
    background: #111d32;
    margin: 3px;
}

.strike-info {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.btn-trade {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--line);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: transform 0.1s ease, background 0.15s ease;
}

.btn-trade:hover {
    transform: scale(1.15);
}

.btn-trade.done {
    font-size: 0.6rem;
}

.btn-buy {
    color: #79f0a7;
    border-color: #2a6a4a;
    background: #163325;
}

.btn-buy:hover {
    background: #1d4a32;
}

.btn-sell {
    color: #ff9d9d;
    border-color: #6a3232;
    background: #31191b;
}

.btn-sell:hover {
    background: #4a2325;
}

@media (max-width: 600px) {
    .otm-grid {
        flex-direction: column;
    }
}

/* Paper trade entry form */
.paper-trade-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.pt-fields {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: flex-end;
}

.paper-trade-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0;
}

.pt-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 0;
    min-width: 120px;
}

.pt-field-symbol {
    flex: 1.8 0 165px;
    min-width: 165px;
}

#ptSymbol {
    min-width: 165px !important;
    width: auto !important;
    text-overflow: clip;
}

.pt-label {
    font-size: 0.62rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pt-field select,
.pt-field input {
    background: #0c1220;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    padding: 7px 8px;
    font-size: 0.8rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.pt-field input[type="date"] {
    padding: 6px 8px;
}

.pt-field input:focus,
.pt-field select:focus {
    border-color: var(--accent, #4ea1ff);
    outline: none;
}

.pt-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.pt-btn {
    width: auto;
    min-width: 120px;
    height: 34px;
    padding: 0 20px;
    font-size: 0.82rem;
}

/* Datafeed page */
.df-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.df-chart-container {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #0c1220;
    height: 560px;
    padding: 14px;
    box-sizing: border-box;
}

.df-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 2px 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 10px;
}

.df-header .df-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.df-header .df-quote {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.df-header .df-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.df-canvas-wrap {
    width: 100%;
    height: 460px;
}

.df-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 460px;
}

.df-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-dim);
}

.df-error h3 {
    color: var(--text);
    margin-bottom: 8px;
}

/* Live ticker */
.live-ticker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0e1628;
    padding: 10px 12px;
}

.live-ticker .ticker-label {
    animation: pulse-bg 1.5s ease-in-out infinite;
}

.live-ticker .ticker-label.live {
    color: #79f0a7;
    border-color: #2a6a4a;
    background: #163325;
}

.live-ticker .ticker-label.closed {
    color: #9db1d8;
    border-color: #45597f;
    background: #1a2438;
    animation: none;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.live-ticker .ticker-item {
    font-size: 0.78rem;
    border-width: 1px;
    padding: 4px 10px;
}

.live-ticker .ticker-item strong {
    color: #dcebff;
}

/* Safari < 14.1 gap fallback (gap ignored in flex AND grid containers) */
@supports not (gap: 1px) {
    .btn-primary { gap: 8px; }
    .btn-primary > * + * { margin-left: 8px; }

    .header-actions,
    .control-strip { gap: 10px; }
    .header-actions > * + *,
    .control-strip > * + * { margin-left: 10px; }

    .chip-group,
    .controls { gap: 8px; }
    .chip-group > * + *,
    .controls > * + * { margin-left: 8px; }

    .ticker-strip { gap: 8px; }
    .ticker-strip > * + * { margin-left: 8px; }

    .signal-row,
    .status-grid { gap: 8px; }
    .signal-row > * + *,
    .status-grid > * + * { margin-left: 8px; }

    .chain-nav { gap: 10px; }
    .chain-nav > * + * { margin-left: 10px; }

    .chain-tab { gap: 8px; }
    .chain-tab > * + * { margin-left: 8px; }

    .chain-head { gap: 12px; }
    .chain-head > * + * { margin-left: 12px; }

    .chain-summary { gap: 6px; }
    .chain-summary > * + * { margin-left: 6px; }

    .range-bar { gap: 10px; }
    .range-bar > * + * { margin-left: 10px; }

    .atm-row { gap: 6px; }
    .atm-row > * + * { margin-left: 6px; }

    .otm-grid { gap: 14px; }
    .otm-grid > * + * { margin-left: 14px; }

    .strike-chip { gap: 4px; }
    .strike-chip > * + * { margin-left: 4px; }

    .paper-trade-form { gap: 12px; }
    .paper-trade-form > * + * { margin-top: 12px; }

    .pt-fields { gap: 10px; }
    .pt-fields > * + * { margin-left: 10px; }

    .pt-field { gap: 4px; }
    .pt-field > * + * { margin-top: 4px; }

    .pt-actions { gap: 10px; }
    .pt-actions > * + * { margin-left: 10px; }

    .df-controls { gap: 10px; }
    .df-controls > * + * { margin-left: 10px; }

    .profile-tab { gap: 6px; }
    .profile-tab > * + * { margin-left: 6px; }

    .radar-header,
    .toolbar,
    .pagination,
    .price-card-header { gap: 10px; }
    .radar-header > * + *,
    .toolbar > * + *,
    .pagination > * + *,
    .price-card-header > * + * { margin-left: 10px; }

    .live-ticker,
    .search-form,
    .report-actions,
    .report-meta,
    .sections-preview { gap: 8px; }
    .live-ticker > * + *,
    .search-form > * + *,
    .report-actions > * + *,
    .report-meta > * + *,
    .sections-preview > * + * { margin-left: 8px; }

    .metric-label,
    .metric-value { gap: 7px; }
    .metric-label > * + *,
    .metric-value > * + * { margin-left: 7px; }

    .action-bar { gap: 10px; }
    .action-bar > * + * { margin-left: 10px; }

    .df-header { gap: 10px; }
    .df-header > * + * { margin-left: 10px; }
    .df-header .df-title,
    .df-header .df-quote { gap: 2px; }
    .df-header .df-title > * + *,
    .df-header .df-quote > * + * { margin-top: 2px; }
    .df-header .df-stats { gap: 10px; }
    .df-header .df-stats > * + * { margin-left: 10px; }

    /* Grid containers: gap is ignored in grid too on Safari < 14.1 */
    .grid-panels,
    .split-columns,
    .report-list,
    .report-mini-list,
    .metric-list,
    .option-chain-grid,
    .chain-split { gap: 0; }

    .grid-panels > *,
    .split-columns > *,
    .report-list > * { margin: 5px; }

    .option-chain-grid > * { margin: 7px; }

    .report-mini-list > *,
    .metric-list > * { margin: 3px; }

    .chain-split > * { margin: 6px; }
}

/* Safari < 14.1 gap fallback for Binance-style additions */
@supports not (gap: 1px) {
    .market-stats,
    .tape-track,
    .stat-extras { gap: 0; }
    .market-stats > * + * { margin-left: 10px; }
    .stat-extras > * + * { margin-left: 12px; }
    .stat-card { gap: 0; }
    .stat-card > * + * { margin-top: 6px; }
    .stat-card-head { gap: 0; }
    .stat-card-head > * + * { margin-left: 8px; }
    .tape-track > * + * { margin-left: 8px; }
    .tape-pill { gap: 0; }
    .tape-pill > * + * { margin-left: 6px; }
}

/* ===== Binance-style live tape marquee ===== */
.tape {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0e1628;
    overflow: hidden;
    position: relative;
}

.tape-track {
    display: flex;
    gap: 8px;
    padding: 8px 6px;
    width: max-content;
    animation: tape-scroll 40s linear infinite;
}

.tape:hover .tape-track {
    animation-play-state: paused;
}

@keyframes tape-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

.tape-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 1px solid var(--line-soft);
    background: #101c33;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 0.7rem;
}

.tape-pill .tp-name {
    color: var(--text-dim);
    font-weight: 500;
}

.tape-pill .tp-price {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s ease;
}

.tape-pill .tp-chg {
    font-weight: 600;
}

.tape-pill .tp-chg.up,
.tape-pill .tp-price.flash-up {
    color: var(--green);
}

.tape-pill .tp-chg.down,
.tape-pill .tp-price.flash-down {
    color: var(--red);
}

.tape-pill .tp-price.flash-up,
.tape-pill .tp-price.flash-down {
    animation: price-flash 0.6s ease;
}

@keyframes price-flash {
    0% {
        filter: brightness(2);
        transform: scale(1.08);
    }
    100% {
        filter: none;
        transform: scale(1);
    }
}

/* ===== Market overview stats bar ===== */
.market-stats {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stat-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #101a2d 0%, #0d1524 100%);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.stat-card-head > span:first-child {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.stat-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e6f0ff;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.stat-price.flash-up {
    animation: stat-flash-up 0.6s ease;
}

.stat-price.flash-down {
    animation: stat-flash-down 0.6s ease;
}

@keyframes stat-flash-up {
    0% {
        color: var(--green);
        text-shadow: 0 0 18px rgba(50, 214, 123, 0.7);
    }
    100% {
        color: #e6f0ff;
        text-shadow: none;
    }
}

@keyframes stat-flash-down {
    0% {
        color: var(--red);
        text-shadow: 0 0 18px rgba(255, 107, 107, 0.7);
    }
    100% {
        color: #e6f0ff;
        text-shadow: none;
    }
}

.stat-extras {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.66rem;
    color: var(--text-dim);
}

.stat-extras b {
    color: #cce2ff;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ===== Visual polish ===== */
@keyframes panel-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-panels .panel {
    animation: panel-rise 0.5s ease both;
}

.grid-panels .panel:nth-child(1) { animation-delay: 0.02s; }
.grid-panels .panel:nth-child(2) { animation-delay: 0.08s; }
.grid-panels .panel:nth-child(3) { animation-delay: 0.14s; }
.grid-panels .panel:nth-child(4) { animation-delay: 0.2s; }
.grid-panels .panel:nth-child(5) { animation-delay: 0.26s; }
.grid-panels .panel:nth-child(6) { animation-delay: 0.32s; }
.grid-panels .panel:nth-child(7) { animation-delay: 0.38s; }
.grid-panels .panel:nth-child(8) { animation-delay: 0.44s; }
.grid-panels .panel:nth-child(9) { animation-delay: 0.5s; }
.grid-panels .panel:nth-child(10) { animation-delay: 0.56s; }
.grid-panels .panel:nth-child(11) { animation-delay: 0.62s; }
.grid-panels .panel:nth-child(12) { animation-delay: 0.68s; }

.panel {
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover {
    transform: translateY(-3px);
    border-color: #2c4a7d;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.market-radar-page h1 {
    background: linear-gradient(90deg, var(--cyan), var(--blue), var(--amber), var(--cyan));
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 8s linear infinite;
}

@keyframes gradient-shift {
    to {
        background-position: 300% center;
    }
}

/* custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
    background: #22365c;
    border-radius: 999px;
    border: 2px solid var(--bg-0);
}

::-webkit-scrollbar-thumb:hover {
    background: #31528c;
}

body {
    background:
        radial-gradient(circle at 15% -20%, #1b2e55 0%, transparent 55%),
        radial-gradient(circle at 85% -20%, #153447 0%, transparent 45%),
        linear-gradient(rgba(83, 167, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(83, 167, 255, 0.03) 1px, transparent 1px),
        var(--bg-0);
    background-size: auto, auto, 36px 36px, 36px 36px, auto;
}

@media (max-width: 800px) {
    .market-stats {
        grid-template-columns: 1fr;
    }
    .tape-track {
        animation-duration: 25s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tape-track,
    .grid-panels .panel,
    .market-radar-page h1 {
        animation: none !important;
    }
}

/* Bulk Nav strip */
.topnav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #0f1a2e 0%, #0c1424 100%);
}
.topnav .topnav-brand {
    font-weight: 700;
    color: var(--text);
    margin-right: 6px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}
.topnav a {
    text-decoration: none;
    color: var(--text-dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.72rem;
    background: #101b30;
    transition: color 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
.topnav a:hover,
.topnav a.active {
    color: var(--text);
    border-color: var(--blue);
    background: #12243f;
}

/* Pro Tools cards on the dashboard */
.pro-tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.pro-tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #0f1a2e 0%, #0d1424 100%);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.pro-tool-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    opacity: 0.7;
}
.pro-tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
    box-shadow: 0 8px 20px rgba(38, 92, 170, 0.25);
}
.pro-tool-card .pro-title {
    font-weight: 700;
    font-size: 0.9rem;
}
.pro-tool-card .pro-desc {
    font-size: 0.74rem;
    color: var(--text-dim);
    line-height: 1.4;
}
.pro-tool-card .pro-link {
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--blue);
    font-weight: 600;
}
@media (max-width: 900px) {
    .pro-tools {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 520px) {
    .pro-tools {
        grid-template-columns: 1fr;
    }
}
