/* Inter font — self-hosted variable */
@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/inter-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

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

:root {
    --bg-primary: #0a0e17;
    --bg-card: #151c2c;
    --border-card: #1e2a3e;
    --border-accent: #2a3a54;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent: #58a6ff;
    --positive: #3fb950;
    --positive-bg: rgba(63, 185, 80, 0.1);
    --negative: #f85149;
    --negative-bg: rgba(248, 81, 73, 0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { height: 100%; }
body {
    min-height: 100%;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* App */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    max-width: 1440px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-card);
    margin-bottom: 16px;
    flex-shrink: 0;
}

.logo h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.logo-plan { color: #fff; }
.logo-key { color: var(--accent); }
.logo-panel { color: var(--text-muted); font-weight: 400; font-size: 18px; margin-left: 2px; }

/* Header right area */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.update-info {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Date Navigation */
.date-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: var(--font);
    line-height: 1;
}

.nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.date-display {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 0 16px;
    height: 36px;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s;
    white-space: nowrap;
}

.date-display:hover { border-color: var(--accent); }

/* Calendar Dropdown */
.calendar-dropdown {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 12px;
    padding: 16px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    min-width: 280px;
}

.calendar-dropdown.open { display: block; }

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cal-title { font-size: 14px; font-weight: 600; }

.cal-nav {
    background: none;
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.cal-nav:hover { border-color: var(--accent); color: var(--accent); }

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.cal-weekday {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    width: 36px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day:hover { background: var(--border-card); color: var(--text-primary); }
.cal-day.today { border: 1px solid var(--accent); color: var(--accent); }
.cal-day.selected { background: var(--accent); color: #0a0e17; font-weight: 600; }
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }
.cal-day.weekend { color: var(--text-muted); }
.cal-day.disabled { opacity: 0.2; cursor: default; pointer-events: none; }

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    gap: 12px;
    align-content: start;
}

/* Card */
.indicator-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
}

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

.indicator-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.card-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.card-change.positive { color: var(--positive); background: var(--positive-bg); }
.card-change.negative { color: var(--negative); background: var(--negative-bg); }
.card-change.neutral { color: var(--text-muted); background: rgba(139,148,158,0.1); }

.card-date {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.closing-label { font-style: italic; }

/* Fear & Greed label inline with value */
.fg-label {
    font-size: 13px;
    font-weight: 500;
    margin-left: 6px;
}

/* Sparkline */
.sparkline-wrap {
    margin-top: auto;
    padding-top: 10px;
}

.sparkline-wrap svg {
    display: block;
    width: 100%;
    height: 36px;
}

/* Loading */
.loading, .no-data {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding-top: 60px;
}

.no-data-card {
    border: 1px dashed var(--border-card);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Footer */
.footer {
    flex-shrink: 0;
    padding: 12px 0 6px;
    margin-top: 14px;
    border-top: 1px solid var(--border-card);
}

.footer-ads {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.footer-link { text-decoration: none; text-align: center; transition: opacity 0.2s; }
.footer-link:hover { opacity: 0.8; }
.footer-label { display: block; font-size: 12px; font-weight: 600; color: var(--accent); }
.footer-desc { display: block; font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* Mobile */
@media (max-width: 768px) {
    .cards-grid { grid-template-columns: 1fr; }
    .app { padding: 12px 16px; }
    .header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .header-right { flex-direction: column; gap: 6px; align-items: flex-start; }
    .card-value { font-size: 20px; }
    .footer-ads { flex-direction: column; align-items: center; gap: 10px; }
    .calendar-dropdown { right: auto; left: 0; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
