/* 33RPM.se – mörkt vinyl-tema */

:root {
    --bg: #0a0a0b;
    --surface: #18181b;
    --surface-2: #1f1f23;
    --surface-hover: #232328;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --accent: #e11d48;
    --accent-hover: #be123c;
    --accent-soft: rgba(225, 29, 72, 0.12);
    --warn: #f59e0b;
    --ok: #10b981;
    --danger: #ef4444;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.45);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --topbar-h: 56px;
    --side-w: 280px;
}

html.light {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --surface-hover: #ebedf0;
    --border: #e4e6eb;
    --border-strong: #ced0d4;
    --text: #050505;
    --text-2: #65676b;
    --text-3: #8a8d91;
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; color: var(--text); }
h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif; margin: 0; }

/* ===== TOPBAR ===== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 12px;
    z-index: 50;
}
.topbar-inner { display: flex; align-items: center; width: 100%; gap: 12px; }
.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 22px; color: var(--text);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    width: var(--side-w); padding-left: 4px;
}
.brand-logo {
    width: 40px; height: 40px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #2a2a2e 0%, #0a0a0b 60%, #18181b 70%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 2px #18181b, 0 0 0 1px var(--accent);
    position: relative;
}
.brand-logo::before {
    content: ''; width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent);
}
.brand-logo::after {
    content: ''; position: absolute; inset: 4px; border-radius: 50%;
    background: repeating-radial-gradient(circle, rgba(255,255,255,.04) 0 1px, transparent 1px 3px);
}
.brand-name { letter-spacing: -0.5px; }

.searchbar {
    flex: 1; max-width: 600px; position: relative;
}
.searchbar input {
    width: 100%; height: 40px; border-radius: 999px; padding: 0 16px 0 44px;
    background: var(--surface-2); border: 1px solid transparent; color: var(--text);
    outline: none; font-size: 14px;
}
.searchbar input:focus { background: var(--surface); border-color: var(--accent); }
.searchbar svg { position: absolute; top: 50%; transform: translateY(-50%); left: 14px; color: var(--text-2); width: 18px; height: 18px; }
.searchbar-results {
    position: absolute; top: 48px; left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px;
    max-height: 460px; overflow-y: auto; box-shadow: var(--shadow); z-index: 60;
    display: none;
}
.searchbar-results.open { display: block; }
.search-result {
    display: flex; align-items: center; gap: 10px; padding: 8px;
    border-radius: var(--radius-sm); cursor: pointer;
}
.search-result:hover { background: var(--surface-2); }
.search-result img, .search-result .avatar { width: 36px; height: 36px; border-radius: 50%; }
.search-result-meta { font-size: 12px; color: var(--text-2); }

.topbar-nav {
    display: flex; align-items: center; gap: 4px;
    flex: 1; justify-content: center;
}
.topbar-nav a {
    width: 100px; height: 44px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); color: var(--text-2); position: relative;
}
.topbar-nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar-nav a.active { color: var(--accent); border-bottom: 3px solid var(--accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.topbar-nav a svg { width: 22px; height: 22px; }

.topbar-right {
    display: flex; align-items: center; gap: 8px; width: var(--side-w);
    justify-content: flex-end; padding-right: 4px;
}
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--surface-2); border: none; color: var(--text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--accent); color: white;
    font-size: 11px; font-weight: 700; min-width: 18px; height: 18px;
    border-radius: 999px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
}
.avatar-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--surface-2); cursor: pointer; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    border: none; padding: 0;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ===== LAYOUT ===== */
.layout {
    padding-top: var(--topbar-h);
    display: grid;
    grid-template-columns: var(--side-w) minmax(0,1fr) var(--side-w);
    gap: 0;
    max-width: 1600px;
    margin: 0 auto;
}
.sidebar-left, .sidebar-right {
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 16px 8px;
}
.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar { width: 8px; }
.sidebar-left::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }

.main {
    padding: 16px 20px;
    width: 100%;
    min-width: 0;     /* tvingar grid-kolumnen att respektera 1fr utan att overflowa */
}

