/* RoomiePatch stylesheet. Plain custom CSS, no frameworks.
   Layout idea: a community forum. Top bar, left navigation, a central
   question feed, and a supporting right column. */

/* ==========================================================
   0. Font: Figtree, saved in assets/fonts/ so it works without internet.
   It is a "variable" font: one file covers every weight from 300 to 900.
   Licence: SIL Open Font License (assets/fonts/OFL.txt).
   ========================================================== */
@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Extra accented letters (only downloaded if a page uses them) */
@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("../fonts/figtree-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================
   1. Colour tokens
   Light mode: white and blue. Dark mode: dark grey and blue.
   Every colour on the site comes from these variables.
   ========================================================== */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-alt: #f1f3f7;
    --surface-hover: #f7f9fc;
    --text: #1a1d24;
    --text-muted: #5f6675;
    --text-faint: #8a909c;
    --border: #e1e4ea;
    --border-strong: #cfd4dd;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #e8effd;
    --on-primary: #ffffff;
    --success: #15803d;
    --success-solid: #16a34a;
    --success-soft: #e6f6ec;
    --danger: #c62828;
    --danger-soft: #fdeaea;
    --overlay: rgba(15, 20, 30, 0.45);
    --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.12);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --topbar-h: 56px;
    /* Figtree comes from assets/fonts/ (see the top of this file); the rest are fallbacks */
    --font: "Figtree", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
    --bg: #17181b;
    --surface: #202226;
    --surface-alt: #2a2c31;
    --surface-hover: #25272c;
    --text: #e6e8ec;
    --text-muted: #a0a6b1;
    --text-faint: #7b818c;
    --border: #33363c;
    --border-strong: #44484f;
    --primary: #5b95ff;
    --primary-hover: #7aa8ff;
    --primary-soft: #1f2c45;
    --on-primary: #0c1322;
    --success: #4ade80;
    --success-solid: #16a34a;
    --success-soft: #17301f;
    --danger: #f87171;
    --danger-soft: #3a1d1d;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ==========================================================
   2. Base
   ========================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 {
    line-height: 1.3;
}

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

a:hover {
    text-decoration: underline;
}

