:root {
    color-scheme: light dark;
    --background: #eef7f6;
    --surface: #ffffff;
    --surface-strong: #f8fafc;
    --text: #15202b;
    --muted: #586574;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: #ccfbf1;
    --border: #d9e2ec;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.13);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #07111f;
        --surface: #111827;
        --surface-strong: #0f172a;
        --text: #e5e7eb;
        --muted: #9ca3af;
        --accent: #2dd4bf;
        --accent-strong: #5eead4;
        --accent-soft: rgba(45, 212, 191, 0.16);
        --border: #243244;
        --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    }
}

* {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable both-edges;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--accent), transparent 78%), transparent 34rem),
        linear-gradient(135deg, var(--background), color-mix(in srgb, var(--background), var(--surface) 28%));
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header,
.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 0 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-logo {
    width: min(330px, 68vw);
    height: auto;
    object-fit: contain;
}

.site-footer span {
    color: var(--muted);
    font-size: 0.9rem;
}

.premarket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.premarket-card.is-up {
    border-color: color-mix(in srgb, #16a34a, var(--border) 55%);
}

.premarket-card.is-down {
    border-color: color-mix(in srgb, #dc2626, var(--border) 55%);
}

.premarket-chart {
    display: grid;
    gap: 8px;
}

.shell {
    flex: 1;
    padding: 22px 0 36px;
}

.landing {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 28px;
    align-items: stretch;
    margin-bottom: 28px;
}

.landing:has(#auth-card.hidden) {
    display: none;
}

.hero,
.card {
    margin-bottom: 24px;
}

.landing > .hero,
.landing > .auth-card {
    margin-bottom: 0;
}

.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    align-content: center;
    min-height: 430px;
    padding: clamp(28px, 5vw, 58px);
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 72%);
    border-radius: 32px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 88%), transparent 48%),
        var(--surface);
    box-shadow: var(--shadow);
}

.hero::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 310px;
    height: 310px;
    border: 42px solid color-mix(in srgb, var(--accent), transparent 82%);
    border-radius: 50%;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.eyebrow,
.muted {
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 720px;
    margin-bottom: 18px;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 10px;
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    letter-spacing: -0.035em;
}

.hero p {
    max-width: 610px;
    color: var(--muted);
    font-size: 1.14rem;
    line-height: 1.65;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.hero-points span {
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 55%);
    border-radius: 999px;
    padding: 9px 13px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 800;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.app-shell {
    display: grid;
    gap: 20px;
}

.view {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 0;
    padding: clamp(24px, 4vw, 34px);
}

.auth-intro {
    color: var(--muted);
    line-height: 1.55;
}

.auth-card form {
    display: grid;
    gap: 14px;
}

.auth-card .actions {
    margin-top: 10px;
}

.card-header,
.actions,
.split {
    display: flex;
    gap: 16px;
}

.card-header {
    justify-content: space-between;
    align-items: flex-start;
}

.card-header:has(.collapsible-toggle) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    align-items: start;
    column-gap: 18px;
}

.card-header:has(.collapsible-toggle) > :first-child {
    grid-column: 1;
    min-width: 0;
}

.card-header:has(.collapsible-toggle) > :not(:first-child):not(.collapsible-toggle) {
    grid-column: 1;
    justify-self: start;
    max-width: 100%;
}

.card-header:has(.collapsible-toggle) > .collapsible-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 43px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 16px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.nav-link.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.split > section {
    display: grid;
    align-content: start;
    gap: 12px;
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 40%);
}

.split + .split {
    margin-top: 18px;
}

.split > section h3 {
    margin-bottom: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.settings-grid {
    margin-bottom: 0;
}

.wide-field {
    grid-column: 1 / -1;
}

.instrument-search-results {
    display: grid;
    gap: 8px;
}

.instrument-search-result {
    display: grid;
    gap: 4px;
    justify-items: start;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 50%);
    color: var(--text);
    text-align: left;
}

