/**
 * STOCK ANALYZER - BASE CSS
 *
 * This is the ONLY stylesheet. No Tailwind, no frameworks.
 * Every visual property references CSS variables set by theme JSON.
 *
 * Structure:
 * 1. CSS Reset
 * 2. Root Variables (defaults - overridden by theme)
 * 3. Base Elements
 * 4. Layout Utilities
 * 5. Components
 * 6. Animations
 */

/* ========================================
   1. CSS RESET
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    font-family: var(--font-primary);
    height: 100%;
}

body {
    min-height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

img, svg, video, canvas {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

ul, ol {
    list-style: none;
}

/* ========================================
   2. ROOT VARIABLES (Theme Defaults)
   These are fallbacks - theme JSON overrides all
   ======================================== */

:root {
    /* Backgrounds */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --bg-code: #1f2937;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-inverted: #ffffff;

    /* Borders */
    --border-primary: #e5e7eb;
    --border-secondary: #d1d5db;

    /* Accent (brand color) */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #60a5fa;
    --accent-bg: rgba(59, 130, 246, 0.1);
    --accent-bg-subtle: rgba(59, 130, 246, 0.05);

    /* Semantic Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --warning-light: #fbbf24;

    /* Highlight */
    --highlight-bg: rgba(59, 130, 246, 0.1);
    --highlight-text: #3b82f6;

    /* Danger */
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-border: #fca5a5;

    /* Stars/Favorites */
    --star-color: #fbbf24;
    --star-bg: rgba(251, 191, 36, 0.1);
    --star-glow: none;

    /* Price Movement */
    --price-up: #10b981;
    --price-up-glow: none;
    --price-down: #ef4444;
    --price-down-glow: none;

    /* Audio */
    --audio-active-bg: rgba(59, 130, 246, 0.2);
    --music-active-color: #3b82f6;
    --music-active-bg: rgba(59, 130, 246, 0.1);
    --music-active-glow: none;
    --viz-bar-color: #3b82f6;
    --viz-bar-glow: none;

    /* Buttons */
    --btn-primary-bg: #3b82f6;
    --btn-primary-bg-hover: #2563eb;
    --btn-primary-text: #ffffff;
    --btn-primary-glow: none;
    --btn-primary-glow-hover: none;

    /* Loader */
    --loader-bg: rgba(255, 255, 255, 0.9);
    --loader-accent: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;

    /* Tile Headers */
    --tile-title-color: var(--text-primary);
    --tile-title-transform: none;
    --tile-title-spacing: normal;
    --tile-title-weight: 600;
    --tile-title-glow: none;

    /* Charts */
    --chart-bg: var(--bg-secondary);
    --chart-text: var(--text-secondary);
    --chart-grid: var(--border-primary);
    --chart-axis: var(--border-secondary);
    --chart-line-primary: var(--accent);
    --chart-line-secondary: #8b5cf6;
    --chart-line-sma20: #ef4444;
    --chart-line-sma50: #f59e0b;
    --chart-line-sma200: #6b7280;
    --chart-candle-up: #10b981;
    --chart-candle-down: #ef4444;
    --chart-volume-up: rgba(16, 185, 129, 0.5);
    --chart-volume-down: rgba(239, 68, 68, 0.5);
    --chart-rsi: #8b5cf6;
    --chart-macd: #3b82f6;
    --chart-macd-signal: #f59e0b;
    --chart-stochastic: #ec4899;
    --chart-stochastic-d: #8b5cf6;
    --chart-overbought: rgba(239, 68, 68, 0.1);
    --chart-oversold: rgba(16, 185, 129, 0.1);
    --chart-bollinger: rgba(139, 92, 246, 0.2);
    --chart-line-glow: none;
    --chart-line-glow-color: transparent;
    --chart-line-glow-width: 0;
    --chart-marker-up: #10b981;
    --chart-marker-down: #ef4444;
    --chart-marker-up-outline: #34d399;
    --chart-marker-down-outline: #f87171;
    --chart-marker-symbol: triangle-up;
    --chart-marker-size: 10;

    /* Benchmark overlay colors (Okabe-Ito colorblind-safe palette) */
    --chart-series-primary: #0072B2;
    --chart-series-comparison: #E69F00;
    --chart-benchmark-1: #009E73;
    --chart-benchmark-2: #56B4E9;
    --chart-benchmark-3: #D55E00;
    --chart-benchmark-4: #CC79A7;
    --chart-benchmark-5: #F0E442;

    /* Grid/Dashboard */
    --grid-dot: #e5e7eb;
    --grid-dot-active: #3b82f6;
    --zoom-bg: rgba(59, 130, 246, 0.1);
    --zoom-border: #3b82f6;
    --measure-bg: rgba(139, 92, 246, 0.1);
    --measure-line: #8b5cf6;
    --placeholder-bg: var(--bg-tertiary);
    --placeholder-border: var(--border-primary);
    --locked-pattern: rgba(0, 0, 0, 0.02);

    /* Fonts */
    --font-primary: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

/* ========================================
   3. BASE ELEMENTS
   ======================================== */

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-center { text-align: center; }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* Form Elements */
input, select, textarea {
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

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

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    accent-color: var(--accent);
}

input[readonly] {
    background-color: var(--bg-tertiary);
    cursor: default;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* ========================================
   4. LAYOUT UTILITIES
   ======================================== */

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.pt-4 { padding-top: 1rem; }
.pt-5 { padding-top: 1.25rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }

.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-auto { margin-top: auto; }

.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-2 { margin-right: 0.5rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Sizing */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-32 { width: 8rem; }
.w-48 { width: 12rem; }
.w-56 { width: 14rem; }
.w-80 { width: 20rem; }

.h-full { height: 100%; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-60 { height: 15rem; }

.min-h-full { min-height: 100%; }
.min-h-screen { min-height: 100vh; }
.min-w-0 { min-width: 0; }

.max-w-7xl { max-width: 80rem; }
.max-w-screen-2xl { max-width: 1536px; }
.max-w-lg { max-width: 32rem; }
.max-h-64 { max-height: 16rem; }
.max-h-80 { max-height: 20rem; }
.max-h-48 { max-height: 12rem; }
.max-h-40 { max-height: 10rem; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-full { top: 100%; }
.right-0 { right: 0; }
.left-0 { left: 0; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Transitions */
.transition { transition: all 0.15s ease; }
.transition-colors { transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
.transition-opacity { transition: opacity 0.15s ease; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* ========================================
   5. COMPONENTS
   ======================================== */

/* === Surfaces (backgrounds) === */
.surface {
    background-color: var(--bg-secondary);
}

.surface-primary {
    background-color: var(--bg-primary);
}

.surface-tertiary {
    background-color: var(--bg-tertiary);
}

/* === Cards === */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: 1.5rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: var(--btn-primary-glow);
}

.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--btn-primary-glow-hover);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    background-color: var(--border-primary);
}

.btn-danger {
    background-color: var(--danger-bg);
    color: var(--error);
    border: 1px solid var(--danger-border);
}

.btn-danger:hover {
    background-color: var(--error);
    color: var(--text-inverted);
}

/* Icon buttons */
.btn-icon {
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background-color: var(--border-primary);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* === Header === */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    box-shadow: var(--shadow-sm);
}

.site-header .container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.site-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* === Footer === */
.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    margin-top: auto;
}

.site-footer .container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.site-footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* === Dropdown === */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 12rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-align: left;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.dropdown-item.active {
    background-color: var(--accent-bg);
    color: var(--accent);
}

/* === Modal === */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 32rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 101;
}

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

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
}

/* === Tiles (Dashboard) === */
.tile-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

.tile-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--tile-title-weight);
    font-size: 0.875rem;
    color: var(--tile-title-color);
    text-transform: var(--tile-title-transform);
    letter-spacing: var(--tile-title-spacing);
    text-shadow: var(--tile-title-glow);
}