.icon {
    display: block;
    flex-shrink: 0;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.brand {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

/* Logo next to the name. It is an image file with fixed colours,
   so it looks the same in light and dark mode. */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.brand-logo {
    display: block;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
}

/* ==========================================================
   3. Buttons, inputs, small parts
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-alt);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--surface-alt);
}

/* Theme toggle: show the moon in light mode, the sun in dark mode */
.theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.input {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.alert {
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    font-size: 14px;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

.avatar-sm { width: 28px; height: 28px; font-size: 13px; }
.avatar-md { width: 36px; height: 36px; font-size: 15px; }
.avatar-lg { width: 72px; height: 72px; font-size: 30px; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.6;
}

a.chip:hover {
    text-decoration: none;
    filter: brightness(0.96);
}

.chip-device {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.open {
    color: var(--primary);
    border: 1px solid var(--primary);
}

.status-badge.resolved {
    background: var(--success-soft);
    color: var(--success);
}

.dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-faint);
}

/* ==========================================================
   4. Top bar
   ========================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.menu-toggle {
    display: none;
}

.topbar-search {
    flex: 1;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-faint);
}

.sidebar-search {
    display: none;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-faint);
}

.sidebar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.topbar-search:focus-within,
.sidebar-search:focus-within {
    border-color: var(--primary);
    background: var(--surface);
}

.topbar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.topbar-search + .topbar-actions {
    margin-left: 0;
}

/* User menu dropdown */
.dropdown {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.user-menu-btn:hover,
.dropdown.open .user-menu-btn {
    border-color: var(--border);
    background: var(--surface-alt);
}

.dropdown-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
}

.dropdown.open .dropdown-panel {
    display: block;
}

.dropdown-header {
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.dropdown-header strong {
    color: var(--text);
    font-size: 14px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

/* Notification bell + panel */
.notif-bell {
    position: relative;
}

.dropdown.open .notif-bell {
    color: var(--text);
    background: var(--surface-alt);
}

.notif-count {
    position: absolute;
    top: 3px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
    box-sizing: border-box;
}

.notif-panel {
    width: 360px;
    padding: 0;
    overflow: hidden;
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.notif-panel-head strong {
    font-size: 15px;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
}

.notif-empty {
    margin: 0;
    padding: 24px 18px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.notif-list {
    max-height: min(420px, 70vh);
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    color: var(--text);
}

.notif-item:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.notif-item.unread {
    background: var(--primary-soft);
}

.notif-item.unread:hover {
    filter: brightness(0.98);
}

.notif-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--primary);
}

.notif-item.unread .notif-icon {
    background: var(--surface);
}

.notif-icon.type-meetup_accepted {
    color: var(--success);
}

.notif-icon.type-meetup_rejected {
    color: var(--text-muted);
}

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

.notif-message {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.notif-item.unread .notif-message {
    font-weight: 600;
}

.notif-text time {
    display: block;
    margin-top: 2px;
    color: var(--text-faint);
    font-size: 12px;
}

.notif-item:not(.unread) .notif-dot,
.notif-list[hidden],
.notif-empty[hidden],
#notif-read-all[hidden] {
    display: none;
}

.notif-dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--primary);
}

/* ==========================================================
   5. Page layout: sidebar | content | rail
   ========================================================== */
.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 300px;
    gap: 24px;
    max-width: 1260px;
    margin: 0 auto;
    padding: 20px 20px 48px;
    align-items: start;
}

/* Pages without a right column let the content take the space */
.layout:not(:has(.rail)) {
    grid-template-columns: 220px minmax(0, 1fr);
}

.content {
    min-width: 0;
}

/* Left sidebar */
.sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
}

.sidebar-close {
    display: none;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.nav-group:last-child {
    border-bottom: 0;
}

.nav-heading {
    margin: 0 0 6px;
    padding: 0 12px;
    color: var(--text-faint);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.nav-link .icon {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    stroke-width: 1.75;   /* slightly thinner lines, like the reference design */
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-link.active .icon {
    color: var(--primary);
}

.nav-link-plain {
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.menu-overlay {
    display: none;
}

/* Right rail: supporting boxes */
.rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
}

.rail-box {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rail-box h2 {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.rail-box p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    padding-left: 34px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 14px;
    counter-increment: step;
}

.steps li:last-child {
    margin-bottom: 0;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 22px;
}

.steps strong {
    color: var(--text);
}

.mini-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mini-list li {
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.mini-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.mini-list a {
    color: var(--text);
    font-weight: 500;
}

.mini-list small {
    display: block;
    color: var(--text-faint);
    font-size: 12.5px;
}

/* ==========================================================
   6. Content: page heading, ask box, feed
   ========================================================== */
.page-head {
    margin-bottom: 16px;
}

.page-head h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--text-muted);
}

/* "Ask a question" box, like a forum's create-post bar */
.ask-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ask-box-input {
    flex: 1;
    min-width: 0;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-faint);
    font-size: 14px;
}

.ask-box-input:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.feed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.feed-head h2 {
    margin: 0;
    font-size: 16px;
}

.feed-head a {
    font-size: 14px;
    font-weight: 600;
}

.feed {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 16px;
}

/* Forms on content pages (Ask a question, etc.) */
.form-card {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-card .form-group {
    margin-bottom: 20px;
}

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

.field-hint {
    margin: -2px 0 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.field-error {
    margin: 6px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.has-error .input {
    border-color: var(--danger);
}

.optional {
    margin-left: 4px;
    color: var(--text-faint);
    font-size: 12.5px;
    font-weight: 400;
}

textarea.input {
    min-height: 160px;
    resize: vertical;
    line-height: 1.55;
}

/* Image upload: the real file input is hidden, the label acts as the button */
.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.form-group .file-drop {
    display: flex;
    margin: 0;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400 !important;
    cursor: pointer;
}

.file-drop strong {
    color: var(--primary);
}

.file-drop:hover {
    border-color: var(--primary);
}

/* Keyboard users: highlight the box when the hidden input has focus */
.file-drop:has(+ .file-input:focus-visible) {
    border-color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.image-preview:not(:empty) {
    margin-top: 10px;
}

.image-preview .field-error {
    grid-column: 1 / -1;
}

.image-preview-item {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
}

.image-preview-item img {
    display: block;
    width: 100%;
    height: 90px;
    object-fit: cover;
}

.image-preview-item figcaption {
    padding: 4px 8px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}

/* ==========================================================
   Thread page (one question and its replies)
   ========================================================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.thread {
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.thread.is-resolved {
    box-shadow: inset 3px 0 0 var(--success-solid);
}

.thread-title {
    margin: 10px 0 10px;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.thread-meta,
.reply-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13.5px;
}

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

.author-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text) !important;
    font-weight: 600;
}

.author-tag {
    padding: 0 7px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 600;
}

.thread-body {
    margin: 18px 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 15.5px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.thread-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.thread-images a {
    display: block;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
}

.thread-images img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    transition: transform 0.2s;
}

.thread-images a:hover img {
    transform: scale(1.03);
}

.thread-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.btn-danger-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-danger-ghost:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.replies-heading {
    margin: 28px 0 12px;
    font-size: 17px;
}

.reply-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.reply {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.reply:first-child {
    border-top: 0;
}

.reply.resolved {
    background: var(--success-soft);
    box-shadow: inset 3px 0 0 var(--success-solid);
}

.resolved-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
}

.reply-body {
    margin-top: 10px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.reply-actions {
    margin-top: 12px;
}

.btn-resolve {
    background: var(--surface);
    border-color: var(--success-solid);
    color: var(--success);
}

.btn-resolve:hover {
    background: var(--success-solid);
    color: #ffffff;
}

.reply-form {
    margin-top: 20px;
    scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.reply-form textarea.input {
    min-height: 120px;
}

/* Shown to staff instead of the reply form */
.staff-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--text);
    font-size: 14px;
}

.staff-note p {
    margin: 0;
}

.staff-note .icon {
    color: var(--primary);
    margin-top: 1px;
}

/* ==========================================================
   Closed (resolved) discussions and the IT Knowledge Repository
   ========================================================== */
.closed-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid var(--success-solid);
    border-radius: var(--radius);
    background: var(--success-soft);
    color: var(--success);
    font-weight: 600;
}

.closed-note p {
    margin: 0;
}

.closed-note[hidden],
.reply-form[hidden] {
    display: none;
}

.nav-group-repo .nav-link {
    font-weight: 600;
}

.rail-box-repo {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.rail-box-repo h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
}

.rail-box-repo p {
    margin-bottom: 12px;
}

/* Permanent notice at the top of the repository */
.repo-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 18px;
    border: 1px solid var(--primary);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--primary-soft);
}

.repo-notice-icon {
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 1px;
}

.repo-notice p {
    margin: 0;
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.6;
}

.repo-search {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.repo-search-box {
    flex: 1 1 280px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-faint);
}

.repo-search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.repo-search-box input {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

.repo-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.repo-result-line {
    margin: 0 0 10px;
}

.repo-card {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
}

.repo-card:first-child {
    border-top: 0;
}

.repo-card:hover {
    background: var(--surface-hover);
}

.repo-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--success);
    font-size: 12.5px;
    font-weight: 600;
}

.repo-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.repo-card-foot strong {
    color: var(--text);
}

.repo-summary {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 15.5px;
}

.repo-section-title {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.repo-text {
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.repo-solution {
    padding: 14px 16px;
    border-left: 3px solid var(--success-solid);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--success-soft);
}

.repo-entry .post-footer {
    margin-top: 18px;
}

.repo-resolution {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--success);
    font-size: 14px;
    font-weight: 600;
}

/* Staff repository pages */
.repo-dash-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.repo-dash-link:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.repo-dash-link .icon {
    color: var(--primary);
}

.repo-dash-go {
    margin-left: auto;
    color: var(--primary);
    font-weight: 600;
}

.tech-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    font-size: 14px;
}