.instrument-search-result span,
.instrument-search-empty {
    font-size: 0.88rem;
}

.settings-form {
    display: grid;
    gap: 18px;
}

.settings-section {
    display: grid;
    gap: 14px;
    border: 1px solid color-mix(in srgb, var(--border), var(--surface-strong) 35%);
    border-radius: 18px;
    padding: 16px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 38%);
}

.settings-section-header {
    display: grid;
    gap: 4px;
}

.settings-section-header h4,
.settings-section-header p {
    margin: 0;
}

.disabled-setting {
    cursor: help;
    opacity: 0.62;
}

.disabled-setting input {
    cursor: not-allowed;
    color: var(--muted);
    border-style: dashed;
    background: color-mix(in srgb, var(--surface-strong), var(--muted) 8%);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

.settings-save-button {
    min-width: 170px;
    padding: 10px 16px;
    font-size: 0.9rem;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.switch-label {
    align-content: center;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    cursor: pointer;
}

input,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus {
    border-color: var(--accent);
    outline: 0;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 82%);
}

.switch-label input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted), transparent 75%);
    transition: background 160ms ease, border-color 160ms ease;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
    transition: transform 160ms ease;
}

.switch-label input:checked + .switch {
    border-color: var(--accent);
    background: var(--accent);
}

.switch-label input:checked + .switch::after {
    transform: translateX(20px);
}

.switch-label input:focus-visible + .switch {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--accent), transparent 76%);
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px color-mix(in srgb, var(--accent), transparent 70%);
}

button:disabled {
    cursor: wait;
    opacity: 0.75;
}

button.is-loading::before {
    content: "";
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.12em;
    animation: spin 800ms linear infinite;
}

.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 116px;
    color: var(--muted);
    font-weight: 700;
}

.loading-placeholder-spinner {
    width: 1.15rem;
    height: 1.15rem;
    border: 2px solid var(--accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

button.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: none;
}

.collapsible-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 104px;
    min-height: 40px;
    padding: 9px 14px;
    font-size: 0.88rem;
}

.collapsible-toggle::after {
    content: "^";
    margin-left: 8px;
    font-size: 0.9em;
    transition: transform 160ms ease;
}

.is-collapsed .collapsible-toggle::after {
    transform: rotate(180deg);
}

[data-collapsible] {
    transition: border-color 160ms ease, background 160ms ease;
}

[data-collapsible].is-collapsed {
    border-color: color-mix(in srgb, var(--border), var(--muted) 18%);
}

[data-collapsible-content][hidden] {
    display: none;
}

.inline-status {
    align-self: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.hidden {
    display: none;
}

.list {
    display: grid;
    gap: 12px;
}

.item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 45%);
}

.compact-item p,
.signal-card p {
    margin-bottom: 0;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 22px;
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 55%);
    border-radius: 22px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 88%), transparent 60%),
        var(--surface-strong);
}

.dashboard-hero h3 {
    margin-bottom: 8px;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.04em;
}

.overview-section {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.swing-ranking-section {
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 60%);
    border-radius: 22px;
    padding: 18px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 91%), transparent 66%),
        color-mix(in srgb, var(--surface), var(--surface-strong) 42%);
}

.swing-ranking-list {
    display: grid;
    gap: 10px;
}

.swing-ranking-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(150px, auto) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 45%);
}

.swing-ranking-item.is-leader {
    border-color: color-mix(in srgb, var(--accent), var(--border) 30%);
    background: color-mix(in srgb, var(--accent-soft), var(--surface) 82%);
}

.swing-rank {
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 900;
}

.swing-ranking-score {
    display: grid;
    gap: 3px;
    text-align: right;
}

.swing-ranking-score strong {
    color: var(--accent-strong);
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.swing-ranking-score span,
.swing-ranking-note {
    font-size: 0.9rem;
}

.automation-section {
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 42%);
}

.saxo-mapping-row {
    display: grid;
    gap: 10px;
}