.sidebar-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text);
}
.sidebar-nav-item:hover { background: var(--surface-2); }
.sidebar-nav-item.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-nav-item .ico {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface-2); display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-nav-item.active .ico { background: var(--accent); color: #fff; }
.sidebar-nav-item .ico svg { width: 18px; height: 18px; }
.sidebar-nav-item .label { font-weight: 600; font-size: 14px; }

.sidebar-section-title {
    text-transform: uppercase; font-size: 11px; letter-spacing: 1px;
    color: var(--text-3); margin: 16px 12px 6px;
}
.sidebar-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.card.tight { padding: 12px; }
.card-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.card-title { font-size: 17px; font-weight: 700; }

/* ===== AVATARS ===== */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background-size: cover; background-position: center;
    background-color: var(--surface-2);
    flex-shrink: 0; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; }
.avatar.lg { width: 56px; height: 56px; }
.avatar.xl { width: 168px; height: 168px; border: 4px solid var(--bg); }

/* ===== COMPOSER ===== */
.composer-pill {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2); border-radius: 999px;
    padding: 10px 16px; cursor: pointer;
    color: var(--text-2); flex: 1;
}
.composer-pill:hover { background: var(--surface-hover); }
.composer-actions {
    display: flex; border-top: 1px solid var(--border);
    margin-top: 12px; padding-top: 8px; gap: 4px;
}
.composer-actions button {
    flex: 1; background: transparent; border: none; color: var(--text-2);
    padding: 10px; border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; font-size: 14px;
}
.composer-actions button:hover { background: var(--surface-2); color: var(--text); }
.composer-actions svg { width: 22px; height: 22px; }

/* ===== POSTCARD ===== */
.postcard { padding: 16px; }
.postcard-head {
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 10px;
}
.postcard-head .meta { flex: 1; min-width: 0; }
.postcard-head .name { font-weight: 700; }
.postcard-head .name a { color: var(--text); }
.postcard-head .name a:hover { text-decoration: underline; }
.postcard-head .sub { font-size: 12px; color: var(--text-2); }
.postcard-body {
    font-size: 15px; white-space: pre-wrap; word-wrap: break-word;
    line-height: 1.45; padding: 4px 0 12px;
}
.postcard-body a { color: var(--accent); }
.postcard-media {
    display: grid; gap: 4px;
    border-radius: var(--radius-sm); overflow: hidden;
    margin: 0 -16px 12px;
}
.postcard-media.n1 img { max-height: 600px; object-fit: cover; width: 100%; }
.postcard-media.n2 { grid-template-columns: 1fr 1fr; }
.postcard-media.n3 { grid-template-columns: 1fr 1fr; }
.postcard-media.n3 img:first-child { grid-row: span 2; height: 100%; }
.postcard-media.n4 { grid-template-columns: 1fr 1fr; }
.postcard-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }

.reaction-counts {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-2); font-size: 13px;
    padding: 6px 0; border-bottom: 1px solid var(--border);
}
.reaction-counts .emoji-stack {
    display: inline-flex; align-items: center;
}
.reaction-counts .emoji-stack span {
    font-size: 16px; margin-right: -6px;
}

.reaction-bar {
    display: flex; padding-top: 6px; gap: 2px;
}
.reaction-bar button {
    flex: 1; background: transparent; border: none; color: var(--text-2);
    padding: 8px; border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-weight: 600; font-size: 14px; position: relative;
}
.reaction-bar button:hover { background: var(--surface-2); color: var(--text); }
.reaction-bar button.active { color: var(--accent); }
.reaction-bar svg { width: 20px; height: 20px; }

.reaction-popover {
    position: absolute; bottom: 100%; left: 0;
    background: var(--surface); border-radius: 999px;
    padding: 6px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: none; gap: 4px; z-index: 30;
    transform: translateY(-4px);
}
.reaction-popover.open { display: flex; }
.reaction-popover button {
    width: 40px; height: 40px; border-radius: 50%; background: transparent;
    border: none; cursor: pointer; font-size: 22px; padding: 0;
    transition: transform 100ms;
}
.reaction-popover button:hover { transform: scale(1.4); background: var(--surface-2); }