.tile-title svg {
    width: 1rem;
    height: 1rem;
}

.tile-body {
    flex: 1;
    padding: 1rem;
    overflow: auto;
}

.tile-close,
.tile-lock {
    padding: 0.25rem;
    font-size: 1rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.tile-close:hover,
.tile-lock:hover {
    opacity: 1;
}

/* Locked state - icon changes color when tile is locked */
.tile-locked .tile-lock {
    color: var(--accent-primary);
    opacity: 1;
}

.tile-locked .tile-lock:hover {
    color: var(--accent-secondary);
}

/* === Search/Autocomplete === */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 16rem;
    overflow-y: auto;
    z-index: 30;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.search-result-item:hover {
    background-color: var(--bg-tertiary);
}

/* === Loader === */
.loader {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-primary);
    border-top-color: var(--loader-accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Alert/Error === */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
}

.alert-error {
    background-color: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--error);
}

.alert-error h3 {
    color: var(--error);
}

/* === Toggle Switch === */
.toggle {
    position: relative;
    width: 2.25rem;
    height: 1.25rem;
    background-color: var(--bg-tertiary);
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

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

.toggle.active::after {
    transform: translateX(1rem);
}

/* === Music Toggle === */
.music-toggle {
    position: relative;
}

.music-toggle.active {
    background-color: var(--music-active-bg);
    box-shadow: var(--music-active-glow);
}

.music-toggle.active .music-icon {
    color: var(--music-active-color);
}

.music-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 1rem;
}