.saxo-inline-fields {
    display: grid;
    grid-template-columns: minmax(110px, 0.8fr) minmax(130px, 1fr) minmax(150px, 1.2fr) auto;
    gap: 12px;
    align-items: end;
}

.compact-switch {
    min-width: 104px;
    padding-bottom: 9px;
}

.automation-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.automation-item {
    display: grid;
    gap: 8px;
}

.automation-schedule-text {
    margin-bottom: 0;
    color: var(--accent-strong);
    font-weight: 800;
    line-height: 1.45;
}

.automation-source-note {
    margin: 12px 0 0;
    font-size: 0.9rem;
}

.watchlist-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 286px;
    align-items: center;
    gap: 12px 16px;
}

.watchlist-item > p {
    grid-column: 1;
}

.watchlist-item > .actions {
    display: grid;
    grid-template-columns: 150px 120px;
    grid-row: 1 / span 2;
    grid-column: 2;
    gap: 16px;
    justify-content: end;
}

.watchlist-item > .actions button {
    width: 100%;
    min-height: 48px;
    padding-inline: 0;
    text-align: center;
}

.watchlist-toggle {
    background: transparent;
    color: var(--accent-strong);
    border: 1px solid var(--accent);
    box-shadow: none;
}

.stock-detail-header {
    margin-bottom: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.metric-card {
    position: relative;
    display: grid;
    gap: 8px;
    min-height: 145px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface-strong), var(--surface) 30%);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metric-card:hover,
.metric-card:focus-visible {
    border-color: color-mix(in srgb, var(--accent), var(--border) 35%);
    box-shadow: 0 16px 34px color-mix(in srgb, var(--accent), transparent 84%);
    outline: 0;
    transform: translateY(-1px);
}

.metric-card span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-card strong {
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    letter-spacing: -0.04em;
}

.metric-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.metric-tooltip {
    position: absolute;
    right: 14px;
    bottom: calc(100% + 10px);
    z-index: 5;
    width: min(290px, calc(100vw - 56px));
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 45%);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.metric-card:hover .metric-tooltip,
.metric-card:focus-visible .metric-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.chart-card {
    display: grid;
    gap: 16px;
    margin: 18px 0 24px;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 35%);
}

.price-chart {
    display: grid;
    gap: 14px;
    min-height: 260px;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.chart-range-label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.chart-range-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-range-button {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.86rem;
}

.chart-range-button[aria-pressed="true"] {
    background: var(--accent);
    color: var(--surface);
}

.price-chart-frame {
    position: relative;
}

.price-chart-svg {
    width: 100%;
    min-height: 260px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(color-mix(in srgb, var(--border), transparent 70%) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--border), transparent 70%) 1px, transparent 1px),
        color-mix(in srgb, var(--surface-strong), transparent 8%);
    background-size: 42px 42px;
}

.chart-hover-area {
    cursor: crosshair;
    fill: transparent;
}

.chart-hover-line {
    pointer-events: none;
    stroke: color-mix(in srgb, var(--accent), transparent 30%);
    stroke-dasharray: 4 5;
    stroke-width: 1.4;
}

.chart-hover-point {
    pointer-events: none;
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 2;
}

.chart-tooltip {
    position: absolute;
    z-index: 2;
    display: grid;
    gap: 3px;
    max-width: 180px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-strong), #000 8%);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.83rem;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 12px));
    white-space: nowrap;
}

.chart-tooltip[hidden] {
    display: none;
}

.chart-tooltip span {
    color: var(--muted);
}

.chart-grid-line {
    stroke: color-mix(in srgb, var(--muted), transparent 68%);
    stroke-width: 1;
}

.chart-axis-label {
    fill: var(--muted);
    font-size: 13px;
}

.chart-price-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent), transparent 35%));
}

