/* Kerbside — shared styles */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --ink: #14181f;
  --ink-2: #4a5160;
  --ink-3: #7b8292;
  --line: #dde1e7;
  --navy: #0f1724;
  --navy-2: #1b2638;
  --plate: #f7c600;
  --plate-ink: #111;
  --accent: #e2421b;
  --accent-ink: #fff;
  --good: #14804a;
  --good-bg: #e3f4ea;
  --warn: #9a5b00;
  --warn-bg: #fff2d6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --head: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1018; --surface: #151b26; --surface-2: #1d2532; --ink: #eef1f6; --ink-2: #b4bccb;
    --ink-3: #8790a2; --line: #2a3344; --good-bg: #12301f; --good: #5fd394; --warn-bg: #3a2a08; --warn: #f3c56b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1018; --surface: #151b26; --surface-2: #1d2532; --ink: #eef1f6; --ink-2: #b4bccb;
  --ink-3: #8790a2; --line: #2a3344; --good-bg: #12301f; --good: #5fd394; --warn-bg: #3a2a08; --warn: #f3c56b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 700; line-height: 1.1; margin: 0 0 .4em; letter-spacing: .2px; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.plate { background: var(--plate); color: var(--plate-ink); font-family: "Barlow Condensed", sans-serif; font-weight: 800; letter-spacing: 2px; padding: 3px 10px 2px 6px; border-radius: 4px; border: 2px solid #111; display: inline-flex; align-items: center; gap: 6px; font-size: 1.25rem; line-height: 1.1; }
