/* ==========================================================================
   OptRL Warehouse Dashboard Design System (Vanilla CSS)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #07090e;
    --bg-panel: rgba(16, 22, 35, 0.65);
    --bg-header: rgba(10, 14, 23, 0.85);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(59, 130, 246, 0.4);
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #5e6875;
    
    /* Semantic Colors (Curated HSL) */
    --accent: hsl(210, 100%, 52%);       /* Electric Blue */
    --accent-glow: rgba(26, 115, 232, 0.35);
    --accent-secondary: #9f7aea;         /* Purple */
    --accent-4: #00d2ff;                 /* Cyan / Sky */
    
    --ok: #05c46b;                       /* Vibrant Green */
    --ok-glow: rgba(5, 196, 107, 0.3);
    
    --warning: #ffc048;                  /* Warm Amber */
    --danger: #ff5e57;                   /* Crimson Red */
    --danger-glow: rgba(255, 94, 87, 0.35);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Layout & Shadow constants */
    --panel-radius: 12px;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* App Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: radial-gradient(circle at 50% 0%, #151b2e 0%, var(--bg-main) 70%);
}

/* Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-accent {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #00d2ff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-left: 1px solid var(--text-muted);
    padding-left: 8px;
    margin-left: 4px;
}

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

.header-portal-btn {
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
    user-select: none;
}

.header-portal-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(217, 119, 6, 0.18) 100%);
    border-color: rgba(245, 158, 11, 0.65);
    color: #fef3c7;
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.header-portal-btn:active {
    transform: translateY(0);
}

.header-portal-btn .portal-arrow {
    font-size: 0.85rem;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.header-portal-btn:hover .portal-arrow {
    transform: translate(2px, -2px);
    opacity: 1;
}

.header-portal-btn .portal-badge-icon {
    font-size: 0.85rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.pulse-dot.green {
    background-color: var(--ok);
    box-shadow: 0 0 8px var(--ok);
    animation: dot-pulse 1.8s infinite;
}

.pulse-dot.blue {
    background-color: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: dot-pulse 1.8s infinite;
}

.pulse-dot.orange {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    animation: dot-pulse 1.8s infinite;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(159, 122, 234, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Dashboard Grid System */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(360px, 390px) 1fr minmax(330px, 360px);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 16px;
    gap: 16px;
}

/* Panel Structure */
.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--panel-radius);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-premium);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: rgba(10, 14, 23, 0.4);
    border-bottom: 1px solid var(--border-glass);
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.badge.success {
    color: var(--ok);
    border-color: rgba(5, 196, 107, 0.2);
    background-color: rgba(5, 196, 107, 0.05);
}

.badge.running {
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.2);
    background-color: rgba(59, 130, 246, 0.05);
}

.badge.queued {
    color: var(--warning);
    border-color: rgba(255, 192, 72, 0.2);
    background-color: rgba(255, 192, 72, 0.05);
}

.badge.failed {
    color: var(--danger);
    border-color: rgba(255, 94, 87, 0.2);
    background-color: rgba(255, 94, 87, 0.05);
}

.panel-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.panel-content.scrollable {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 16px;
    gap: 16px;
}

/* Accordion (Folding Config Sections) */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-item {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.01);
    transition: var(--transition-smooth);
}

.accordion-item.active {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

.accordion-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}

.accordion-title h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accordion-title .arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.accordion-item.active .accordion-title .arrow {
    transform: rotate(0deg);
}

.accordion-content {
    padding: 14px;
    border-top: 1px solid var(--border-glass);
    display: none;
    flex-direction: column;
    gap: 12px;
}

.accordion-item.active .accordion-content {
    display: flex;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
}

.form-row.single-col {
    grid-template-columns: 1fr;
}

.form-hint {
    font-size: 0.69rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: block;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

input[type="number"], input[type="text"], input[type="password"], select, textarea {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

select {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

select optgroup {
    background: #0d121f;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.76rem;
    padding: 6px 0;
}

select option {
    background: #111827;
    color: #f1f5f9;
    font-size: 0.8rem;
    padding: 4px 6px;
}

select option:disabled {
    color: #64748b;
    background: #0b0f19;
}

input[type="number"]:focus, input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--border-focus);
}

/* Tactile Checkbox Cards */
.tactile-checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.tactile-checkbox-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
}

.tactile-checkbox-card input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.tactile-checkbox-card .toggle-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tactile-checkbox-card .toggle-card-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.25;
}

.tactile-checkbox-card .toggle-card-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.tactile-checkbox-card:has(input:checked) {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.04);
}

/* Range Input Custom Styling */
.range-group {
    gap: 4px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-val {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-4);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
    margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 4px var(--accent);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Section Dividers inside Accordion */
.section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 4px;
}

.section-title-bar h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Shelves Configuration Row */
.shelves-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 4px;
}