.viz-bar {
    width: 3px;
    background-color: var(--viz-bar-color);
    box-shadow: var(--viz-bar-glow);
    animation: visualizer 0.4s ease-in-out infinite alternate;
}

.viz-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.viz-bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.viz-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.viz-bar:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.viz-bar:nth-child(5) { height: 30%; animation-delay: 0.4s; }

@keyframes visualizer {
    to { height: 20%; }
}

/* === Wiki Hover Card === */
.wiki-hover-card {
    position: fixed;
    width: 20rem;
    max-height: calc(100vh - 30px);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 60;
}

.wiki-hover-card img {
    width: 100%;
    height: 15rem;
    object-fit: cover;
    border-bottom: 1px solid var(--border-primary);
}

/* === Price Colors === */
.price-up {
    color: var(--price-up);
    text-shadow: var(--price-up-glow);
}

.price-down {
    color: var(--price-down);
    text-shadow: var(--price-down-glow);
}

/* === Quick Action Chips === */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.chip:hover {
    background-color: var(--border-primary);
}

.chip-danger {
    background-color: var(--danger-bg);
    color: var(--error);
}

.chip-danger:hover {
    background-color: var(--error);
    color: var(--text-inverted);
}

/* Benchmark chip styles */
.chip-benchmark {
    border: 1px solid var(--border-primary);
    background-color: transparent;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

.chip-benchmark:hover {
    border-color: var(--accent);
    background-color: var(--bg-tertiary);
}

.chip-benchmark.active {
    background-color: var(--accent);
    color: var(--text-inverted);
    border-color: var(--accent);
}

.chip-benchmark.active:hover {
    opacity: 0.85;
}

/* Benchmark chips container */
.benchmark-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Temporary benchmark chip (created from search) */
.chip-benchmark-temp {
    border: 1px dashed var(--accent);
    background-color: var(--accent);
    color: var(--text-inverted);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-md);
}

.chip-benchmark-temp:hover {
    opacity: 0.85;
}

/* === Checkbox/Radio Styling === */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

/* === Range Slider === */
input[type="range"] {
    -webkit-appearance: none;
    width: 8rem;
    height: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 0;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    background-color: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    background-color: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* === Combined View (Portfolio Overlay) === */
.combined-view {
    position: fixed;
    inset: 0;
    background-color: var(--bg-primary);
    overflow-y: auto;
    z-index: 40;
}

.combined-view .container {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

/* === Period/Benchmark Button Groups === */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.btn-group .btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-primary);
    background-color: transparent;
    color: var(--text-secondary);
}