.plate .gb { background: #1a3e9c; color: #fff; font-size: .55rem; letter-spacing: 0; padding: 4px 3px; border-radius: 2px; font-family: var(--body); font-weight: 700; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: #cdd5e2; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .93rem; white-space: nowrap; }
.nav a:hover { color: #fff; background: var(--navy-2); }
.nav a.active { color: #fff; background: var(--navy-2); box-shadow: inset 0 -2px 0 var(--plate); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 8px; color: #fff; background: var(--navy-2); border: 0; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; font-size: .9rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; flex-shrink: 0; }
@media (max-width: 600px) { .user-chip { padding: 3px; } .user-chip > span:not(.avatar) { display: none; } .header-actions { gap: 4px; } }
.badge-member { background: var(--plate); color: #111; font-size: .65rem; font-weight: 800; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .5px; }

@media (max-width: 1140px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--navy); flex-direction: column; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .site-header .wrap { justify-content: space-between; }
  .header-actions .btn-sell { display: none; }
}

/* Buttons & form */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font: 600 .92rem var(--body); cursor: pointer; text-decoration: none; transition: transform .05s, background .15s, border-color .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #c93712; }
.btn-plate { background: var(--plate); color: #111; }
.btn-plate:hover { background: #e3b600; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-dark { background: var(--navy-2); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn.on { color: var(--accent); border-color: var(--accent); }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--ink-2); }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--plate); outline-offset: 0; border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); }
.check input { width: auto; }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 80% -10%, #2b3c5c 0%, transparent 60%), var(--navy); color: #fff; padding: 56px 0 72px; position: relative; overflow: hidden; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); text-transform: uppercase; }
.hero h1 span { color: var(--plate); }
.hero p.lead { color: #c3cbd8; font-size: 1.1rem; max-width: 560px; }
.hero-road { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: repeating-linear-gradient(90deg, var(--plate) 0 50px, transparent 50px 90px); opacity: .9; }
.search-panel { background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-lg); margin-top: 26px; display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px; align-items: end; max-width: 980px; }
.search-panel .field { margin: 0; }
@media (max-width: 860px) { .search-panel { grid-template-columns: 1fr 1fr; } .search-panel .btn { grid-column: 1 / -1; } }
@media (max-width: 480px) { .search-panel { grid-template-columns: 1fr; } }

.page-head { background: var(--navy); color: #fff; padding: 34px 0 30px; }
.page-head p { color: #c3cbd8; margin: 0; max-width: 680px; }
.crumbs { font-size: .85rem; color: #9aa6ba; margin-bottom: 8px; }
.crumbs a { color: #cdd5e2; }

section.block { padding: 44px 0; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.link-more { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; position: relative; }
a.card:hover, .card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card .media { aspect-ratio: 16 / 10; position: relative; overflow: hidden; }
.card .media svg { width: 100%; height: 100%; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.card .price { font-family: var(--head); font-size: 1.6rem; font-weight: 700; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.card .foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: .84rem; color: var(--ink-3); }
.card .save { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); color: var(--ink-2); font-size: .78rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.plate { background: var(--plate); color: #111; }
.pill.dark { background: var(--navy-2); color: #fff; }
.tag-reg { position: absolute; left: 10px; bottom: 10px; background: var(--plate); color: #111; font: 800 .8rem var(--head); letter-spacing: 1.5px; padding: 2px 7px; border-radius: 3px; border: 1.5px solid #111; }

/* Layout with sidebar filters */
.with-side { display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; padding: 28px 0 56px; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 80px; }
.side h3 { font-size: 1.2rem; }
@media (max-width: 900px) { .with-side { grid-template-columns: 1fr; } .side { position: static; } }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 13px; font: 600 .85rem var(--body); cursor: pointer; }
.chip.on { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Feature tiles on home */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--navy); color: var(--plate); display: grid; place-items: center; margin-bottom: 12px; }
.tile h3 { margin-bottom: 4px; }
.tile p { color: var(--ink-3); margin: 0; font-size: .92rem; }

.stats { display: flex; gap: 36px; margin-top: 28px; flex-wrap: wrap; }
.stats div { font-family: var(--head); font-size: 2rem; font-weight: 700; color: var(--plate); line-height: 1; }
.stats span { display: block; font-family: var(--body); font-size: .8rem; color: #9aa6ba; font-weight: 500; margin-top: 4px; }

/* Detail page */
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 26px; padding: 28px 0 56px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.gallery { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.gallery svg { width: 100%; height: 100%; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.thumbs div { border-radius: 8px; overflow: hidden; aspect-ratio: 16/10; opacity: .8; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.spec { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.spec small { display: block; color: var(--ink-3); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.spec b { font-size: .98rem; }
.feature-list { columns: 2; padding-left: 18px; margin: 0; }
@media (max-width: 520px) { .feature-list { columns: 1; } }
.seller { display: flex; gap: 12px; align-items: center; }
.seller .avatar { width: 46px; height: 46px; font-size: 1rem; }
.safety { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .86rem; }
.big-price { font-family: var(--head); font-size: 2.6rem; font-weight: 700; line-height: 1; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 11px 16px; font: 600 .95rem var(--body); color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }

/* Forum */
.forum-cats { display: grid; gap: 10px; }
.forum-cat { display: grid; grid-template-columns: 48px 1fr 90px 90px 220px; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
.forum-cat:hover { border-color: var(--ink-3); }
.forum-cat .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.3rem; }
.forum-cat .num { text-align: center; font-weight: 700; }
.forum-cat .num small { display: block; color: var(--ink-3); font-weight: 500; font-size: .75rem; }
.forum-cat .latest { font-size: .83rem; color: var(--ink-3); overflow: hidden; }
.forum-cat .latest b { color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
@media (max-width: 860px) { .forum-cat { grid-template-columns: 44px 1fr; } .forum-cat .num, .forum-cat .latest { display: none; } }
.thread-row { display: grid; grid-template-columns: 1fr 80px 80px 180px; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.thread-row:hover { background: var(--surface-2); }
.thread-row:last-child { border-bottom: 0; }
.thread-row .t { font-weight: 600; }
.thread-row .num { text-align: center; font-size: .9rem; }
@media (max-width: 720px) { .thread-row { grid-template-columns: 1fr; } .thread-row .num, .thread-row .last { display: none; } }
.post { display: grid; grid-template-columns: 150px 1fr; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post .who { padding: 18px 14px; background: var(--surface-2); text-align: center; font-size: .82rem; color: var(--ink-3); }
.post .who .avatar { width: 52px; height: 52px; margin: 0 auto 8px; font-size: 1.1rem; }
.post .who b { display: block; color: var(--ink); font-size: .92rem; }
.post .content { padding: 18px 20px; }
.post .content .when { font-size: .8rem; color: var(--ink-3); margin-bottom: 8px; display: flex; justify-content: space-between; }
.post .content p { white-space: pre-wrap; }
@media (max-width: 640px) { .post { grid-template-columns: 1fr; } .post .who { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 14px; } .post .who .avatar { margin: 0; width: 36px; height: 36px; } }
.pinned { color: var(--accent); font-weight: 700; font-size: .75rem; text-transform: uppercase; margin-right: 6px; }

/* Garage */
.member-gate { background: linear-gradient(135deg, var(--navy) 0%, #24324a 100%); color: #fff; border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.member-gate p { color: #c3cbd8; margin: 0; }
@media (max-width: 700px) { .member-gate { grid-template-columns: 1fr; } }
.garage-owner { display: flex; align-items: center; gap: 10px; }
.mod-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Events */
.event-card { display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); align-items: start; }
.event-card + .event-card { margin-top: 12px; }
.date-block { background: var(--navy); color: #fff; border-radius: 10px; text-align: center; padding: 8px 0; font-family: var(--head); }
.date-block .d { font-size: 2rem; font-weight: 700; line-height: 1; }
.date-block .m { color: var(--plate); text-transform: uppercase; font-weight: 700; letter-spacing: 1px; font-size: .9rem; }
.date-block .w { font-size: .75rem; color: #9aa6ba; font-family: var(--body); }
.event-card h3 { margin: 0 0 4px; }
.event-card .actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.distance { font-family: var(--head); font-size: 1.3rem; font-weight: 700; }
@media (max-width: 640px) { .event-card { grid-template-columns: 64px 1fr; } .event-card .actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }

/* Membership */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative; }
.plan.featured { border: 2px solid var(--plate); }
.plan .ribbon { position: absolute; top: -12px; left: 24px; }
.plan .amount { font-family: var(--head); font-size: 3rem; font-weight: 700; line-height: 1; }
.plan ul { padding: 0; list-style: none; margin: 16px 0 22px; flex: 1; }
.plan li { padding: 6px 0 6px 26px; position: relative; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.plan li::before { content: "✓"; position: absolute; left: 4px; color: var(--good); font-weight: 800; }
.plan li.no { color: var(--ink-3); }
.plan li.no::before { content: "–"; color: var(--ink-3); }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 12, 20, .6); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.close-x { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-3); }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 200; font-weight: 500; border-left: 4px solid var(--plate); max-width: calc(100% - 32px); animation: fade .2s; }

/* Footer */
.site-footer { background: var(--navy); color: #9aa6ba; padding: 40px 0 26px; margin-top: 40px; font-size: .9rem; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.site-footer h4 { color: #fff; font-size: 1.1rem; }
.site-footer a { color: #cdd5e2; text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: var(--plate); }
.site-footer .legal { border-top: 1px solid #243047; margin-top: 26px; padding-top: 16px; font-size: .8rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }

/* Avatars as photos, profile links */
img.avatar { object-fit: cover; background: var(--surface-2); }
.avatar.xl { width: 128px; height: 128px; font-size: 2.6rem; border: 5px solid var(--surface); box-shadow: var(--shadow); }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.card .avatar.lg { border: 3px solid var(--surface); }
a.ulink { text-decoration: none; color: inherit; }
a.ulink:hover { text-decoration: underline; }

/* Photos */
.photo-grid { display: grid; gap: 6px; margin: 12px 0 4px; max-width: 640px; }
.photo-grid.n1 { grid-template-columns: 1fr; }
.photo-grid.n2 { grid-template-columns: 1fr 1fr; }
.photo-grid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.photo-grid.n3 .ph:first-child { grid-row: span 2; }
.photo-grid.n4 { grid-template-columns: 1fr 1fr; }
.ph { padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 16 / 10; background: var(--surface-2); display: block; width: 100%; }
.photo-grid.n3 .ph:first-child { aspect-ratio: auto; height: 100%; }
.ph img, .ph svg { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ph:hover img, .ph:hover svg { transform: scale(1.03); }
.lightbox img, .lightbox svg { width: 100%; height: auto; max-height: 75vh; object-fit: contain; border-radius: 8px; }
.pick-prev { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pp { position: relative; width: 84px; height: 64px; border-radius: 6px; overflow: hidden; }
.pp img { width: 100%; height: 100%; object-fit: cover; }
.pp button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; line-height: 1; font-size: 1rem; }

/* Forum post extras */
.post .who .drives { margin-top: 6px; font-size: .75rem; color: var(--ink-2); }
.post .who .drives b { display: inline; font-size: .75rem; }
.post.member .who { box-shadow: inset 3px 0 0 var(--post-accent, var(--plate)); }
.post .sig { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 8px; font-size: .82rem; color: var(--ink-3); font-style: italic; }

/* Profile */
.profile-cover { height: 220px; background: var(--navy); }
@media (max-width: 640px) { .profile-cover { height: 140px; } }
.profile-head { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: start; padding: 16px 0 18px; }
.profile-head > div:first-child { margin-top: -80px; }
.profile-head h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.6rem); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-head .bio { margin: 6px 0 0; max-width: 640px; color: var(--ink-2); }
@media (max-width: 700px) { .profile-head { grid-template-columns: 1fr; gap: 10px; } .profile-head > div:first-child { margin-top: -66px; } .avatar.xl { width: 100px; height: 100px; font-size: 2rem; } }
.profile-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.profile-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 14px; font-size: .8rem; color: var(--ink-3); }
.profile-stats b { display: block; font-family: var(--head); font-size: 1.5rem; color: var(--ink); line-height: 1.1; }
.profile-tabs .tab.on { border-bottom-color: var(--p-accent, var(--accent)); }
.locked { position: relative; }
.locked .lock-overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 80%, transparent); display: grid; place-items: center; text-align: center; border-radius: var(--radius-sm); padding: 12px; z-index: 1; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.cover-sw { width: 96px; height: 48px; border-radius: 8px; border: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--line); color: #fff; font-size: .7rem; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.6); padding: 0; }
.cover-sw.on { box-shadow: 0 0 0 3px var(--ink); }
.perk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 14px 0; }
.perk-list div { background: rgba(255,255,255,.07); border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
.activity-row { display: block; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.activity-row:hover { background: var(--surface-2); }
.activity-row:last-child { border-bottom: 0; }

/* Inbox link in header */
.inbox-link { position: relative; color: #cdd5e2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; }
.inbox-link:hover { background: var(--navy-2); color: #fff; }
.inbox-link .count { position: absolute; top: 1px; right: 0; background: var(--accent); color: #fff; font-size: .65rem; font-weight: 800; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* Trust */
.trust { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.t-excellent { background: #dcfce7; color: #14532d; }
.t-great { background: #e0f2fe; color: #0c4a6e; }
.t-good { background: #fef9c3; color: #713f12; }
.t-fair { background: #fee2e2; color: #7f1d1d; }
.t-new { background: var(--surface-2); color: var(--ink-3); }
.stars { color: #f59e0b; letter-spacing: 1px; }
.trust-summary { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 760px) { .trust-summary { grid-template-columns: 1fr; } }
.dial { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.dial > div { width: 118px; height: 118px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.dial b { font-family: var(--head); font-size: 2.6rem; line-height: 1; display: block; }
.dist-row { display: grid; grid-template-columns: 26px 1fr 26px; gap: 8px; align-items: center; font-size: .82rem; margin: 3px 0; }
.dist-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.dist-bar span { display: block; height: 100%; background: #f59e0b; }
.review { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; }
.star-input label { font-size: 2rem; color: var(--line); cursor: pointer; margin: 0; line-height: 1; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: #f59e0b; }
.star-input input:focus-visible + label { outline: 2px solid var(--plate); }
.btn.on-trust { background: var(--good-bg); color: var(--good); border-color: var(--good); }

/* Messages */
.inbox { display: grid; grid-template-columns: 320px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 230px); min-height: 480px; }
.inbox-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-side .tabs { margin: 0; padding: 0 4px; }
.inbox-side .tab { padding: 11px 9px; font-size: .86rem; }
.inbox-list { overflow-y: auto; flex: 1; }
.convo-row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.convo-row:hover, .convo-row.on { background: var(--surface-2); }
.convo-row .meta { flex: 1; min-width: 0; }
.convo-row .meta b { display: flex; justify-content: space-between; gap: 6px; font-size: .92rem; }
.convo-row .meta b small { color: var(--ink-3); font-weight: 500; }
.convo-row .snip { font-size: .82rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-row.unread .snip { color: var(--ink); font-weight: 600; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chat-ctx { padding: 8px 16px; background: var(--surface-2); font-size: .82rem; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 75%; padding: 9px 13px; border-radius: 16px; background: var(--surface-2); white-space: pre-wrap; word-wrap: break-word; font-size: .93rem; }
.bubble.mine { align-self: flex-end; background: var(--navy-2); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble time { display: block; font-size: .68rem; opacity: .65; margin-top: 3px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form textarea { min-height: 44px; height: 44px; resize: none; }
.back-btn { display: none; }
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 180px); }
  .inbox.chatting .inbox-side { display: none; }
  .inbox:not(.chatting) .chat { display: none; }
  .back-btn { display: inline-flex; }
}

/* Groups */
.g-cover { height: 90px; position: relative; }
.g-icon { position: absolute; left: 14px; bottom: -22px; width: 48px; height: 48px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 1.6rem; }
.group-card .body { padding-top: 28px; }
.group-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 14px 0 22px; position: relative; }
.g-icon.big { position: static; width: 96px; height: 96px; font-size: 3rem; border-radius: 20px; border: 4px solid var(--surface); flex-shrink: 0; margin-top: -58px; }
.group-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.group-head .crumbs { margin: 0; }
.group-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; padding-bottom: 56px; }
.group-layout .panel + .panel, .group-layout #composer + #feed .panel:first-child { margin-top: 16px; }
.gpost { margin-top: 16px; }
@media (max-width: 900px) { .group-layout { grid-template-columns: 1fr; } .group-layout aside { order: -1; } }
.avatar-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.comments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
.comment { display: flex; gap: 10px; padding: 8px 0; font-size: .9rem; }
.comment .avatar { width: 28px; height: 28px; font-size: .65rem; }
.cform { display: flex; gap: 8px; margin-top: 6px; }
.role-badge { display: inline-flex; align-items: center; gap: 3px; font-size: .68rem; font-weight: 800; padding: 1px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; vertical-align: middle; }
.role-badge.admin { background: linear-gradient(135deg, #f7c600, #f59e0b); color: #111; box-shadow: 0 0 0 1px #b45309 inset; }
.role-badge.mod { background: #e0e7ff; color: #3730a3; box-shadow: 0 0 0 1px #a5b4fc inset; }
.mem-list { display: flex; flex-direction: column; }
.mem-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.mem-row .avatar { width: 32px; height: 32px; font-size: .72rem; }
.mem-name { flex: 1; min-width: 0; font-size: .9rem; font-weight: 600; }
.mem-menu { position: relative; }
.mem-menu summary { list-style: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink-2); font-weight: 800; }
.mem-menu summary::-webkit-details-marker { display: none; }
.mem-menu[open] summary { background: var(--surface-2); }
.mem-menu .menu { position: absolute; right: 0; top: 34px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 210px; padding: 4px; display: flex; flex-direction: column; }
.mem-menu .menu button { background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 6px; font: 500 .88rem var(--body); color: var(--ink); cursor: pointer; }
.mem-menu .menu button:hover { background: var(--surface-2); }
.mem-menu .menu button.danger { color: #c41e1e; }
.menu-note { font-size: .78rem; color: var(--ink-3); padding: 8px 10px; }
.banned { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.link-btn { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: .85rem; padding: 2px 6px; border-radius: 4px; align-self: flex-start; }
.link-btn:hover { color: #c41e1e; background: var(--surface-2); }
.req-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.req-row:first-of-type { border-top: 0; }

.auth-error { color: #b91c1c; background: #fee2e2; padding: 8px 10px; border-radius: 6px; margin: 0 0 12px; }
#auth-msg.pill { display: block; white-space: normal; margin: 0 0 12px; padding: 8px 10px; border-radius: 6px; }

/* Legal pages */
.legal-doc { max-width: 820px; padding: 28px 16px 56px; }
.legal-doc h2 { margin-top: 32px; font-size: 1.6rem; }
.legal-doc h3 { margin-top: 20px; font-size: 1.2rem; }
.legal-doc p, .legal-doc li { line-height: 1.65; }
.legal-doc li { margin-bottom: 6px; }
.legal-doc table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .9rem; }
.legal-doc th, .legal-doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-doc th { background: var(--surface-2); }
.legal-doc .toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.legal-doc .toc ol { margin: 6px 0 0; padding-left: 20px; columns: 2; }
@media (max-width: 640px) { .legal-doc .toc ol { columns: 1; } .legal-doc table { font-size: .82rem; } }
mark.todo { background: #fde047; color: #111; padding: 0 4px; border-radius: 3px; font-weight: 700; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); line-height: 1.5; }
.consent input { width: auto; margin-top: 4px; flex-shrink: 0; }

.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.demo-note { background: var(--warn-bg); color: var(--warn); font-size: .82rem; text-align: center; padding: 6px 16px; }
