/* ==========================================================================
   928 Club Sweden — dark theme
   ========================================================================== */

/* Dark theme (default) */
:root {
    color-scheme: dark;
    --bg:          #0d0e10;
    --bg-elev:     #16181c;
    --bg-elev-2:   #1d2025;
    --border:      #2a2e35;
    --border-soft: #23262c;
    --text:        #e7e9ec;
    --text-muted:  #9aa1aa;
    /* Monochrome accent: white on dark, black on light. Red is reserved for
       destructive actions and errors so it keeps its meaning. */
    --accent:      #f0f1f3;
    --accent-hover:#ffffff;
    --on-accent:   #101215;   /* text/icons placed on an accent surface */
    --danger:      #fa2223;
    --nav-bg:      #14161a;   /* navigation row */
    --bar:         #22262d;   /* forum table headers */
    /* Safari/Apple system blue — used only for admin affordances */
    --blue:        #0a84ff;
    --blue-soft:   rgba(10, 132, 255, 0.16);
    --blue-line:   rgba(10, 132, 255, 0.55);
    --radius:      10px;
    --maxw:        1040px;
    --header-h:    56px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Light theme */
:root[data-theme="light"] {
    color-scheme: light;
    --bg:          #f4f5f7;
    --bg-elev:     #ffffff;
    --bg-elev-2:   #eceef2;
    --border:      #d3d7de;
    --border-soft: #e3e6ea;
    --text:        #15181d;
    --text-muted:  #5c6572;
    --accent:      #17191e;
    --accent-hover:#000000;
    --on-accent:   #ffffff;
    --nav-bg:      #e7eaef;
    --bar:         #dfe3e9;
    --blue:        #0066cc;          /* darker on white, for legible contrast */
    --blue-soft:   rgba(0, 102, 204, 0.10);
    --blue-line:   rgba(0, 102, 204, 0.45);
}
/* Headings follow the text colour — white on dark, near-black on light. */
:root { --title-accent: var(--text); }
/* The logo is white artwork — invert it so it reads on a light background. */
:root[data-theme="light"] .brand-logo { filter: invert(1); }

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must win. Its display:none comes from the browser's own
   stylesheet, so any author rule — .image-tools { display: flex } — silently
   beats it and the element stays on screen. */
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    /* Always reserve room for the scrollbar, so short pages (Events) and long
       pages (Hem) centre content at exactly the same width — no sideways jump. */
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Sticky footer: content grows, the footer stays at the bottom of the
       viewport even on short pages. */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.site-main, .admin-main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }

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

h1, h2, h3 { line-height: 1.2; font-weight: 700; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.muted { color: var(--text-muted); }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: var(--on-accent); padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Staging warning strip — only ever rendered on staging.928clubsweden.se */
.staging-banner {
    position: sticky; top: 0; z-index: 60;
    background: repeating-linear-gradient(45deg, #b8860b, #b8860b 12px, #8a6508 12px, #8a6508 24px);
    color: #fff; text-align: center; font-weight: 700; font-size: 0.82rem;
    letter-spacing: 0.04em; padding: 6px 12px;
}
.staging-banner a { color: #fff; text-decoration: underline; font-weight: 600; }

/* --- Header: top row (logo / account / theme) + nav row -------------------- */
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border); }
.header-top { background: var(--bg); }
.header-top-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; min-height: var(--header-h);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-link { color: var(--text-muted); font-size: 0.92rem; font-weight: 600; white-space: nowrap; }
.header-link:hover { color: var(--text); text-decoration: none; }

.header-nav { background: var(--nav-bg); border-top: 1px solid var(--border-soft); }
.header-nav-inner { display: flex; align-items: center; gap: 10px; min-height: 44px; }

/* Light/dark switch */
.theme-toggle { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.theme-toggle-track {
    position: relative; display: inline-flex; align-items: center;
    width: 54px; height: 28px; border-radius: 999px;
    background: var(--bg-elev-2); border: 1px solid var(--border);
}
/* Both icons sit on the track; the knob slides over the active one and
   repeats it in full contrast, leaving the other visible but quiet. */
.theme-track-icon {
    position: absolute; font-size: 12px; line-height: 1;
    color: var(--text-muted); opacity: 0.75;
}
.theme-track-icon--sun  { left: 7px; }
.theme-track-icon--moon { right: 7px; }
.theme-knob {
    position: absolute; top: 2px; left: 2px; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg-elev); border: 1px solid var(--border);
    transition: transform 0.16s ease;
}
.theme-icon { font-size: 12px; line-height: 1; color: var(--text); }
.theme-icon--sun { display: none; }
:root[data-theme="light"] .theme-icon--sun  { display: inline; }
:root[data-theme="light"] .theme-icon--moon { display: none; }
/* Dark mode keeps the knob on the right (moon), light mode on the left (sun). */
:root .theme-knob { transform: translateX(26px); }
:root[data-theme="light"] .theme-knob { transform: translateX(0); }
.theme-toggle:focus-visible .theme-toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 36px; width: auto; }
.brand-logo--sm { height: 28px; }
.brand-text { font-size: 1rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.brand-text--admin { color: var(--blue); font-weight: 800; letter-spacing: 0.01em; }

.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.site-nav a {
    color: var(--text-muted); padding: 10px 12px; border-radius: 6px;
    font-size: 0.92rem; font-weight: 600; white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--bg-elev); text-decoration: none; }
.site-nav a.active { color: var(--text); background: var(--bg-elev); }