.shelf-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 32px;
    gap: 6px;
    align-items: center;
}

.shelf-row .shelf-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.shelf-row input {
    padding: 4px 6px;
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 6px;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background-color: hsl(210, 100%, 42%);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(159, 122, 234, 0.25);
}

.btn-accent:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(159, 122, 234, 0.35);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px var(--danger-glow);
}

.btn-danger:hover:not(:disabled) {
    background-color: #e55047;
}

.btn-ghost {
    background-color: transparent;
    border-color: var(--border-glass);
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-tiny {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass);
    color: var(--text-secondary);
}

.btn-tiny:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-delete {
    background-color: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-delete:hover {
    color: var(--danger);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* Hyperparams Block */
.hyperparams-section {
    margin-top: 10px;
}

.hyperparam-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
}

.hyperparam-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.hyperparam-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.hyperparam-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hyperparam-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.hyperparam-row input.algo-param-input {
    width: 96px;
    min-width: 96px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-align: right;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #f1f5f9;
}

.hyperparam-row input[type="checkbox"].algo-param-input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Hyperparameters Default Banner (Basic Mode) */
.hyperparams-default-banner {
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.banner-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #60a5fa;
}

.banner-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 2px 0;
}

.param-chip {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.banner-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin: 0;
}

/* Panel 2 Layout: Visualizer */
.panel-visualizer {
    grid-column: 2;
    min-height: 0;
}

.visualizer-content {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.visualizer-stage-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.grid-dimensions-display {
    position: absolute;
    top: 10px;
    left: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: rgba(10, 14, 23, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-glass);
    z-index: 2;
}

.svg-container {
    width: 90%;
    height: 90%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
}

/* Grid Cell Styles */
.grid-cell {
    transition: fill 0.3s ease;
}

.grid-cell-line {
    stroke: rgba(255, 255, 255, 0.02);
    stroke-width: 1;
}

/* Replay Console */
.replay-console {
    background-color: rgba(0,0,0,0.45);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    height: 130px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-mono);
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background-color: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.console-clear {
    cursor: pointer;
}

.console-clear:hover {
    color: var(--text-primary);
}

.console-body {
    padding: 8px 12px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
}

.console-line {
    color: var(--text-secondary);
}

.console-line.system {
    color: var(--accent-4);
}

.console-line.action {
    color: var(--accent-secondary);
}

.console-line.success {
    color: var(--ok);
}

.console-line.error {
    color: var(--danger);
}

.visualizer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
    flex-shrink: 0;
    background: transparent;
    position: relative;
    z-index: 5;
}

.control-btn-group {
    display: flex;
    gap: 8px;
}

.speed-control-wrapper {
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-glass);
    padding: 2px 10px;
    border-radius: 8px;
}

.speed-control-wrapper label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.speed-control-wrapper select {
    background: transparent;
    border: none;
    padding: 2px 6px;
    font-size: 0.75rem;
    height: 28px;
    width: auto;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

.speed-control-wrapper select:focus {
    outline: none;
    box-shadow: none;
}

.speed-control-wrapper input[type="date"],
.speed-control-wrapper input[type="number"] {
    background: transparent;
    border: none;
    padding: 2px 6px;
    font-size: 0.75rem;
    height: 28px;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    color-scheme: dark;
}

.speed-control-wrapper input[type="date"]:focus,
.speed-control-wrapper input[type="number"]:focus {
    outline: none;
    box-shadow: none;
}

.goal-badge-hit {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #10b981 !important;
    border: 1px solid #10b981 !important;
}

.goal-badge-breached {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    border: 1px solid #ef4444 !important;
}

.goal-badge-running {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
    border: 1px solid #3b82f6 !important;
}


/* Panel 3: Metrics */
.panel-metrics {
    grid-column: 3;
}

/* KPI Dashboard Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.kpi-card {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-card.card-compact {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 12px 14px;
}

.kpi-value-container {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-number {
    position: absolute;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.kpi-large-number {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.1;
}

.kpi-large-number.text-ink {
    color: var(--accent);
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kpi-subtext {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Progress Rings SVG */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

/* Chart Wrapper */
.chart-wrapper {
    background-color: rgba(0,0,0,0.2);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title-bar h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.chart-title-bar span {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
}

.chart-container {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chart-path.line {
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 2px 4px var(--accent-glow));
}

.chart-path.shadow {
    stroke: var(--accent);
    stroke-width: 3;
    opacity: 0.15;
    filter: blur(2px);
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.03);
    stroke-width: 0.5;
}

.chart-axis {
    stroke: var(--text-muted);
    stroke-width: 0.5;
}

.chart-dot {
    fill: var(--accent);
    stroke: var(--bg-main);
    stroke-width: 1;
    transition: transform 0.1s ease;
}

.chart-dot:hover {
    transform: scale(1.4);
}

/* History Wrapper */
.history-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.history-item {
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.history-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(159, 122, 234, 0.06));
    border-color: rgba(59, 130, 246, 0.3);
}

