/* OG portal — one stylesheet, no build step. */

:root {
    --bg: #f5f4f0;
    --surface: #ffffff;
    --surface-quiet: #efeee8;
    --text: #1f2a26;
    --muted: #5f6b66;
    --border: #dcdad2;
    --accent: #305f4f;
    --accent-hover: #244a3d;
    --accent-soft: #e2ece7;
    --on-accent: #ffffff;
    --ok: #2f6b3f;
    --ok-soft: #dff0e2;
    --warn: #8a5a00;
    --warn-soft: #fbefd5;
    --error: #a3322a;
    --error-soft: #f8e1de;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(31, 42, 38, 0.06), 0 2px 8px rgba(31, 42, 38, 0.04);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #151a18;
        --surface: #1e2522;
        --surface-quiet: #19201d;
        --text: #e6ebe8;
        --muted: #9aa7a1;
        --border: #34403b;
        --accent: #7fb59f;
        --accent-hover: #9cc9b6;
        --accent-soft: #24352e;
        --on-accent: #10201a;
        --ok: #8fd09f;
        --ok-soft: #1f3526;
        --warn: #e8c070;
        --warn-soft: #3a2f17;
        --error: #f09a90;
        --error-soft: #3d2220;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 1.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h2:not(:first-child) { margin-top: 1.5rem; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.lead { font-size: 1.05rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Top bar --- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.6rem 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 650;
    color: var(--text);
    text-decoration: none;
}
.brand svg { width: 26px; height: 26px; fill: var(--accent); }
.mainnav { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }
.mainnav a, .mainnav .soon {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
}
.mainnav a:hover { background: var(--surface-quiet); }
.mainnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mainnav .soon { color: var(--muted); cursor: default; }
.topbar-tools { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.topbar-tools form { margin: 0; }
.profile-link { font-size: 0.95rem; text-decoration: none; }
.profile-link[aria-current="page"] { font-weight: 600; }

.langswitch { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.langswitch button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0.25rem 0.5rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.langswitch button + button { border-left: 1px solid var(--border); }
.langswitch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.linkbutton {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 0.95rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
}

/* --- Page --- */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 2rem 16px 3rem; flex: 1; }
.page-narrow { max-width: 560px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1.5rem 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.card-quiet { background: var(--surface-quiet); box-shadow: none; }
.auth-card { padding: 2rem; }
.auth-card h1 { font-size: 1.5rem; }

.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2 .card { margin-bottom: 0; }

.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 1.25rem; }
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.tile h2 { margin-bottom: 0.4rem; }
.tile p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.95rem; }
.tile-soon { border-style: dashed; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-warn .stat-value { color: var(--warn); }

/* --- Messages --- */
.messages { margin-bottom: 1.25rem; }
.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
}
.message-success { background: var(--ok-soft); border-left-color: var(--ok); }
.message-warning { background: var(--warn-soft); border-left-color: var(--warn); }
.message-error { background: var(--error-soft); border-left-color: var(--error); }
.message p { margin: 0; }

/* --- Forms (also used by all allauth pages) --- */
form p { margin: 0 0 1rem; }
label { display: block; font-weight: 550; margin-bottom: 0.3rem; }
input[type="email"], input[type="password"], input[type="text"], input[type="tel"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
input[type="checkbox"] + label { display: inline; font-weight: 400; margin-left: 0.4rem; }
.helptext, form p span { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 0.25rem; }
.errorlist { list-style: none; padding: 0; margin: 0 0 0.5rem; color: var(--error); font-size: 0.9rem; }

.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }

.btn, button[type="submit"]:not([class]):not(.langswitch button) {
    display: inline-block;
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--error); border-color: var(--error); }

.choices { border: 0; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.75rem; }
.choice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    font-weight: 400;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 0.2rem; flex-shrink: 0; }

.consent-text {
    background: var(--surface-quiet);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}
.consent-text p { margin: 0 0 0.75rem; }
.consent-text p:last-child { margin-bottom: 0; }