/* ===== COMMENTS ===== */
.comments { padding-top: 8px; }
.comment {
    display: flex; gap: 8px; margin-top: 10px;
}
.comment .body {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 8px 12px; flex: 1; min-width: 0;
}
.comment .body .name { font-weight: 700; font-size: 13px; }
.comment .body p { margin: 2px 0 0; word-wrap: break-word; }
.comment .meta-row { font-size: 12px; color: var(--text-2); padding: 4px 12px 0; display: flex; gap: 12px; }
.comment .meta-row a { color: var(--text-2); }
.comment .meta-row a:hover { color: var(--text); text-decoration: underline; }
.comment-form {
    display: flex; gap: 8px; padding-top: 12px; align-items: flex-start;
}
.comment-form .input {
    flex: 1; background: var(--surface-2); border-radius: 999px;
    padding: 8px 12px; border: 1px solid transparent; color: var(--text);
    outline: none; min-height: 36px;
}
.comment-form .input:focus { border-color: var(--accent); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600;
    font-size: 14px; border: none; cursor: pointer;
    background: var(--surface-2); color: var(--text);
    transition: background 100ms;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }
.btn-block { display: flex; width: 100%; padding: 11px 16px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 50%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== INPUTS ===== */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="url"],
textarea, select {
    width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); outline: none; font-size: 15px;
}
.input:focus,
input:focus, textarea:focus, select:focus {
    border-color: var(--accent); background: var(--surface);
}
textarea { min-height: 100px; resize: vertical; line-height: 1.4; }
label.field { display: block; margin-bottom: 12px; }
label.field .lab { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-2); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.help { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* ===== AUTH ===== */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
    background:
        radial-gradient(ellipse at top, rgba(225, 29, 72, 0.08), transparent 60%),
        var(--bg);
}
.auth-shell {
    width: 100%; max-width: 980px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
}
.auth-promo h1 {
    font-size: 56px; font-weight: 800; line-height: 1.05; letter-spacing: -2px;
    background: linear-gradient(45deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}
.auth-promo p { color: var(--text-2); font-size: 17px; max-width: 420px; }
.auth-promo .vinyl-bg {
    width: 240px; height: 240px; margin-top: 32px;
    border-radius: 50%; position: relative;
    background: radial-gradient(circle at 50% 50%, #28282d 0%, #0a0a0b 70%, #18181b 80%);
    box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 0 0 6px #18181b, 0 0 0 2px var(--accent);
}
.auth-promo .vinyl-bg::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 60px; height: 60px; border-radius: 50%;
    background: radial-gradient(circle, var(--accent), var(--accent-hover));
}
.auth-promo .vinyl-bg::after {
    content: ''; position: absolute; inset: 12px; border-radius: 50%;
    background: repeating-radial-gradient(circle, rgba(255,255,255,.03) 0 1px, transparent 1px 4px);
}

.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px 28px;
    box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 20px; }
.auth-card .footer {
    border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px;
    text-align: center; font-size: 14px; color: var(--text-2);
}
.auth-card .footer a { color: var(--accent); font-weight: 600; }

