body {
    background: #f7f7f9;
    color: #172033;
}

.app-top-nav {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
}

.app-main {
    padding-bottom: 1rem;
}

.skip-link {
    position: absolute;
    z-index: 2000;
    top: .75rem;
    left: .75rem;
    padding: .55rem .75rem;
    border-radius: .5rem;
    background: #fff;
    color: #0d6efd;
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .18);
}

.nav-link.active,
.mobile-bottom-nav a.active {
    font-weight: 700;
}

.mobile-bottom-nav {
    display: none;
}

.section-shell {
    border: 1px solid #dee2e6;
    border-radius: .8rem;
    background: #fff;
    box-shadow: 0 .12rem .75rem rgba(15, 23, 42, .05);
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.action-row .btn {
    min-height: 2.35rem;
}

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

.essential-card {
    border: 1px solid #e5e7eb;
    border-radius: .8rem;
    background: linear-gradient(180deg, #fff, #fbfcfe);
    padding: 1rem;
}

.essential-label {
    color: #6c757d;
    font-size: .82rem;
    margin-bottom: .25rem;
}

.essential-value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-essentials {
    border-top: 4px solid #0d6efd;
}

.dashboard-next-action {
    border-top: 1px solid #eef1f5;
    padding-top: .85rem;
}

.detail-disclosure {
    border: 1px solid #e5e7eb;
    border-radius: .8rem;
    background: #fff;
}

.detail-disclosure > summary {
    cursor: pointer;
    padding: .9rem 1rem;
    font-weight: 700;
}

.detail-disclosure > div {
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
}

.mobile-card-table {
    --mobile-row-border: #e5e7eb;
}

.bot-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.bot-card {
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background:
        radial-gradient(circle at top right, rgba(13, 110, 253, .07), transparent 18rem),
        linear-gradient(180deg, #fff, #fbfcfe);
    box-shadow: 0 .16rem .85rem rgba(15, 23, 42, .06);
    padding: 1rem;
}

.bot-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.bot-card-title {
    font-size: 1.08rem;
    line-height: 1.25;
    margin: 0;
}

.bot-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.bot-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.metric-tile {
    border: 1px solid #edf0f4;
    border-radius: .85rem;
    background: rgba(255, 255, 255, .76);
    padding: .8rem;
}

.metric-tile span,
.metric-tile small {
    display: block;
    color: #6c757d;
}

.metric-tile span {
    font-size: .78rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.metric-tile strong {
    display: block;
    font-size: 1rem;
    line-height: 1.25;
}

.bot-card-details {
    border-top: 1px solid #eef1f5;
    margin-top: .9rem;
    padding-top: .75rem;
}

.bot-card-details summary {
    cursor: pointer;
    color: #495057;
    font-size: .9rem;
    font-weight: 700;
}

.empty-state-card {
    border: 1px dashed #c9d2df;
    border-radius: .9rem;
    background: #fbfcfe;
    padding: 1.25rem;
    text-align: center;
}

.live-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
}

.live-position-card {
    border: 1px solid #e1e7ef;
    border-left: 4px solid #198754;
    border-radius: 1rem;
    background:
        radial-gradient(circle at top right, rgba(25, 135, 84, .06), transparent 16rem),
        linear-gradient(180deg, #fff, #fbfcfe);
    box-shadow: 0 .14rem .75rem rgba(15, 23, 42, .055);
    padding: 1rem;
}

.live-position-card.sold {
    border-left-color: #0d6efd;
    background:
        radial-gradient(circle at top right, rgba(13, 110, 253, .06), transparent 16rem),
        linear-gradient(180deg, #fff, #fbfcfe);
}

.live-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.live-card-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.live-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .9rem;
}

.live-card-details {
    border-top: 1px solid #eef1f5;
    margin-top: .85rem;
    padding-top: .7rem;
}

.live-card-details summary {
    cursor: pointer;
    color: #495057;
    font-size: .9rem;
    font-weight: 700;
}

.live-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.live-mini-chart {
    border: 1px solid #e8edf4;
    border-radius: .85rem;
    background: #fff;
    padding: .8rem;
}

.chart-title {
    color: #495057;
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: .65rem;
}

.price-track {
    position: relative;
    height: 2.2rem;
    border-radius: 999px;
    background:
        linear-gradient(90deg, rgba(108, 117, 125, .14), rgba(25, 135, 84, .18)),
        #f3f6fa;
    overflow: visible;
}

.price-marker {
    position: absolute;
    top: -.2rem;
    bottom: -.2rem;
    width: 2px;
    transform: translateX(-1px);
    background: #495057;
}

.price-marker::after {
    content: "";
    position: absolute;
    top: -.12rem;
    left: 50%;
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
    transform: translateX(-50%);
    background: currentColor;
    box-shadow: 0 0 0 3px #fff;
}

.price-marker span {
    position: absolute;
    top: 1.95rem;
    left: 50%;
    transform: translateX(-50%);
    color: #6c757d;
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
}

.price-marker.entry {
    color: #6c757d;
}

.price-marker.current {
    color: #198754;
}

.price-marker.target {
    color: #fd7e14;
}

.chart-scale {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.35rem;
    color: #6c757d;
    font-size: .74rem;
}

.pnl-bridge {
    display: grid;
    gap: .35rem;
}

.pnl-bar {
    display: block;
    min-width: .25rem;
    height: .48rem;
    border-radius: 999px;
}

.pnl-bar.gross {
    background: #adb5bd;
}

.pnl-bar.fee {
    background: #fd7e14;
}

.pnl-bar.net.positive {
    background: #198754;
}

.pnl-bar.net.negative {
    background: #dc3545;
}

.readiness-step-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
}

.readiness-step-card {
    border: 1px solid #e5e7eb;
    border-radius: .85rem;
    background: #fff;
    padding: .85rem 1rem;
}

.scenario-hero {
    border-top: 4px solid #0d6efd;
}

.scenario-live .scenario-hero {
    border-top-color: #198754;
}

.scenario-paper .scenario-hero {
    border-top-color: #0d6efd;
}

.scenario-research .scenario-hero {
    border-top-color: #0dcaf0;
}

.scenario-primary-action .btn {
    min-width: 11rem;
}

.scenario-focus-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.scenario-focus-card {
    border: 1px solid #e5e7eb;
    border-radius: .85rem;
    background: linear-gradient(180deg, #fff, #fbfcfe);
    padding: .9rem 1rem;
    color: #495057;
}

.allocator-section,
.model-evidence-section {
    border-top: 4px solid #111827;
}

.model-evidence-section {
    border-top-color: #0dcaf0;
}

.allocator-summary-pill {
    min-width: 12rem;
    border: 1px solid #e5e7eb;
    border-radius: .85rem;
    background: #fff;
    padding: .75rem 1rem;
}

.allocator-card-list,
.model-evidence-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
}

.allocator-card,
.model-evidence-card {
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background:
        radial-gradient(circle at top right, rgba(17, 24, 39, .055), transparent 16rem),
        linear-gradient(180deg, #fff, #fbfcfe);
    box-shadow: 0 .14rem .75rem rgba(15, 23, 42, .055);
    padding: 1rem;
}

.model-evidence-card {
    background:
        radial-gradient(circle at top right, rgba(13, 202, 240, .075), transparent 16rem),
        linear-gradient(180deg, #fff, #fbfcfe);
}

.allocator-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.allocator-card-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

pre.json { background: #fff; border: 1px solid #e5e7eb; padding: 12px; border-radius: 8px; }
.badge-status { font-size: .85rem; }
.table td, .table th { vertical-align: middle; }

.help-note {
    font-size: 0.92rem;
    color: #495057;
}

.ui-mode-beginner .expert-only {
    display: none !important;
}

.tab-explainer {
    font-size: 0.9rem;
    color: #6c757d;
}

.beginner-card {
    border-top: 4px solid #0d6efd;
}

.beginner-step {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #198754);
}

.dashboard-focus-shell {
    border-top: 4px solid #0d6efd;
}

.focus-card {
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.04), rgba(25, 135, 84, 0.02));
    border-color: rgba(13, 110, 253, 0.15) !important;
}

.decision-strip {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.readiness-hero {
    border-top: 4px solid #198754;
}

.live-control-hero {
    background: linear-gradient(180deg, rgba(25, 135, 84, 0.06), rgba(255, 255, 255, 0.96));
}

.live-growth-card {
    border-top: 4px solid #fd7e14;
    background:
        radial-gradient(circle at top left, rgba(253, 126, 20, 0.10), transparent 32rem),
        linear-gradient(180deg, rgba(255, 248, 236, 0.95), rgba(255, 255, 255, 0.98));
}

.alpha-factory-card {
    border-top: 4px solid #111827;
    background:
        radial-gradient(circle at top left, rgba(17, 24, 39, 0.08), transparent 30rem),
        radial-gradient(circle at bottom right, rgba(25, 135, 84, 0.08), transparent 28rem),
        linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.98));
}

.alpha-lane-card {
    background: rgba(255, 255, 255, 0.72);
}

.readiness-hero-meta {
    max-width: 28rem;
}

.bot-summary-card {
    border-top: 3px solid #dee2e6;
}

.bot-action-panel {
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.04), rgba(108, 117, 125, 0.02));
}

.bot-form-section {
    border-top: 3px solid #0d6efd;
}

.simple-config-card {
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.04), rgba(255, 255, 255, 0.9));
}

