* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #1a2a38; color: #e0e0e0; min-height: 100vh; }
a { color: #66b0ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
nav { background: #162836; padding: 0 20px; display: flex; align-items: center; height: 56px; border-bottom: 1px solid #2a3a48; }
nav .logo { font-size: 1.3em; font-weight: 700; color: #ffd700; margin-right: 30px; white-space: nowrap; }
nav a { color: #b0c4d8; margin-right: 20px; font-size: 0.9em; padding: 4px 0; border-bottom: 2px solid transparent; }
nav a:hover, nav a.active { color: #fff; text-decoration: none; border-bottom-color: #ffd700; }
nav .spacer { flex: 1; }
nav .user-info { font-size: 0.85em; color: #8899aa; }
nav .user-info .name { color: #ffd700; font-weight: 600; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
h1 { font-size: 1.6em; margin-bottom: 16px; color: #ffd700; }
h2 { font-size: 1.2em; margin: 20px 0 12px; color: #c0d0e0; }
p { margin-bottom: 12px; line-height: 1.5; color: #a0b0c0; }

/* Cards */
.card { background: #21323f; border-radius: 8px; padding: 20px; margin-bottom: 16px; border: 1px solid #2a3a48; }
.card-title { font-size: 1.1em; font-weight: 600; color: #ffd700; margin-bottom: 8px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; color: #8899aa; border-bottom: 2px solid #2a3a48; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: #ffd700; }
.sort-arrow { display: inline-block; width: 14px; text-align: center; margin-left: 4px; }
td { padding: 10px 12px; border-bottom: 1px solid #1e2e3c; font-size: 0.95em; }
tr:hover td { background: #1e3040; }
tr.rank-1 td strong { color: #ffd700; }
tr.rank-2 td strong { color: #c0c0c0; }
tr.rank-3 td strong { color: #cd7f32; }
tr.rank-last td strong { color: #e57373; }
tr.rank-me td { background: #1e3a28; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.money { font-family: 'Courier New', monospace; font-weight: 600; }
.pos { color: #4caf50; }
.neg { color: #f44336; }
.diff-up { color: #4caf50; }
.diff-down { color: #f44336; }
.diff-same { color: #8899aa; }

/* Forms */
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 4px; color: #b0c4d8; font-size: 0.9em; }
input, select, textarea { width: 100%; padding: 10px 12px; background: #0f1923; border: 1px solid #2a3a48; border-radius: 6px; color: #e0e0e0; font-size: 0.95em; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #ffd700; }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }
select option { background: #1a2a38; }
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.95em; font-weight: 600; transition: all 0.2s; }
.btn-primary { background: #ffd700; color: #0f1923; }
.btn-primary:hover { background: #ffe44d; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger { background: #d32f2f; color: #fff; }
.btn-danger:hover { background: #e53935; }
.btn-secondary { background: #2a3a48; color: #e0e0e0; }
.btn-secondary:hover { background: #3a4a58; }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.85em; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9em; }
.alert-info { background: #1a3a4a; border: 1px solid #2a5a6a; color: #8ab4c8; }
.alert-error { background: #3a1a1a; border: 1px solid #6a2a2a; color: #d88; }
.alert-success { background: #1a3a2a; border: 1px solid #2a5a3a; color: #8ac8a0; }

/* Date picker */
.date-picker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.date-picker input { width: auto; min-width: 160px; }
.date-picker label { margin-bottom: 0; white-space: nowrap; }

/* Messages */
.message { padding: 16px; margin-bottom: 12px; border-left: 4px solid #ffd700; background: #1a2a38; border-radius: 0 8px 8px 0; }
.message .date { font-size: 0.8em; color: #8899aa; margin-bottom: 4px; }
.message h3 { color: #ffd700; margin-bottom: 6px; }
.message-actions { margin-top: 8px; display: flex; gap: 8px; }
.like-btn { background: none; border: 1px solid #4a5a68; color: #8899aa; padding: 4px 12px; border-radius: 12px; cursor: pointer; font-size: 0.85em; transition: all 0.2s; }
.like-btn:hover { border-color: #e57373; color: #e57373; }
.like-btn.liked { border-color: #e57373; color: #e57373; background: rgba(229, 115, 115, 0.1); }

/* Factor badges */
.factor-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; font-weight: 700; }
.factor-high { background: #1a5a2a; color: #4caf50; }
.factor-mid { background: #2a3a48; color: #b0c4d8; }
.factor-low { background: #5a1a1a; color: #f44336; }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #2a3a48; }
.tab { padding: 10px 20px; cursor: pointer; color: #8899aa; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab:hover { color: #e0e0e0; }
.tab.active { color: #ffd700; border-bottom-color: #ffd700; }

/* Grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .grid, .grid-3 { grid-template-columns: 1fr; } }

/* Stat card */
.stat { text-align: center; padding: 16px; }
.stat .value { font-size: 2em; font-weight: 700; color: #ffd700; text-shadow: 0 0 4px rgba(255,255,255,0.3); }
.stat .label { font-size: 0.85em; color: #8899aa; margin-top: 4px; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: #1a2a38; padding: 24px; border-radius: 8px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; border: 1px solid #2a3a48; }
.modal-content h2 { margin-top: 0; }
.close { float: right; cursor: pointer; font-size: 1.5em; color: #8899aa; }
.close:hover { color: #fff; }

/* Chart wrapper */
.chart-wrapper { width: 100%; height: 250px; position: relative; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: #8899aa; }
.spinner { display: inline-block; width: 30px; height: 30px; border: 3px solid #2a3a48; border-top-color: #ffd700; border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Factor select in predictions */
.factor-select { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 12px 0; }
.factor-item { display: flex; align-items: center; gap: 8px; background: #0f1923; padding: 6px 10px; border-radius: 4px; }
.factor-item label { margin: 0; flex: 1; font-size: 0.9em; }
.factor-item select { width: 70px; }

/* Clickable row */
.clickable { cursor: pointer; }
.clickable:hover td { background: #1e3040; }

/* Inline form */
.form-inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* Scrollable table wrapper */
.table-wrap { overflow-x: auto; }
