/* Affiliate United Group — AUG-1
   Navy / emerald / gold. Professional community, not flashy. */

:root {
    --navy: #1C3146;
    --navy-dark: #0F172A;
    --navy-mid: #1E293B;
    --emerald: #10B981;
    --emerald-dark: #047857;
    --forest: #204734;
    --gold: #D4AF37;
    --gold-dim: #AC9664;
    --silver: #DBD9DC;
    --bg: #F8FAFC;
    --bg-alt: #EEF2F6;
    --card: #FFFFFF;
    --text: #1E293B;
    --muted: #64748B;
    --border: #E2E8F0;
    --danger: #B91C1C;
    --ok: #047857;
    --radius: 10px;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

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

html { font-size: 16px; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
}

h1, h2, h3, h4, .brand-word {
    font-family: Poppins, "Open Sans", sans-serif;
    font-weight: 700;
    color: var(--navy-dark);
    line-height: 1.25;
}

img { max-width: 100%; height: auto; }
a { color: var(--forest); text-decoration: none; }
a:hover { color: var(--gold); }
a.btn-text { display: inline-block; }

.wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }
.wrap-narrow { width: min(560px, calc(100% - 32px)); margin: 0 auto; }

.skip {
    position: absolute;
    left: -999px;
    top: 8px;
    background: var(--gold);
    color: var(--navy-dark);
    padding: 8px 12px;
}
.skip:focus { left: 8px; z-index: 20; }

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

.brand-bar {
    background: #000;
    text-align: center;
    padding: 10px 16px 0;
}

.brand-link { display: inline-block; }
.brand-logo {
    display: block;
    height: 78px;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
}

.site-header {
    background: var(--navy);
    border-bottom: 3px solid var(--gold);
}

.nav-wrap { display: flex; align-items: center; justify-content: flex-end; min-height: 52px; }

.nav-toggle { display: none; }
.nav-toggle-label {
    display: none;
    color: #fff;
    border: 1px solid var(--gold-dim);
    padding: 6px 12px;
    border-radius: 6px;
    margin: 10px 0;
    cursor: pointer;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    align-items: center;
}

.nav-links a {
    color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.is-active { color: var(--gold); }

.rss-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rss-link img {
    display: block;
    width: 22px;
    height: 22px;
}

.feed-url-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
    margin-top: 8px;
}
.feed-url-row input {
    flex: 1;
    min-width: 180px;
}
.feed-url-row .btn { width: auto; }
.rss-steps { margin: 8px 0 12px; padding-left: 20px; }
.rss-steps li { margin: 6px 0; }
.reader-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.reader-links .btn { width: auto; }
.nav-links .rss-link {
    padding: 8px 10px;
}
.nav-links .rss-link:hover { opacity: 0.85; }

.nav-cta {
    background: var(--emerald);
    color: #fff !important;
    margin-left: 6px;
}
.nav-cta:hover { background: var(--emerald-dark); color: #fff !important; }

.badge {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy-dark);
    font-size: 0.75rem;
}

main { min-height: 60vh; padding: 28px 0 48px; }

.flash {
    width: min(1100px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
}
.flash-ok { background: #ECFDF5; color: var(--ok); border: 1px solid #A7F3D0; }
.flash-err { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.flash-info { background: #F8FAFC; color: var(--navy); border: 1px solid var(--border); }

.hero {
    background: var(--navy-dark);
    color: #fff;
    padding: 48px 0 56px;
    text-align: center;
}
.hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 12px 0 8px; }
.hero .tagline { color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.hero p { color: var(--silver); max-width: 640px; margin: 0 auto 22px; }

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
    display: inline-block;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 8px;
    text-align: center;
}

.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-dark); color: #fff; }

.btn-gold {
    background: transparent;
    color: var(--navy);
    border: 2px solid var(--gold);
}
.btn-gold:hover { background: var(--gold); color: var(--navy-dark); }

.hero .btn-gold { color: #fff; }
.hero .btn-gold:hover { color: var(--navy-dark); }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dim); }

.btn-danger { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }

.btn-text {
    background: none;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
}
.btn-text:hover, .btn-text.is-on { color: var(--emerald-dark); }

.section { padding: 40px 0; }
.section-alt { background: var(--bg-alt); }

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.icon-check {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ECFDF5;
    color: var(--emerald-dark);
    display: grid;
    place-items: center;
    font-weight: 700;
    margin-bottom: 10px;
}

.layout { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }

.page-title { margin: 0 0 8px; }
.lede { color: var(--muted); margin: 0 0 20px; }

.composer textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea { resize: vertical; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
.composer form > label:first-of-type { margin-top: 0; }

.check-list {
    margin: 12px 0 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px 10px;
    background: #fff;
}
.check-list legend {
    font-weight: 600;
    padding: 0 6px;
}
.check-list .muted { margin: 0 0 6px; font-weight: 400; }
.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin: 6px 0;
}
.check-item input { width: auto; flex-shrink: 0; }

.website-fields {
    margin: 12px 0 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px 12px;
    background: #fff;
}
.website-fields legend {
    font-weight: 600;
    padding: 0 6px;
}
.website-fields .muted { margin: 0 0 6px; font-weight: 400; }
.website-fields label { margin-top: 10px; }

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.pill-row .pill-sm { margin-top: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}
.tabs a {
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--navy);
    font-weight: 600;
}
.tabs a.is-active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.tabs .rss-link {
    background: transparent;
    border: 0;
    padding: 6px;
    margin-left: auto;
}
.tabs .rss-link:hover { background: transparent; }