.chart-overlay-line {
    fill: none;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.chart-overlay-line.is-bollinger {
    stroke: color-mix(in srgb, #38bdf8, var(--muted) 20%);
    stroke-dasharray: 6 5;
}

.chart-overlay-line.is-bollinger-middle {
    stroke: color-mix(in srgb, #38bdf8, transparent 20%);
    stroke-width: 1.2;
}

.chart-overlay-baseline {
    stroke-width: 1.4;
    stroke-dasharray: 4 4;
    opacity: 0.85;
}

.chart-overlay-baseline.is-macd {
    stroke: color-mix(in srgb, var(--accent-strong), transparent 28%);
}

.chart-overlay-baseline.is-volume {
    stroke: color-mix(in srgb, #a78bfa, transparent 18%);
}

.chart-macd-bar,
.chart-volume-bar {
    stroke-linecap: round;
    stroke-width: 3;
    opacity: 0.95;
}

.chart-macd-bar.is-positive {
    stroke: var(--accent);
}

.chart-macd-bar.is-negative {
    stroke: #f97316;
}

.chart-volume-bar {
    stroke: color-mix(in srgb, #a78bfa, transparent 10%);
}

.chart-swing-segment {
    stroke: #facc15;
    stroke-dasharray: 7 7;
    stroke-linecap: round;
    stroke-width: 2;
}

.chart-marker {
    fill: color-mix(in srgb, var(--muted), transparent 78%);
    stroke: var(--muted);
    stroke-width: 3;
}

.chart-marker.is-positive {
    stroke: #22c55e;
    fill: color-mix(in srgb, #22c55e, transparent 62%);
}

.chart-marker.is-negative {
    stroke: #ef4444;
    fill: color-mix(in srgb, #ef4444, transparent 62%);
}

.chart-marker.is-neutral {
    stroke: #94a3b8;
    fill: color-mix(in srgb, #94a3b8, transparent 70%);
}

.chart-turning-point {
    stroke-width: 3;
}

.chart-turning-point.is-bottom {
    fill: var(--accent-soft);
    stroke: var(--accent-strong);
}

.chart-turning-point.is-top {
    fill: color-mix(in srgb, #facc15, transparent 65%);
    stroke: #facc15;
}

.chart-legend,
.pagination,
.signal-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.legend-item::before {
    content: "";
    width: 18px;
    height: 4px;
    border-radius: 999px;
    background: var(--muted);
}

.legend-item.is-line::before,
.legend-item.is-positive::before {
    background: #22c55e;
}

.legend-item.is-negative::before {
    background: #ef4444;
}

.legend-item.is-bollinger::before {
    background: #38bdf8;
}

.legend-item.is-macd::before {
    background: var(--accent-strong);
}

.legend-item.is-volume::before {
    background: var(--muted);
}

.legend-item.is-bottom::before {
    background: var(--accent-strong);
}

.legend-item.is-top::before {
    background: #facc15;
}

.timing-card {
    display: grid;
    gap: 14px;
    margin: -6px 0 24px;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 45%);
}

.timing-card h3 {
    margin-bottom: 6px;
}

.timing-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.has-tooltip {
    position: relative;
}

.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: calc(100% + 10px);
    z-index: 20;
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 45%);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.timing-note {
    margin: 12px 0 0;
    line-height: 1.5;
}

.signal-marker-list {
    display: grid;
    gap: 8px;
}

.signal-marker-list article {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    color: var(--muted);
}

.signal-marker-list strong {
    color: var(--text);
}

.signal-heading {
    justify-content: space-between;
}

.badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 10px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.badge.is-positive {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.badge.is-negative {
    border-color: #f97316;
    background: color-mix(in srgb, #f97316, transparent 84%);
    color: #c2410c;
}

.badge.is-warning {
    border-color: #f59e0b;
    background: color-mix(in srgb, #f59e0b, transparent 84%);
    color: #92400e;
}

.push-actions {
    display: grid;
    gap: 8px;
    align-content: start;
}

.push-actions p {
    margin: 0;
    line-height: 1.45;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    gap: 18px;
}

.admin-row,
.admin-run {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.admin-row > :first-child,
.admin-run > :first-child {
    min-width: 0;
}

.admin-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-actions select {
    min-width: 112px;
}

#admin-jobs .admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 276px;
    align-items: center;
    gap: 18px;
}

#admin-jobs .admin-actions {
    display: grid;
    grid-template-columns: 164px 96px;
    align-items: center;
    justify-content: end;
    gap: 12px;
    flex-wrap: nowrap;
}

#admin-jobs .admin-actions .badge,
#admin-jobs .admin-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    text-align: center;
}

#admin-jobs .admin-actions .badge {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
}

.admin-definition-list {
    display: grid;
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
    gap: 10px 14px;
    margin: 0;
}

.admin-definition-list dt {
    color: var(--muted);
    font-weight: 800;
}

.admin-definition-list dd {
    margin: 0;
}

.admin-run-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.admin-run details {
    margin-top: 10px;
}

.admin-run pre {
    max-height: 320px;
    overflow: auto;
    margin: 10px 0 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface-strong);
    white-space: pre-wrap;
}

.signal-summary {
    margin: 10px 0 14px;
    color: var(--text);
    line-height: 1.55;
}

.pagination {
    justify-content: center;
    margin-top: 16px;
    color: var(--muted);
    font-weight: 700;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    width: min(420px, calc(100% - 40px));
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 45%);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.data-source-reminder {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 45%);
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent), transparent 88%);
}

.data-source-reminder p {
    margin: 0;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 17, 31, 0.72);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 18px;
    width: min(1180px, calc(100vw - 48px));
    max-height: min(860px, calc(100vh - 48px));
    border: 1px solid color-mix(in srgb, var(--accent), var(--border) 55%);
    border-radius: 24px;
    padding: 22px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.modal-body {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.signal-details {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.signal-details h4 {
    margin: 0 0 8px;
}

.signal-details ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.modal-body .signal-details {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.modal-body .signal-details section {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    background: color-mix(in srgb, var(--surface), var(--surface-strong) 48%);
}

.modal-body .signal-details .signal-audit-section {
    grid-column: 1 / -1;
}

.signal-audit-block {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.signal-audit-block strong {
    color: var(--text);
}

.signal-audit-readable {
    margin: 0;
}

.signal-audit-empty {
    margin: 0;
}

.signal-audit-full,
.signal-audit-raw {
    margin-top: 10px;
}

.signal-audit-full summary,
.signal-audit-raw summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
}

.signal-audit-full summary:hover,
.signal-audit-raw summary:hover {
    color: var(--accent-strong);
}

.signal-audit-pre-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    margin-bottom: 4px;
}

.signal-audit-pre-toolbar .signal-audit-select-all {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.signal-audit-selectable-pre {
    user-select: text;
    cursor: text;
}

.signal-audit-block pre {
    max-height: 360px;
    margin: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: var(--surface-strong);
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 0.86rem/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.signal-audit-block .signal-audit-human-text {
    max-height: 520px;
    font: inherit;
    line-height: 1.55;
}

.modal-body .signal-details li {
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    text-align: center;
}

.site-footer strong {
    color: var(--text);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    .site-header,
    .card-header,
    .dashboard-hero,
    .split,
    .actions {
        flex-direction: column;
    }

    .site-header {
        align-items: flex-start;
    }

    .landing {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .watchlist-item {
        grid-template-columns: 1fr;
    }

    .watchlist-item > p,
    .watchlist-item > .actions {
        grid-column: 1;
        grid-row: auto;
    }

    .swing-ranking-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .swing-ranking-score {
        grid-column: 1 / -1;
        text-align: left;
    }

    .swing-ranking-item > button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .saxo-inline-fields {
        grid-template-columns: 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-row,
    .admin-run {
        flex-direction: column;
    }

    .admin-actions {
        justify-content: flex-start;
    }

    #admin-jobs .admin-row {
        grid-template-columns: 1fr;
    }

    #admin-jobs .admin-actions {
        grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
        width: 100%;
    }

    .brand-logo {
        width: min(300px, 88vw);
    }
}
