* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: #0f1115;
    color: #e9edf1;
}

header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #171a21;
    border-bottom: 1px solid #2c313b;
    padding: 14px 20px;
}

h1, h2, h3 { margin: 0 0 12px 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-top: 22px; }

.container {
    padding: 16px 20px 40px;
}

.status {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    border-radius: 999px;
    padding: 5px 10px;
    background: #2a303b;
    font-size: 13px;
}

.badge.live { background: #174f33; }
.badge.stale { background: #6a2626; }
.badge.simulated { background: #5a3b12; border: 1px solid #a76a1d; }
.badge.manual { background: #293444; border: 1px solid #45566f; }

.safety-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    color: #cbd3de;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.safety-strip span {
    border: 1px solid #394251;
    border-radius: 999px;
    padding: 5px 9px;
    background: #171b22;
}

.shadow-market-card { margin-bottom: 16px; }
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.panel-heading h2 { margin-top: 0; }
.compact-table-wrap { max-height: 280px; }
.quote-warning {
    border: 1px solid #475263;
    border-radius: 7px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
}
.quote-warning.simulated {
    background: #3f2a0f;
    border-color: #93601e;
    color: #ffd497;
}

.tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

button, a.button {
    background: #2b3240;
    color: #fff;
    border: 1px solid #3c4657;
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
}

button.active { background: #3c4f78; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid #2c313b;
    border-radius: 8px;
    background: #15181e;
}

table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

th, td {
    border-bottom: 1px solid #262b34;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    background: #20242c;
    z-index: 2;
}

tbody tr:hover {
    background: #20252e;
}

.symbol-link {
    color: #8db7ff;
    font-weight: 700;
    text-decoration: none;
}

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

.card {
    background: #171a21;
    border: 1px solid #2c313b;
    border-radius: 9px;
    padding: 14px;
    min-width: 0;
}

.kv {
    width: 100%;
    border-collapse: collapse;
}

.kv td:first-child {
    color: #9aa7b6;
    width: 46%;
}

.chart {
    width: 100%;
    max-width: 1200px;
    border: 1px solid #303642;
    border-radius: 8px;
    background: #fff;
}

pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #111318;
    border: 1px solid #2b3039;
    padding: 12px;
    border-radius: 8px;
    max-height: 620px;
    overflow: auto;
    color: #d8dee7;
}

.muted { color: #98a2b3; }
.error { color: #ff9b9b; }

@media (max-width: 700px) {
    .container { padding: 12px; }
    header { padding: 12px; }
}


/* v0.2 compact primary table + inline full stock detail */
.trade-row {
    cursor: pointer;
}

.trade-row.selected {
    background: #242b36;
}

.details-row > td {
    padding: 0;
    background: #0f1115;
    border-bottom: 2px solid #3a4352;
    /* v1.8.2: normal detail content must not inherit the trade table's nowrap. */
    white-space: normal;
    position: relative;
}

.inline-details {
    padding: 18px;
    /*
     * v1.8.2: Long Term tables can be several thousand pixels wide because
     * the parent table uses width:max-content.  An auto-width detail block
     * therefore stretched across the entire table and pushed the decision /
     * field panels far off-screen.  Keep the expanded stock panel pinned to
     * the visible table viewport instead of the table's intrinsic width.
     */
    min-width: 0;
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    position: sticky;
    left: 0;
    white-space: normal;
}

.detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.detail-chart-card {
    background: #171a21;
    border: 1px solid #2c313b;
    border-radius: 9px;
    padding: 14px;
    margin-bottom: 14px;
}

.inline-chart {
    display: block;
    width: 100%;
    max-height: 760px;
    object-fit: contain;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.raw-card {
    margin-bottom: 14px;
}

.history-list {
    display: grid;
    gap: 5px;
    font-size: 13px;
}

@media (max-width: 900px) {
    .inline-details {
        min-width: 0;
        width: calc(100vw - 26px);
        max-width: calc(100vw - 26px);
        padding: 12px;
        left: 0;
    }

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


/* v0.4 reading stability + chart/high-yield layout */

.detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(330px, 0.85fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}

.detail-chart-card {
    min-width: 0;
    margin-bottom: 0;
}

.chart-host {
    width: 100%;
    min-height: 220px;
}

.inline-chart {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    display: block;
}

.high-yield-card {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 115px);
    overflow: auto;
}

.hy-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.hy-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    background: #2a303b;
    border: 1px solid #3b4452;
    font-size: 12px;
    line-height: 1.1;
}

.hy-chip.accent {
    background: #2c4368;
    border-color: #486da5;
}

.hy-chip.danger {
    background: #6a2626;
    border-color: #9b4040;
}

.hy-section-title {
    color: #aab6c5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 13px 0 6px;
}

.hy-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.hy-metric {
    background: #12151a;
    border: 1px solid #282e38;
    border-radius: 7px;
    padding: 8px;
    min-width: 0;
}

.hy-metric.emphasis {
    border-color: #3f516f;
    background: #171d27;
}

.hy-metric.danger {
    border-color: #8a3a3a;
    background: #2c1717;
}

.hy-metric.negative .hy-value {
    color: #ffb0b0;
}

.hy-label {
    color: #8f9bab;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 3px;
}

.hy-value {
    color: #f1f4f7;
    font-size: 14px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.all-data-heading {
    margin: 18px 0 10px;
}

.below-details {
    display: grid;
    gap: 10px;
}

.data-disclosure {
    padding: 0;
    overflow: hidden;
}

.data-disclosure summary {
    cursor: pointer;
    user-select: none;
    padding: 12px 14px;
    font-weight: 650;
    background: #171a21;
}

.data-disclosure[open] summary {
    border-bottom: 1px solid #2c313b;
}

.disclosure-body {
    padding: 12px 14px 14px;
    overflow-x: auto;
}

.disclosure-body pre {
    margin: 0;
}

@media (max-width: 1180px) {
    .detail-hero {
        grid-template-columns: 1fr;
    }

    .high-yield-card {
        position: static;
        max-height: none;
    }

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

@media (max-width: 720px) {
    .hy-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* v0.5 local decision engine integration */

.decision-symbol {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    border-radius: 7px;
    color: #fff;
}

.decision-symbol-action {
    font-size: 9px;
    letter-spacing: .05em;
    font-weight: 800;
    opacity: .88;
}

.decision-green {
    background: #175c38 !important;
    border-color: #2d8d5b !important;
}

.decision-yellow {
    background: #6b5719 !important;
    border-color: #a88a2a !important;
}

.decision-red {
    background: #6d2727 !important;
    border-color: #a44747 !important;
}

.decision-gray {
    background: #3b414b !important;
    border-color: #555e6c !important;
}

.decision-side {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.decision-side .high-yield-card {
    position: static;
    max-height: none;
}

.ai-card {
    border-style: dashed;
}

.decision-banner {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #3a4351;
}

.decision-action {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: .02em;
}

.decision-age {
    font-size: 11px;
    color: #d1d7df;
    text-align: right;
}

.order-line {
    border: 1px solid #44536a;
    background: #111722;
    border-radius: 8px;
    padding: 10px;
    font-weight: 750;
    line-height: 1.45;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
}

.decision-fast-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.decision-label {
    margin-top: 13px;
    margin-bottom: 5px;
    color: #98a5b6;
    font-size: 10px;
    letter-spacing: .09em;
    font-weight: 800;
}

.decision-list {
    margin: 5px 0 0 18px;
    padding: 0;
    line-height: 1.45;
    font-size: 13px;
}

.decision-text {
    line-height: 1.45;
    font-size: 13px;
}

.decision-warnings {
    margin-top: 12px;
    font-size: 12px;
}

.decision-warnings summary {
    cursor: pointer;
    color: #aab4c1;
}

.ai-placeholder {
    padding: 6px 0;
}

.ai-placeholder-title {
    font-weight: 750;
    margin-bottom: 5px;
}

@media (max-width: 720px) {
    .decision-fast-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* v1.6 private remote/PWA readiness */
.remote-access-card {
    margin-bottom: 16px;
}

.remote-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.small-note {
    margin-top: 10px;
    font-size: 12px;
}

.offline-card {
    border-color: #8a3434;
    max-width: 760px;
}

.offline-card h2 {
    color: #ff9b9b;
}

@media (max-width: 700px) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    header {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .panel-heading,
    .detail-head {
        flex-direction: column;
    }

    .inline-details {
        min-width: 0;
        padding: 12px;
    }

    th, td {
        font-size: 12px;
        padding: 7px 8px;
    }

    button, a.button {
        min-height: 42px;
    }
}

/* v1.6.1 private remote login */
.login-body { margin: 0; background: #101319; color: #eef2f7; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.login-wrap { max-width: 420px; margin: 8vh auto; padding: 22px; }
.login-card { background: #1a1f28; border: 1px solid #313846; border-radius: 14px; padding: 24px; box-shadow: 0 18px 48px #0008; }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-muted { color: #aab3c2; font-size: 14px; margin-bottom: 20px; }
.login-label { display: block; margin: 14px 0 6px; font-size: 13px; color: #cbd3df; }
.login-input { box-sizing: border-box; width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #465064; background: #11151c; color: #fff; font-size: 16px; }
.login-trust { display: flex; gap: 9px; align-items: flex-start; margin: 18px 0; color: #d7deea; font-size: 14px; }
.login-trust input { margin-top: 3px; }
.login-button { width: 100%; padding: 13px; border: 0; border-radius: 8px; background: #4b7bec; color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
.login-notice { padding: 11px; border-radius: 8px; background: #183522; border: 1px solid #2e6c42; margin: 14px 0; }
.login-notice.error { background: #3b1d22; border-color: #7a343d; }
.login-foot { color: #8f99a8; font-size: 12px; margin-top: 18px; line-height: 1.45; }

/* v1.8.3: restore execution-focused high-yield snapshot beneath chart */
.detail-left {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.trade-snapshot-card {
    position: static;
    max-height: none;
    overflow: visible;
}

.snapshot-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.snapshot-title-row h3 {
    margin-bottom: 0;
}

.trade-snapshot-card .hy-critical-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hy-chip.positive {
    background: #175c38;
    border-color: #2d8d5b;
}

.hy-chip.watch {
    background: #6b5719;
    border-color: #a88a2a;
}

.hy-decision-strip {
    display: grid;
    gap: 5px;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid #303846;
    border-radius: 7px;
    background: #141922;
    color: #d6dde7;
    font-size: 12px;
    line-height: 1.35;
}

.hy-awaiting-decision {
    margin-top: 9px;
}

@media (max-width: 1500px) {
    .trade-snapshot-card .hy-critical-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .trade-snapshot-card .hy-critical-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* v2.0.1 Supervisor-backed system health panel */
.system-health-card {
    margin-bottom: 16px;
    border-color: #394251;
}

.system-health-heading {
    margin-bottom: 10px;
}

.system-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 7px;
}

.system-health-row {
    display: grid;
    grid-template-columns: 10px minmax(110px, 1fr) auto;
    grid-template-areas:
        "dot name state"
        ". meta meta";
    column-gap: 9px;
    row-gap: 2px;
    align-items: center;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #303744;
    border-radius: 8px;
    background: #14181e;
}

.system-health-dot {
    grid-area: dot;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7e8999;
    box-shadow: 0 0 0 2px rgba(126, 137, 153, .12);
}

.system-health-name {
    grid-area: name;
    font-weight: 700;
    min-width: 0;
}

.system-health-state {
    grid-area: state;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
}

.system-health-meta {
    grid-area: meta;
    color: #8f9bad;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.system-health-row.healthy {
    border-color: #28543f;
}

.system-health-row.healthy .system-health-dot {
    background: #4bc17b;
    box-shadow: 0 0 0 2px rgba(75, 193, 123, .14);
}

.system-health-row.healthy .system-health-state {
    color: #8be2ad;
}

.system-health-row.intentional {
    border-color: #3b4656;
}

.system-health-row.intentional .system-health-dot {
    background: #8e9aab;
}

.system-health-row.intentional .system-health-state {
    color: #b4bfce;
}

.system-health-row.degraded {
    border-color: #7d3838;
    background: #1d1517;
}

.system-health-row.degraded .system-health-dot {
    background: #ef7777;
    box-shadow: 0 0 0 2px rgba(239, 119, 119, .16);
}

.system-health-row.degraded .system-health-state {
    color: #ffaaaa;
}

.system-health-alerts {
    display: grid;
    gap: 6px;
    margin: 0 0 10px;
}

.system-health-alert {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .025em;
}

.system-health-alert.danger {
    background: #3a1719;
    border: 1px solid #79373d;
    color: #ffb2b7;
}

.system-health-alert.warning {
    background: #34280f;
    border: 1px solid #725922;
    color: #f7d88a;
}

.system-health-placeholder {
    grid-column: 1 / -1;
    padding: 10px 2px;
}

.system-health-footnote {
    margin-top: 10px;
}

@media (max-width: 700px) {
    .system-health-grid {
        grid-template-columns: 1fr;
    }

    .system-health-row {
        grid-template-columns: 10px minmax(90px, 1fr) auto;
    }

    .system-health-meta {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* v2.0.1a notification provenance: make Scenario Lab history impossible to mistake for LIVE. */
.notification-test-row td {
    background: rgba(90, 59, 18, 0.10);
}

.notification-context {
    margin-top: 3px;
    color: #b7a174;
    font-size: 9px;
    white-space: nowrap;
}

/* v2.0.10g: explicit phone-alert order card. The four manual-order fields are
   deliberately oversized so a tapped Holly alert is readable at a glance. */
.action-alert-card {
    border: 3px solid #7c8798;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    background: #171a21;
    box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.action-alert-card.actionable {
    border-color: #34c77b;
    background: #10251a;
}
.action-alert-card.inactive {
    border-color: #ef5350;
    background: #2c1415;
}
.action-alert-card.acked {
    border-color: #738198;
    background: #171d25;
}
.action-alert-topline,
.action-alert-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.action-alert-badge {
    display: inline-block;
    font-weight: 900;
    letter-spacing: .06em;
    font-size: 14px;
}
.action-alert-instruction {
    font-size: clamp(30px, 9vw, 58px);
    font-weight: 950;
    line-height: 1;
    margin: 16px 0;
    letter-spacing: .02em;
}
.action-alert-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.action-alert-metric {
    border: 1px solid #445064;
    border-radius: 10px;
    padding: 12px;
    background: rgba(0,0,0,.22);
}
.action-alert-label {
    font-size: 11px;
    color: #aeb9c8;
    font-weight: 800;
    letter-spacing: .07em;
}
.action-alert-value {
    font-size: clamp(25px, 7vw, 42px);
    font-weight: 950;
    margin-top: 4px;
}
.action-alert-current {
    margin: 12px 0;
    font-size: 14px;
    color: #c7d0dc;
}
.action-alert-ack {
    background: #f0f3f7;
    color: #111820;
    border: 0;
    font-size: 16px;
    font-weight: 950;
    padding: 14px 18px;
}
.action-alert-state-text {
    font-weight: 800;
}
.action-alert-safety {
    margin-top: 12px;
    font-size: 11px;
    color: #9ca8b8;
    letter-spacing: .04em;
}
@media (max-width: 520px) {
    .action-alert-metrics { grid-template-columns: 1fr; }
    .action-alert-ack { width: 100%; }
}

/* Prospective decision audit timeline */
.audit-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(127,127,127,0.22);
    line-height: 1.35;
}
.audit-row:last-child { border-bottom: 0; }


/* Prospective strategy review / gate economics */
.strategy-review-card[hidden] { display: none !important; }

.strategy-review-summary {
    margin-top: 10px;
    margin-bottom: 12px;
}

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

.strategy-review-metric {
    border: 1px solid rgba(127,127,127,0.25);
    border-radius: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    min-width: 0;
}

.strategy-review-value {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.15;
    margin: 4px 0;
}

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

@media (max-width: 560px) {
    .strategy-review-grid {
        grid-template-columns: 1fr;
    }
}


/* 2026-09-16e: read-only external research/source visibility */
.research-source-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.research-source-metric {
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    padding: 10px;
    background: rgba(255,255,255,.025);
    min-width: 0;
}
.research-source-value {
    font-size: 1.3rem;
    font-weight: 850;
    line-height: 1.15;
    margin: 4px 0;
    overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
    .research-source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
    .research-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Wealthsimple automation master control */
.wealthsimple-automation-card {
    margin-bottom: 16px;
    border-color: #3a4658;
}

.wealthsimple-toggle {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #3f4d61;
    border-radius: 10px;
    background: #171d26;
}

.wealthsimple-toggle input {
    width: 18px;
    height: 18px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 9px;
    border: 1px solid #45566f;
    background: #293444;
    color: #f3f6fb;
    text-decoration: none;
    font-weight: 650;
}

.button-link:hover {
    background: #34435a;
}

.secondary-link {
    background: #202733;
}

.wealthsimple-execution-status {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #303a49;
    border-radius: 10px;
    background: #141920;
}

.wealthsimple-session-row {
    display: grid;
    grid-template-columns: minmax(65px, .7fr) minmax(110px, 1fr) minmax(130px, 2fr);
    gap: 8px;
    padding: 5px 0;
    border-top: 1px solid #262f3c;
    font-size: 12px;
}

.wealthsimple-session-row:first-child {
    border-top: 0;
}

@media (max-width: 700px) {
    .wealthsimple-session-row {
        grid-template-columns: 70px 1fr;
    }
    .wealthsimple-session-detail {
        grid-column: 1 / -1;
    }
}