.post-head, .post-author {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.post-author { justify-content: flex-start; color: inherit; }
.post-author span { display: flex; flex-direction: column; }
.post-title { margin: 12px 0 0; font-size: 1.2rem; line-height: 1.35; color: var(--navy); }
.post-title + .post-body { margin-top: 8px; }
.post-body { margin: 12px 0; overflow-wrap: anywhere; }
.post-image { margin: 12px 0 0; }
.post-image a { display: block; color: inherit; }
.post-image img {
    display: block;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    max-height: 480px;
    object-fit: contain;
    background: var(--bg-alt);
}
.edit-current-image {
    margin-top: 12px;
    padding-top: 4px;
}
.edit-current-image .post-image img {
    max-height: 220px;
    width: auto;
}
.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 8px;
    align-items: center;
    position: relative;
}
.post-actions .btn {
    margin-left: auto;
    padding: 6px 14px;
}
.share-menu {
    position: relative;
    display: inline-block;
}
.share-menu > summary {
    list-style: none;
}
.share-menu > summary::-webkit-details-marker,
.share-menu > summary::marker { display: none; content: ''; }
.share-panel {
    position: absolute;
    z-index: 30;
    left: 0;
    top: calc(100% + 6px);
    min-width: 0;
    width: max-content;
    max-width: min(420px, calc(100vw - 48px));
    padding: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.share-panel .share-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--navy);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.share-panel .share-option:hover {
    background: var(--bg-alt);
    border-color: var(--gold);
    color: var(--gold-dim);
}
.post { margin-bottom: 16px; }
.shared-post {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg);
    margin: 8px 0;
}

.pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--forest);
    background: #ECFDF5;
    border-radius: 999px;
    padding: 4px 8px;
}
.pill-sm { margin-top: 4px; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: var(--navy);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}
.avatar-xs { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-sm { width: 42px; height: 42px; }
.avatar-md { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }

.muted { color: var(--muted); }
.inline-form { display: inline; }

.member-card { display: flex; flex-direction: column; gap: 10px; }
.member-card-main { display: flex; gap: 12px; color: inherit; align-items: center; }
.member-card-main span { display: flex; flex-direction: column; }

.profile-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.profile-hero .meta { flex: 1; min-width: 220px; }
.profile-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    flex-shrink: 0;
}
.profile-join-btn {
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding: 12px 22px;
}
.profile-link-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 0;
}
.profile-link-btns .btn {
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}
.stats { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.stats strong { color: var(--navy-dark); }

.stat-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.3;
}
.stat-btn:hover {
    border-color: var(--gold);
    color: inherit;
}
.stat-btn.is-active {
    border-color: var(--navy);
    background: #fff;
}

.follow-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px 24px;
    background: rgba(15, 23, 42, 0.45);
    overflow: auto;
}
.follow-overlay-dismiss {
    position: absolute;
    inset: 0;
}
.follow-panel {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: min(72vh, 640px);
    overflow: auto;
    margin: 0;
}
.follow-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.follow-panel-head h2 { margin: 0; font-size: 1.2rem; }