.nav-current { display: none; font-weight: 700; }
.nav-toggle {
    display: none;
    width: 38px; height: 34px; padding: 8px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); margin: 3px 0; border-radius: 2px; }

/* --- Main / layout --------------------------------------------------------- */
.site-main { padding: 40px 0 64px; }

.page-head { margin-bottom: 28px; }
.page-head h1 { margin: 0 0 8px; font-size: 2rem; }
.page-head .muted { margin: 0; max-width: 60ch; }

.section { margin-top: 48px; }
.section-title { font-size: 1.4rem; margin: 0 0 8px; }

/* --- Front door for guests: log in, or ask the board for an account ------- */
.gate {
    display: grid; gap: 16px; margin: 44px auto 0; max-width: 900px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.gate-card {
    padding: 20px 22px; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.gate-card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.gate-card p { margin: 0 0 12px; color: var(--text-muted); }
.gate-card p:last-child { margin-bottom: 0; }
.gate-card a { color: var(--blue); font-weight: 600; }
.gate-card .btn { color: var(--on-accent); }

/* --- Home showcase ----------------------------------------------------------
   Big photo + centered title/tagline + quote block (matches the club's draft). */
.showcase { padding-top: 8px; }
.showcase-photo {
    display: block; width: 100%; max-width: 900px; height: auto;
    margin: 0 auto; border-radius: var(--radius);
}
.showcase-credit { text-align: center; font-size: 0.72rem; margin: 6px 0 0; opacity: 0.7; }
.showcase-title {
    margin: 34px 0 10px; text-align: center;
    color: var(--title-accent); font-size: 1.7rem; letter-spacing: 0.02em;
}
.showcase-tagline { margin: 0 auto; max-width: 70ch; text-align: center; color: var(--text-muted); }
.showcase-source {
    margin: 40px 0 18px; text-align: center;
    color: var(--title-accent); font-weight: 700; font-size: 0.85rem;
}
.showcase-quotes { max-width: 72ch; margin: 0 auto; }
.showcase-quotes p {
    font-style: italic; font-size: 1.15rem; line-height: 1.7; margin: 0 0 22px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-block; padding: 11px 20px; border-radius: 9px;
    font: inherit; /* <button> elements don't inherit font by default */
    background: var(--accent); color: var(--on-accent); font-weight: 600; border: 1px solid var(--accent);
    cursor: pointer; text-align: center;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elev); border-color: var(--text-muted); }

/* --- Cards (used from Phase 2 onward) ------------------------------------- */
.card-grid {
    display: grid; gap: 18px; margin-top: 20px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}

/* --- Prose (static pages, articles) ---------------------------------------- */
.prose { max-width: 68ch; }
.prose p { margin: 0 0 16px; }
.prose h2 { margin: 28px 0 10px; font-size: 1.3rem; }
.prose a { text-decoration: underline; }
.prose img {
    display: block; max-width: 100%; height: auto;
    margin: 20px auto; border-radius: var(--radius);
}

/* Size and placement an author picks for an image in the editor. The same
   classes are used in the editor and in the published article. */
.prose img.img-full,   .prose figure.img-full   { max-width: 100%; }
.prose img.img-medium, .prose figure.img-medium { max-width: 62%; }
.prose img.img-small,  .prose figure.img-small  { max-width: 36%; }
.prose img.img-left,   .prose figure.img-left   { margin-left: 0; margin-right: auto; }
.prose img.img-center, .prose figure.img-center { margin-left: auto; margin-right: auto; }
.prose img.img-right,  .prose figure.img-right  { margin-left: auto; margin-right: 0; }
.prose figure { margin: 20px auto; }
.prose figure img { margin: 0; width: 100%; max-width: 100%; }
.prose figcaption {
    margin-top: 6px; font-size: 0.85rem; color: var(--text-muted); text-align: center;
}

/* --- Event attendance ------------------------------------------------------ */
.rsvp {
    margin: 0 0 24px; padding: 14px 16px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.rsvp-summary { display: flex; align-items: baseline; gap: 8px; margin: 0; flex-wrap: wrap; }
.rsvp-icon { font-size: 1rem; }

/* Overlapping faces, like every guest list you have ever seen. */
.rsvp-faces { display: flex; align-items: center; flex-wrap: wrap; row-gap: 6px; margin: 10px 0 0; padding-left: 3px; }
.rsvp-face { width: 40px; height: 40px; line-height: 40px; }
.rsvp-faces > a, .rsvp-more { margin-left: -8px; }
.rsvp-faces > a:first-child { margin-left: 0; }
.rsvp-faces .avatar { border: 2px solid var(--bg-elev); display: block; }
.rsvp-faces > a:hover .avatar { border-color: var(--blue); position: relative; z-index: 1; }
.rsvp-more {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-elev-2); border: 2px solid var(--bg-elev);
    font-size: 0.8rem; color: var(--text-muted);
}

.rsvp-buttons { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.rsvp-buttons form { margin: 0; }
.rsvp-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 600; font-size: 0.92rem;
    color: var(--text); background: var(--bg-elev-2);
    border: 1px solid var(--border); border-radius: 999px;
}
.rsvp-btn:hover { border-color: var(--text-muted); }
.rsvp-mark { opacity: 0.75; font-weight: 700; }
.rsvp-count {
    padding: 0 6px; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
    background: var(--bg); color: var(--text-muted);
}
/* Your own answer, so a glance tells you what you replied. */
.rsvp-btn.is-mine { border-width: 2px; }
.rsvp-btn--going.is-mine   { border-color: #34c759; color: #a9e9bc; }
.rsvp-btn--maybe.is-mine   { border-color: #d9a441; color: #f2d79a; }
.rsvp-btn--no.is-mine      { border-color: var(--text-muted); color: var(--text-muted); }
:root[data-theme="light"] .rsvp-btn--going.is-mine { border-color: #1e8c46; color: #14622f; }
:root[data-theme="light"] .rsvp-btn--maybe.is-mine { border-color: #a8801f; color: #6a5113; }

.rsvp-list { margin-top: 12px; font-size: 0.9rem; }
.rsvp-list summary { cursor: pointer; color: var(--text-muted); }
.rsvp-list summary:hover { color: var(--text); }
.rsvp-group { margin: 8px 0 0; }

.card-going { font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 640px) {
    /* Twelve faces at full size run off a phone screen. */
    .rsvp-face { width: 32px; height: 32px; line-height: 32px; }
    .rsvp-more { width: 32px; height: 32px; }
    .rsvp-buttons { gap: 6px; }
    .rsvp-btn { padding: 9px 13px; }
}

/* --- Empty state ----------------------------------------------------------- */
.empty-state {
    margin-top: 16px; padding: 40px 24px; text-align: center;
    background: var(--bg-elev); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state p { margin: 0 0 6px; }
.empty-state--lg { padding: 72px 24px; }
.empty-state--lg h1 { margin: 4px 0 10px; font-size: 2rem; }

/* --- Footer ---------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* --- Responsive nav -------------------------------------------------------- */
/* Mid widths: compress the nav so it stays on one row. */
@media (max-width: 1099px) {
    .site-nav a { padding: 10px 8px; font-size: 0.86rem; }
}

/* Narrow (phones / tablets portrait): nav collapses behind the hamburger. */
@media (max-width: 860px) {
    .header-nav { position: relative; }
    .header-nav .nav-toggle { display: block; }
    .nav-current { display: block; color: var(--text-muted); font-size: 0.95rem; }
    .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 45;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--bg-elev); border-bottom: 1px solid var(--border);
        padding: 8px; box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    }
    body.nav-open .site-nav { display: flex; }
    .site-nav a { padding: 13px 12px; border-radius: 8px; font-size: 1rem; }
    .site-nav a.active { box-shadow: none; background: var(--bg-elev-2); }
}

/* Phones: keep the top row on one line — the name is on the profile page anyway */
@media (max-width: 560px) {
    .header-link { display: none; }
    .brand-logo { height: 30px; }
    .header-actions { gap: 8px; }
    .btn-small { padding: 6px 10px; }
}
.btn-small { white-space: nowrap; }

/* ==========================================================================
   Article cards
   ========================================================================== */
.article-card { display: flex; flex-direction: column; color: var(--text); }
.article-card:hover { text-decoration: none; border-color: var(--text-muted); }
.card-thumb {
    display: block; aspect-ratio: 16 / 9; background-size: cover; background-position: center;
    background-color: var(--bg-elev-2);
}
.card-thumb--empty {
    background-image: radial-gradient(600px 200px at 30% 0%, rgba(250,34,35,0.12), transparent 60%);
}
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.card-badge {
    align-self: flex-start; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted); font-weight: 700;
}
.card-title { font-weight: 700; font-size: 1.05rem; }
.card-date { color: var(--text-muted); font-size: 0.85rem; }
.card-excerpt { color: var(--text-muted); font-size: 0.92rem; }

/* ==========================================================================
   Single article + gallery
   ========================================================================== */
.back-link { margin: 0 0 16px; }
.article-head h1 { margin: 0 0 6px; font-size: 2rem; }
.article-meta { margin: 0 0 24px; }
.article-body { margin-bottom: 28px; }

.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery-item {
    display: block; border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; background: var(--bg-elev);
}
.gallery-item img { display: block; width: 100%; height: 180px; object-fit: cover; }
.gallery-caption { display: block; padding: 8px 10px; font-size: 0.85rem; color: var(--text-muted); }

.lightbox {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.9); align-items: center; justify-content: center; padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
.lightbox-close {
    position: absolute; top: 16px; right: 20px; font-size: 2rem; line-height: 1;
    background: none; border: none; color: #fff; cursor: pointer;
}

/* ==========================================================================
   Forms (shared by admin + future member pages)
   ========================================================================== */
.form label { display: block; margin-bottom: 16px; font-weight: 600; }
/* Every text-like input, so new types (tel, date, url…) are styled too. */
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]),
.form select, .form textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.form input:focus, .form select:focus, .form textarea:focus, .editor:focus {
    outline: 2px solid var(--accent); outline-offset: 1px;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.small { font-size: 0.85rem; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: rgba(46,160,67,0.12); border-color: #2ea043; color: #b8f0c4; }
.alert-error { background: rgba(250,34,35,0.12); border-color: #fa2223; color: #ffc9ce; }
/* Light theme needs dark ink on the same tints — pale text vanishes there. */
:root[data-theme="light"] .alert-success { color: #14622f; }
:root[data-theme="light"] .alert-error   { color: #8f1418; }

.auth-card {
    max-width: 420px; margin: 24px auto; padding: 28px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.auth-card h1 { margin: 0 0 6px; font-size: 1.5rem; }

/* ==========================================================================
   Admin chrome
   ========================================================================== */
/* The admin panel is strictly monochrome — black, white and grey only —
   so it's immediately obvious you're in the tool, not on the public site. */
body.admin {
    --bg:          #0a0a0a;
    --bg-elev:     #151515;
    --bg-elev-2:   #1e1e1e;
    --border:      #383838;
    --border-soft: #2c2c2c;
    --nav-bg:      #121212;
    --bar:         #1e1e1e;
    --accent:      #f5f5f5;   /* white = admin mode */
    --accent-hover:#ffffff;
    --on-accent:   #111111;
}
/* Admin in light mode: still monochrome, just inverted. */
:root[data-theme="light"] body.admin {
    --bg:          #f2f2f2;
    --bg-elev:     #ffffff;
    --bg-elev-2:   #e9e9e9;
    --border:      #cfcfcf;
    --border-soft: #e0e0e0;
    --text:        #16181c;
    --text-muted:  #5f6570;
    --nav-bg:      #e9e9e9;
    --bar:         #e4e4e4;
    --accent:      #1c1f24;   /* dark buttons on light admin */
    --accent-hover:#000000;
    --on-accent:   #ffffff;
}
:root[data-theme="light"] body.admin .chip-active { color: #fff; }
:root[data-theme="light"] body.admin .badge-on { background: #1c1f24; border-color: #1c1f24; color: #fff; }
:root[data-theme="light"] body.admin .alert-error { background: #1c1f24; border-color: #1c1f24; color: #fff; }
:root[data-theme="light"] body.admin .badge-danger { border-color: #1c1f24; color: #1c1f24; }
:root[data-theme="light"] body.admin .badge-warn { background: #e7e8ea; border-color: #6b7076; color: #2a2d31; }
:root[data-theme="light"] body.admin .alert-notice a { color: #1c1f24; }
:root[data-theme="light"] body.admin .btn-danger { color: #a3131a; border-color: #a3131a; background: transparent; }
:root[data-theme="light"] body.admin .btn-danger:hover { background: #a3131a; color: #fff; }
body.admin .btn-ghost { color: var(--text); }
body.admin .btn-danger { color: #ff8a8e; }    /* danger stays red, readable */
body.admin .btn-danger:hover { color: #fff; }
body.admin .chip-active { color: #111; }

/* Status colours become monochrome in admin (meaning carried by contrast). */
body.admin .alert-success { background: var(--bg-elev-2); border-color: #6a6a6a; color: var(--text); }
body.admin .alert-error   { background: #f5f5f5; border-color: #f5f5f5; color: #111; }
body.admin .alert-notice  { background: var(--bg-elev-2); border-color: #6a6a6a; color: var(--text); }
body.admin .alert-notice a { color: #fff; }
body.admin .badge-on     { background: #f5f5f5; border-color: #f5f5f5; color: #111; }
body.admin .badge-warn   { background: var(--bg-elev-2); border-color: #8a8a8a; color: #eee; }
body.admin .badge-danger { background: transparent; border-color: #fff; color: #fff; font-weight: 700; }
body.admin .linklike.danger:hover { color: #fff; text-decoration: underline; }

.admin-header { border-top: 3px solid var(--blue); }
/* Admin's nav row sits on its own surface, like the public site's. */
body.admin .header-top { background: var(--bg); }
.admin-main { padding: 32px 0 64px; }

.inline-form { display: inline; }
.linklike {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font: inherit; padding: 8px 10px; border-radius: 8px;
}
.linklike:hover { color: var(--text); background: var(--bg-elev-2); }
.linklike.danger:hover { color: #ffc9ce; }
:root[data-theme="light"] .linklike.danger:hover { color: #8f1418; }

.admin-list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.stat-card {
    display: flex; flex-direction: column; gap: 6px; padding: 18px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.stat-card:hover { border-color: var(--text-muted); text-decoration: none; }
.stat-title { font-weight: 700; font-size: 1.1rem; }
.stat-numbers { color: var(--text-muted); font-size: 0.9rem; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.88rem;
}
.chip:hover { text-decoration: none; color: var(--text); }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem;
    background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); }
.badge-on { background: var(--bg-elev-2); border-color: var(--text-muted); color: var(--text); }
/* A compact pill for the rows of them beside a member's name. */
.badge-sm { padding: 1px 7px; font-size: 0.72rem; }
.badge-board { background: var(--bg-elev-2); border-color: var(--text-muted); color: var(--text); }
.badge-vip { background: rgba(230,180,60,0.15); border-color: #d9a441; color: #f2d79a; }
:root[data-theme="light"] .badge-vip { background: rgba(170,130,30,0.12); border-color: #a8801f; color: #6a5113; }

/* ==========================================================================
   Rich-text editor + image manager
   ========================================================================== */
.wysiwyg .editor, .wysiwyg .wysiwyg-toolbar { display: none; }
.wysiwyg.enhanced .wysiwyg-source { display: none; }
.wysiwyg.enhanced .editor, .wysiwyg.enhanced .wysiwyg-toolbar { display: block; }

.wysiwyg-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.wysiwyg-toolbar button {
    background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 0.85rem;
}
.wysiwyg-toolbar button:hover { border-color: var(--text-muted); }
.wysiwyg { position: relative; }   /* the image tools are placed against this */
.editor {
    min-height: 260px; padding: 14px 16px; background: var(--bg-elev-2);
    border: 1px solid var(--border); border-radius: 8px;
    overflow-x: hidden; /* content (e.g. pasted/inserted images) may never break the box */
}
.editor.is-empty::before { content: "Skriv artikeltexten här…"; color: var(--text-muted); }
/* The editing surface is the article's own column, so a "medium" image is the
   same width here as it will be on the page. */
.editor.prose { max-width: 68ch; }
.editor--dropping { border-color: var(--blue); background: var(--blue-soft); }
.editor img { cursor: grab; }
.editor img:hover { outline: 2px dashed var(--text-muted); outline-offset: 2px; }
.editor img.is-selected { outline: 2px solid var(--blue); outline-offset: 2px; }
/* An image still on its way up: visibly not finished. */
.editor img[data-pending] { opacity: 0.45; filter: saturate(0.4); cursor: progress; }
.editor figcaption:focus { outline: 2px solid var(--blue); outline-offset: 2px; }

.editor-help { margin: 8px 0 0; }
.editor-status { margin: 4px 0 0; min-height: 1.2em; }
.editor-status--error { color: var(--danger); }

/* Floating controls for the image the author clicked. */
.image-tools {
    position: absolute; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px;
    padding: 6px; background: var(--bg-elev); border: 1px solid var(--blue-line);
    border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.image-tools-group { display: flex; gap: 2px; }
.image-tools button {
    background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 4px 9px; font-size: 0.82rem; cursor: pointer;
}
.image-tools button:hover { border-color: var(--text-muted); }
.image-tools button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.image-tools button.danger { color: var(--danger); }

.image-manager { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 10px; }
.image-manager legend { padding: 0 8px; font-weight: 600; }
.image-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.image-item { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.image-item img { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.image-item input[type="text"] { width: 100%; padding: 7px 9px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.image-item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.85rem; }
.image-item-row .order-label { color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.image-item-row input[type="number"] { padding: 5px 7px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.upload-label { display: block; font-weight: 600; }
.upload-label input { display: block; margin-top: 6px; }

/* --- Publish toggle ---------------------------------------------------------
   A big, obvious switch: off = draft (hidden), on = published (visible). */
.form label.publish-box, .publish-box {
    display: flex; align-items: center; gap: 14px;
    margin: 22px 0 4px; padding: 16px 18px; cursor: pointer;
    background: var(--bg-elev); border: 1px dashed var(--border); border-radius: var(--radius);
    font-weight: 400;
}
.publish-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
    display: block; flex: 0 0 auto; width: 52px; height: 30px; border-radius: 999px;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    position: relative; transition: background 0.15s ease;
}
.switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--text-muted); transition: left 0.15s ease, background 0.15s ease;
}
.publish-checkbox:checked ~ .switch-track { background: var(--accent); border-color: var(--accent); }
.publish-checkbox:checked ~ .switch-track::after { left: 25px; background: var(--bg); }
.publish-checkbox:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.publish-state { font-size: 0.95rem; }
.publish-state--on  { display: none; }
.publish-checkbox:checked ~ .publish-state--on  { display: inline; }
.publish-checkbox:checked ~ .publish-state--off { display: none; }
.publish-checkbox:checked ~ * strong { color: var(--text); }
.publish-box:has(.publish-checkbox:checked) { border-style: solid; border-color: var(--accent); }

/* ==========================================================================
   Accounts / profiles / avatars
   ========================================================================== */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--bg-elev-2); }
.avatar-initial {
    text-align: center; font-weight: 700; color: var(--on-accent);
    background: var(--accent);
}
.profile-head { display: flex; align-items: center; gap: 18px; }
/* The admin link sits at the top right of the profile, level with the name —
   the same place it occupies on every other page. */
.profile-head > .admin-link { margin-left: auto; align-self: flex-start; }
.profile-head h1 { margin: 0 0 4px; font-size: 1.7rem; }
.profile-head p { margin: 0; }
.profile-avatar-edit { display: flex; align-items: center; gap: 16px; }

/* --- Link directory (Rep & Service) ---------------------------------------- */
/* Rep & Service and Delar: one link per row, full width — a directory reads
   better as a list than as a grid of cards. */
.link-list { list-style: none; margin: 18px 0 0; padding: 0; }
.link-list li + li { margin-top: 10px; }
.link-row {
    display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
}
.link-row:hover { border-color: var(--text-muted); background: var(--bg-elev-2); text-decoration: none; }
.link-thumb {
    flex: 0 0 auto; width: 72px; height: 72px; border-radius: 8px;
    /* Light tile + contain: site logos are usually dark artwork on a
       transparent background, which would vanish on our dark cards. */
    background-color: #f2f2f2; background-size: contain;
    background-repeat: no-repeat; background-position: center;
}
.link-thumb--empty {
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 700; color: #555;
}
.link-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.link-title { font-weight: 700; }
.link-host { font-size: 0.82rem; color: var(--blue); }
.link-desc { font-size: 0.9rem; color: var(--text-muted); }

/* admin */
.link-add { padding: 16px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.link-thumb-small { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.link-thumb-preview { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }

/* --- Member directory ------------------------------------------------------ */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* --- Account invitations (admin) -------------------------------------------- */
.invite-box {
    margin: 0 0 20px; padding: 14px 16px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
/* A link that will never be shown again deserves to stand out. */
.invite-box--fresh { border-color: var(--blue-line); background: var(--blue-soft); }
.invite-box h2 { margin: 0 0 6px; font-size: 1.05rem; }
.invite-box p { margin: 0 0 10px; }
.invite-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.invite-link input {
    flex: 1 1 320px; min-width: 0; padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem;
    background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text);
}

/* --- Member profiles ------------------------------------------------------- */
/* A wide photo of the member's car, used as the profile header. */
.profile-cover {
    display: block; margin: 0 0 16px; overflow: hidden;
    border-radius: var(--radius); background: var(--bg-elev-2);
    aspect-ratio: 3 / 1;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* No photo yet: a slim invitation, not a big empty hole. */
.profile-cover--empty {
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--border); color: var(--text-muted); font-size: 0.92rem;
    aspect-ratio: auto; height: 76px; background: transparent;
}
.profile-cover--empty:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
/* With a cover above, the avatar rides up over its lower edge. */
.profile-head--overlap { align-items: flex-end; }
.profile-head--overlap .avatar {
    margin-top: -52px; border: 3px solid var(--bg); background: var(--bg-elev-2);
}
.profile-car { margin: 4px 0 0; font-weight: 600; }
/* The two texts on a profile: Om {namn} / Om bilen. */
.about-title { margin: 0 0 8px; font-size: 1.1rem; }

/* Label/value pairs on a profile. */
.detail-list {
    display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px;
    margin: 18px 0 12px; font-size: 0.95rem;
}
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; }
.detail-list dd a { color: var(--blue); }

/* Cover photo picker, in both the member's own form and the admin editor. */
.cover-edit { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.cover-preview {
    width: 240px; aspect-ratio: 3 / 1; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border);
}
.cover-preview--empty {
    display: flex; align-items: center; justify-content: center;
    border-style: dashed; color: var(--text-muted); font-size: 0.85rem;
}

.member-row {
    display: flex; align-items: center; gap: 14px; padding: 10px 14px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.member-no {
    flex: 0 0 auto; min-width: 3.4em; text-align: center;
    font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.04em;
    padding: 4px 8px; border-radius: 6px;
    background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted);
}
.member-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.member-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-sub { display: block; }
.member-name { color: var(--blue); font-weight: 600; }
.member-name-plain { font-weight: 600; }
/* Not activated yet: a dashed edge says "on the way in" without a second style. */
.member-row--pending { border-style: dashed; }
.member-name:hover { text-decoration: underline; }
.member-contact { white-space: nowrap; font-size: 0.9rem; }
.member-contact a { color: var(--text-muted); }

/* admin: inline member-number editor */
.no-form { display: flex; align-items: center; gap: 4px; }
.no-form input[type="number"] {
    width: 72px; padding: 6px 8px; font: inherit; font-variant-numeric: tabular-nums;
    background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
}

@media (max-width: 640px) {
    .member-row { flex-wrap: wrap; gap: 10px; }
    .member-contact { width: 100%; padding-left: calc(3.4em + 14px); }
    /* A 3:1 crop is too thin on a phone. */
    .profile-cover { aspect-ratio: 2 / 1; }
    .profile-head--overlap .avatar { margin-top: -36px; }
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 10px; }
    .cover-preview { width: 100%; }
}

/* logout button in the public nav */

/* attention notice (e.g. pending approvals) */
.alert-notice { background: rgba(230,180,60,0.12); border-color: #d9a441; color: #f2d79a; }
.alert-notice a { color: #ffe6ad; }
:root[data-theme="light"] .alert-notice   { color: #6a5113; }
:root[data-theme="light"] .alert-notice a { color: #4d3a0d; }

/* member-list badges + compact actions */
.badge-warn { background: rgba(230,180,60,0.15); border-color: #d9a441; color: #f2d79a; }
.badge-danger { background: rgba(250,34,35,0.15); border-color: #fa2223; color: #ffc9ce; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-danger { background: transparent; color: #ff8a8e; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.member-actions { flex-wrap: wrap; justify-content: flex-end; gap: 4px; }

/* ==========================================================================
   Forum — classic board layout (tables of rows, postbit beside each post)
   ========================================================================== */
.forum-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.forum-head h1 { margin: 0 0 4px; font-size: 1.7rem; }
.forum-head p { margin: 0; }

.crumbs { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; }
.crumbs a { color: var(--text-muted); }
.crumbs span { margin: 0 2px; }

/* Board tables */
.fbox { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-elev); }
.fbox-head, .frow {
    display: grid; grid-template-columns: 1fr 80px 90px 240px;
    gap: 12px; align-items: center; padding: 10px 14px;
}
.fbox-head {
    background: var(--bar); font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
}
.frow { border-top: 1px solid var(--border-soft); }
.frow:hover { background: var(--bg-elev-2); }
.frow--pinned { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fcol-main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.fcol-num { text-align: center; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fcol-last { font-size: 0.88rem; min-width: 0; }
.frow-title { font-weight: 700; color: var(--text); }
.frow-sub { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* Read/unread dot, like the classic forum icons */
.fstatus {
    flex: 0 0 auto; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%;
    background: var(--bg-elev-2); border: 2px solid var(--border);
}
.fstatus--new { background: var(--accent); border-color: var(--accent); }
.fstatus--locked { border-style: dashed; }
.badge-new { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.page-link {
    display: inline-block; min-width: 30px; text-align: center; padding: 5px 8px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-elev); color: var(--text); font-size: 0.88rem;
}
.page-link:hover { border-color: var(--text-muted); text-decoration: none; }
.page-link--current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.page-gap { color: var(--text-muted); }
.pagination .muted { margin-right: 6px; }

.mod-bar { display: flex; gap: 8px; margin: 10px 0; padding: 8px 12px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; }

/* Posts */
.posts { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.post { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 14px; background: var(--bar); border-bottom: 1px solid var(--border);
}
.post-number { font-weight: 700; }
.post-main { display: grid; grid-template-columns: 170px 1fr; }
.post-user {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    padding: 16px 12px; background: var(--bg-elev-2); border-right: 1px solid var(--border);
}
.post-user-name { font-weight: 700; color: var(--text); }
.post-user-meta { font-size: 0.76rem; color: var(--text-muted); line-height: 1.5; }
.post-content { padding: 16px 18px; min-width: 0; }
.post-body { max-width: none; }
.post-body p:last-child { margin-bottom: 0; }
.post-quote {
    margin: 0 0 12px; padding: 10px 14px;
    background: var(--bg-elev-2); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
    font-size: 0.95rem; color: var(--text-muted);
}
.post-quote cite { display: block; font-style: normal; font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 0.85rem; }
.post-attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.post-attachments img {
    width: 160px; height: 120px; object-fit: cover; display: block;
    border: 1px solid var(--border); border-radius: 8px;
}
.post-edited { margin: 10px 0 0; font-style: italic; }
.post-actions {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); font-size: 0.9rem;
}

.reply-form { margin-top: 20px; }
.reply-form textarea, .form textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; font: inherit; resize: vertical;
}
.reply-locked { margin-top: 20px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 8px; }

/* Forum on phones: tables become stacked rows, postbit becomes a header */
@media (max-width: 760px) {
    .fbox-head { display: none; }
    .frow { grid-template-columns: 1fr; gap: 6px; }
    .fcol-num { text-align: left; font-size: 0.82rem; }
    .fcol-num::before { content: attr(data-label) ": "; }
    .fcol-num, .fcol-last { padding-left: 22px; }
    .fcol-last { border-top: 1px dashed var(--border-soft); padding-top: 6px; }
    .post-main { grid-template-columns: 1fr; }
    .post-user {
        flex-direction: row; align-items: center; text-align: left; gap: 10px;
        border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 14px;
    }
    .post-user-meta { font-size: 0.72rem; }
    .forum-head { flex-direction: column; }
    .forum-head .btn { width: 100%; }
}

/* admin category editor */
.cat-editor { display: flex; flex-direction: column; gap: 10px; }
.cat-flag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-muted); white-space: nowrap;
}
.cat-flag input { margin: 0; }

.cat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-form input[type="text"], .cat-form input[type="number"] {
    padding: 8px 10px; background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.cat-form input[name="name"] { min-width: 160px; }
.cat-form input[name="description"] { min-width: 220px; flex: 1; }

/* ==========================================================================
   Polish
   ========================================================================== */
.prose, .post-body, .forum-cat-name, .card-title { overflow-wrap: anywhere; }

/* Tablets & below: wide tables scroll sideways instead of breaking layout. */
@media (max-width: 820px) {
    .data-table { display: block; overflow-x: auto; }
    .admin-list-head { flex-wrap: wrap; }
}

/* Phones */
@media (max-width: 640px) {
    .data-table th, .data-table td { padding: 8px 8px; }
    .site-main { padding: 28px 0 48px; }
    .showcase-title { font-size: 1.35rem; }
    .showcase-quotes p { font-size: 1.05rem; }
    .forum-cat { flex-direction: column; align-items: flex-start; gap: 6px; }
    .forum-cat-meta { text-align: left; white-space: normal; }
    .profile-head { flex-wrap: wrap; }
    .thread-head h1 { font-size: 1.4rem; }
    .page-head h1 { font-size: 1.6rem; }

    /* Stack action buttons vertically, full width (profile, forms, page heads) */
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
    .form-actions .inline-form { display: block; }
    .form-actions .inline-form .btn { width: 100%; }
    .head-actions { width: 100%; flex-direction: column; align-items: stretch; }
    .head-actions .btn { width: 100%; }
    .head-actions .inline-form { display: block; }
    .head-actions .inline-form .btn { width: 100%; }
    .admin-list-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .admin-list-head > .btn, .admin-list-head > a.btn { width: 100%; }
    .auth-card .form .btn { width: 100%; }
    .mod-bar { flex-wrap: wrap; }
}

/* ==========================================================================
   Home page: upcoming events + latest forum posts
   ========================================================================== */
.home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.home-head .section-title { margin: 0; }
.home-more { font-size: 0.88rem; color: var(--text-muted); white-space: nowrap; }

.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-row {
    display: flex; align-items: center; gap: 16px; padding: 12px 16px; color: var(--text);
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.event-row:hover { border-color: var(--text-muted); text-decoration: none; }
.event-date {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58px; height: 58px; border-radius: 10px;
    background: var(--accent); color: var(--on-accent);
}
.event-day { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.event-month { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.event-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.event-title { font-weight: 700; }
.event-sub { font-size: 0.9rem; color: var(--text-muted); overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.latest-posts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.latest-post {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.latest-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.latest-title { font-weight: 600; color: var(--text); }
.latest-sub { font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 640px) {
    .home-head { flex-direction: column; align-items: flex-start; gap: 4px; }
    .event-row { gap: 12px; }
    .event-date { width: 50px; height: 50px; }
}

/* A page title with something at its right edge (the admin link, an action). */
.title-row {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.title-row > h1 { margin-bottom: 0; }
.title-row-actions { display: flex; align-items: center; gap: 10px; }

.admin-link { color: var(--blue); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.admin-link:hover { text-decoration: underline; }
.admin-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* The home page has no title row, so its link sits on its own line. */
.admin-link-row { margin: 0 0 8px; text-align: right; }

/* ==========================================================================
   Chips — action buttons sized like the status badges
   ========================================================================== */
/* Same footprint as a status badge, but interactive. */
.achip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.achip {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.5;
    white-space: nowrap; cursor: pointer; text-align: center;
    border: 1px solid transparent;
}
.achip:hover { text-decoration: none; }
.achip-blue { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-line); }
.achip-danger { color: #c1121a; background: rgba(250, 34, 35, 0.10); border-color: rgba(250, 34, 35, 0.45); }
:root:not([data-theme="light"]) .achip-danger { color: #ff8a8e; }
.achip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.achip-danger:focus-visible { outline-color: var(--danger); }

/* Wide tables scroll inside their own box instead of stretching the layout */
.table-scroll { width: 100%; overflow-x: auto; }
.table-scroll .data-table { display: table; margin: 0; min-width: 760px; }
.data-table td { vertical-align: top; }

/* Mektips topics: the forum's categories, used as content areas. A plain
   vertical list — the eye runs down twelve names far quicker than across a grid. */
.topic-list { list-style: none; margin: 18px 0 0; padding: 0; }
.topic-list li + li { margin-top: 8px; }
.topic-row {
    display: flex; align-items: baseline; gap: 16px; padding: 12px 16px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
}
.topic-row:hover { border-color: var(--text-muted); background: var(--bg-elev-2); text-decoration: none; }
.topic-main { flex: 1; min-width: 0; }
.topic-name { display: block; font-weight: 700; }
.topic-desc { display: block; margin-top: 2px; font-size: 0.88rem; color: var(--text-muted); }
.topic-count {
    flex: 0 0 auto; font-size: 0.85rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.event-facts { margin: 0 0 20px; }

.forum-cta {
    margin: 0 0 20px; padding: 10px 14px; font-size: 0.92rem;
    background: var(--blue-soft); border: 1px solid var(--blue-line);
    border-radius: var(--radius); color: var(--text);
}
.forum-cta a { color: var(--blue); font-weight: 600; }

/* Membership fee status — the one place admin keeps colour. */
.badge-fee-paid   { background: rgba(52,199,89,0.15);  border-color: #34c759; color: #a9e9bc; }
.badge-fee-unpaid { background: rgba(250,34,35,0.15);  border-color: #fa2223; color: #ffc9ce; }
.badge-fee-exempt { background: rgba(230,180,60,0.15); border-color: #d9a441; color: #f2d79a; }
:root[data-theme="light"] .badge-fee-paid   { background: rgba(30,140,70,0.10);  border-color: #1e8c46; color: #14622f; }
:root[data-theme="light"] .badge-fee-unpaid { background: rgba(195,30,35,0.10);  border-color: #c31e23; color: #8f1418; }
:root[data-theme="light"] .badge-fee-exempt { background: rgba(170,130,30,0.14); border-color: #a8801f; color: #6a5113; }

/* Members table specifics */
.members-table .col-no {
    width: 1%; white-space: nowrap;
    font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.04em;
}
.members-table .col-fee { white-space: nowrap; }
.data-table .col-actions { width: 1%; text-align: right; }

/* One menu per row instead of a wall of buttons. <details> gives us the
   open/close behaviour, keyboard support and a no-JavaScript fallback. */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary {
    list-style: none; cursor: pointer; user-select: none;
    width: 32px; height: 28px; line-height: 24px; text-align: center;
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); background: var(--bg-elev-2);
    font-size: 1.1rem; letter-spacing: 0.08em;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover { border-color: var(--text-muted); }
.row-menu > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.row-menu[open] > summary { border-color: var(--blue); color: var(--blue); }

.row-menu-panel {
    /* In flow by default, so the row simply grows when JavaScript is off. */
    margin-top: 6px; min-width: 210px; padding: 6px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    text-align: left;
}
/* With JavaScript the panel is placed against the viewport, so the table's own
   horizontal scrolling can neither clip it nor be unmasked by it. */
.has-js .row-menu-panel { position: fixed; z-index: 30; margin: 0; }
.row-menu-panel form { margin: 0; }
.row-menu-item {
    display: block; width: 100%; padding: 7px 10px; text-align: left;
    background: none; border: 0; border-radius: 6px; cursor: pointer;
    color: var(--text); font: inherit; font-size: 0.9rem;
}
.row-menu-item:hover { background: var(--bg-elev-2); text-decoration: none; }
.row-menu-item:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.row-menu-item--danger { color: var(--danger); }

.nowrap { white-space: nowrap; }

/* The fee picker carries its own status colour, so no badge is needed beside it. */
select.fee-select { font-weight: 600; }
select.fee-select--paid   { border-color: #34c759; color: #a9e9bc; }
select.fee-select--unpaid { border-color: #fa2223; color: #ffc9ce; }
select.fee-select--exempt { border-color: #d9a441; color: #f2d79a; }
:root[data-theme="light"] select.fee-select--paid   { border-color: #1e8c46; color: #14622f; }
:root[data-theme="light"] select.fee-select--unpaid { border-color: #c31e23; color: #8f1418; }
:root[data-theme="light"] select.fee-select--exempt { border-color: #a8801f; color: #6a5113; }
.member-link { color: var(--blue); font-weight: 700; }
.member-link:hover { text-decoration: underline; }

.page-image-preview {
    width: 160px; height: 100px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .table-scroll .data-table { min-width: 680px; }
    /* Scaled-down images become unreadable on a phone. */
    .prose img.img-medium, .prose figure.img-medium,
    .prose img.img-small,  .prose figure.img-small { max-width: 100%; }
    .image-tools { position: static; margin-top: 8px; }
}