/* ===== PROFILE ===== */
.profile-cover {
    height: 360px; background: var(--surface-2);
    background-size: cover; background-position: center;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    position: relative;
}
.profile-cover.empty {
    background: linear-gradient(135deg, #1f1f23 0%, #2a1a23 50%, #18181b 100%);
}
.profile-header {
    margin-top: -32px;
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--border);
}
.profile-header-row {
    display: flex; align-items: flex-end; gap: 24px;
    padding: 24px 0;
}
.profile-header-row .info { flex: 1; padding-bottom: 8px; }
.profile-header-row .name { font-size: 32px; font-weight: 800; }
.profile-header-row .meta { color: var(--text-2); margin-top: 4px; }
.profile-header-actions { display: flex; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.profile-tabs {
    display: flex; gap: 4px; border-top: 1px solid var(--border);
    padding-top: 4px; overflow-x: auto;
}
.profile-tabs a {
    padding: 14px 16px; color: var(--text-2); font-weight: 600;
    border-bottom: 3px solid transparent; white-space: nowrap;
}
.profile-tabs a:hover { color: var(--text); background: var(--surface-2); }
.profile-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

.profile-grid {
    display: grid; grid-template-columns: 360px 1fr; gap: 16px;
    margin-top: 16px;
}
@media (max-width: 920px) {
    .profile-grid { grid-template-columns: 1fr; }
}

/* ===== FORMS / MODAL ===== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; z-index: 100;
    padding: 16px;
}
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 540px; max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow);
}
.modal-head {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; position: relative;
}
.modal-head h3 { font-size: 18px; }
.modal-head .close {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 48px 16px;
    color: var(--text-2);
}
.empty-state .vinyl-icon {
    width: 80px; height: 80px; margin: 0 auto 16px;
    border-radius: 50%; position: relative;
    background: radial-gradient(circle, #28282d 0%, #0a0a0b 70%, #18181b 80%);
    box-shadow: inset 0 0 0 3px #18181b, 0 0 0 1px var(--border-strong);
    opacity: 0.6;
}
.empty-state .vinyl-icon::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { max-width: 320px; margin: 0 auto; }

/* ===== NOTIFICATIONS DROPDOWN ===== */
.dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); width: 360px; max-height: 480px;
    overflow-y: auto; box-shadow: var(--shadow);
    display: none; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown-head {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700;
}
.notif-item {
    display: flex; gap: 10px; padding: 10px 16px; align-items: flex-start;
    border-left: 3px solid transparent; cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); border-left-color: var(--accent); }
