:root {
    --bg: #0b0f17;
    --surface: #131a26;
    --surface-2: #1a2332;
    --border: #243044;
    --border-soft: #1d2738;
    --text: #e6edf3;
    --text-muted: #8b97a8;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 200px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }

.container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ TICKER TAPE (top banner) ============ */
.ticker-tape-wrap {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 60;
}
.ticker-tape-wrap .tradingview-widget-container { max-height: 46px; }

/* ============ HEADER & NAV ============ */
.site-header {
    background: rgba(19, 26, 38, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 46px;
    z-index: 50;
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.4px;
}
.brand span { color: var(--accent); }

nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav .nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-icon { font-size: 13px; }
nav .nav-link:hover { color: var(--text); background: var(--surface-2); }
nav .nav-link.active { color: var(--text); background: var(--surface-2); }

main { flex: 1; padding: 28px 0 64px; }

/* ============ HERO ============ */
.hero { margin-bottom: 24px; }
.hero h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.6px;
}
.lead { color: var(--text-muted); font-size: 14px; }

/* ============ PANEL (widget card) ============ */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-head {
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-head h2 { font-size: 14px; font-weight: 600; }
.panel-link {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.panel-link:hover { text-decoration: underline; }
.panel-body { padding: 0; }

/* ============ DASHBOARD GRID ============ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (max-width: 1000px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ============ FULL WIDGET (calendar) ============ */
.full-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

/* ============ MARKETS / NEWS GRID ============ */
.markets-grid,
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (max-width: 1100px) {
    .markets-grid,
    .news-grid { grid-template-columns: 1fr; }
}

/* ============ MACRO SUBNAV ============ */
.subnav {
    position: sticky;
    top: 116px;
    z-index: 40;
    background: rgba(19, 26, 38, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.subnav::-webkit-scrollbar { height: 4px; }
.subnav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.subnav-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.subnav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}
.subnav-link.active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--cat-color);
    box-shadow: inset 0 0 0 1px var(--cat-color);
}
.subnav-icon { font-size: 14px; }
.subnav-count {
    background: var(--cat-color);
    color: #fff;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.85;
}

/* ============ MACRO SECTIONS ============ */
.cat-section {
    margin-bottom: 36px;
    scroll-margin-top: 200px;
}
.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 0 10px 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--cat-color);
}
.cat-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}
.cat-icon { font-size: 20px; }
.cat-count {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ============ INDICATOR CARDS ============ */
.indicator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
}
.indicator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: border-color 0.15s;
}
.indicator-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--cat-color, var(--accent));
    opacity: 0.65;
    z-index: 1;
}
.indicator-card:hover {
    border-color: var(--cat-color, var(--accent));
}
.indicator-card-head {
    padding: 12px 14px 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}
.indicator-card-head h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.indicator-card-head .flag { font-size: 14px; }
.indicator-symbol {
    font-family: "SF Mono", Monaco, monospace;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ============ TRADINGVIEW WIDGET CONTAINER ============ */
.tradingview-widget-container {
    width: 100%;
}
.tradingview-widget-container__widget {
    width: 100%;
}

/* ============ FOOTER ============ */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .hero h1 { font-size: 22px; }
    .indicator-grid { grid-template-columns: 1fr; }
    .site-header { top: 46px; }
    .subnav { top: 108px; }
    html { scroll-padding-top: 180px; }
}