.tech-banner p {
    margin: 0;
}

.tech-banner.is-tech {
    border-color: var(--success-solid);
    background: var(--success-soft);
}

.tech-banner.is-tech .icon {
    color: var(--success);
}

.repo-admin-title {
    margin: 0 0 4px;
    font-size: 17px;
}

.repo-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 8px 0 14px;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: 13px;
}

.repo-facts strong {
    color: var(--text);
}

.repo-state,
.repo-status {
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.repo-status {
    padding: 4px 12px;
    font-size: 13px;
}

.repo-state.published,
.repo-status.approved {
    background: var(--success-soft);
    color: var(--success);
}

.repo-state.unpublished,
.repo-status.pending {
    background: var(--primary-soft);
    color: var(--primary);
}

.repo-status.rejected {
    background: var(--danger-soft);
    color: var(--danger);
}

.repo-decision {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

.repo-decision.approved {
    background: var(--success-soft);
}

.repo-decision.rejected {
    background: var(--danger-soft);
}

.repo-decision p {
    margin: 8px 0 0;
}

.repo-decision span {
    font-weight: 600;
}

.review-replies {
    margin-top: 12px;
}

.repo-preview {
    padding: 18px 20px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.repo-preview h3 {
    margin: 10px 0 6px;
}

.repo-preview h4 {
    margin: 14px 0 4px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.repo-preview p {
    margin: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* ==========================================================
   Reply voting and reputation
   ========================================================== */
.reply-layout {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 14px;
}

.reply-main {
    min-width: 0;
}

.vote-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.vote-btn.up:hover:not(:disabled) {
    border-color: var(--success-solid);
    color: var(--success);
}

.vote-btn.down:hover:not(:disabled) {
    border-color: var(--danger);
    color: var(--danger);
}

/* The vote this student has given right now */
.vote-btn.up.active {
    background: var(--success-solid);
    border-color: var(--success-solid);
    color: #ffffff;
}

.vote-btn.down.active {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.vote-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vote-score {
    min-width: 28px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
}

.vote-score.positive {
    color: var(--success);
}

.vote-score.negative {
    color: var(--danger);
}

/* While a vote is being saved */
.vote-box.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.vote-error {
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.vote-error[hidden] {
    display: none;
}

/* "Reputation: 23 · Recently Helpful" beside a username */
.rep-info {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.rep-score strong {
    color: var(--text);
    font-weight: 700;
}

.rep-short {
    display: none;
}

.rep-status {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.rep-status.helpful {
    background: var(--success-soft);
    color: var(--success);
}

.rep-status.not-helpful {
    background: var(--danger-soft);
    color: var(--danger);
}

.rep-status.neutral {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
}

/* Reputation box on the profile */
.profile-rep {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
}

.profile-rep-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.profile-rep-number {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--success);
}

.profile-rep-score.negative .profile-rep-number {
    color: var(--danger);
}

.profile-rep-word {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.profile-rep-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    font-size: 13.5px;
    color: var(--text);
}

.profile-rep-detail span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.profile-rep-detail .muted {
    font-size: 12.5px;
}

.info-list {
    margin: 0;
}

.info-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.info-list div:first-child {
    border-top: 0;
    padding-top: 0;
}

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

.info-list dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.rail-box-highlight {
    border-color: var(--success-solid);
    background: var(--success-soft);
}

/* ==========================================================
   Reports (student report form + admin queue)
   ========================================================== */
.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    filter: brightness(0.92);
}

[data-theme="dark"] .btn-danger {
    color: #1b0d0d;
}

.reply-report {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-faint);
    font-size: 12.5px;
}

.reply-report:hover {
    color: var(--danger);
    text-decoration: none;
}

.muted {
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Quoted copy of the reported content */
.reported-preview {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-left: 3px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-alt);
    overflow-wrap: anywhere;
}

.reported-preview p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.reported-preview-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--text-faint);
    font-size: 12.5px;
    font-weight: 600;
}

.reported-gone {
    color: var(--text-faint);
    font-style: italic;
    font-size: 14px;
}

.report-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-item {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.type-badge {
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.reason-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
}

.report-by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.report-by strong {
    color: var(--text);
}

.report-head .status-badge {
    margin-left: auto;
}

.status-badge.removed {
    background: var(--danger-soft);
    color: var(--danger);
}

.status-badge.dismissed {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.report-note {
    margin: 0 0 14px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.report-note span {
    color: var(--text-muted);
    font-weight: 600;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==========================================================
   Direct messages (inbox)
   ========================================================== */
.nav-badge,
.unread-badge {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
}

.nav-badge[hidden],
.notif-count[hidden] {
    display: none;
}

.chat-error {
    margin: 0 0 6px;
    color: var(--danger);
    font-size: 13px;
}

.chat-error[hidden] {
    display: none;
}

/* Banner on a post page, e.g. "This question was just marked as resolved." */
.live-notice {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--success-soft);
    color: var(--success);
    font-size: 14px;
    font-weight: 600;
}

.live-notice[hidden] {
    display: none;
}

/* Brief highlight on something that just arrived or changed through a live update */
.just-updated {
    animation: just-updated 2.4s ease-out;
}

@keyframes just-updated {
    0%   { outline: 2px solid var(--primary); outline-offset: 2px; }
    100% { outline: 2px solid transparent; outline-offset: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    .just-updated {
        animation: none;
    }
}

/* Small banner shown when the live connection has trouble */
.live-status {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 120;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 13px;
    box-shadow: var(--shadow-pop);
}

.live-status[hidden] {
    display: none;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.inbox {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    height: calc(100vh - var(--topbar-h) - 68px);
    min-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.inbox-list {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--border);
}

.inbox-title {
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
}

.inbox-empty {
    padding: 28px 18px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.inbox-empty strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
}

.conversation-list {
    flex: 1;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
}

/* A conversation row: the chat link plus a small Delete chat button on the right */
.conversation-row {
    position: relative;
}

.conversation-delete {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.12s;
}

.conversation-delete .icon-btn {
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.conversation-delete .icon-btn:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

/* Shown when hovering the row or using the keyboard; always shown on touch screens */
.conversation-row:hover .conversation-delete,
.conversation-delete:focus-within {
    opacity: 1;
}

@media (hover: none) {
    .conversation-delete {
        opacity: 1;
    }

    .conversation-row .conversation {
        padding-right: 48px;
    }
}

.conversation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text);
}

.conversation:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.conversation.active {
    background: var(--primary-soft);
}

.conversation-text {
    flex: 1;
    min-width: 0;
}

.conversation-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.conversation-name {
    font-weight: 600;
    font-size: 14.5px;
}

.conversation-top time {
    flex-shrink: 0;
    color: var(--text-faint);
    font-size: 12px;
}

.conversation-preview {
    display: block;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.conversation.unread .conversation-preview {
    color: var(--text);
    font-weight: 600;
}

/* Right side: the chat */
.inbox-chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 14px;
}

.chat-placeholder .icon {
    margin-bottom: 8px;
    color: var(--text-faint);
}

.chat-placeholder strong {
    color: var(--text);
    font-size: 16px;
}

.chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.chat-back {
    display: none;
}

.chat-head form {
    margin: 0;
}

.chat-profile-link {
    margin-left: auto;
    font-size: 13.5px;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px;
    overflow-y: auto;
    background: var(--bg);
}

.chat-start {
    margin: auto 0 8px;
    color: var(--text-faint);
    font-size: 13px;
    text-align: center;
}

.bubble-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 75%;
}

.bubble-row.mine {
    align-self: flex-end;
    align-items: flex-end;
}

.bubble {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 16px 16px 16px 4px;
    background: var(--surface);
    overflow-wrap: anywhere;
}

.bubble-row.mine .bubble {
    border-color: var(--primary);
    border-radius: 16px 16px 4px 16px;
    background: var(--primary);
    color: var(--on-primary);
}

.bubble p {
    margin: 0;
    line-height: 1.5;
}

.bubble img {
    display: block;
    max-width: 260px;
    max-height: 260px;
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.bubble img + p,
.bubble a + p {
    margin-top: 8px;
}

.bubble-time {
    margin-top: 3px;
    color: var(--text-faint);
    font-size: 11.5px;
}

.chat-compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.chat-attach {
    flex-shrink: 0;
}

.chat-input-wrap {
    flex: 1;
    min-width: 0;
}

.chat-input {
    display: block;
    max-height: 140px;
    min-height: 40px !important;
    padding: 9px 14px;
    border-radius: 20px;
    resize: none;
}

.chat-preview {
    grid-template-columns: repeat(auto-fill, minmax(90px, 110px));
}

.chat-preview:not(:empty) {
    margin: 0 0 8px;
}

.chat-preview .image-preview-item img {
    height: 70px;
}

/* ==========================================================
   Image viewer (enlarged image with an X button)
   ========================================================== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 64px 16px 24px;
    background: rgba(8, 10, 14, 0.88);
}

.lightbox.open {
    display: flex;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.lightbox-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Stop the page behind from scrolling while the image is open */
body.lightbox-open {
    overflow: hidden;
}

a[data-lightbox] {
    cursor: zoom-in;
}

/* ==========================================================
   Meetup requests
   ========================================================== */
.meetup-with {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.meetup-hint {
    margin: -10px 0 18px;
}

.meetup-card {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.meetup-card.pending {
    box-shadow: inset 3px 0 0 var(--primary);
}

.meetup-card.accepted {
    box-shadow: inset 3px 0 0 var(--success-solid);
}

.meetup-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.meetup-status {
    margin-left: auto;
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.meetup-status.pending {
    color: var(--primary);
    border: 1px solid var(--primary);
}

.meetup-status.accepted {
    background: var(--success-soft);
    color: var(--success);
}

.meetup-status.rejected {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.meetup-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 12px;
}

.meetup-details div {
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--surface-alt);
}

.meetup-details dt {
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meetup-details dd {
    margin: 2px 0 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.meetup-message {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.meetup-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.meetup-note.accepted {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--success-soft);
    color: var(--success);
    font-weight: 600;
}

@media (max-width: 760px) {
    .meetup-details {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   Modal popup (Meetup Safety Notice)
   ========================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--overlay);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
}

.modal-title {
    margin: 0 0 12px;
    font-size: 19px;
}

.modal-body p {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.6;
}

.modal-section {
    margin: 4px 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
}

.modal-list {
    margin: 0 0 14px;
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.55;
}

.modal-list li + li {
    margin-top: 6px;
}

.modal-body p.modal-highlight {
    padding: 10px 12px;
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--primary-soft);
    color: var(--text);
    font-weight: 600;
}

.modal-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-check input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.btn:disabled,
.btn:disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--primary);
}

/* Page heading with a button on the right */
.page-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==========================================================
   Profile page
   ========================================================== */
.profile-card {
    display: flex;
    gap: 20px;
    padding: 24px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-info h1 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 6px;
    font-size: 22px;
}

.profile-bio {
    margin: 0 0 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

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

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-stats strong {
    color: var(--text);
}

.stat-help {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--success);
}

.stat-help strong {
    color: var(--success);
}

.bio-edit summary {
    list-style: none;
    cursor: pointer;
}

.bio-edit summary::-webkit-details-marker {
    display: none;
}

.bio-edit[open] summary {
    display: none;
}

.bio-edit form {
    max-width: 520px;
}

.bio-edit textarea.input {
    min-height: 90px;
    margin-bottom: 8px;
}

/* Hidden visually, still read by screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Open / Resolved tabs */
.tabs-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.tabs {
    display: flex;
    gap: 4px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 600;
}

.tab:hover {
    color: var(--text);
    text-decoration: none;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-count {
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.tab.active .tab-count {
    background: var(--primary-soft);
    color: var(--primary);
}

.sort-label {
    padding-bottom: 10px;
    color: var(--text-faint);
    font-size: 13px;
}

/* Filter bar above the feed */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.input-sm {
    width: auto;
    padding: 7px 10px;
    font-size: 14px;
}

.filter-bar select.input-sm {
    flex: 0 1 180px;
}

.filter-bar input.input-sm {
    flex: 1 1 160px;
}

.btn-sm {
    padding: 7px 16px;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
}

.filter-pill:hover {
    border-color: var(--danger);
    color: var(--danger);
    text-decoration: none;
}

.clear-filters {
    font-size: 13px;
    font-weight: 600;
}

/* Popular tags in the right column */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-count {
    margin-left: 6px;
    color: var(--text-faint);
    font-size: 11.5px;
}

.chip-active {
    background: var(--primary);
    color: var(--on-primary);
}

.chip-active .chip-count {
    color: inherit;
    opacity: 0.8;
}

/* ==========================================================
   7. Post card (question in a feed)
   ========================================================== */
.post-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 16px;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}

.post-card:first-child {
    border-top: 0;
}

.post-card:hover {
    background: var(--surface-hover);
}

.post-card.is-resolved {
    box-shadow: inset 3px 0 0 var(--success-solid);
}

/* Reply count box on the left */
.post-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    height: 58px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-muted);
}

.post-stat-count {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.post-stat-label {
    font-size: 11.5px;
}

.post-stat.resolved {
    background: var(--success-solid);
    border-color: var(--success-solid);
    color: #ffffff;
}

.post-stat.resolved .post-stat-count {
    color: #ffffff;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.post-category {
    color: var(--text);
    font-weight: 600;
}

.post-author {
    color: var(--text-muted);
    font-weight: 500;
}

.post-meta .status-badge {
    margin-left: auto;
}

.post-title {
    margin: 6px 0 4px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--primary);
    text-decoration: none;
}

.post-excerpt {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.post-images-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    color: var(--text-faint);
    font-size: 13px;
}

/* On mobile the reply count moves into this inline link */
.post-replies-inline {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==========================================================
   8. Login page
   ========================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-page .theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.login-card .brand {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    font-size: 24px;
}

.login-card .brand-logo {
    width: 48px;
    height: 48px;
}

.login-card h1 {
    margin: 0 0 4px;
    font-size: 20px;
}

.login-card .subtitle {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.login-card .btn {
    padding: 11px 18px;
    border-radius: var(--radius);
}

.login-hint {
    margin: 20px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* ==========================================================
   9. Responsive
   ========================================================== */

/* Medium screens: the right rail drops below the feed */
@media (max-width: 1100px) {
    .layout,
    .layout:not(:has(.rail)) {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .rail {
        grid-column: 2;
        position: static;
    }

    .user-menu-name {
        display: none;
    }
}

/* Phones and small tablets: sidebar becomes a slide-out menu */
@media (max-width: 760px) {
    .topbar {
        gap: 8px;
        padding: 0 10px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar-search {
        display: none;
    }

    .btn-ask span {
        display: none;
    }

    .btn-ask {
        width: 38px;
        height: 38px;
        padding: 0;
    }

    /* Smaller logo, name and buttons so everything fits in the phone top bar */
    .topbar .brand {
        gap: 6px;
        font-size: 18px;
    }

    .topbar .brand-logo {
        width: 28px;
        height: 28px;
    }

    .topbar-actions {
        gap: 2px;
    }

    .topbar .icon-btn,
    .btn-ask {
        width: 34px;
        height: 34px;
    }

    /* On phones the notification panel spans the screen width under the top bar */
    .notif-dropdown {
        position: static;
    }

    .notif-panel {
        position: fixed;
        top: calc(var(--topbar-h) + 4px);
        left: 8px;
        right: 8px;
        width: auto;
    }

    .user-menu-btn {
        padding-right: 4px;
    }

    .user-menu-btn > .icon {
        display: none;
    }

    .layout,
    .layout:not(:has(.rail)) {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px 12px 40px;
    }

    .rail {
        grid-column: 1;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: 270px;
        padding: 56px 12px 20px;
        overflow-y: auto;
        background: var(--surface);
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar-close {
        display: inline-flex;
        position: absolute;
        top: 10px;
        right: 10px;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    body.menu-open .menu-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: var(--overlay);
    }

    /* Search moves into the slide-out menu */
    .sidebar-search {
        display: flex;
    }

    .post-card {
        grid-template-columns: minmax(0, 1fr);
        padding: 14px;
    }

    .sort-label {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-card {
        padding: 16px;
    }

    .thread {
        padding: 16px;
    }

    .profile-card {
        flex-direction: column;
        gap: 12px;
        padding: 18px;
    }

    /* Inbox: show either the list or the open chat, not both */
    .layout:has(.inbox) {
        padding-bottom: 16px;
    }

    .inbox {
        grid-template-columns: minmax(0, 1fr);
        height: calc(100vh - var(--topbar-h) - 32px);
        height: calc(100dvh - var(--topbar-h) - 32px);
    }

    .inbox.has-chat .inbox-list,
    .inbox:not(.has-chat) .inbox-chat {
        display: none;
    }

    .inbox-list {
        border-right: 0;
    }

    .chat-back {
        display: inline-flex;
        margin-left: -6px;
    }

    .bubble-row {
        max-width: 85%;
    }

    .bubble img {
        max-width: 200px;
    }

    .thread-title {
        font-size: 20px;
    }

    .reply {
        padding: 14px 16px;
    }

    /* Narrower vote column and shorter reputation text on phones */
    .reply-layout {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
    }

    .vote-btn {
        width: 30px;
        height: 30px;
    }

    .rep-label {
        display: none;
    }

    .rep-short {
        display: inline;
    }

    .tab {
        padding: 10px 10px;
    }

    .filter-bar select.input-sm {
        flex: 1 1 140px;
    }

    .post-stat {
        display: none;
    }

    .post-replies-inline {
        display: inline-flex;
    }

    .post-meta .status-badge {
        margin-left: 0;
    }

    .login-card {
        padding: 28px 20px;
    }
}
