:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #475569;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --radius: 8px;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-user {
    color: var(--primary);
    font-weight: 600;
}

/* Main */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 140px);
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
}
.btn-secondary:hover { background: #475569; }

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-large { padding: 0.8rem 1.6rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface-light);
    color: var(--text-muted);
}

.badge-waiting { background: #f59e0b; color: #000; }
.badge-active { background: var(--success); color: white; }
.badge-finished { background: var(--secondary); color: white; }
.badge-primary { background: var(--primary); color: white; }

/* Panels */
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Dashboard */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Game List */
.game-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s;
}

.game-card:hover {
    border-color: var(--primary);
}

.game-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.game-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.game-company {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Tables */
.data-table, .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th, .data-table td,
.report-table th, .report-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th, .report-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.report-table td:last-child {
    text-align: right;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.form-group small, .hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.input-value {
    font-weight: 600;
    color: var(--primary);
    margin-left: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.inline-form {
    display: inline;
}

/* Round Interface */
.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.round-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.cash {
    font-weight: 700;
    color: var(--success);
}

/* KPI Bar */
.kpi-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

/* Decision Panel */
.decision-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.dept-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.dept-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.dept-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.dept-tab:hover {
    color: var(--text);
}

.dept-content {
    display: none;
}

.dept-content.active {
    display: block;
}

.dept-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* Product Card within decisions */
.product-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.product-card h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--primary);
}

/* Decision Actions */
.decision-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Lobby */
.lobby-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.lobby-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.lobby-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

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

.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.player-row.host {
    border: 1px solid var(--primary);
}

.player-name {
    font-weight: 600;
}

.player-user {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Alerts */
.messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.alert-success { background: rgba(22,163,74,0.15); color: #86efac; border: 1px solid var(--success); }
.alert-error { background: rgba(220,38,38,0.15); color: #fca5a5; border: 1px solid var(--danger); }
.alert-warning { background: rgba(202,138,4,0.15); color: #fde047; border: 1px solid var(--warning); }

/* Auth pages */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .lobby-grid { grid-template-columns: 1fr; }
    .navbar { flex-direction: column; gap: 1rem; }
    .round-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .decision-actions { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
}
