/* ============================================
   RYSK OPTIONS DASHBOARD — Design System v3
   Refined dark flat — editorial, contemporary
   ============================================ */

:root {
    /* Surface */
    --bg: #09090b;
    --bg-raised: #111113;
    --bg-hover: rgba(255, 255, 255, 0.04);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.10);

    /* Text */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* Accent — muted teal-green, not neon */
    --accent: #34d399;
    --accent-dim: rgba(52, 211, 153, 0.10);

    /* Semantic — softer palette */
    --color-error: #ef7070;
    --color-error-dim: rgba(239, 112, 112, 0.08);
    --color-warning: #f0b940;
    --color-warning-dim: rgba(240, 185, 64, 0.08);
    --color-cyan: #38bdf8;
    --color-cyan-dim: rgba(56, 189, 248, 0.08);
    --color-orange: #f59e0b;
    --color-orange-dim: rgba(245, 158, 11, 0.08);
    --color-purple: #a78bfa;
    --color-purple-dim: rgba(167, 139, 250, 0.08);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
}

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-secondary);
    min-height: 100vh;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

/* --- Navigation --- */
.dashboard-nav {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: 0;
    border-bottom: none;
}

.dashboard-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.dashboard-nav a:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.dashboard-nav a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* --- Chart Controls --- */
.chart-controls {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.chart-select {
    background: var(--bg-raised);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
}

.chart-select:hover {
    border-color: var(--text-muted);
}

.chart-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Splash Screen --- */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.splash-card {
    background: transparent;
    border: none;
    padding: var(--space-2xl) var(--space-xl);
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.splash-title {
    font-family: var(--font-sans);
    font-size: 2.6em;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.splash-subtitle {
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
    font-size: 0.95em;
    line-height: 1.6;
}

.splash-input-row {
    display: flex;
    gap: 0;
    justify-content: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.splash-input {
    min-width: 280px;
    width: 100%;
    max-width: 340px;
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.splash-button {
    padding: 10px 28px;
    font-weight: 600;
    background: var(--text-primary);
    color: var(--bg);
    border: 1px solid var(--text-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.splash-button:hover:enabled {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.splash-typing {
    margin-top: 20px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.82em;
    min-height: 20px;
    white-space: pre-wrap;
}

.splash-typing::after {
    content: '▌';
    margin-left: 2px;
    color: var(--text-muted);
    animation: splash-cursor 1s steps(2, start) infinite;
}

@keyframes splash-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Header --- */
header {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-family: var(--font-sans);
    font-size: 1.15em;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.account-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    font-size: 0.85em;
}

.account-display {
    color: var(--text-muted);
}

.account-display code {
    font-family: var(--font-mono);
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.account-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9em;
    flex-wrap: wrap;
}

.account-info .label {
    color: var(--text-muted);
}

.account-input {
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.account-input:focus {
    outline: none;
    border-color: var(--accent);
}

.account-input::placeholder {
    color: var(--text-muted);
}

.account-status {
    color: var(--text-muted);
    font-size: 0.8em;
}

/* --- Cards — clean sections with breathing room --- */
.card {
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    padding: var(--space-lg) 0;
    margin-bottom: 0;
}

.card h2 {
    font-family: var(--font-sans);
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0;
    color: var(--text-muted);
    border-bottom: none;
    padding-bottom: 0;
}

/* --- Collapsible Sections --- */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: opacity var(--transition-fast);
}

.collapsible-header:hover {
    opacity: 0.7;
}

.collapsible-header.expanded .chevron {
    transform: rotate(90deg);
}

.chevron {
    display: inline-block;
    font-size: 0.55em;
    color: var(--text-muted);
    transition: transform var(--transition-base);
    width: 12px;
    text-align: center;
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity var(--transition-base);
    max-height: 10000px;
    opacity: 1;
    padding-top: 20px;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* --- Charts --- */
#chart-container,
.chart-container {
    width: 100%;
    min-height: 350px;
    overflow: visible;
}

#chart-plot {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
    position: relative;
}

/* Force Plotly SVG to fill container */
.chart-container .js-plotly-plot,
.chart-container .plot-container,
.chart-container .svg-container {
    width: 100% !important;
}

/* --- Subsection Titles --- */
.subtitle {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-bottom: var(--space-md);
}

.subsection-title {
    font-family: var(--font-sans);
    font-size: 0.75em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

/* --- Buttons — soft, rounded --- */
.terminal-button {
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 7px 16px;
    font-family: var(--font-sans);
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.terminal-button:hover:enabled {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.terminal-button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-sm);
}

/* --- Summary Grid — soft cards with subtle fills --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    margin-bottom: 0;
    background: var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-raised);
    border: none;
    padding: 16px 20px;
}

.summary-card:last-child {
    border-right: none;
}

.summary-value {
    font-family: var(--font-sans);
    font-size: 1.25em;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.summary-subtext {
    font-size: 0.78em;
    color: var(--text-muted);
}

.summary-label {
    font-size: 0.7em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

/* --- Asset Summary Grid --- */
.asset-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    margin-top: var(--space-md);
    margin-bottom: 0;
    background: var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* --- Asset Carousel --- */
.asset-carousel {
    position: relative;
    margin-top: var(--space-md);
}

.asset-carousel-track {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    background: var(--border);
    border-radius: var(--radius-lg);
    gap: 1px;
}

.asset-carousel-track::-webkit-scrollbar {
    display: none;
}

.asset-carousel-track .asset-card {
    min-width: 220px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: none;
    border-radius: 0;
}

.asset-carousel-track .asset-card:last-child {
    border-right: none;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    z-index: 2;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.carousel-arrow:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: var(--bg-raised);
}

.carousel-arrow.left {
    left: -16px;
}

.carousel-arrow.right {
    right: -16px;
}

.asset-card {
    background: var(--bg-raised);
    border: none;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.asset-card::after {
    content: '›';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    opacity: 0;
    transition: opacity var(--transition-fast), right var(--transition-fast);
}

.asset-card:hover::after {
    opacity: 1;
    right: 8px;
}

.asset-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.asset-card.selected {
    background: var(--accent-dim);
}

.asset-card.selected::after {
    opacity: 0;
}

/* Subtle one-time nudge on the first card */
@keyframes card-nudge {
    0%, 100% { background: var(--bg-raised); }
    50% { background: rgba(255, 255, 255, 0.06); }
}

.asset-carousel-track .asset-card:first-child:not(.selected) {
    animation: card-nudge 2s ease 1.5s 1;
}

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

.asset-symbol {
    font-family: var(--font-sans);
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
}

.asset-count {
    font-size: 0.72em;
    color: var(--text-muted);
}

.asset-card-metrics {
    display: grid;
    gap: 6px;
}

.asset-metric {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
}

.asset-metric-label {
    font-size: 0.68em;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.asset-metric-value {
    font-family: var(--font-sans);
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-secondary);
}

.asset-summary-apr {
    font-family: var(--font-sans);
    color: var(--accent);
    font-size: 0.9em;
    font-weight: 600;
}

.outcome-grid .asset-card {
    min-height: auto;
    gap: 4px;
}

.outcome-card .summary-subtext {
    display: block;
}

/* --- Suggestion Cards --- */
.suggestion-card {
    border: none;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-bottom: 0;
    background: transparent;
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    font-size: 0.9em;
}

.suggestion-asset {
    font-family: var(--font-sans);
    font-size: 1em;
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-balance {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-left: 10px;
}

.suggestion-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px;
    margin-top: var(--space-sm);
    background: var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.suggestion-option {
    background: var(--bg-raised);
    border: none;
    padding: 14px 16px;
    font-size: 0.85em;
    transition: background var(--transition-fast);
}

.suggestion-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.suggestion-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.suggestion-strike {
    font-family: var(--font-sans);
    font-size: 1em;
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    font-size: 0.85em;
}

.suggestion-metric {
    display: flex;
    flex-direction: column;
}

.suggestion-metric-label {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.suggestion-metric-value {
    font-family: var(--font-sans);
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-secondary);
}

.suggestion-metric-sub {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Badges — soft pills, no hard borders --- */
.suggestion-badge,
.rich-cheap-badge,
.status-badge,
.side-badge,
.strategy-badge,
.token-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72em;
    font-weight: 500;
    white-space: nowrap;
    border: none;
    border-radius: var(--radius-full);
}

/* Suggestion badges */
.suggestion-badge.excellent {
    background: var(--accent-dim);
    color: var(--accent);
}

.suggestion-badge.good {
    background: var(--color-warning-dim);
    color: var(--color-warning);
}

.suggestion-badge.balanced {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Rich/Cheap badges */
.rich-cheap-badge.rich {
    background: var(--color-error-dim);
    color: var(--color-error);
}

.rich-cheap-badge.cheap {
    background: var(--accent-dim);
    color: var(--accent);
}

.rich-cheap-badge.fair {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.rich-cheap-badge.slightly-rich {
    background: var(--color-orange-dim);
    color: var(--color-orange);
}

.rich-cheap-badge.slightly-cheap {
    background: rgba(163, 230, 53, 0.08);
    color: #a3e635;
}

/* Status badges */
.status-badge {
    margin-left: 6px;
}

.status-active {
    background: var(--accent-dim);
    color: var(--accent);
}

.status-expired {
    background: var(--color-error-dim);
    color: var(--color-error);
}

.status-default {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Side badges */
.side-buy {
    background: var(--accent-dim);
    color: var(--accent);
}

.side-sell {
    background: var(--color-orange-dim);
    color: var(--color-orange);
}

/* Strategy badges */
.strategy-covered-call {
    background: var(--color-cyan-dim);
    color: var(--color-cyan);
}

.strategy-cash-secured-put {
    background: var(--color-orange-dim);
    color: var(--color-orange);
}

.strategy-other {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Token badge */
.token-badge {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    font-size: 0.85em;
}

.data-table thead {
    border-bottom: 1px solid var(--border-strong);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 12px 10px 0;
    text-align: left;
}

.data-table td {
    padding: 10px 12px 10px 0;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.9em;
}

.data-table th:first-child,
.data-table td:first-child {
    padding-left: 0;
}

.table-subtext {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8em;
    margin-top: 2px;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

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

/* --- Pagination --- */
.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: var(--space-sm) 0;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.pager.bottom {
    margin-top: var(--space-sm);
}

.pager-btn {
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 5px 12px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.82em;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.pager-btn:hover:not(:disabled) {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.pager-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.pager-info {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    border-bottom: none;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 3px;
}

.tabs.tab-carousel {
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    flex-wrap: nowrap;
    margin-bottom: var(--space-md);
}

.tabs.tab-carousel::-webkit-scrollbar {
    display: none;
}

.tabs.tab-carousel .tab-button {
    flex-shrink: 0;
    white-space: nowrap;
}

.data-table th.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px;
}

.data-table th.sortable-header::after {
    content: "↕";
    position: absolute;
    right: 6px;
    color: var(--text-muted);
    font-size: 0.8em;
}

.data-table th.sortable-header.sorted-asc::after {
    content: "↑";
    color: var(--text-primary);
}

.data-table th.sortable-header.sorted-desc::after {
    content: "↓";
    color: var(--text-primary);
}

.tab-button {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82em;
    font-family: var(--font-sans);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tab-button:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-button.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.inventory-table {
    display: none;
}

.inventory-table.active {
    display: block;
}

/* --- Positions Detail --- */
.positions-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-top: var(--space-sm);
}

.positions-section {
    flex: 1;
}

@media (min-width: 1100px) {
    .positions-wrapper {
        flex-direction: row;
    }
}

.positions-detail {
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    padding: 20px 0 0;
    margin-top: var(--space-lg);
}

.positions-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.positions-detail-header h3 {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95em;
    color: var(--text-primary);
}

.detail-close {
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 0.78em;
    font-family: var(--font-sans);
    padding: 5px 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.detail-close:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.positions-detail-summary {
    margin-bottom: 20px;
}

.positions-detail-filters {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: 14px;
}

.expiry-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-sm);
}

.expiry-filter-card {
    background: var(--bg-raised);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    font-family: var(--font-sans);
    font-size: 0.82em;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
}

.expiry-filter-card:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.expiry-filter-card.active {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-dim);
}

.detail-grid {
    gap: 0;
}

.positions-heatmap {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    margin-bottom: 20px;
}

.chart-card {
    width: 100%;
}

.positions-detail-table {
    overflow-x: auto;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 0;
}

.modal-content {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    max-width: 1100px;
    width: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: var(--font-sans);
    font-size: 1em;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    border: none;
    padding: 0;
}

.modal-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-close {
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.82em;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.modal-subtext {
    color: var(--text-muted);
    font-size: 0.75em;
}

.modal-section {
    border: none;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    background: transparent;
}

.modal-section:first-child {
    border-top: none;
    padding-top: 0;
}

.modal-section h3 {
    font-family: var(--font-sans);
    margin-top: 0;
    margin-bottom: var(--space-sm);
    font-size: 0.75em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.modal-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.modal-table-wrapper {
    overflow-x: auto;
}

.modal-body .data-table {
    font-size: 0.78em;
}

/* --- States --- */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    margin: var(--space-sm) 0 var(--space-sm);
}

.loading {
    text-align: left;
    padding: var(--space-sm) 0;
    color: var(--text-muted);
    font-size: 0.85em;
}

.error {
    color: var(--color-error);
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: var(--color-error-dim);
    border-radius: var(--radius-md);
    font-size: 0.85em;
}

.warning {
    color: var(--color-warning);
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: var(--color-warning-dim);
    border-radius: var(--radius-md);
    font-size: 0.85em;
}

/* --- Docs Page --- */
.docs-section h2 {
    margin-bottom: 10px;
}

.docs-code {
    margin-top: var(--space-sm);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.82em;
    line-height: 1.55;
    padding: var(--space-md);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 320px;
}

.docs-code.expanded {
    max-height: none;
}

.docs-endpoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-sm);
}

.docs-address-row {
    display: flex;
    gap: 10px;
    margin: 10px 0 14px;
    flex-wrap: wrap;
}

.docs-address-input {
    min-width: 320px;
    max-width: 560px;
    width: 100%;
}

.docs-endpoint {
    display: block;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 14px;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.docs-endpoint:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.docs-endpoint strong {
    display: block;
    font-size: 0.9em;
    margin-bottom: var(--space-xs);
}

.docs-endpoint span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.76em;
    color: var(--text-muted);
}

.docs-output-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 8px;
    flex-wrap: wrap;
}

.docs-output-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.docs-open-endpoint.disabled {
    pointer-events: none;
    opacity: 0.4;
}

/* --- APY/Risk utility classes --- */
.apy-high { color: var(--accent); }
.apy-medium { color: var(--color-warning); }
.apy-low { color: var(--text-muted); }
.risk-low { color: var(--accent); }
.risk-medium { color: var(--color-warning); }
.risk-high { color: var(--color-error); }

/* --- Code --- */
code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.9em;
    background: none;
    padding: 0;
}
