/* ── Variables: light-mode defaults (overridden by [data-theme] blocks) ── */
:root {
    --accent:       #cc2936;
    --accent-hover: #a8202c;
    --bg:           #f2f2ef;
    --bg-secondary: #e8e8e4;
    --text:         #18181b;
    --text-muted:   #6b7280;
    --border:       #d8d8d4;
    --card-bg:      #ffffff;
    --nav-bg:       rgba(255,255,255,0.96);
    --radius:       8px;
    --shadow:       0 1px 2px rgba(0,0,0,.06);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    transition: background 0.15s, color 0.15s;
}

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

/* ── Navigation ── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.3rem 1.25rem;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.nav-brand { flex-shrink: 0; }

.nav-brand {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.nav-brand:hover { color: var(--accent); text-decoration: none; }

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem 0.5rem;
    flex-wrap: wrap;   /* a long admin menu drops to a second row instead of running off the page */
}
.nav-actions .btn { white-space: nowrap; flex-shrink: 0; }

.nav-link {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    transition: color 0.1s, background 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-link:hover { color: var(--text); background: var(--bg-secondary); text-decoration: none; }

.nav-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

/* Mobile: collapse the link row behind a hamburger into a dropdown panel, rather than
   letting it overflow (pushes the page wide) or scroll sideways (nobody expects that
   on a nav bar) — the standard pattern. */
@media (max-width: 640px) {
    .nav-inner { padding: 0 0.85rem; gap: 0.5rem; }

    .nav-hamburger { display: flex; }

    .nav-actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
        display: none;
        position: absolute;
        top: 54px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        padding: 0.6rem;
        max-height: calc(100vh - 54px);
        overflow-y: auto;
    }
    .nav-actions.nav-actions-open { display: flex; }

    .nav-link {
        padding: 0.65rem 0.75rem;
        border-radius: 6px;
        width: 100%;
    }
    .nav-actions .btn { width: 100%; text-align: center; }
    .nav-actions .theme-toggle { align-self: flex-start; margin-top: 0.2rem; }
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--text);
    transition: background 0.1s, border-color 0.1s;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-secondary); border-color: var(--accent); }

/* ── Main content wrapper ── */
.main-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.1s, background 0.1s;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); opacity: 1; text-decoration: none; color: #fff; }

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); text-decoration: none; color: var(--text); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); text-decoration: none; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-full { width: 100%; margin-top: 0.5rem; }

/* ── Auth card ── */
.auth-card {
    max-width: 420px;
    margin: 2.5rem auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ── Forms ── */
.field { margin-bottom: 1rem; }

.field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="number"],
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color 0.1s;
}

.field input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }

.field-error input { border-color: #c0292e; }
.field-hint { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.field-hint.error { color: #c0292e; }

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}
.checkbox-label input { margin-top: 2px; flex-shrink: 0; }

.hp-field {
    position: absolute;
    left: -9999px; top: -9999px;
    width: 1px; height: 1px;
    overflow: hidden; opacity: 0; pointer-events: none;
}

.input-disabled {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-error   { background: rgba(192,41,46,.1);  color: #b71c1c; border: 1px solid rgba(192,41,46,.25); }
.alert-success { background: rgba(34,197,94,.1);  color: #166534; border: 1px solid rgba(34,197,94,.25); }
.alert-info    { background: rgba(99,102,241,.1); color: #312e81; border: 1px solid rgba(99,102,241,.25); }

/* ── Welcome / landing card ── */
.welcome-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.welcome-title  { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.4rem; }
.welcome-slogan { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.welcome-body   { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.75rem; }
.welcome-actions { display: flex; justify-content: center; gap: 0.75rem; }

/* ── Verification steps ── */
.verify-steps { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 0.5rem; }

.verify-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}
.verify-step.complete { border-color: #16a34a; background: rgba(34,197,94,.07); }
.verify-step.active   { border-color: var(--accent); background: rgba(204,41,54,.06); }

.step-icon {
    flex-shrink: 0;
    width: 2rem; height: 2rem;
    border-radius: 50%;
    background: var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.verify-step.complete .step-icon { background: #16a34a; color: #fff; }
.verify-step.active   .step-icon { background: var(--accent); color: #fff; }
.verify-step p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Profile ── */
.profile-card { max-width: 640px; margin: 0 auto; }

.profile-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    margin-bottom: 1rem;
}
.profile-avatar-wrap { flex-shrink: 0; }

.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: flex; align-items: center; justify-content: center;
}
.profile-avatar-md { width: 64px; height: 64px; }
.profile-avatar-placeholder { background: var(--accent); color: #fff; font-size: 1.75rem; font-weight: 700; }

.profile-meta { flex: 1; min-width: 0; }
.profile-display-name { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.1rem; }
.profile-username { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.profile-bio { font-size: 0.9rem; margin-bottom: 0.75rem; white-space: pre-wrap; word-break: break-word; }
.profile-stats { display: flex; gap: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }
.profile-stats strong { color: var(--text); }
.profile-edit-btn { position: absolute; top: 1.25rem; right: 1.25rem; }
.profile-posts { margin-top: 0; }

/* Avatar edit section */
.avatar-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.avatar-upload-form label { cursor: pointer; }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.page-header h1 { font-size: 1.2rem; font-weight: 800; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ── Photo gallery (My photos) ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.photo-grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}
.photo-grid-item a { display: block; width: 100%; height: 100%; }
.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-grid-remove-form { position: absolute; top: 6px; right: 6px; margin: 0; }
.photo-grid-remove {
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.photo-grid-remove:hover { background: var(--accent); }

/* ── SVG icons ── */
.icon {
    width: 1em; height: 1em;
    vertical-align: -0.12em;
    flex-shrink: 0;
}

/* ── Post images ── */
.post-image-wrap { margin-top: 0.6rem; }
.post-image-wrap .ai-badge { margin-top: 0.35rem; }
.post-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* ── Compose box ── */
.compose-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
}
.compose-box-reply { margin-top: 1rem; margin-bottom: 0; }
.inline-reply-box { margin-top: 0.75rem; }
.inline-reply-box .compose-box-reply { margin-top: 0; }

.compose-inner { display: flex; gap: 0.75rem; }
.compose-avatar-wrap { flex-shrink: 0; }
.compose-avatar { width: 40px; height: 40px; font-size: 1rem; }
.compose-fields { flex: 1; min-width: 0; }

/* Sits right below the (now read-only) textarea while an /ask answer is being
   researched — same visual treatment as .ai-answer, so it previews exactly where the
   real answer will land once the page reloads. The rest of the compose box (image/poll
   buttons, submit) is hidden while this shows — see compose.js — rather than using the
   `disabled` attribute, since a disabled field is dropped from the submitted form data
   (same reason the submit button itself is never disabled here). */
.compose-ai-pending {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
/* display:flex above overrides the [hidden] attribute's default display:none (any
   author rule beats the browser's built-in [hidden] styling) — restore it explicitly. */
.compose-ai-pending[hidden] { display: none; }

.compose-textarea {
    width: 100%;
    padding: 0.4rem 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.55;
    resize: none;
    outline: none;
    min-height: 60px;
}
.compose-textarea::placeholder { color: var(--text-muted); }

.compose-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}
.compose-counter { font-size: 0.8rem; color: var(--text-muted); }

.compose-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.2rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: color 0.1s;
}
.compose-attach-btn:hover { color: var(--accent); }
.compose-attach-btn-active { color: var(--accent); }
.compose-file-input { display: none; }

/* Last icon button in the row pushes the counter/submit button to the far right —
   moved off the shared .compose-attach-btn class now that there are two of them. */
#compose-poll-toggle { margin-right: auto; }

.compose-poll-builder {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.compose-poll-options { display: flex; flex-direction: column; gap: 0.5rem; }
.compose-poll-option {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}
.compose-poll-option:focus { outline: none; border-color: var(--accent); }
.compose-poll-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.compose-poll-duration {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
}

.compose-image-preview {
    position: relative;
    margin-top: 0.6rem;
    display: inline-block;
    max-width: 180px;
}
.compose-image-thumb {
    display: block;
    width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.compose-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Post list ── */
.post-list { display: flex; flex-direction: column; gap: 0.6rem; }
.post-list-replies { margin-top: 1rem; }

/* ── Post card ── */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    transition: background 0.1s;
    scroll-margin-top: 5rem;
}
.post-card:hover { background: var(--bg-secondary); }
.post-card:target {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* /ask answer — lives on the same post as the question, set apart as a cited block
   (same visual language as other "referenced content" treatments in the app) so it
   reads as a sourced answer, not part of the asker's own words. */
.ai-answer {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.ai-answer-text {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}
.ai-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.55rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
}

.post-repost-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-left: 2.6rem;
}
.post-repost-label a { color: var(--text-muted); font-weight: 600; }
.post-repost-label a:hover { text-decoration: underline; }

/* Two-column post layout */
.post-row { display: flex; gap: 0.75rem; }
.post-aside { flex-shrink: 0; width: 40px; }
.post-content { flex: 1; min-width: 0; }

.post-avatar-link { display: block; text-decoration: none; }

.post-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: flex; align-items: center; justify-content: center;
}
.post-avatar-placeholder {
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.post-meta {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}
.post-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.post-name:hover { text-decoration: underline; }
/* ── Subscription plans ── */
.plan-intro { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; max-width: 40rem; margin: 0 0 1.25rem; }
.plan-grid { display: flex; flex-direction: column; gap: 1rem; }
.plan-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 17rem);
    column-gap: 1.75rem;
    padding: 1.25rem;
}
.plan-info { display: flex; flex-direction: column; gap: 1rem; }
.plan-card-head { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.plan-name { font-size: 0.95rem; }
.plan-price { font-size: 2rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; }
.plan-price small { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.plan-features {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 0.45rem;
    font-size: 0.9rem; line-height: 1.35;
}
.plan-features li { display: flex; gap: 0.55rem; align-items: flex-start; }
.plan-features li::before { content: "\2713"; color: var(--accent); font-weight: 800; flex-shrink: 0; }
.plan-buy {
    padding-left: 1.75rem;
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column; justify-content: center; gap: 0.75rem;
}
@media (max-width: 38rem) {
    .plan-card { grid-template-columns: minmax(0, 1fr); row-gap: 1rem; }
    .plan-buy { padding-left: 0; border-left: none; padding-top: 1rem; border-top: 1px solid var(--border); }
}
.plan-fine { margin: 0; font-size: 0.78rem; line-height: 1.45; color: var(--text-muted); }
.plan-consent { font-size: 0.8rem; line-height: 1.45; color: var(--text); }
.plan-consent a { text-decoration: underline; }
.plan-buy .btn { width: 100%; padding: 0.7rem 1rem; font-size: 0.9rem; }

.plan-current { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.25rem; max-width: 34rem; }
.plan-current-title { margin: 0; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.plan-current .plan-features { font-size: 0.92rem; }
.plan-current .plan-name { align-self: flex-start; }
.plan-ending { padding: 0.6rem 0.8rem; border-radius: 6px; background: rgba(240,170,30,.14); border: 1px solid rgba(240,170,30,.35); color: var(--text); }

/* ── Admin: subscription plans ── */
.admin-intro { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; margin: 0 0 1.1rem; max-width: 44rem; }
.admin-plan { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1rem; padding: 1.1rem 1.25rem; }
.admin-plan-retired { opacity: 0.75; border-style: dashed; }
.admin-plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; }
.admin-plan-meta { font-size: 0.82rem; color: var(--text-muted); }
.admin-plan-head .admin-plan-meta { margin-left: auto; }
.admin-chip { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; letter-spacing: 0.02em; }
.admin-chip-ok     { background: rgba(34,197,94,.14);  color: #15803d; }
.admin-chip-muted  { background: rgba(120,130,150,.18); color: var(--text-muted); }
.admin-chip-accent { background: var(--accent); color: #fff; }
.admin-econ { margin: 0; font-size: 0.85rem; line-height: 1.45; color: var(--text-muted); }
.admin-econ strong { color: var(--text); }
.admin-econ-loss { color: #b71c1c; background: rgba(192,41,46,.08); border: 1px solid rgba(192,41,46,.25); border-radius: 6px; padding: 0.5rem 0.7rem; }
.admin-econ-loss strong { color: #b71c1c; }
.admin-includes { margin: 0; font-size: 0.9rem; }
.admin-includes em { color: var(--text-muted); }
.admin-edit > summary { cursor: pointer; font-size: 0.85rem; font-weight: 700; color: var(--accent); }
.admin-edit[open] > summary { margin-bottom: 0.8rem; }
.admin-plan-form { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.65rem 0.9rem; }
.admin-grid .field { margin: 0; }
.admin-grid .admin-wide { grid-column: span 2; }
.admin-grid .admin-full { grid-column: 1 / -1; }
.admin-grid .field select { width: 100%; padding: 0.55rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.admin-check { font-size: 0.82rem; line-height: 1.45; }
.admin-plan-form .btn { align-self: flex-start; }
.admin-plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.admin-details { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.25rem; margin-bottom: 1rem; }
.admin-details > summary { cursor: pointer; font-weight: 700; font-size: 0.95rem; }
.admin-details[open] > summary { margin-bottom: 0.9rem; }
.admin-lookup { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
@media (max-width: 38rem) {
    .admin-grid .admin-wide { grid-column: 1 / -1; }
    .admin-plan-head .admin-plan-meta { margin-left: 0; width: 100%; }
}

/* Subscriber username: a shaded highlight behind the name plus a bold serif face, so a paying,
   verified person is recognisable at a glance. Colour comes from the plan's style; the text
   colour is inherited so it stays readable in both themes. Keep keys in sync with
   SubscriptionService::STYLES. Change --uname-font to restyle the font everywhere. */
:root { --uname-font: Georgia, "Times New Roman", serif; }
.uname-styled {
    font-family: var(--uname-font);
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    border-radius: 0.4rem;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.uname-sky    { background: rgba(56, 140, 255, 0.20); }
.uname-mint   { background: rgba(40, 180, 120, 0.20); }
.uname-amber  { background: rgba(240, 170, 30, 0.24); }
.uname-rose   { background: rgba(230, 70, 110, 0.20); }
.uname-violet { background: rgba(140, 90, 230, 0.20); }
.uname-slate  { background: rgba(120, 130, 150, 0.24); }

.post-badge {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    opacity: 0.85;
}
.post-handle {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.post-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
}
.post-date:hover { text-decoration: underline; }

.post-body {
    font-size: 0.95rem;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 0.6rem;
}
.post-body .hashtag,
.post-body .mention { color: var(--accent); text-decoration: none; font-weight: 500; }
.post-body .hashtag:hover,
.post-body .mention:hover { text-decoration: underline; }

/* ── Polls ── */
.poll { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

.poll-vote-form { margin: 0; }
.poll-vote-btn {
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s;
}
.poll-vote-btn:hover { border-color: var(--accent); background: var(--bg-secondary); }

.poll-result {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
}
.poll-result-chosen { border-color: var(--accent); }
.poll-result-bar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    z-index: 0;
}
.poll-result-label, .poll-result-percent { position: relative; z-index: 1; }
.poll-result-percent { font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* Voted-but-still-open results are actual buttons (to allow changing the vote) —
   reset button chrome so they look identical to the read-only .poll-result div. */
.poll-result-clickable {
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.1s;
}
.poll-result-clickable:hover { border-color: var(--accent); }

.poll-meta { font-size: 0.78rem; color: var(--text-muted); margin: 0.1rem 0 0; }

.post-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.1s;
    font-family: inherit;
}
.post-action:hover { color: var(--accent); text-decoration: none; }
.post-action-delete { color: var(--text-muted); }
.post-action-delete:hover { color: #c0292e; }
.post-action-form { display: inline; margin: 0; padding: 0; }
.post-action-liked { color: var(--accent); }
.post-action-liked:hover { color: var(--accent-hover); }

/* ── Report dropdown ── */
.post-report { position: relative; display: inline-flex; }
.post-report-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    min-width: 210px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: 0.35rem;
}
.post-report-menu-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 0.4rem 0.6rem 0.3rem;
}
.post-report-menu-form { margin: 0; }
.post-report-reason {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: var(--text);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.post-report-reason:hover { background: var(--bg-secondary); color: var(--accent); }

/* ── Hashtag / mention links outside post body ── */
a.hashtag, a.mention { color: var(--accent); font-weight: 500; }

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
.site-footer a { color: var(--text-muted); }

/* ── Notification badge (nav bell) ── */
.nav-notif-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.notif-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9999px;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    line-height: 1.5;
    letter-spacing: 0;
}

/* ── Notification list page ── */
.notif-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.notif-unread {
    border-left: 3px solid var(--accent);
}

.notif-avatar-wrap { flex-shrink: 0; }

.notif-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    display: flex; align-items: center; justify-content: center;
}

.notif-avatar-placeholder {
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.notif-body { flex: 1; min-width: 0; }

.notif-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.notif-actor {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.notif-actor:hover { text-decoration: underline; }

.notif-post-preview {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-post-preview:hover { text-decoration: underline; color: var(--text); }

.notif-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Feed bar (tabs + filter) ── */
.feed-bar { margin-bottom: 1rem; }

.feed-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 0.6rem;
}

.feed-tab {
    text-align: center;
    padding: 0.6rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 7px;
    transition: color 0.12s, background 0.12s, box-shadow 0.12s;
    white-space: nowrap;
}
.feed-tab:hover { color: var(--text); text-decoration: none; }
.feed-tab.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.feed-filter-form { margin-bottom: 0; }

.feed-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.feed-filter-icon {
    position: absolute;
    left: 0.65rem;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.feed-filter-input {
    width: 100%;
    padding: 0.45rem 2rem 0.45rem 2.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.feed-filter-input:focus { border-color: var(--accent); background: var(--card-bg); }
.feed-filter-input::placeholder { color: var(--text-muted); }

.feed-filter-clear {
    position: absolute;
    right: 0.65rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    line-height: 1;
}
.feed-filter-clear:hover { color: var(--accent); text-decoration: none; }

.feed-active-tag {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.feed-active-tag strong { color: var(--accent); }
.feed-active-tag a { color: var(--text-muted); margin-left: 0.5rem; }
.feed-active-tag a:hover { color: var(--text); text-decoration: none; }

/* ── Profile header actions ── */
.profile-header-actions {
    flex-shrink: 0;
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.btn-icon {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }
.btn-icon-active {
    background: rgba(204,41,54,.1);
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Following management list ── */
.follow-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.follow-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.1s;
}
.follow-card:hover { background: var(--bg-secondary); }

.follow-avatar-link {
    flex-shrink: 0;
    display: block;
    text-decoration: none;
    line-height: 0;
}

.follow-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}
.follow-avatar-init {
    background: var(--accent);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.follow-info {
    flex: 1;
    min-width: 0;
}
.follow-name {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}
.follow-name:hover { text-decoration: underline; }
.follow-handle {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.follow-bio {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0.15rem 0 0;
}

/* Single form, buttons are direct flex children */
form.follow-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

/* ── New post slide-in animation ── */
@keyframes post-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.post-card-new { animation: post-slide-in 0.25s ease both; }

/* ── Trending hashtag grid ── */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.trending-chip {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0.85rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.15s;
}
.trending-chip:hover { border-color: var(--accent); }
.trending-tag {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
    line-height: 1.3;
    overflow-wrap: anywhere;   /* a very long hashtag breaks inside the box instead of spilling out */
}
.trending-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── Admin moderation ── */
.mod-badge-pending {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
}
.mod-score {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    background: rgba(204, 41, 54, 0.15);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
}
.mod-reviewed { opacity: 0.55; }
.mod-blocked-body {
    margin-top: 0.4rem;
    padding: 0.6rem 0.75rem;
    background: rgba(204, 41, 54, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Flash messages ── */
.flash {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    width: 100%;
    box-sizing: border-box;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
}
.flash-error              { background: #cc2936; color: #fff; }
.flash-success            { background: #16a34a; color: #fff; }
.flash-icon               { flex-shrink: 0; color: #fff; }
.flash-message            { color: #fff; }
.flash-message a          { color: #fff; text-decoration: underline; font-weight: 800; }
.flash-message a:hover    { opacity: 0.8; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle; }
/* Slower sweep than .spin — reads as "thinking/processing" rather than a quick action,
   since a /ask answer can take up to a minute. */
.dial-spin { animation: spin 1.6s linear infinite; display: inline-block; vertical-align: middle; }

/* ── Posting progress bar ── */
#posting-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #cc2936;
    color: #fff;
    text-align: center;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.posting-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

/* ── Link preview card ── */
.link-preview {
    display: flex;
    flex-direction: column;
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}
.link-preview:hover { border-color: var(--accent); }
.link-preview-image { width: 100%; height: 200px; overflow: hidden; }
.link-preview-image img { width: 100%; height: 200px; object-fit: cover; display: block; }
.link-preview-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
}
.link-preview-domain { font-size: 0.75rem; color: var(--text-muted); text-transform: lowercase; }
.link-preview-title  { font-size: 0.9rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.link-preview-desc   { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

/* ── Infinite scroll sentinel ── */
.feed-end { min-height: 1px; padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.feed-end--loading::after { content: 'Loading more\2026'; }
.feed-end--done { opacity: 0.6; }

/* ── Utility ── */
.text-muted { color: var(--text-muted); font-size: 0.875rem; }

.guest-reply-prompt {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
}

/* ── Advertiser dashboard ── */
.stat-tile-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}
.stat-tile-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}
.stat-tile-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: proportional-nums;
}
.stat-tile-hero {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-color: transparent;
}
.stat-tile-hero .stat-tile-label { color: rgba(255,255,255,0.85); }
.stat-tile-hero .stat-tile-value { color: #fff; font-size: 2.25rem; }

.dashboard-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.dashboard-section h2 {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.dashboard-section h2 .icon { color: var(--accent); flex-shrink: 0; }

.saturation-readout {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.saturation-readout strong { font-size: 1.6rem; color: var(--accent); }
.saturation-readout span { color: var(--text-muted); font-size: 0.85rem; }

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    height: 6px;
    cursor: pointer;
}

.creative-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.creative-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.creative-thumb {
    aspect-ratio: 1.91 / 1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.creative-thumb img { width: 100%; height: 100%; object-fit: contain; }
.creative-body { padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    text-transform: capitalize;
    width: fit-content;
}
.chip-active  { background: rgba(34,197,94,.15);  color: #15803d; }
.chip-pending { background: rgba(234,179,8,.18);  color: #a16207; }
.chip-rejected{ background: rgba(192,41,46,.12);  color: #c0292e; }
.chip-paused  { background: var(--bg-secondary);  color: var(--text-muted); }

.creative-actions { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-top: auto; }
.creative-actions .field { flex: 1; min-width: 140px; margin-bottom: 0; }