.btn-group .btn:hover {
    background-color: var(--bg-tertiary);
}

.btn-group .btn.active {
    background-color: var(--accent);
    color: var(--text-inverted);
    border-color: var(--accent);
}

/* === Flatpickr Overrides === */
.flatpickr-calendar {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
    box-shadow: var(--shadow-lg) !important;
}

.flatpickr-day {
    color: var(--text-primary) !important;
}

.flatpickr-day:hover {
    background-color: var(--bg-tertiary) !important;
}

.flatpickr-day.selected {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.flatpickr-months .flatpickr-month {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: var(--text-primary) !important;
}

.flatpickr-weekday {
    color: var(--text-muted) !important;
}

/* ========================================
   6. RESPONSIVE
   ======================================== */

@media (min-width: 640px) {
    .sm\:inline { display: inline; }
    .sm\:block { display: block; }
    .sm\:flex { display: flex; }
    .sm\:flex-row { flex-direction: row; }
    .sm\:w-auto { width: auto; }
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:space-x-4 > * + * { margin-left: 1rem; }
}

@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Safe area for mobile notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .pb-safe {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   7. GRIDSTACK INTEGRATION
   ======================================== */

.grid-stack-item-content {
    background: transparent;
}

.grid-stack-placeholder > .placeholder-content {
    background-color: var(--placeholder-bg);
    border: 2px dashed var(--placeholder-border);
    border-radius: var(--radius-lg);
}

.gs-item-content.locked {
    background: var(--locked-pattern);
}

/* ========================================
   8. SCREEN READER ONLY
   ======================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   9. LINE CLAMP (text truncation)
   ======================================== */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   10. APP LAYOUT
   ======================================== */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-tagline {
    display: none;
    font-size: 0.875rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .header-tagline {
        display: block;
    }
}

.main-content {
    flex: 1;
    max-width: 80rem;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Footer */
.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-links .separator {
    color: var(--border-primary);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   11. ICONS
   ======================================== */

.icon-sm {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.icon-md {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.icon-lg {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.icon-xl {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.icon-accent {
    color: var(--accent);
}

.tile-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--accent);
}

/* ========================================
   12. SEARCH SECTION
   ======================================== */

.search-card {
    margin-bottom: 1.5rem;
}

.search-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .search-row {
        flex-direction: row;
        align-items: flex-end;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group.flex-grow {
    flex: 1;
    min-width: 0;
}

.input-wrapper {
    position: relative;
}

.input-loader {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

/* Date Range */
.date-range-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .date-range-row {
        flex-direction: row;
    }
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-input {
    width: auto;
    min-width: 8rem;
}

.date-input.readonly {
    background-color: var(--bg-tertiary);
    cursor: default;
}

/* Options Row */
.options-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-primary);
}

.options-row:first-of-type {
    border-top: none;
}

.options-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.threshold-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 2rem;
}

/* ========================================
   13. FORM ELEMENTS (Extended)
   ======================================== */

.form-section {
    margin-bottom: 1rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.flex-grow {
    flex: 1;
    min-width: 0;
}

/* ========================================
   14. BUTTON VARIANTS
   ======================================== */

.btn-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.btn-icon-sm:hover {
    background-color: var(--border-primary);
    color: var(--text-primary);
}

.btn-text-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
}

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

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-label-desktop {
    display: none;
}

@media (min-width: 640px) {
    .btn-label-desktop {
        display: inline;
    }
}

.link {
    color: var(--accent);
    cursor: pointer;
    transition: color 0.15s ease;
}

.link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ========================================
   15. DROPDOWN (Extended)
   ======================================== */

.dropdown-wrapper {
    position: relative;
}

.dropdown-scroll {
    max-height: 16rem;
    overflow-y: auto;
}

.dropdown-footer {
    border-top: 1px solid var(--border-primary);
    padding: 0.5rem;
}

.dropdown-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    color: var(--accent);
    text-align: left;
    transition: background-color 0.15s ease;
}

.dropdown-action:hover {
    background-color: var(--bg-tertiary);
}

/* ========================================
   16. MUSIC/VOLUME CONTROLS
   ======================================== */

.music-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 4rem;
    height: 0.25rem;
    cursor: pointer;
}

/* ========================================
   17. MODAL (Extended)
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 32rem;
    z-index: 52;
}

.modal-close {
    padding: 0.25rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

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

/* ========================================
   18. TILES (Extended)
   ======================================== */

.tile-actions {
    display: flex;
    gap: 0.25rem;
}

.tile-body-flush {
    padding: 0;
}

.chart-container {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

/* ========================================
   19. WATCHLIST COMPONENTS
   ======================================== */

.watchlist-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.watchlist-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.watchlist-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.watchlist-add {
    margin-top: 1rem;
}

.stock-info-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stock-info-content {
    flex: 1;
}

.storage-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   20. LOADING & EMPTY STATES
   ======================================== */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.loading-state-lg {
    padding: 4rem 2rem;
}

.loader-lg {
    width: 2.5rem;
    height: 2.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* ========================================
   21. METRICS & LISTS
   ======================================== */

.metrics-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.moves-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 20rem;
    overflow-y: auto;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.holdings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 12rem;
    overflow-y: auto;
}

/* ========================================
   22. COMBINED VIEW (Portfolio)
   ======================================== */

.combined-view-content {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.combined-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .combined-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.combined-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.combined-title-group h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.combined-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.combined-return {
    font-size: 1.25rem;
    font-weight: 600;
}

.combined-controls {
    margin-bottom: 1.5rem;
}

.combined-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group-end {
    margin-left: auto;
}

.control-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.weights-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.animal-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================
   23. HOVER CARD (Wikipedia-style)
   ======================================== */

.hover-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 10rem;
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
}

.hover-card-content {
    padding: 1rem;
}

.hover-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.hover-card-return {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.hover-card-headline {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.hover-card-headline:hover {
    color: var(--accent);
}

.hover-card-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.hover-card-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   24. MISCELLANEOUS
   ======================================== */

/* Flex utilities used in HTML */
.flex-grow {
    flex: 1;
}

/* Toggle input (hidden but functional) */
.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Responsive visibility */
@media (max-width: 639px) {
    .sm\:hidden {
        display: none;
    }
}

/* Backdrop blur (if supported) */
@supports (backdrop-filter: blur(8px)) {
    .modal-backdrop {
        backdrop-filter: blur(4px);
    }
}

/* ========================================
   25. JS-GENERATED CONTENT
   ======================================== */

/* Date inputs state toggle */
.date-input.readonly,
.date-input[readonly] {
    background-color: var(--bg-tertiary);
    cursor: default;
}

.date-input.editable {
    background-color: var(--bg-secondary);
    cursor: text;
}

/* Theme dropdown option */
.theme-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: left;
    transition: background-color 0.15s ease;
}

.theme-option:hover {
    background-color: var(--bg-tertiary);
}

/* Search result items (dynamic) */
.search-result,
.compare-result {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    transition: background-color 0.15s ease;
}

.search-result:last-child,
.compare-result:last-child {
    border-bottom: none;
}

.search-result:hover,
.compare-result:hover,
.search-result.highlighted,
.compare-result.highlighted {
    background-color: var(--bg-tertiary);
}

.result-symbol {
    font-weight: 500;
    color: var(--text-primary);
}

.result-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-empty {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Stock info */
.stock-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stock-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stock-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stock-identifiers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin-top: 0.5rem;
}

.stock-identifier {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stock-identifier .label {
    font-weight: 500;
}

.stock-price {
    text-align: right;
    margin-left: 1rem;
}

.stock-price-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stock-price-change {
    font-size: 1.125rem;
}

.stock-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

/* Metrics rows */
.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.metric-label {
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* Significant move row */
.move-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-primary);
}

.move-row:last-child {
    border-bottom: none;
}

.move-date {
    color: var(--text-secondary);
}

.move-value {
    font-weight: 500;
}

/* News article */
.news-article {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.news-article:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-headline {
    font-weight: 500;
    color: var(--accent);
    transition: color 0.15s ease;
}

.news-headline:hover {
    color: var(--accent-hover);
}

.news-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.news-source-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.news-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.news-sources-header {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Semantic text colors (replacing Tailwind) */
.text-success {
    color: var(--success);
}

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

/* ========================================
   26. WATCHLIST JS COMPONENTS
   ======================================== */

/* Watchlist accordion item */
.watchlist-item {
    border-bottom: 1px solid var(--border-primary);
}

.watchlist-item:last-child {
    border-bottom: none;
}

.watchlist-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.watchlist-header-row:hover {
    background-color: var(--bg-tertiary);
}

.watchlist-name-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.watchlist-expand-icon {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.watchlist-expand-icon.rotated {
    transform: rotate(90deg);
}

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

.watchlist-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.watchlist-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.watchlist-action-btn {
    padding: 0.25rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.watchlist-action-btn:hover {
    color: var(--text-primary);
}

.watchlist-action-btn.danger:hover {
    color: var(--error);
}

.watchlist-action-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Watchlist tickers list */
.watchlist-tickers {
    padding: 0 0.75rem 0.5rem;
}

.watchlist-tickers.collapsed {
    display: none;
}

.watchlist-ticker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.watchlist-ticker-row:hover {
    background-color: var(--bg-tertiary);
}

.watchlist-ticker-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.watchlist-ticker-btn:hover {
    color: var(--accent);
}

.watchlist-remove-ticker {
    opacity: 0;
    color: var(--text-muted);
    transition: opacity 0.15s ease, color 0.15s ease;
}

.watchlist-ticker-row:hover .watchlist-remove-ticker {
    opacity: 1;
}

.watchlist-remove-ticker:hover {
    color: var(--error);
}

.watchlist-empty-msg {
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

/* Watchlist dropdown items */
.watchlist-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-align: left;
    transition: background-color 0.15s ease;
}

.watchlist-dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.watchlist-dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Period/Benchmark button states */
.period-btn,
.benchmark-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.period-btn:hover,
.benchmark-btn:hover {
    background-color: var(--bg-tertiary);
}

.period-btn.active {
    background-color: var(--accent);
    color: var(--text-inverted);
    border-color: var(--accent);
}

.benchmark-btn.active {
    background-color: var(--warning);
    color: var(--text-primary);
    border-color: var(--warning);
}

/* Weight display chip */
.weight-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.weight-ticker {
    font-weight: 500;
    color: var(--text-primary);
}

.weight-value {
    color: var(--text-muted);
}

/* Holdings editor */
.holding-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.holding-row:last-child {
    border-bottom: none;
}

.holding-row:hover {
    background-color: var(--bg-tertiary);
}

.holding-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.holding-remove-btn {
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.holding-remove-btn:hover {
    color: var(--error);
}

.holding-ticker {
    font-weight: 500;
    color: var(--text-primary);
}

.holding-price {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.holding-input {
    width: 5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.holding-equal {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Holdings search results */
.holdings-search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    transition: background-color 0.15s ease;
}

.holdings-search-result:hover {
    background-color: var(--bg-tertiary);
}

/* Status messages */
.status-message {
    text-align: center;
    color: var(--text-muted);
}

/* ========================================
   THEME IMPORT MODAL
   ======================================== */

.theme-import-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    resize: vertical;
}

.theme-import-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.theme-import-textarea::placeholder {
    color: var(--text-muted);
}

.theme-import-error {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 0.875rem;
}

/* Import button in theme dropdown */
.theme-import-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-primary);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-import-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent);
}

.theme-import-btn svg {
    width: 1rem;
    height: 1rem;
    opacity: 0.7;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.opacity-50 { opacity: 0.5; }
.cursor-not-allowed { cursor: not-allowed; }
