:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242736;
    --border: #2d3148;
    --text: #e4e5e9;
    --text-muted: #8b8fa3;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .logo span { color: var(--primary); }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: var(--surface2);
    color: var(--text);
}

.sidebar .user-info {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 16px;
    padding: 12px;
    background: var(--surface2);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
}

.main {
    flex: 1;
    margin-left: 240px;
    padding: 32px 40px;
    max-width: 1200px;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.card h3 { font-size: 16px; margin-bottom: 12px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 700; }

/* ── Progress bar ── */
.progress-bar {
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.yellow { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }
.progress-bar .fill.blue { background: var(--info); }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover { background: var(--surface2); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-run { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-change { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-done { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-risk { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-track { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-behind { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-not-started { background: rgba(139,143,163,0.15); color: var(--text-muted); }

/* ── Goal type badges ── */
.badge-contradiction { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-antigoal { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-bet { background: rgba(99,102,241,0.15); color: var(--primary); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }

input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea { resize: vertical; min-height: 100px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Filters ── */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters select {
    width: auto;
    min-width: 180px;
}

/* ── Page header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; font-weight: 700; }

/* ── Goal detail ── */
.goal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.goal-meta .meta-item .meta-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.goal-meta .meta-item .meta-value {
    font-size: 14px;
    white-space: pre-line;
}

/* ── Checkin list ── */
.checkin-item {
    padding: 16px;
    border-left: 3px solid var(--border);
    margin-bottom: 12px;
    background: var(--surface2);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.checkin-item.status-done { border-left-color: var(--success); }
.checkin-item.status-track { border-left-color: var(--success); }
.checkin-item.status-risk { border-left-color: var(--danger); }
.checkin-item.status-behind { border-left-color: var(--warning); }

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

.checkin-header .left { display: flex; align-items: center; gap: 12px; }

.checkin-notes { font-size: 14px; color: var(--text-muted); white-space: pre-line; margin-top: 8px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 16px; }
    .goal-meta { grid-template-columns: 1fr; }
}