.notif-item .meta { flex: 1; min-width: 0; }
.notif-item .meta p { margin: 0; font-size: 14px; }
.notif-item .meta .time { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ===== MESSAGES ===== */
.msg-layout {
    display: grid; grid-template-columns: 320px 1fr;
    height: calc(100vh - var(--topbar-h)); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.msg-list {
    border-right: 1px solid var(--border); overflow-y: auto;
}
.msg-list-item {
    padding: 12px 16px; cursor: pointer; display: flex; gap: 10px;
    border-bottom: 1px solid var(--border);
}
.msg-list-item:hover { background: var(--surface-2); }
.msg-list-item.active { background: var(--surface-2); }
.msg-list-item .name { font-weight: 700; }
.msg-list-item .preview { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread {
    display: flex; flex-direction: column; height: 100%;
}
.msg-thread-head {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    display: flex; gap: 10px; align-items: center;
}
.msg-thread-body {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.msg-bubble {
    max-width: 65%; padding: 9px 14px; border-radius: 18px;
    font-size: 14px; line-height: 1.4; word-wrap: break-word;
}
.msg-bubble.me {
    align-self: flex-end; background: var(--accent); color: #fff;
}
.msg-bubble.them {
    align-self: flex-start; background: var(--surface-2);
}
.msg-thread-form {
    border-top: 1px solid var(--border); padding: 12px;
    display: flex; gap: 8px;
}
.msg-thread-form input {
    flex: 1; padding: 10px 14px; background: var(--surface-2);
    border: 1px solid transparent; border-radius: 999px;
    color: var(--text); outline: none;
}
.msg-thread-form input:focus { border-color: var(--accent); }

/* ===== EVENT / GROUP / PAGE CARDS ===== */
.entity-card {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
}
.entity-card .cover {
    aspect-ratio: 16/9; background: var(--surface-2);
    border-radius: var(--radius-sm); margin: -16px -16px 12px;
    background-size: cover; background-position: center;
    border-radius: var(--radius) var(--radius) 0 0;
}
.entity-card h3 { font-size: 18px; margin-bottom: 4px; }
.entity-card .meta { color: var(--text-2); font-size: 13px; margin-bottom: 12px; }
.entity-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}

/* ===== RECORD CARD (vinyl) ===== */
.record-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.record-card {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border); overflow: hidden;
    transition: transform 120ms, border-color 120ms;
}
.record-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.record-card .cover {
    aspect-ratio: 1/1; background: var(--surface-2);
    background-size: cover; background-position: center;
    position: relative;
}
.record-card .cover.empty {
    background:
        radial-gradient(circle at center, #2a2a2e 0%, #0a0a0b 65%, #18181b 80%);
}
.record-card .cover.empty::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 32%; height: 32%; border-radius: 50%; background: var(--accent);
}
.record-card .meta { padding: 10px 12px; }
.record-card .artist { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-card .title { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .layout { grid-template-columns: 0 minmax(0,1fr) var(--side-w); }
    .sidebar-left { display: none; }
}
@media (max-width: 900px) {
    .layout { grid-template-columns: minmax(0,1fr); padding-bottom: 64px; }
    .sidebar-right { display: none; }
    .topbar-nav a { width: auto; flex: 1; min-width: 0; }
    .brand { width: auto; }
    .brand-name { display: none; }
    .topbar-right { width: auto; }
    .auth-shell { grid-template-columns: 1fr; gap: 24px; }
    .auth-promo { text-align: center; }
    .auth-promo h1 { font-size: 40px; }
    .auth-promo .vinyl-bg { width: 160px; height: 160px; margin: 24px auto 0; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-cover { height: 200px; }
    .profile-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .profile-header-row .name { font-size: 26px; }
    .avatar.xl { width: 120px; height: 120px; margin-top: -60px; }
    .msg-layout { grid-template-columns: 1fr; }
    .msg-list { display: none; }
    .msg-layout.show-list .msg-list { display: block; }
    .msg-layout.show-list .msg-thread { display: none; }
}

/* ===== RECORDS BROWSER ===== */
.rec-app {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    align-items: flex-start;
}
.rec-side {
    position: sticky; top: calc(var(--topbar-h) + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    max-height: calc(100vh - var(--topbar-h) - 24px);
    overflow-y: auto;
}
.rec-side h6 {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px;
    color: var(--text-3); margin: 16px 0 6px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}
.rec-side h6:first-child { margin-top: 0; }
.rec-side ul { list-style: none; padding: 0; margin: 0; }
.rec-side li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 8px; border-radius: 6px; cursor: pointer;
    color: var(--text); font-size: 13.5px;
    transition: background 80ms;
    user-select: none;
}
.rec-side li:hover { background: var(--surface-2); }
.rec-side li.active {
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.rec-side li .cnt {
    color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums;
}
.rec-side li.active .cnt { color: var(--accent); opacity: 0.7; }
.rec-side .show-more {
    padding: 4px 8px; color: var(--text-2); cursor: pointer; font-size: 12px;
}
.rec-side .show-more:hover { color: var(--accent); }
.rec-side-scope {
    background: var(--surface-2); border-radius: 8px; padding: 4px;
    display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px;
}
.rec-side-scope li {
    padding: 8px 10px; border-radius: 6px; font-weight: 600;
}
.rec-side-stat {
    padding: 10px 4px 14px; margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.rec-side-stat .big {
    font-size: 28px; font-weight: 800; font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -1px; line-height: 1;
}
.rec-side-stat .sub { color: var(--text-3); font-size: 12px; margin-top: 4px; }

.rec-main { min-width: 0; }
.rec-bar {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 14px;
}
.rec-search {
    flex: 1; min-width: 200px; position: relative;
}
.rec-search input {
    width: 100%; height: 40px; border-radius: 999px; padding: 0 36px 0 40px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); outline: none; font-size: 14px;
    transition: border-color 100ms;
}
.rec-search input:focus { border-color: var(--accent); }
.rec-search svg { position: absolute; top: 50%; transform: translateY(-50%); left: 14px; color: var(--text-2); width: 16px; height: 16px; }
.rec-search button {
    position: absolute; top: 50%; transform: translateY(-50%); right: 8px;
    background: none; border: none; color: var(--text-2); cursor: pointer;
    padding: 6px; border-radius: 50%; display: none;
}
.rec-search.has-text button { display: block; }

.rec-bar select.rec-sort {
    height: 40px; border-radius: 999px; padding: 0 32px 0 14px;
    background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23a1a1aa' stroke-width='2'><polyline points='1 1 6 6 11 1'/></svg>") no-repeat right 12px center;
    border: 1px solid var(--border); color: var(--text); font-size: 13px;
    appearance: none; -webkit-appearance: none; cursor: pointer;
}
.rec-bar .view-toggle {
    display: inline-flex; background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px;
}
.rec-bar .view-toggle button {
    width: 32px; height: 32px; border-radius: 999px; background: transparent;
    border: none; cursor: pointer; color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
}
.rec-bar .view-toggle button.active { background: var(--accent); color: #fff; }

/* Grid view — Letterboxd-stil, ren posterruta */
.rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}
.rec-tile {
    cursor: pointer; position: relative;
    transition: transform 120ms ease;
}
.rec-tile:hover { transform: translateY(-3px); }
.rec-tile .cover {
    aspect-ratio: 1/1;
    background: var(--surface-2);
    background-size: cover; background-position: center;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    transition: box-shadow 120ms, outline 80ms;
    outline: 0 solid transparent;
    outline-offset: 0;
}
.rec-tile:hover .cover {
    box-shadow: 0 12px 32px rgba(0,0,0,.6);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.rec-tile .cover.empty {
    background:
        radial-gradient(circle at center, #2a2a2e 0%, #0a0a0b 65%, #18181b 80%);
}
.rec-tile .cover.empty::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 32%; height: 32%; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}
.rec-tile .cover .badge-format {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.65); backdrop-filter: blur(8px);
    color: #fff; font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 999px; letter-spacing: 0.5px;
    opacity: 0; transition: opacity 120ms;
}
.rec-tile:hover .cover .badge-format { opacity: 1; }
.rec-tile .meta { padding: 8px 4px 0; min-height: 38px; }
.rec-tile .artist {
    font-size: 12.5px; font-weight: 700; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    letter-spacing: 0.2px;
}
.rec-tile .title {
    font-size: 12px; color: var(--text-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-style: italic;
}
.rec-tile .year { font-size: 11px; color: var(--text-3); }

/* List view — Discogs-stil, kompakt tabell */
.rec-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.rec-list .head {
    display: grid;
    grid-template-columns: 48px minmax(140px,2fr) minmax(140px,2fr) 70px 60px 80px 110px;
    gap: 12px; padding: 10px 14px;
    background: var(--surface-2); color: var(--text-3);
    text-transform: uppercase; font-size: 11px; letter-spacing: 1.2px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.rec-list .row {
    display: grid;
    grid-template-columns: 48px minmax(140px,2fr) minmax(140px,2fr) 70px 60px 80px 110px;
    gap: 12px; padding: 8px 14px;
    align-items: center; cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 80ms;
}
.rec-list .row:last-child { border-bottom: none; }
.rec-list .row:hover { background: var(--surface-2); }
.rec-list .thumb {
    width: 44px; height: 44px; border-radius: 4px;
    background: var(--surface-2); background-size: cover; background-position: center;
    flex-shrink: 0;
}
.rec-list .thumb.empty {
    background: radial-gradient(circle, #28282d 0%, #0a0a0b 65%, #18181b 80%);
    position: relative;
}
.rec-list .thumb.empty::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 32%; height: 32%; border-radius: 50%; background: var(--accent);
}
.rec-list .col-artist { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-list .col-title  { font-style: italic; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-list .col-year, .rec-list .col-format, .rec-list .col-country, .rec-list .col-label { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Artist-vy: alfabetisk indelning med små thumbs */
.rec-artists {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0;
}
.rec-artists .letter-head {
    padding: 12px 16px 6px;
    color: var(--accent); font-weight: 800; font-size: 22px;
    font-family: 'Space Grotesk', sans-serif;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.rec-artists .letter-head:first-child { border-top: none; }
.rec-artists .artist-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 80ms;
}
.rec-artists .artist-row:hover { background: var(--surface-2); }
.rec-artists .artist-row .thumbs {
    display: flex; gap: -8px;
    flex-shrink: 0;
}
.rec-artists .artist-row .thumbs .t {
    width: 36px; height: 36px; border-radius: 4px;
    background: var(--surface-2); background-size: cover; background-position: center;
    margin-left: -8px;
    box-shadow: 0 0 0 2px var(--surface);
}
.rec-artists .artist-row .thumbs .t:first-child { margin-left: 0; }
.rec-artists .artist-row .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-artists .artist-row .cnt { color: var(--text-3); font-size: 13px; }
.rec-artists .artist-row .arrow { color: var(--text-3); }

/* A-Ö jump bar (för artist-vyn) */
.rec-jumpbar {
    position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 4px;
    display: flex; flex-direction: column; gap: 2px;
    box-shadow: var(--shadow); z-index: 10;
}
.rec-jumpbar a {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; font-size: 10px;
    color: var(--text-2); border-radius: 50%; cursor: pointer;
    transition: all 80ms;
}
.rec-jumpbar a:hover, .rec-jumpbar a.active { background: var(--accent); color: #fff; }
.rec-jumpbar a.disabled { opacity: 0.25; pointer-events: none; }
@media (max-width: 1340px) { .rec-jumpbar { display: none; } }

/* Empty state */
.rec-empty {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 48px 16px;
    text-align: center; color: var(--text-2);
}

/* Mobile sidebar collapse */
.rec-side-toggle {
    display: none;
    background: var(--surface-2); border: 1px solid var(--border);
    height: 40px; border-radius: 999px; padding: 0 16px;
    color: var(--text); font-size: 13px; align-items: center; gap: 6px; cursor: pointer;
}
@media (max-width: 900px) {
    .rec-app { grid-template-columns: 1fr; }
    .rec-side {
        position: fixed; left: 0; top: 0; bottom: 0; width: 280px;
        max-height: 100vh; border-radius: 0;
        z-index: 90; transform: translateX(-100%); transition: transform 200ms;
    }
    .rec-side.open { transform: translateX(0); }
    .rec-side-toggle { display: inline-flex; }
    .rec-side-backdrop {
        position: fixed; inset: 0; background: rgba(0,0,0,.6);
        display: none; z-index: 89;
    }
    .rec-side-backdrop.open { display: block; }
}

/* ============== DETAIL OVERLAY ============== */
.rec-detail-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
    z-index: 200;
    overflow-y: auto;
    animation: fadeIn 120ms;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.rec-detail-sheet {
    max-width: 1080px; margin: 32px auto; min-height: calc(100vh - 64px);
    background: var(--bg); border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,.7);
    animation: slideUp 200ms;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.rec-detail-close {
    position: fixed; top: 16px; right: 16px; z-index: 210;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,.6); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.1);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.rec-detail-hero {
    --hero-bg: var(--surface);
    background: linear-gradient(180deg, var(--hero-bg) 0%, var(--bg) 100%);
    padding: 40px 40px 32px;
    display: grid; grid-template-columns: 320px 1fr; gap: 32px;
    position: relative;
}
.rec-detail-hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 80% at 30% 30%, rgba(0,0,0,.3), transparent 80%);
    pointer-events: none;
}
.rec-detail-hero .cover-large {
    aspect-ratio: 1/1; border-radius: var(--radius);
    background-size: cover; background-position: center;
    background-color: var(--surface-2);
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    position: relative; z-index: 1;
}
.rec-detail-hero .cover-large.empty {
    background: radial-gradient(circle, #28282d 0%, #0a0a0b 65%, #18181b 80%);
}
.rec-detail-hero .cover-large.empty::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 32%; height: 32%; border-radius: 50%; background: var(--accent);
}
.rec-detail-hero .info {
    padding-top: 16px; position: relative; z-index: 1;
    color: #fff;
}
.rec-detail-hero .info .pretitle {
    font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
    color: rgba(255,255,255,.7); margin-bottom: 8px;
}
.rec-detail-hero .info .artist {
    font-size: 18px; font-weight: 600; margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.rec-detail-hero .info h1 {
    font-size: 44px; font-weight: 800; line-height: 1.05; letter-spacing: -1px;
    font-family: 'Space Grotesk', sans-serif;
    margin: 0 0 16px;
    text-shadow: 0 2px 16px rgba(0,0,0,.6);
}
.rec-detail-hero .info .facts {
    display: flex; gap: 12px; flex-wrap: wrap;
    color: rgba(255,255,255,.85); font-size: 14px;
    margin-bottom: 24px;
}
.rec-detail-hero .info .facts span { padding: 4px 10px; background: rgba(255,255,255,.1); border-radius: 999px; backdrop-filter: blur(4px); }
.rec-detail-hero .info .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-detail-hero .info .actions .btn { box-shadow: 0 4px 16px rgba(0,0,0,.3); }

.rec-detail-body { padding: 32px 40px 40px; }
.rec-detail-body section { margin-bottom: 32px; }
.rec-detail-body section h3 {
    font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
    color: var(--text-3); margin: 0 0 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
    font-weight: 700;
}

/* Tracklist */
.tracklist {
    display: flex; flex-direction: column;
}
.tracklist .track {
    display: grid;
    grid-template-columns: 28px 1fr 60px;
    gap: 14px; align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.tracklist .track:last-child { border-bottom: none; }
.tracklist .track:hover { background: var(--surface); }
.tracklist .track .pos { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.tracklist .track .ttl { color: var(--text); }
.tracklist .track .dur { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.tracklist .heading {
    padding: 10px 4px 4px;
    font-weight: 700; color: var(--text-2); font-size: 13px;
    text-transform: uppercase; letter-spacing: 1px;
}

/* Identifiers / credits as collapsible */
.rec-detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
.rec-detail-grid dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.rec-detail-grid dt { color: var(--text-3); }
.rec-detail-grid dd { margin: 0; color: var(--text); }
.rec-detail-grid dd a { color: var(--accent); }

.versions-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.version-tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px; cursor: pointer;
    transition: border-color 100ms;
}
.version-tile:hover { border-color: var(--accent); }
.version-tile .cover {
    aspect-ratio: 1/1; background: var(--surface-2);
    background-size: cover; background-position: center;
    border-radius: 6px; margin-bottom: 8px;
}
.version-tile .meta { font-size: 12px; color: var(--text-2); }

@media (max-width: 720px) {
    .rec-detail-hero { grid-template-columns: 1fr; padding: 24px 20px; gap: 16px; }
    .rec-detail-hero .cover-large { max-width: 240px; margin: 0 auto; }
    .rec-detail-hero .info { text-align: center; }
    .rec-detail-hero .info .facts { justify-content: center; }
    .rec-detail-hero .info h1 { font-size: 32px; }
    .rec-detail-body { padding: 20px; }
    .rec-detail-grid { grid-template-columns: 1fr; }
    .rec-list .head, .rec-list .row {
        grid-template-columns: 44px minmax(100px,1.2fr) 70px 80px;
    }
    .rec-list .col-title, .rec-list .col-format, .rec-list .col-country,
    .rec-list .head > *:nth-child(3), .rec-list .head > *:nth-child(5), .rec-list .head > *:nth-child(7) { display: none; }
}

/* ===== UTILITIES ===== */
.row { display: flex; gap: 8px; align-items: center; }
.row-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--text-2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.fw-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.flash {
    background: var(--accent-soft); color: var(--accent); padding: 10px 14px;
    border-radius: var(--radius-sm); margin-bottom: 12px;
    border: 1px solid rgba(225,29,72,0.3);
}
.flash.ok { background: rgba(16,185,129,.12); color: var(--ok); border-color: rgba(16,185,129,.3); }
.hidden { display: none !important; }
.divider-h { height: 1px; background: var(--border); margin: 12px 0; }

/* ===== SCROLL-LOADED ===== */
.loading-spinner {
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; width: 28px; height: 28px;
    animation: spin 0.8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Subtila vinyl-skiveffekter på cover & headers */
.vinyl-streak {
    background-image:
        linear-gradient(to right, transparent 0%, rgba(225, 29, 72, 0.08) 50%, transparent 100%);
}