.connection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.connection-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
}
.connection-main span { display: flex; flex-direction: column; min-width: 0; }
.connection-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.comments { margin-top: 12px; }
.comment { display: flex; gap: 10px; margin: 10px 0; }
.comment-form textarea { margin: 8px 0; }

.notice-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}
.notice-row.unread {
    background: #F0FDFA;
    margin: 0 -12px;
    padding: 0 12px;
}
.notice {
    display: block;
    flex: 1;
    min-width: 0;
    padding: 14px 0;
    color: inherit;
}
.notice-row .btn-text { flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
table.data th, table.data td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.data th { background: var(--navy); color: #fff; }

.search-bar {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 10px;
    margin-bottom: 20px;
    align-items: end;
}

.pager {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin: 24px 0 0;
}
.pager a { font-weight: 700; }

.banner-note {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: #92400E;
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.site-footer {
    background: var(--navy-dark);
    color: var(--silver);
    padding: 28px 0;
    text-align: center;
    font-size: 0.95rem;
}
.site-footer a { color: var(--gold); }
.site-footer a:hover { color: #fff; }
.site-footer .muted { color: #94A3B8; }
.footer-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: #fff; }

.admin-subnav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.admin-subnav a {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--navy);
    font-weight: 600;
}
.admin-subnav a.is-active { background: var(--navy); color: #fff; }

.plain-list {
    margin: 0 0 12px;
    padding-left: 18px;
}
.plain-list li { margin: 4px 0; }

.group-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}
.group-card h2 { margin-top: 0; }
.post-in-group { margin: 0 0 8px; }

.inbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    color: inherit;
}
.inbox-row:last-child { border-bottom: 0; }
.inbox-row.unread { background: #F0FDFA; margin: 0 -12px; padding: 0 12px; }
.inbox-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 12px 0;
    color: inherit;
}
.inbox-row .btn-text { flex-shrink: 0; }
.inbox-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.inbox-preview { color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.message-thread { display: flex; flex-direction: column; gap: 10px; }
.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-alt, #F8FAFC);
    border: 1px solid var(--border);
}
.message-bubble.mine {
    margin-left: auto;
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.message-bubble.mine .muted { color: #CBD5E1; }
.message-bubble.mine .btn-text { color: #E2E8F0; }
.message-bubble.mine .btn-text:hover { color: var(--gold); }
.message-bubble.theirs { margin-right: auto; }
.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.message-bubble .muted { font-size: 0.8rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.stat-grid .card { text-align: center; }
.stat-grid strong { display: block; font-size: 1.8rem; color: var(--navy); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.ad-card { margin-bottom: 16px; }
.ad-card .ad-title { margin: 0 0 8px; font-size: 1.15rem; }
.ad-card .ad-image { margin: 0 0 12px; }
.ad-card .ad-image img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; }
.ad-body { margin: 0 0 10px; }
.ad-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 0; }
.ad-teaser { padding: 12px 0; border-top: 1px solid var(--border); }
.ad-teaser:first-of-type { border-top: 0; padding-top: 0; }
.ad-teaser .ad-title { margin: 0 0 4px; font-size: 1rem; }
.ad-teaser .ad-body { margin: 0 0 6px; font-size: 0.9rem; }
.ad-teaser .ad-actions { margin: 4px 0 0; }
.ad-admin-thumb { margin: 0 0 8px; }
.ad-admin-thumb img { max-width: 160px; max-height: 90px; object-fit: cover; border-radius: 6px; display: block; }

.asset-card { margin-top: 16px; }
.asset-card h2 .muted { font-weight: 600; font-size: 0.95rem; }
.asset-preview {
    background: #000;
    padding: 16px;
    text-align: center;
    border-radius: 8px;
    margin: 8px 0 16px;
    overflow: auto;
}
.asset-preview img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}
.asset-code {
    width: 100%;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    resize: vertical;
}
.asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.asset-actions .btn { width: auto; }

@media (max-width: 880px) {
    .grid-2, .grid-3, .form-row, .search-bar, .stat-grid {
        grid-template-columns: 1fr;
    }
    .nav-wrap { flex-wrap: wrap; justify-content: space-between; }
    .nav-toggle-label { display: inline-block; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 12px;
    }
    .nav-toggle:checked ~ .nav-links { display: flex; }
    .nav-cta { margin-left: 0; }
    .brand-logo { height: 58px; }
    .profile-hero-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }
    .profile-hero-actions .btn {
        flex: 1 1 auto;
        text-align: center;
    }
}
