:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent: #f7931a;
    --grid-line: #333;
    --green: #00CC00;
    --orange: #FF9900;
    --red: #FF3300;
    --dark-red: #4D0000;
    --gray: #888888;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 2rem;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container { max-width: 1200px; width: 100%; margin: 0 auto; }
@media (max-width: 768px) { .container { padding: 1rem; } }

.container.narrow { max-width: 600px; }

/* ========== HEADER ========== */
header {
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--grid-line);
    padding-bottom: 1.5rem;
}

h1 { font-size: 2rem; font-weight: 700; color: var(--accent); margin: 0 0 0.5rem 0; letter-spacing: -0.5px; }
h2 { font-size: 1.1rem; font-weight: 400; color: var(--text-muted); margin: 0; text-transform: uppercase; letter-spacing: 1px; }
.subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; display: block; }

/* ========== DASHBOARD CARD ========== */
.dashboard-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid var(--grid-line);
}

/* ========== NAV BUTTONS ========== */
.nav-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin: 1.5rem 0; }
.nav-btn { 
    display: inline-block; 
    background: var(--accent); 
    color: #fff !important; 
    text-decoration: none; 
    padding: 0.5rem 1rem; 
    border-radius: 6px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    transition: background 0.2s;
    border: none;
}
.nav-btn:hover { background: #e07d10; }
.nav-btn.current-page { background: #333; border: 2px solid var(--accent); color: var(--accent) !important; cursor: default; }

/* ========== FOOTER ========== */
footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    
 color: #777; }

/* ========== ALERT BOX ========== */
.warning-box {
    text-align: center;
    margin: 1.5rem auto 0.5rem auto;
    padding: 0.8rem 1rem;
    max-width: 700px;
    border-top: 1px solid var(--grid-line);
    border-bottom: 1px solid var(--grid-line);
}
.warning-box span:first-child { color: #ff9900; font-size: 0.85rem; font-weight: bold; }
.warning-box span:last-child { font-size: 0.85rem; color: var(--text-muted); }

/* ========== INPUTS & FORMS ========== */
input[type="number"], input[type="text"], select, input.date-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--grid-line);
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    font-feature-settings: "tnum";
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: #555; font-weight: 400; }

label.calc-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ========== BUTTONS ========== */
button {
    background: transparent;
    border: 1px solid var(--grid-line);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; }
button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ========== CONTROLS / TOGGLES ========== */
.controls, .toggle-group, .btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem 0;
    padding: 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--grid-line);
    justify-content: center;
}

.toggle-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; text-align: center; margin-bottom: 0.25rem; letter-spacing: 1px; }

/* ========== STATS GRID ========== */
.bottom-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--grid-line);
}

.bottom-stat-item {
    background: rgba(255,255,255,0.03);
    padding: 0.8rem;
    border-radius: 6px;
    text-align: center;
    border-left: 3px solid transparent;
    min-height: 45px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.bottom-stat-item.price { border-left-color: var(--accent); }
.bottom-stat-item.deviation { border-left-color: var(--orange); transition: border-left-color 0.3s; }
.bottom-stat-item.manifesto { border-left-color: var(--gray); min-height: 65px; display: flex; align-items: center; justify-content: center; }
.bottom-stat-item.sma { border-left-color: var(--green); }
.bottom-stat-item.growth-1y { border-left-color: var(--green); }
.bottom-stat-item.growth-4y { border-left-color: var(--green); }
.bottom-stat-item.annual { border-left-color: var(--green); }
.bottom-stat-item.high { border-left-color: var(--gray); }
.bottom-stat-item.low { border-left-color: var(--gray); }
.bottom-stat-item.change { border-left-color: var(--gray); }
.bottom-stat-item.dev-high { border-left-color: var(--red); background: rgba(255, 51, 0, 0.05); }
.bottom-stat-item.dev-low { border-left-color: var(--green); background: rgba(0, 204, 0, 0.05); }

.bottom-stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin-bottom: 0.25rem; display: block; }
.bottom-stat-val { font-size: 1.1rem; font-weight: 700; color: var(--text-main); font-feature-settings: "tnum"; }
.bottom-stat-item.manifesto .bottom-stat-val { font-size: 0.85rem !important; line-height: 1.2; max-width: 140px; overflow-wrap: break-word; }

/* ========== DESCRIPTION BOX ========== */
.description-box-full {
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    border-left: 4px solid var(--accent);
    margin-top: 1.5rem;
}
.description-box-full strong { color: var(--text-main); }
.description-box-full .green-text { color: var(--green); font-weight: bold; }
.description-box-full .red-text { color: var(--red); font-weight: bold; }

