:root {
    --bg: #f4f5f7;
    --card-bg: #ffffff;
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }

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

/* ---- Login page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-align: center;
    width: 320px;
}
.login-box h1 { margin: 0 0 8px; }
.login-box p { color: var(--muted); margin-bottom: 20px; }
.login-box input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    font-size: 15px;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
.login-box button:hover { background: var(--primary-dark); }
.error { color: #dc2626; font-size: 14px; }

/* ---- Dashboard ---- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar-actions { display: flex; gap: 16px; align-items: center; }
.topbar-actions button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.topbar-actions button:hover { background: var(--primary-dark); }
.topbar-actions button:disabled { opacity: 0.6; cursor: not-allowed; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.logout-link:hover { text-decoration: underline; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    padding: 32px;
}

.account-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
}

.account-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.account-header h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.warn { color: #b45309; font-size: 14px; }

.stats-row {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.stat { text-align: center; }
.stat-number { display: block; font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); }

.growth-row { display: flex; gap: 10px; margin-bottom: 14px; }
.growth-badge {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
}
.growth-badge.up { background: #ecfdf5; color: #059669; }
.growth-badge.down { background: #fef2f2; color: #dc2626; }
.growth-label { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 2px; }

.chart-wrap { margin-bottom: 16px; }
.growth-chart { width: 100%; height: 70px; display: block; }
.chart-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }

.media-list h3 { font-size: 14px; margin: 0 0 10px; color: var(--muted); }
.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.media-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
}
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 11px;
    padding: 6px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.15s;
}
.media-item:hover .media-overlay { opacity: 1; }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
