:root {
    --as-bg: #f4f7fb;
    --as-ink: #111827;
    --as-muted: #667085;
    --as-panel: rgba(255, 255, 255, 0.94);
    --as-line: rgba(17, 24, 39, 0.08);
    --as-nav: #07111f;
    --as-nav-soft: #0d1b2f;
    --as-accent: #0f766e;
    --as-blue: #2563eb;
    --as-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
canvas {
    max-width: 100%;
    height: auto;
}

body.saas-dashboard {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 34rem),
        linear-gradient(180deg, #f8fafc 0%, var(--as-bg) 100%);
}

.app-main {
    margin-left: 260px;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    padding: 22px;
    background: linear-gradient(180deg, var(--as-nav) 0%, var(--as-nav-soft) 100%);
    color: #fff;
    z-index: 20;
    box-shadow: 20px 0 55px rgba(7, 17, 31, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    font-size: 20px;
    margin-bottom: 28px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14b8a6 0%, #2563eb 100%);
    color: #fff;
    font-size: 16px;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.28);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 800;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 30;
    background: var(--as-nav);
    color: #fff;
}

.saas-dashboard .container {
    max-width: 1500px;
    padding: 28px;
}

.saas-dashboard .topbar {
    padding: 18px 20px;
    border: 1px solid var(--as-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    box-shadow: var(--as-shadow);
}

.saas-dashboard .title {
    color: var(--as-ink);
    letter-spacing: 0;
}

.saas-dashboard .subtitle {
    max-width: 780px;
}

.top-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.top-actions > * {
    min-width: 0;
}

.top-actions .link-btn,
.top-actions .notify-btn {
    justify-content: center;
}

.dashboard-shell {
    display: grid;
    gap: 18px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.dashboard-hero-main,
.dashboard-hero-side {
    border: 1px solid var(--as-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(16px);
    box-shadow: var(--as-shadow);
}

.dashboard-hero-main {
    position: relative;
    overflow: hidden;
    padding: 22px 24px;
}

.dashboard-hero-main::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, #0f766e 0%, #2563eb 55%, #f59e0b 100%);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #ecfeff;
    color: #155e75;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-headline {
    margin: 14px 0 0;
    color: var(--as-ink);
    font-size: 34px;
    font-weight: 950;
    line-height: 1.02;
}

.hero-copy {
    margin: 10px 0 0;
    max-width: 760px;
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 700;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--as-line);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.95);
    color: var(--as-ink);
    font-size: 12px;
    font-weight: 900;
}

.hero-badge small {
    color: var(--as-muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-command-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.hero-command-card {
    padding: 14px;
    border: 1px solid var(--as-line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.92));
}

.hero-command-card span {
    display: block;
    color: var(--as-muted);
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-command-card strong {
    display: block;
    margin-top: 8px;
    color: var(--as-ink);
    font-size: 22px;
    font-weight: 950;
    line-height: 1.15;
}

.hero-command-card small {
    display: block;
    margin-top: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.dashboard-hero-side {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.hero-side-card {
    padding: 14px 16px;
    border: 1px solid var(--as-line);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.94);
}

.hero-side-card span {
    display: block;
    color: var(--as-muted);
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-side-card strong {
    display: block;
    margin-top: 8px;
    color: var(--as-ink);
    font-size: 18px;
    font-weight: 950;
    line-height: 1.2;
}

.hero-side-card p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.status-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--as-line);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    font-size: 12px;
    font-weight: 900;
    color: var(--as-ink);
}

.status-pill small {
    color: var(--as-muted);
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tab-shell {
    padding: 8px;
    border: 1px solid var(--as-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--as-shadow);
    margin-bottom: 18px;
}

.tab-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    background: transparent;
    margin: 0;
    padding: 0;
}

.tab-btn {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all .18s ease;
}

.tab-btn.active {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    border-color: var(--as-line);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.tab-btn:hover:not(.active) {
    background: rgba(248, 250, 252, 0.95);
    color: #0f172a;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: #fff;
    color: var(--as-ink);
    font-weight: 900;
}

.notify-btn[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

.saas-dashboard .nav-card {
    display: none;
}

.saas-dashboard .card,
.saas-dashboard .hero-trade {
    border-radius: 12px;
    border: 1px solid var(--as-line);
    box-shadow: var(--as-shadow);
    min-width: 0;
    overflow-wrap: anywhere;
}

.saas-dashboard .hero-trade {
    position: relative;
    overflow: hidden;
}

.saas-dashboard .hero-trade::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--as-accent), var(--as-blue));
}

.no-trade-state {
    background: #ffffff !important;
    color: var(--as-ink) !important;
}

.smart-primary.smart-ce {
    background: #ecfdf5 !important;
    color: #064e3b !important;
}

.smart-primary.smart-pe {
    background: #fef2f2 !important;
    color: #7f1d1d !important;
}

.smart-primary.smart-none {
    background: #f8fafc !important;
    color: var(--as-ink) !important;
}

.smart-primary.smart-ce::before {
    background: linear-gradient(90deg, #059669, #22c55e);
}

.smart-primary.smart-pe::before {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.smart-primary.smart-none::before {
    background: linear-gradient(90deg, #94a3b8, #64748b);
}

.quick-decision-strip {
    position: sticky;
    top: 12px;
    z-index: 12;
    display: grid;
    grid-template-columns: 0.7fr 1.1fr 1.7fr auto;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--as-line);
    border-left: 5px solid #64748b;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.quick-decision-strip.ready {
    border-left-color: #047857;
}

.quick-decision-strip.locked {
    border-left-color: #b91c1c;
}

.quick-decision-strip.manage {
    border-left-color: #0f766e;
}

.quick-decision-strip > div {
    min-width: 0;
}

.quick-decision-strip span,
.quick-decision-strip small {
    display: block;
    color: var(--as-muted);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.quick-decision-strip strong {
    display: block;
    margin-top: 4px;
    color: var(--as-ink);
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.quick-decision-strip > div:first-child strong {
    color: #12212f;
    font-size: 18px;
}

.quick-decision-strip.ready > div:first-child strong {
    color: #047857;
}

.quick-decision-strip.locked > div:first-child strong {
    color: #b91c1c;
}

.quick-decision-strip .link-btn {
    align-self: center;
    justify-content: center;
    white-space: nowrap;
}

.trader-cockpit {
    display: grid;
    gap: 16px;
    padding: 22px;
}

.cockpit-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.cockpit-symbol {
    margin-top: 8px;
    color: var(--as-ink);
    font-size: 30px;
    font-weight: 950;
    line-height: 1.15;
}

.cockpit-subline {
    margin-top: 6px;
    color: var(--as-muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.cockpit-stage {
    min-width: 160px;
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;
    color: #fff;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cockpit-stage.scan {
    background: #64748b;
}

.cockpit-stage.watch {
    background: #b45309;
}

.cockpit-stage.ready,
.cockpit-stage.manage {
    background: #047857;
}

.cockpit-stage.locked {
    background: #b91c1c;
}

.cockpit-command {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--as-line);
    border-left: 4px solid var(--as-accent);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
}

.cockpit-command span,
.cockpit-levels span,
.cockpit-logic span {
    color: var(--as-muted);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cockpit-command strong {
    color: var(--as-ink);
    font-size: 20px;
}

.cockpit-levels,
.cockpit-levels-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.cockpit-levels > div,
.cockpit-levels-row > div,
.cockpit-logic > div,
.cockpit-empty {
    min-width: 0;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    padding: 12px;
}

.cockpit-levels strong,
.cockpit-levels-row strong {
    display: block;
    margin-top: 6px;
    color: var(--as-ink);
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.cockpit-levels small {
    display: block;
    margin-top: 4px;
    color: var(--as-muted);
    font-weight: 800;
}

.cockpit-levels-row small {
    display: block;
    margin-top: 4px;
    color: var(--as-muted);
    font-weight: 800;
}

.cockpit-panel {
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.92);
    padding: 12px;
}

.cockpit-panel .small {
    margin: 0;
    color: var(--as-muted);
    font-weight: 750;
    line-height: 1.5;
}

.signal-queue {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.signal-queue-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 8px;
    background: #f8fbff;
}

.signal-queue-card span {
    display: block;
    color: var(--as-muted);
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.signal-queue-card strong {
    display: block;
    margin-top: 6px;
    color: var(--as-ink);
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.signal-queue-card p {
    margin: 8px 0 0;
    color: #475569;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.45;
}

.cockpit-logic {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 10px;
}

.cockpit-logic p,
.cockpit-empty p {
    margin: 8px 0 0;
    color: var(--as-ink);
    font-weight: 750;
    line-height: 1.45;
}

.quiet-alert-source {
    display: none;
}

.cockpit-actions {
    margin-top: 0;
}

.final-trade-engine {
    display: grid;
    gap: 14px;
    margin-top: 20px;
    padding: 18px;
    border: 1px solid var(--as-line);
    border-left: 5px solid #64748b;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--as-shadow);
}

.final-trade-engine.ready {
    border-left-color: #047857;
}

.final-trade-engine.locked {
    border-left-color: #b91c1c;
}

.final-trade-engine.manage {
    border-left-color: #0f766e;
}

.final-engine-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.engine-kicker,
.engine-focus span,
.engine-check span,
.engine-lane span {
    color: var(--as-muted);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.final-engine-head h2 {
    margin: 6px 0;
    color: var(--as-ink);
    font-size: 28px;
    line-height: 1.15;
}

.final-engine-head p,
.engine-focus p,
.engine-check p,
.engine-lane p,
.engine-lane small {
    margin: 6px 0 0;
    color: var(--as-muted);
    font-weight: 750;
    line-height: 1.45;
}

.engine-verdict {
    min-width: 150px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #12212f;
    color: #fff;
    text-align: center;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.final-trade-engine.ready .engine-verdict,
.engine-check.pass strong {
    color: #047857;
}

.final-trade-engine.ready .engine-verdict {
    background: #047857;
    color: #fff;
}

.final-trade-engine.locked .engine-verdict,
.engine-check.block strong {
    color: #b91c1c;
}

.final-trade-engine.locked .engine-verdict {
    background: #b91c1c;
    color: #fff;
}

.engine-focus {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 10px;
}

.engine-focus > div,
.engine-check,
.engine-lane {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: #f8fafc;
}

.engine-focus strong,
.engine-check strong,
.engine-lane strong {
    display: block;
    margin-top: 6px;
    color: var(--as-ink);
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

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

.lifecycle-step {
    min-height: 42px;
    display: grid;
    place-items: center;
    padding: 8px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--as-muted);
    font-size: 11px;
    font-weight: 950;
    text-align: center;
    text-transform: uppercase;
}

.lifecycle-step.done {
    background: #ecfdf5;
    color: #047857;
    border-color: rgba(4, 120, 87, 0.24);
}

.lifecycle-step.active {
    background: #12212f;
    color: #ffffff;
    border-color: #12212f;
}

.trust-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.trust-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: #fff7ed;
}

.trust-item span {
    display: block;
    color: #9a3412;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.trust-item p {
    margin: 6px 0 0;
    color: #3f2a12;
    font-weight: 800;
    line-height: 1.45;
}

.engine-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.hedge-preview-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 10px;
    align-items: stretch;
    padding: 12px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    background: #f0fdfa;
}

.hedge-preview-card > div {
    min-width: 0;
}

.hedge-preview-card span {
    display: block;
    color: #0f766e;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.hedge-preview-card strong {
    display: block;
    margin-top: 6px;
    color: var(--as-ink);
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.hedge-preview-card p {
    margin: 6px 0 0;
    color: var(--as-muted);
    font-weight: 800;
    line-height: 1.45;
}

.hedge-preview-card .link-btn {
    align-self: center;
    white-space: nowrap;
}

.engine-check.wait strong {
    color: #b45309;
}

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

.engine-lane.ready {
    background: #ecfdf5;
    border-color: rgba(4, 120, 87, 0.24);
}

.engine-lane.near {
    background: #fff7ed;
    border-color: rgba(180, 83, 9, 0.24);
}

.perf-terminal {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.perf-card {
    min-height: 118px;
    padding: 18px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--as-shadow);
}

.perf-card span {
    display: block;
    color: var(--as-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.perf-card strong {
    display: block;
    margin-top: 14px;
    font-size: 34px;
    color: var(--as-ink);
}

.perf-card.profit strong,
.profit-text {
    color: #047857;
}

.perf-card.loss strong,
.loss-text {
    color: #dc2626;
}

.perf-card.neutral strong {
    color: #64748b;
}

.risk-strip {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.risk-strip span {
    padding: 10px 12px;
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 900;
}

.terminal-chart {
    height: 190px;
    border: 1px solid var(--as-line);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.line-chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

.empty-chart {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--as-muted);
    font-weight: 900;
}

.donut-chart {
    width: 176px;
    height: 176px;
    margin: 18px auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(#059669 calc(var(--win) * 1%), #e11d48 0);
}

.donut-chart span {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--as-ink);
    font-size: 24px;
    font-weight: 950;
}

.bar-stack {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.bar-stack span {
    display: block;
    margin-bottom: 6px;
    color: var(--as-muted);
    font-size: 12px;
    font-weight: 900;
}

.bar-stack div div {
    height: 10px;
    overflow: hidden;
    border-radius: 8px;
    background: #e5e7eb;
}

.bar-stack i {
    display: block;
    height: 100%;
    border-radius: 8px;
    background: #0f766e;
}

.empty-state-icon {
    width: 54px;
    height: 54px;
    margin-top: 14px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 900;
}

.ai-confidence-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.ai-score {
    margin-top: 14px;
    font-size: 42px;
    font-weight: 950;
    color: var(--as-ink);
}

.ai-score span {
    font-size: 16px;
    color: var(--as-muted);
}

.ai-progress {
    height: 12px;
    margin-top: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.ai-progress > div {
    height: 100%;
    border-radius: inherit;
    transition: width 240ms ease;
}

.ai-high {
    background: linear-gradient(90deg, #059669, #22c55e);
    color: #fff;
}

.ai-medium {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    color: #111827;
}

.ai-low {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    color: #fff;
}

.saas-dashboard .link-btn,
.saas-dashboard button {
    border-radius: 8px;
}

.saas-dashboard .stat,
.saas-dashboard .hero-metric,
.saas-dashboard .ladder-stage {
    border-radius: 8px;
}

.lazy-table-hidden {
    display: none;
}

.lazy-table-toggle {
    margin-top: 12px;
    background: #eef2ff;
    color: #3730a3;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    background: rgba(244, 247, 251, 0.94);
    z-index: 60;
    color: var(--as-ink);
    font-weight: 900;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(15, 118, 110, 0.18);
    border-top-color: var(--as-accent);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

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

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.22), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.16), transparent 30rem),
        #f5f7fb;
}

.login-card {
    animation: cardIn 320ms ease both;
}

.login-brand {
    color: var(--as-ink);
    margin-bottom: 16px;
}

.login-page input:focus {
    outline: 3px solid rgba(15, 118, 110, 0.16);
    border-color: var(--as-accent);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

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

    .app-main {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    .sidebar.is-open,
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .saas-dashboard .container {
        padding: 72px 16px 18px;
    }

    .quick-decision-strip {
        top: 64px;
        grid-template-columns: 1fr 1fr;
    }

    .cockpit-head,
    .cockpit-logic,
    .final-engine-head,
    .engine-focus {
        grid-template-columns: 1fr;
        display: grid;
    }

    .cockpit-stage {
        width: 100%;
    }

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

    .engine-checks,
    .engine-lanes,
    .hedge-preview-card {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trade-lifecycle {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

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

    .dashboard-hero-main,
    .dashboard-hero-side {
        border-radius: 16px;
    }

    .dashboard-hero-main {
        padding: 18px;
    }

    .hero-headline {
        font-size: 28px;
    }

    .hero-command-grid {
        grid-template-columns: 1fr;
    }

    .status-pill {
        width: 100%;
        justify-content: space-between;
    }

    .tab-bar {
        grid-template-columns: 1fr;
    }

    .saas-dashboard .topbar {
        align-items: stretch;
    }

    .blessing-card {
        display: none;
    }

    .quick-decision-strip {
        margin-left: -6px;
        margin-right: -6px;
        grid-template-columns: 1fr;
    }

    .quick-decision-strip .link-btn {
        min-height: 42px;
        width: 100%;
    }

    .top-actions,
    .saas-dashboard .toolbar {
        width: 100%;
    }

    .top-actions > *,
    .saas-dashboard .toolbar > * {
        flex: 1 1 calc(50% - 8px);
        min-width: 132px;
    }

    .top-actions > div {
        flex: 0 0 auto;
    }

    .top-actions .link-btn,
    .top-actions .notify-btn {
        min-height: 42px;
        width: 100%;
    }

    .saas-dashboard .topbar {
        padding: 16px;
    }

    .saas-dashboard .title {
        font-size: 24px;
        line-height: 1.1;
    }

    .saas-dashboard .subtitle {
        font-size: 13px;
    }

    .status-rail {
        grid-template-columns: 1fr;
    }

    .cockpit-levels,
    .cockpit-levels-row {
        grid-template-columns: 1fr;
    }

    .cockpit-symbol {
        font-size: 24px;
    }

    .engine-checks,
    .engine-lanes,
    .hedge-preview-card {
        grid-template-columns: 1fr;
    }

    .hedge-preview-card .link-btn {
        width: 100%;
        justify-content: center;
    }

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

    .final-engine-head h2 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .saas-dashboard .container {
        padding: 72px 12px 16px;
    }

    .top-actions > *,
    .saas-dashboard .toolbar > * {
        flex: 1 1 100%;
        min-width: 0;
    }

    .hero-headline {
        font-size: 24px;
    }

    .hero-copy,
    .hero-command-card small,
    .hero-side-card p,
    .status-pill {
        font-size: 12px;
    }

    .hero-badges {
        gap: 8px;
    }

    .hero-badge {
        width: 100%;
        justify-content: space-between;
    }
}

/* Notched phones — keep tap targets clear of home indicator */
@supports (padding: max(0px)) {
    body.saas-dashboard .container {
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .as-topbar {
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
    }
}

/* Shared responsive safety net for legacy/internal pages */
@media (max-width: 900px) {
    .container,
    .wrap {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .toolbar,
    .top-actions,
    .actions,
    .stat-grid,
    .stats-grid,
    .layout,
    .mini-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column;
    }

    .toolbar > *,
    .top-actions > *,
    .actions > * {
        width: 100%;
        min-width: 0;
    }

    .card,
    .nav-card,
    .hero-trade,
    .perf-card,
    .blessing-card {
        padding: 16px !important;
    }

    table,
    .analytics-table,
    .dash-table,
    .movers-table,
    .trades-table,
    .scan-log-table,
    .override-table,
    .sector-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    body {
        overflow-x: hidden;
    }

    .card,
    .nav-card,
    .hero-trade,
    .perf-card,
    .blessing-card {
        border-radius: 12px;
        padding: 14px !important;
    }

    input,
    select,
    textarea,
    button,
    .btn,
    .link-btn {
        max-width: 100%;
        box-sizing: border-box;
    }

    pre,
    code {
        white-space: pre-wrap;
        word-break: break-word;
    }
}