/* ========== CHART CONTAINER ========== */
.chart-container { height: 400px; position: relative; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 1rem; margin-bottom: 1.5rem; }
.legend { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; display: flex; gap: 1rem; justify-content: center; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

/* ========== GAUGE (VERTICAL COLOR BAR) ========== */
.gauge-layout { display: flex; align-items: stretch; gap: 8px; margin-top: 0.5rem; justify-content: center; }
.gauge-zones-left { display: flex; flex-direction: column-reverse; justify-content: space-evenly; width: 55px; text-align: right; padding-right: 4px; }
.gauge-zones-left span { font-size: 0.68rem; font-weight: bold; text-shadow: 1px 1px 2px rgba(0,0,0,0.7); }
.gauge-bar-wrapper { position: relative; width: 36px; height: 220px; }
.gauge-bar-bg { width: 36px; height: 220px; border-radius: 4px; position: relative; border: 1px solid #555; }
.gauge-arrow { position: absolute; right: -22px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px;
background: #ffffff; clip-path: polygon(0% 50%, 100% 0%, 100% 100%); filter: drop-shadow(0 0 8px rgba(255,255,255,1)) drop-shadow(0 0 12px rgba(255,255,255,0.7)); z-index: 100; transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1); border: 2px solid #fff; }
.gauge-percs-right { display: flex; flex-direction: column-reverse; justify-content: space-evenly; width: 55px; font-size: 0.68rem; color: var(--text-muted); text-align: left; padding-left: 4px; }
.gauge-col { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 8px; }
.gauge-label { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-bottom: 0.5rem; font-weight: 600; max-width: 90%; }
.strategy-box { text-align: center; margin-bottom: 0.5rem; }
.strategy-title { font-size: 1.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.25rem; display: block; }
.strategy-sub { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.stat-badge { font-size: 1.2rem; font-weight: 700; margin-top: 0.25rem; color: #fff; }
.deviation-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 0.15rem; }

/* ========== METRICS BOX (TOP RIGHT PANEL) ========== */
.metrics-box { background: rgba(255,255,255,0.03); padding: 1.5rem; border-radius: 6px; display: flex; flex-direction: column; gap: 1rem; }
.metric-row { display: flex; flex-direction: column; gap: 0.25rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5rem; }
.metric-row:last-child { border-bottom: none; }
.metric-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.metric-val { font-size: 1.1rem; font-weight: 700; color: var(--text-main); font-feature-settings: "tnum"; }
.val-price { color: var(--accent); }
.val-sma { color: var(--green); }
.top-disclaimer { font-size: 0.65rem; color: #888; text-align: center; margin-top: 0.5rem; font-style: italic; border-top: 1px solid var(--grid-line); padding-top: 0.5rem; line-height: 1.3; }

/* ========== TOP SECTION LAYOUT ========== */
.top-section { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 768px) { .top-section { grid-template-columns: 1fr; } }

/* ========== CALCULATOR ========== */
.calc-box { background: rgba(255,255,255,0.03); padding: 1.5rem; border-radius: 6px; display: flex; flex-direction: column; gap: 0.8rem; }
.calc-divider { height: 1px; background: var(--grid-line); margin: 0.5rem 0; }
.calc-title { font-size: 0.75rem; color: var(--text-main); text-transform: uppercase; font-weight: 700; text-align: center; margin-bottom: 0.5rem; }
.live-price-display { font-size: 1.5rem; color: var(--accent); font-weight: 700; text-align: center; margin-bottom: 0.25rem; }
.price-disclaimer { font-size: 0.65rem; color: #888; text-align: center; margin-bottom: 1rem; font-style: italic; border-top: 1px solid var(--grid-line); padding-top: 0.3rem; line-height: 1.3; }
.history-separator { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; text-align: center; letter-spacing: 2px; margin: 1.5rem 0 0.5rem 0; position: relative; }
.history-separator::before, .history-separator::after { content: ""; display: inline-block; width: 40px; height: 1px; background: var(--grid-line); vertical-align: middle; margin: 0 10px; }
.date-picker-row { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.history-output { background: rgba(255,255,255,0.03); border-radius: 6px; padding: 0.8rem; margin-top: 1rem; border: 1px solid var(--grid-line); }
.history-line-1 { font-size: 0.95rem; color: var(--text-main); font-weight: 600; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.history-line-2, .history-line-3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.history-value-change { font-size: 0.9rem; font-weight: 700; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid rgba(255,255,255,0.05); }
.val-positive { color: var(--green); }
.val-negative { color: var(--red); }
.true-conversion { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-top: 0.5rem; font-style: italic; }
.date-note { font-size: 0.65rem; color: #888; font-style: italic; text-align: center; }

/* ========== STATUS BOX (for alerts) ========== */
#status { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 8px; border-left: 3px solid var(--grid-line); min-height: 2rem; }
.alert-flash { border-left-color: var(--red) !important; background: rgba(255, 51, 0, 0.05) !important; }
.hint { font-size: 0.65rem; color: #888; font-style: italic; text-align: center; margin-top: 0.5rem; }

/* ========== MANIFESTO ANIMATION ========== */
.manifesto-anim { transition: opacity 0.2s ease-in-out; white-space: normal; overflow-wrap: break-word; }

/* ========== MARKET CYCLE SVG ========== */
.market-cycle-svg { width: 100%; max-height: 240px; display: block; }