details.advanced-panel summary {
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .app-main {
        padding-bottom: 5.5rem;
    }

    .navbar .d-flex.align-items-center {
        align-items: stretch !important;
        flex-direction: column;
        gap: .55rem;
        margin-top: .75rem;
    }

    .navbar .navbar-text {
        margin-right: 0 !important;
    }

    .navbar form,
    .navbar .btn {
        width: 100%;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 1030;
        left: 0;
        right: 0;
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(4.25rem, 1fr));
        gap: .25rem;
        padding: .45rem .55rem calc(.45rem + env(safe-area-inset-bottom));
        border-top: 1px solid #d8dee9;
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(12px);
        box-shadow: 0 -.35rem 1.25rem rgba(15, 23, 42, .12);
    }

    .mobile-bottom-nav a {
        min-height: 3rem;
        border-radius: .8rem;
        color: #495057;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        text-decoration: none;
        font-size: .82rem;
    }

    .mobile-bottom-nav a.active {
        color: #0d6efd;
        background: rgba(13, 110, 253, .10);
    }

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

    .bot-card-main {
        flex-direction: column;
    }

    .bot-card-actions {
        width: 100%;
        justify-content: stretch;
    }

    .bot-card-actions .btn {
        flex: 1 1 auto;
    }

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

    .live-card-header {
        flex-direction: column;
    }

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

    .live-detail-grid {
        grid-template-columns: 1fr;
    }

    .scenario-focus-grid {
        grid-template-columns: 1fr;
    }

    .allocator-card-header {
        flex-direction: column;
    }

    .section-title {
        flex-direction: column;
    }

    .action-row .btn,
    .d-flex.flex-wrap.gap-2 .btn,
    .d-flex.flex-wrap.gap-2 form {
        flex: 1 1 auto;
    }

    .nav-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    h2 {
        font-size: 1.55rem;
    }

    .container {
        padding-left: .85rem;
        padding-right: .85rem;
    }

    .card-body {
        padding: 1rem;
    }

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

    .bot-card {
        padding: .9rem;
    }

    .bot-card-metrics {
        grid-template-columns: 1fr;
    }

    .live-position-card {
        padding: .9rem;
    }

    .live-card-metrics {
        grid-template-columns: 1fr;
    }

    .chart-scale {
        font-size: .7rem;
    }

    .bot-card-actions {
        flex-direction: column;
    }

    .table-responsive {
        overflow-x: visible;
    }

    table.mobile-card-table {
        border-collapse: separate;
        border-spacing: 0 .75rem;
    }

    table.mobile-card-table thead {
        display: none;
    }

    table.mobile-card-table,
    table.mobile-card-table tbody,
    table.mobile-card-table tr,
    table.mobile-card-table td {
        display: block;
        width: 100%;
    }

    table.mobile-card-table tr {
        border: 1px solid var(--mobile-row-border);
        border-radius: .85rem;
        background: #fff;
        box-shadow: 0 .12rem .65rem rgba(15, 23, 42, .06);
        padding: .25rem .85rem;
        margin-bottom: .75rem;
    }

    table.mobile-card-table td {
        border: 0 !important;
        border-bottom: 1px solid #eef1f5 !important;
        padding: .65rem 0 !important;
    }

    table.mobile-card-table td:last-child {
        border-bottom: 0 !important;
    }

    table.mobile-card-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .2rem;
        color: #6c757d;
        font-size: .78rem;
        font-weight: 700;
        letter-spacing: .01em;
    }

    table.mobile-card-table td[data-label=""],
    table.mobile-card-table td:not([data-label]) {
        padding-top: .75rem !important;
    }

    table.mobile-card-table td[data-label=""]::before,
    table.mobile-card-table td:not([data-label])::before {
        content: none;
    }

    table.mobile-card-table .btn {
        width: 100%;
        margin-top: .35rem;
    }

    .help-note,
    .tab-explainer {
        font-size: .88rem;
    }
}

.opportunity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.opportunity-card {
    border: 1px solid #d9e2ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    padding: 1rem;
}

.opportunity-score {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: .75rem;
}

.opportunity-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    margin: .9rem 0;
}

.opportunity-metrics div {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: .45rem .55rem;
    background: #f8fafc;
}

.opportunity-metrics dt {
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
}

.opportunity-metrics dd {
    margin: 0;
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .opportunity-grid {
        grid-template-columns: 1fr;
    }

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

.opportunity-fasttrack {
    border: 1px solid rgba(13, 110, 253, .18);
    border-left: 4px solid #0d6efd;
    border-radius: .75rem;
    padding: .75rem;
    background: linear-gradient(135deg, rgba(13,110,253,.06), rgba(25,135,84,.05));
}