.history-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 24px 0;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--transition-smooth);
}

.modal {
    background-color: #0d131f;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    width: 420px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    animation: modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: rgba(0,0,0,0.25);
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

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

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

/* Keyframe Animations */
@keyframes dot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        box-shadow: 0 0 12px currentColor;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

@keyframes modal-enter {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar Styling - High-contrast, sleek, and visible scrollbar sliders */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.45) rgba(10, 14, 23, 0.5);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 14, 23, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ==========================================================================
   Pickup, Drop, and Invalid Action Animation Effects
   ========================================================================== */

/* Visual Flash animations for shelf and drop-off */
@keyframes flash-pickup-anim {
    0% {
        fill: rgba(255, 192, 72, 0.7);
        stroke: var(--warning);
        stroke-width: 3;
    }
    100% {
        fill: rgba(255, 192, 72, 0.15);
        stroke: var(--warning);
        stroke-width: 1;
    }
}
.flash-pickup {
    animation: flash-pickup-anim 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes flash-dropoff-anim {
    0% {
        fill: rgba(5, 196, 107, 0.7);
        stroke: var(--ok);
        stroke-width: 4;
    }
    100% {
        fill: rgba(5, 196, 107, 0.15);
        stroke: var(--ok);
        stroke-width: 1.5;
    }
}
.flash-dropoff {
    animation: flash-dropoff-anim 0.9s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes flash-invalid-anim {
    0% {
        fill: rgba(255, 94, 87, 0.9);
        stroke: var(--danger);
        stroke-width: 3;
        filter: drop-shadow(0 0 12px var(--danger));
    }
    100% {
        fill: var(--accent-glow);
        stroke: var(--accent);
        stroke-width: 1.5;
        filter: url(#robot-glow);
    }
}
.flash-invalid {
    animation: flash-invalid-anim 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Expanding ripple rings on action execution */
.ripple-circle {
    fill: none;
    stroke-linecap: round;
    animation: ripple-anim 0.7s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes ripple-anim {
    0% {
        r: 4px;
        stroke-width: 3px;
        opacity: 0.9;
    }
    100% {
        r: 28px;
        stroke-width: 0.5px;
        opacity: 0;
    }
}

/* Mode Toggle Switch Styling */
.mode-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    transition: var(--transition-smooth);
}

.advanced-toggle-label:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.mode-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    transition: var(--transition-smooth);
}

.mode-badge.active {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.switch-wrapper {
    position: relative;
    width: 32px;
    height: 18px;
}

.switch-wrapper input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    top: 2px;
    background-color: #cbd5e1;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.switch-wrapper input:checked + .switch-slider {
    background: var(--accent);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.switch-wrapper input:checked + .switch-slider:before {
    transform: translateX(14px);
    background-color: #ffffff;
}

/* Preset button styles */
.preset-btn, .cash-preset-btn {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.preset-btn:hover, .cash-preset-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.preset-btn.active, .cash-preset-btn.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

/* Product Tour Styles */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.tour-overlay.hidden {
    display: none;
    opacity: 0;
}

.tour-card {
    position: absolute;
    width: 320px;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(5, 196, 107, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.tour-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tour-step-counter {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.tour-body {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.tour-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.tour-highlight {
    position: relative !important;
    z-index: 10001 !important;
    box-shadow: 0 0 0 4px var(--accent), 0 8px 24px rgba(0, 0, 0, 0.6) !important;
    background: rgba(25, 25, 35, 0.95) !important;
    pointer-events: none !important;
}

/* Tooltip info styling for rating card */
#kpi-rating-card {
    transition: var(--transition-smooth);
}
#kpi-rating-card:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Env Selector Tab Button States */
.env-tabs .tab-btn {
    transition: var(--transition-smooth);
}
.env-tabs .tab-btn:hover {
    color: #fff !important;
}
.env-tabs .tab-btn.active {
    background: var(--accent) !important;
    color: #fff !important;
}

/* Trading Holdings Table Styling */
.trading-table th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
}
.trading-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.trading-table tbody tr {
    transition: background-color 0.15s ease;
}
.trading-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.text-green {
    color: var(--ok) !important;
}
.text-red {
    color: var(--danger) !important;
}




/* ==========================================================================
   Training + trading chart upgrade (2026-07): reward curve legend/ticks,
   PV replay timeline with buy/sell markers, daily ledger + signal tables.
   Mark specs: 2px lines round cap, hairline solid grid one step off surface,
   markers >= 8px with a 2px surface ring, text wears text tokens only.
   ========================================================================== */

.chart-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 4px 6px;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.legend-key {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-line {
    stroke-width: 2;
    stroke-linecap: round;
}

.legend-line.raw {
    stroke: var(--accent-secondary);
    opacity: 0.65;
}

.legend-line.smooth {
    stroke: var(--accent);
}

.legend-note {
    color: var(--text-muted);
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.64rem;
}

.chart-path.raw-line {
    stroke: var(--accent-secondary);
    stroke-width: 1;
    stroke-linecap: round;
    opacity: 0.55;
}

.chart-ticks text {
    fill: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 7px;
    font-variant-numeric: tabular-nums;
}

.chart-crosshair {
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 1;
    pointer-events: none;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 14, 23, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 30;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.chart-tooltip .tt-title {
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.chart-tooltip .tt-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-tooltip .tt-key {
    display: inline-block;
    width: 12px;
    height: 2px;
    border-radius: 1px;
}

.chart-tooltip .tt-val {
    font-weight: 700;
}

.chart-tooltip .tt-label {
    color: var(--text-secondary);
}

/* --- PV replay chart -------------------------------------------------- */

.pv-chart-card,
.trade-table-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 12px;
    flex-shrink: 0;
}

.chart-container.pv-chart-container {
    position: relative;
    width: 100%;
    /* .chart-container fixes height at 100px and centers its child: the
       190px PV svg would bleed over the title above and the card below. */
    height: 190px;
}

#pv-chart {
    width: 100%;
    height: 190px;
    display: block;
}

.pv-line {
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.pv-area {
    fill: var(--accent);
    opacity: 0.08;
    stroke: none;
}

.pv-grid-line {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.pv-day-line {
    stroke: rgba(255, 255, 255, 0.10);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.pv-day-label {
    fill: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.pv-tick-label {
    fill: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.pv-marker.buy {
    fill: var(--ok);
    stroke: var(--bg-main);
    stroke-width: 2;
}

.pv-marker.sell {
    fill: var(--danger);
    stroke: var(--bg-main);
    stroke-width: 2;
}

.signal-glyph {
    font-size: 0.72rem;
    line-height: 1;
}

.signal-glyph.buy { color: var(--ok); }
.signal-glyph.sell { color: var(--danger); }

.trade-table-scroll {
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    background: rgba(10, 14, 23, 0.4);
}

.trading-table {
    border-collapse: separate;
    border-spacing: 0;
}

.trading-table th,
.trade-thead-row th {
    position: sticky;
    top: 0;
    background: #0f1523;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 3;
    font-weight: 600;
}

.trade-thead-row {
    position: sticky;
    top: 0;
    z-index: 3;
}

.trading-table td {
    font-variant-numeric: tabular-nums;
}

.signal-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
}

.signal-chip.buy {
    color: var(--ok);
    background: rgba(5, 196, 107, 0.12);
}

.signal-chip.sell {
    color: var(--danger);
    background: rgba(255, 94, 87, 0.12);
}

.pnl-pos { color: var(--ok); }
.pnl-neg { color: var(--danger); }

/* ==========================================================================
   Smart Portfolio Management System (Institutional Cyber-Utilitarian)
   ========================================================================== */

/* Executive Portfolio Ribbon (Bloomberg-style High-Density Bar) */
.spm-executive-ribbon {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    background: linear-gradient(180deg, #0b1120 0%, #080d19 100%);
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.spm-ribbon-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.spm-ribbon-tile:last-child {
    border-right: none;
}

.spm-ribbon-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.spm-ribbon-val {
    font-family: var(--font-mono, monospace);
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.spm-ribbon-val.accent {
    color: #38bdf8;
}

.spm-ribbon-val.ok {
    color: #34d399;
}

.spm-ribbon-val.warning {
    color: #fbbf24;
}

.spm-ribbon-val.danger {
    color: #fb7185;
}

.spm-ribbon-sub {
    font-size: 0.65rem;
    font-family: var(--font-mono, monospace);
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.spm-ribbon-sub.ok {
    color: #34d399;
}

.spm-ribbon-sub.warning {
    color: #fbbf24;
}

.spm-ribbon-sub.danger {
    color: #fb7185;
}

/* Institutional Workspace Sub-Navigation */
.spm-nav-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(11, 17, 32, 0.75);
    padding: 4px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.spm-nav-tab {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
    white-space: nowrap;
}

.spm-nav-tab:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.04);
}

.spm-nav-tab.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Sub-view Section Container */
.spm-view-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spm-view-section.hidden {
    display: none !important;
}

/* Institutional Badge Pill */
.spm-badge-icon {
    font-family: var(--font-mono, monospace);
    font-size: 0.60rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(56, 189, 248, 0.14);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    text-transform: uppercase;
}

/* Portfolio Manager Advisory Desk Card */
.pm-advisory-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(10, 15, 29, 0.96) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.pm-perf-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(0, 0, 0, 0.32);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.pm-perf-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pm-perf-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.pm-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.pm-indicator-dot.perf {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.pm-indicator-dot.underperf {
    background: #f43f5e;
    box-shadow: 0 0 6px #f43f5e;
}

.pm-chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
    align-items: center;
}

.pm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.70rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    transition: background 0.2s, border-color 0.2s;
}

.pm-chip.perf {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.38);
}

.pm-chip.underperf {
    background: rgba(244, 63, 94, 0.14);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.38);
}

.pm-chip.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
    font-size: 0.68rem;
    font-family: inherit;
}

.pm-chip-score {
    font-size: 0.65rem;
    opacity: 0.9;
}

.pm-outlook-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pm-outlook-card {
    background: rgba(13, 20, 36, 0.65);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pm-outlook-card.tactical {
    border-left: 3px solid #38bdf8;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.05) 0%, rgba(13, 20, 36, 0.7) 100%);
}

.pm-outlook-card.strategic {
    border-left: 3px solid #c084fc;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.05) 0%, rgba(13, 20, 36, 0.7) 100%);
}

.pm-outlook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pm-outlook-badge {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 3px;
}

.pm-outlook-badge.tactical {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.pm-outlook-badge.strategic {
    background: rgba(192, 132, 252, 0.18);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.pm-outlook-meta {
    font-size: 0.64rem;
    color: var(--text-muted);
}

.pm-outlook-body {
    font-size: 0.74rem;
    line-height: 1.45;
    color: #e2e8f0;
}

.pm-macro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.pm-macro-tile {
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-macro-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pm-macro-val {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.pm-macro-val.accent {
    color: #38bdf8;
}

.pm-macro-val.warning {
    color: #fbbf24;
}

.pm-macro-val.ok {
    color: #34d399;
}

.pm-macro-val.danger {
    color: #fb7185;
}

.pm-macro-sub {
    font-size: 0.64rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.pm-macro-sub.ok {
    color: #34d399;
}

.pm-macro-sub.accent {
    color: #38bdf8;
}

.pm-macro-sub.warning {
    color: #fbbf24;
}

.pm-macro-sub.danger {
    color: #fb7185;
}

.pm-executive-summary {
    font-size: 0.74rem;
    color: #e0f2fe;
    background: rgba(14, 165, 233, 0.08);
    border-left: 3px solid #0ea5e9;
    padding: 8px 12px;
    border-radius: 4px;
    line-height: 1.45;
}

.pm-table-wrapper {
    max-height: 240px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
}

.pm-table th {
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.pm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
}

.pm-badge-buy {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.pm-badge-sell {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.4);
}

.pm-badge-hold {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.pm-badge-flat {
    background: rgba(71, 85, 105, 0.18);
    color: #94a3b8;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.pm-asset-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-asset-sym {
    font-weight: 700;
    color: #fff;
    font-size: 0.76rem;
    font-family: var(--font-mono, monospace);
}

.pm-asset-tag {
    font-size: 0.60rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 2px;
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pm-asset-tag.perf {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.pm-asset-tag.underperf {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
}

.pm-asset-tag.neutral {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

.pm-alloc-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 105px;
}

.pm-alloc-nums {
    display: flex;
    justify-content: space-between;
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
}

.pm-alloc-bar-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.pm-alloc-bar-fill {
    height: 100%;
    background: #38bdf8;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pm-conviction-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.pm-conviction-bar {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.pm-conviction-fill {
    height: 100%;
    background: #f59e0b;
    border-radius: 2px;
}

.pm-rationale-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 280px;
}

.pm-rationale-outlook {
    font-size: 0.65rem;
    font-weight: 600;
    color: #93c5fd;
    line-height: 1.3;
}

.pm-rationale-text {
    font-size: 0.66rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Holdings & Allocation Card Styling */
.spm-holdings-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(10, 15, 29, 0.96) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.spm-holdings-table th {
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.spm-holdings-table td {
    padding: 8px 10px;
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.spm-holdings-table td:first-child {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    color: #fff;
}

@media (max-width: 1024px) {
    .spm-executive-ribbon {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .spm-executive-ribbon {
        grid-template-columns: 1fr;
    }
    .pm-perf-banner,
    .pm-outlook-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Inventory (donut shops) replay stage
   ========================================================================== */

/* Shared replay summary bar: inventory + trading stages use the same shell. */
.inv-summary-bar,
.portfolio-summary-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    font-size: 0.85rem;
}
.inv-summary-bar strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.portfolio-summary-bar strong { font-variant-numeric: tabular-nums; }
#inv-now-shop { color: var(--accent-4); }

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

.inv-shop-empty {
    grid-column: 1 / -1;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border: 1px dashed var(--border-glass);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.15);
}

.inv-shop-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: rgba(16, 22, 35, 0.55);
    transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
    opacity: 0.72;
    min-width: 0;
}

.inv-shop-card.active {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow), 0 6px 20px rgba(0, 0, 0, 0.35);
}

.inv-shop-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
}

.inv-shop-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.inv-shop-sub { font-size: 0.66rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.inv-capacity { display: flex; align-items: center; gap: 6px; }

.inv-capacity-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.inv-capacity-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-4));
    transition: width 0.35s ease;
}

.inv-capacity-label { font-size: 0.62rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Aisle of product tiles */
.inv-aisle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    max-height: 210px;
    overflow-y: auto;
    padding-right: 2px;
}

.inv-tile {
    padding: 5px 6px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border-glass);
    border-left: 2px solid transparent;
    min-width: 0;
}

.inv-tile.perishable { border-left-color: var(--warning); }
.inv-tile.essential { border-left-color: var(--accent-4); }

.inv-tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.inv-tile-name { font-size: 0.68rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-tile-price { font-size: 0.64rem; color: var(--ok); font-variant-numeric: tabular-nums; }

.inv-tile-bar {
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    margin: 4px 0 3px;
}

.inv-tile-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent-4);
    transition: width 0.35s ease, background 0.2s;
}
.inv-tile-fill.expiring { background: var(--warning); }
.inv-tile-fill.empty { background: var(--danger); }

.inv-tile-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.inv-tile-onhand { font-weight: 700; color: var(--text-primary); }
.inv-tile-badges { display: flex; gap: 3px; flex-wrap: wrap; }

.inv-badge {
    padding: 0 4px;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.inv-badge.promo { color: var(--accent-4); background: rgba(0, 210, 255, 0.14); }
.inv-badge.waste { color: var(--danger); background: rgba(255, 94, 87, 0.14); }
.inv-badge.lost { color: var(--warning); background: rgba(255, 192, 72, 0.14); }

/* Sale / expiry flashes */
@keyframes invFlashSold {
    0% { box-shadow: inset 0 0 0 1px var(--ok), 0 0 10px var(--ok-glow); }
    100% { box-shadow: none; }
}
@keyframes invFlashExpired {
    0% { box-shadow: inset 0 0 0 1px var(--danger), 0 0 10px var(--danger-glow); }
    100% { box-shadow: none; }
}
.inv-tile.flash-sold { animation: invFlashSold 0.6s ease-out; }
.inv-tile.flash-expired { animation: invFlashExpired 0.6s ease-out; }

/* Orders / in-transit */
.inv-orders { display: flex; flex-direction: column; gap: 4px; }
.inv-orders-title { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.inv-orders-list { display: flex; flex-wrap: wrap; gap: 4px; }
.inv-order-chip {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(26, 115, 232, 0.12);
    color: var(--text-primary);
    border: 1px solid rgba(26, 115, 232, 0.25);
    font-variant-numeric: tabular-nums;
}
.inv-order-transit { color: var(--text-secondary); }
.inv-order-none { font-size: 0.62rem; color: var(--text-muted); }

/* Movement chart */
.inv-line-onhand { stroke: var(--accent-4); stroke-width: 2; fill: none; }
.inv-line-demand { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; opacity: 0.9; }
.inv-line-sold { stroke: var(--ok); stroke-width: 2; fill: none; }
.legend-line.inv-key-onhand { stroke: var(--accent-4); stroke-width: 2; }
.legend-line.inv-key-demand { stroke: var(--warning); stroke-width: 2; stroke-dasharray: 4 3; }
.legend-line.inv-key-sold { stroke: var(--ok); stroke-width: 2; }
.inv-gridline { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.inv-tick { fill: var(--text-muted); font-size: 9px; font-family: "JetBrains Mono", monospace; }
.inv-band-label { fill: var(--text-secondary); font-weight: 700; }
.inv-shop-band { fill: rgba(255, 255, 255, 0.025); }

/* Impact reveal (after parallel replay finishes) */
.inv-impact {
    margin-top: 4px;
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border-glass);
    background:
        radial-gradient(120% 100% at 20% 0%, rgba(26,115,232,0.10), transparent 60%),
        rgba(16, 22, 35, 0.6);
}
.inv-impact.reveal { animation: invImpactIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes invImpactIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.inv-impact-eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--accent-4); font-weight: 600;
}
.inv-impact-head h3 { margin: 6px 0 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text-primary); }
.inv-impact-head .ii-hit {
    background: linear-gradient(100deg, var(--accent), var(--accent-4));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.inv-impact-live {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 4px;
}
@media (max-width: 720px) { .inv-impact-live { grid-template-columns: repeat(2, 1fr); } }
.ii-stat {
    background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border-glass);
    border-left: 3px solid var(--ok); border-radius: 10px; padding: 12px 14px;
}
.ii-big {
    font-family: "JetBrains Mono", monospace; font-weight: 700;
    font-size: 1.5rem; line-height: 1; color: var(--ok); font-variant-numeric: tabular-nums;
}
.ii-lab { margin-top: 6px; font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; }

.inv-impact-table-scroll { overflow-x: auto; margin: 16px 0 4px; border-radius: 10px; border: 1px solid var(--border-glass); }
.inv-impact-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; font-size: 0.8rem; }
.inv-impact-table th, .inv-impact-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-glass); }
.inv-impact-table thead th { font-weight: 800; color: var(--text-secondary); font-size: 0.82rem; }
.inv-impact-table tbody td:first-child {
    color: var(--text-muted); font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem; font-weight: 600; width: 150px;
}
.inv-impact-table td.dim { color: var(--text-secondary); }
.inv-impact-table th.rl, .inv-impact-table td.rl {
    background: rgba(26, 115, 232, 0.12);
    border-left: 1px solid rgba(26, 115, 232, 0.3); border-right: 1px solid rgba(26, 115, 232, 0.3);
}
.inv-impact-table th.rl { color: var(--text-primary); }
.inv-impact-table td.rl { color: var(--text-primary); font-weight: 600; }
.inv-impact-table tbody tr:last-child td { border-bottom: none; }
.inv-impact-table .no { color: var(--danger); font-weight: 700; }
.inv-impact-table .yes { color: var(--ok); font-weight: 700; }

.inv-impact-loop { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 2px; font-size: 0.78rem; }
.ii-flow { font-family: "JetBrains Mono", monospace; }
.ii-flow.dim { color: var(--text-muted); }
.ii-flow.on { color: var(--accent-4); }
.ii-flow.on b { color: var(--ok); }
.ii-x { color: var(--danger); }

.inv-impact-foot { margin: 12px 0 0; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.55; }
.inv-impact-foot b { color: var(--text-primary); }

/* ==========================================================================
   Responsive Design & Enhanced Slider Styling
   ========================================================================== */

/* Enhanced Range Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
    margin: 6px 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
    border: 2px solid #ffffff;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.9);
}

input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
    border: 2px solid #ffffff;
    cursor: pointer;
}

/* Hyperparam Cards with Sliders */
.hyperparam-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hyperparam-card:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(59, 130, 246, 0.3);
}

.hyperparam-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: #90caf9;
}

.hyperparam-card input[type="number"] {
    width: 96px;
    min-width: 96px;
    padding: 3px 6px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    text-align: right;
}

/* Step Presets */
.step-presets {
    display: flex;
    gap: 4px;
}

.preset-btn {
    padding: 3px 6px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #90caf9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    color: #fff;
}

.preset-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Responsive Breakpoints */
@media (max-width: 1360px) {
    .dashboard-grid {
        grid-template-columns: 350px 1fr 300px;
        gap: 12px;
        padding: 12px;
    }
}

@media (max-width: 1140px) {
    .dashboard-grid {
        grid-template-columns: 330px 1fr;
        overflow-y: auto;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    .panel-metrics {
        grid-column: 1 / -1;
    }

    .panel-visualizer {
        min-height: 440px;
    }
}

@media (max-width: 860px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
        height: auto;
        min-height: calc(100vh - 60px);
        padding: 10px;
        gap: 12px;
    }

    .panel-visualizer,
    .panel-metrics {
        grid-column: 1;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        gap: 10px;
        padding: 10px 14px;
    }

    .header-status {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .env-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
}

@media (max-width: 540px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

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

    .chart-legend {
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-height: 720px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
    .app-container {
        height: auto;
        min-height: 100vh;
    }
    .dashboard-grid {
        height: auto;
        min-height: 600px;
    }
}

/* Market Universe & Rolling Momentum Screener (Robinhood/Groww style) */
.universe-screener-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.universe-screener-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.universe-screener-desc {
    margin: 0;
    font-size: 0.69rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.universe-quick-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px 6px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.universe-action-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.67rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.universe-action-btn:hover {
    background: #334155;
    color: #ffffff;
}

.universe-action-btn.perf-btn:hover {
    border-color: rgba(16, 185, 129, 0.6);
    color: #34d399;
}

.universe-action-btn.underperf-btn:hover {
    border-color: rgba(244, 63, 94, 0.6);
    color: #fb7185;
}

.universe-action-btn.core-btn:hover {
    border-color: rgba(59, 130, 246, 0.6);
    color: #60a5fa;
}

.universe-action-btn.lowvol-btn:hover {
    border-color: rgba(14, 165, 233, 0.6);
    color: #38bdf8;
}

.universe-action-btn.clear-btn:hover {
    border-color: rgba(239, 68, 68, 0.6);
    color: #f87171;
}

.universe-sector-ribbon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 6px;
    background: rgba(15, 23, 42, 0.45);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    overflow-x: auto;
    white-space: nowrap;
}

.universe-sector-pills {
    display: flex;
    gap: 5px;
    align-items: center;
}

.universe-sector-pill {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.universe-sector-pill:hover, .universe-sector-pill.active {
    background: #283548;
    border-color: #3b82f6;
    color: #ffffff;
}

.universe-sector-pill .pill-ret {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
}

.universe-dropdown-filters {
    display: flex;
    gap: 4px;
    align-items: center;
}

.universe-select-filter {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.67rem;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.universe-select-filter:focus {
    border-color: #3b82f6;
}

.univ-card-tags {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.univ-tag {
    font-size: 0.56rem;
    padding: 0 4px;
    border-radius: 2px;
    background: rgba(51, 65, 85, 0.6);
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.univ-tag.vol-low {
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.15);
}

.univ-tag.vol-high {
    color: #f97316;
    background: rgba(249, 115, 22, 0.15);
}

.universe-screener-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 2px;
}

.universe-filter-tabs {
    display: flex;
    gap: 4px;
}

.universe-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.universe-tab:hover {
    color: #f1f5f9;
}

.universe-tab.active {
    background: #243049;
    border-color: #3b82f6;
    color: #60a5fa;
}

.universe-summary-stats {
    display: flex;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.univ-stat-item strong {
    font-family: var(--font-mono, monospace);
    color: #34d399;
}

.universe-ticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.universe-ticker-card {
    background: #141b2d;
    border: 1px solid #232d42;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
}

.universe-ticker-card:hover {
    background: #1c263e;
    border-color: #3b5078;
    transform: translateY(-1px);
}

.universe-ticker-card.selected {
    background: rgba(59, 130, 246, 0.14);
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

.univ-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.univ-card-sym {
    font-family: var(--font-mono, monospace);
    font-weight: 700;
    font-size: 0.78rem;
    color: #f1f5f9;
}

.universe-ticker-card.selected .univ-card-sym {
    color: #60a5fa;
}

.univ-card-check {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: color 0.15s;
}

.universe-ticker-card.selected .univ-card-check {
    color: #3b82f6;
}

.univ-card-name {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.univ-card-metrics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.univ-card-price {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    color: #cbd5e1;
}

.univ-card-ret {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 700;
}

.univ-card-ret.positive {
    color: #34d399;
}

.univ-card-ret.negative {
    color: #f87171;
}

.univ-card-ret.neutral {
    color: var(--text-muted);
}

.univ-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
    font-size: 0.60rem;
    color: #64748b;
}

.univ-badge {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.univ-badge.perf {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.univ-badge.underperf {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.35);
}

.univ-badge.neutral {
    background: rgba(100, 116, 139, 0.18);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* ==========================================================================
   Stock Trading User Persona Redesign (Clean, Purpose-Driven Fintech)
   ========================================================================== */

/* Strategy Preset Grid */
.strategy-preset-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.strategy-card {
    background: linear-gradient(180deg, #111827 0%, #0c121e 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    user-select: none;
}

.strategy-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: #141d2e;
    transform: translateY(-1px);
}

.strategy-card.active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.strategy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.strategy-card-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.strategy-card.active .strategy-card-title {
    color: #38bdf8;
}

.strategy-card-badge {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.strategy-card-tickers {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
}

.strategy-card-desc {
    font-size: 0.64rem;
    color: #94a3b8;
    line-height: 1.35;
}

.strategy-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.62rem;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--font-mono, monospace);
}

.strategy-card-meta .target {
    color: #34d399;
    font-weight: 700;
}

.strategy-card-meta .risk {
    color: #94a3b8;
}

/* Clean Collapsible Details Drawer */
details.clean-details {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    margin: 10px 0;
    overflow: hidden;
    transition: border-color 0.2s;
}

details.clean-details[open] {
    border-color: rgba(56, 189, 248, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

details.clean-details summary {
    padding: 8px 12px;
    font-size: 0.73rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color 0.15s, background-color 0.15s;
}

details.clean-details summary::-webkit-details-marker {
    display: none;
}

details.clean-details summary:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.03);
}

details.clean-details[open] summary {
    color: #38bdf8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

details.clean-details summary .drawer-indicator {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

details.clean-details[open] summary .drawer-indicator {
    transform: rotate(90deg);
}

.clean-details-content {
    padding: 10px 12px;
}

/* Stacked Visual Allocation Bar in Holdings */
.spm-alloc-bar-container {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.spm-alloc-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.spm-alloc-bar-header strong {
    color: #f1f5f9;
}

.spm-alloc-stacked-bar {
    height: 18px;
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spm-alloc-segment {
    height: 100%;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.spm-alloc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.66rem;
    color: var(--text-secondary);
}

.spm-alloc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono, monospace);
}

.spm-alloc-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

/* Clean Replay Controls Toolbar Styling */
.replay-options-toggle-btn {
    font-size: 0.70rem;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.replay-options-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}