/* --- Tables --- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.group-start td { border-top: 2px solid var(--border); }

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-quiet); color: var(--muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0 0 1rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.linklist { padding-left: 1.1rem; margin: 0 0 1rem; }
.linklist li { margin-bottom: 0.35rem; }

/* allauth: recovery codes and TOTP secret */
.auth-card img { max-width: 220px; height: auto; background: #fff; padding: 8px; border-radius: 8px; }
.auth-card textarea, .auth-card pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.panel { margin-bottom: 1.5rem; }

@media (max-width: 640px) {
    h1 { font-size: 1.4rem; }
    .card, .auth-card { padding: 1.1rem; }
    .topbar-tools { margin-left: 0; width: 100%; justify-content: space-between; }
    .details { grid-template-columns: 1fr; }
    .details dd { margin-bottom: 0.5rem; }
}

/* "Remember me" and other checkboxes rendered by form.as_p: box first, then label. */
form p:has(> input[type="checkbox"]) {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}
form p:has(> input[type="checkbox"]) label { margin: 0; font-weight: 400; }

/* --- Documents --- */
.filterbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1.25rem; }
.filterbar input[type="search"] {
    flex: 1 1 220px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.filterbar select { width: auto; flex: 0 1 220px; }
.filterbar .btn { padding: 0.5rem 1rem; }

.doclist { list-style: none; margin: 0; padding: 0; }
.doc { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.doc:last-child { border-bottom: 0; }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.doc-title:hover { text-decoration: underline; }
.doc-meta { margin-top: 0.15rem; }
.doc-desc { margin: 0.35rem 0 0; font-size: 0.95rem; }
.doc-admin { white-space: nowrap; }
.filetype {
    flex-shrink: 0;
    width: 2.6rem;
    padding: 0.45rem 0;
    text-align: center;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--surface-quiet);
    color: var(--muted);
}
.filetype-pdf { background: var(--error-soft); color: var(--error); }
.filetype-doc, .filetype-docx, .filetype-odt { background: var(--accent-soft); color: var(--accent); }
.filetype-xls, .filetype-xlsx, .filetype-ods { background: var(--ok-soft); color: var(--ok); }

.tile h2 a { color: inherit; text-decoration: none; }
.tile h2 .badge { vertical-align: middle; margin-left: 0.3rem; }
.tile-list { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.tile-list li { padding: 0.3rem 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.tile-list li:last-child { border-bottom: 0; }
.tile-list .small { display: block; }

.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.page-wide { max-width: 1100px; }

.print-only { display: none; }
@media print {
    .topbar, .footer, .messages, .no-print { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; color: #000; }
    .card { border: 0; box-shadow: none; padding: 0; }
    .page { padding: 0; max-width: none; }
    .table td { padding: 0.8rem 0.5rem; }
}

/* Narrower screens: brand + tools on the first row, the menu as its own row. */
@media (max-width: 960px) {
    .topbar-inner { gap: 0.5rem 1rem; }
    .topbar-tools { order: 2; margin-left: auto; }
    .mainnav { order: 3; flex-basis: 100%; margin: 0 -0.65rem; }
}
.table td:first-child { white-space: nowrap; }
.btn-small { white-space: nowrap; }

/* --- Forum --- */
.topiclist { list-style: none; margin: 0; padding: 0; }
.topic { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; justify-content: space-between; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.topic:last-child { border-bottom: 0; }
.topic-main { flex: 1 1 320px; min-width: 0; }
.topic-title { font-weight: 500; text-decoration: none; color: var(--text); overflow-wrap: anywhere; }
.topic-unread .topic-title { font-weight: 700; color: var(--accent); }
.topic-title:hover { text-decoration: underline; }
.topic-stats { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.topic-replies { font-weight: 600; }
.pager { display: flex; gap: 1rem; justify-content: center; padding-top: 1rem; }

.modbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.post { padding: 1.1rem 1.25rem; scroll-margin-top: 1rem; }
.post-new { border-left: 4px solid var(--accent); }
.post-head { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
.avatar {
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}
.permalink { color: inherit; text-decoration: none; }
.permalink:hover { text-decoration: underline; }
.post-body { overflow-wrap: anywhere; }
.post-removed { font-style: italic; margin: 0; }
.attachments { list-style: none; padding: 0; margin: 0.9rem 0 0; display: grid; gap: 0.4rem; }
.attachments li { display: flex; align-items: center; gap: 0.6rem; }
.attachments .filetype { width: 2.3rem; padding: 0.25rem 0; }
.post-actions { display: flex; gap: 1rem; align-items: center; margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.post-actions form { margin: 0; }
.form-card { max-width: 760px; }
textarea { resize: vertical; min-height: 6rem; }
input[type="file"] { font: inherit; }

@media (max-width: 640px) {
    .topic-stats { flex-direction: row; flex-wrap: wrap; gap: 0 0.5rem; align-items: baseline; text-align: left; }
}

/* --- Votes --- */
.proposal { background: var(--surface-quiet); border-left: 4px solid var(--accent); padding: 0.9rem 1.1rem; border-radius: 6px; margin-bottom: 1rem; }
.ballot { border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1rem 1rem; margin: 0 0 1rem; }
.ballot legend { padding: 0 0.35rem; }
.ballot-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-top: 0.4rem; }
.ballot-options .choice { align-items: center; font-weight: 600; }
.ballot-yes:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.ballot-no:has(input:checked) { border-color: var(--error); background: var(--error-soft); }
.ballot-abstain:has(input:checked) { border-color: var(--muted); background: var(--surface-quiet); }

.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-quiet); margin: 0.75rem 0 1rem; }
.bar span { display: block; height: 100%; }
.bar-yes, .dot.dot-yes { background: var(--ok); }
.bar-no, .dot.dot-no { background: var(--error); }
.bar-abstain, .dot.dot-abstain { background: var(--muted); }
.bar-participation { background: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.5rem; background: var(--border); }
.result { font-size: 1.15rem; font-weight: 700; margin: 0; }
.result-yes { color: var(--ok); }
.result-no { color: var(--error); }
.result-table { max-width: 420px; }
.badge-yes { background: var(--ok-soft); color: var(--ok); }
.badge-no { background: var(--error-soft); color: var(--error); }
.badge-abstain { background: var(--surface-quiet); color: var(--muted); }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
.inline-form select, .inline-form input[type="date"] { width: auto; padding: 0.3rem 0.5rem; font: inherit; font-size: 0.9rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.inline-form label { margin: 0; }
.steps { padding-left: 1.2rem; display: grid; gap: 1rem; margin: 0; }
input[type="datetime-local"], input[type="date"] { padding: 0.5rem 0.7rem; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
