/* ==========================================================================
   AI Herning – medlemsområde (Feed, Medlemmer, Viden, Arrangementer)
   Matcher Pencil-designet (aiHerning.pen). Alle regler er scoped til .app-shell.
   ========================================================================== */

.app-shell {
    --content-max: 1340px;
    --blue: #2457ff;
    --blue-hover: #1747e5;
    --blue-08: rgba(36, 87, 255, .08);
    --blue-tint: rgba(36, 87, 255, .07);
    --cyan: #00cfff;
    --teal: #00a8c7;
    --success: #1f9d57;
    --success-tint: rgba(31, 157, 87, .1);
    --danger: #d64545;
    --danger-tint: rgba(214, 69, 69, .09);
    --bg: #f7f9fc;
    --card: #fff;
    --surface: #eef3f8;
    --border: #dce4ee;
    --border-card: #e0e0e0;
    --text: #081426;
    --text-2: #44546a;
    --muted: #718096;
    --font-head: "Funnel Sans", Inter, ui-sans-serif, system-ui, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

    min-height: 100vh;
    display: flex;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.app-shell a {
    text-decoration: none;
    color: inherit;
}

/* ---- Sidebar ------------------------------------------------------------ */
.app-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 220px;
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-right: 1px solid var(--border);
}

.app-sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 24px 16px 16px;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 8px 8px;
}

.app-nav-label {
    padding: 12px 12px 4px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    transition: background-color .14s ease, color .14s ease;
}

.app-nav a:hover {
    background: var(--surface);
}

.app-nav a.active {
    background: var(--blue-08);
    color: var(--blue);
}

.app-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.app-sidebar-spacer {
    flex: 1;
}

.app-profile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    color: inherit;
}

a.app-profile:hover {
    background: var(--surface);
}

.app-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.app-profile-link:hover {
    background: var(--surface);
}

.app-profile-link > div {
    min-width: 0;
    flex: 1;
}

.app-profile-link:hover .app-profile-name {
    color: var(--blue);
}

.app-profile-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--blue-tint);
    color: var(--blue);
}

.app-profile-name {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.app-profile-role {
    color: var(--text-2);
    font-size: 10px;
}

.app-profile > div {
    min-width: 0;
    flex: 1;
}

.app-logout {
    margin: 0;
}

.app-logout button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}

.app-logout button:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
    color: var(--danger);
}

.app-logout-icon {
    flex-shrink: 0;
}

/* ---- Main + topbar ------------------------------------------------------ */
.app-main {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.app-topbar h1 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 400;
    letter-spacing: 0;
}

.app-topbar-spacer {
    flex: 1;
}

.app-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
}

.app-search svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--muted);
}

.app-search input {
    width: 210px;
    max-width: 40vw;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.app-search input::placeholder {
    color: var(--muted);
}

.app-btn-primary,
.app-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, transform .14s ease;
}

.app-btn-primary {
    background: var(--blue);
    color: #fff;
}

.app-btn-primary:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}

.app-btn-secondary {
    background: var(--card);
    border-color: var(--border);
    color: var(--text-2);
}

.app-btn-secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.app-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.app-btn-danger:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
}

.app-btn-primary:disabled,
.app-btn-secondary:disabled,
.app-btn-danger:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.app-btn-primary svg,
.app-btn-secondary svg,
.app-btn-danger svg {
    width: 15px;
    height: 15px;
}

.app-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.app-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding: 28px;
}

/* ---- Shared card + chips ------------------------------------------------ */
.app-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(36, 87, 255, .06);
    color: var(--blue);
    font-size: 12px;
    font-weight: 500;
}

.app-avatar {
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(36, 87, 255, .07);
    color: var(--blue);
    flex-shrink: 0;
}

/* ==========================================================================
   FEED
   ========================================================================== */
.feed-area {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: flex-start;
}

.feed-column {
    width: 100%;
    max-width: 680px;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- Dashboard side columns (desktop only) ------------------------------ */
.feed-aside {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 28px;
}

.feed-aside-right {
    width: 300px;
}

.profile-widget {
    padding: 0;
    overflow: hidden;
}

.profile-widget-cover {
    height: 52px;
    background: linear-gradient(105deg, var(--blue), var(--cyan));
}

.profile-widget-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px 18px;
}

.profile-widget-avatar {
    width: 56px;
    height: 56px;
    margin-top: -28px;
    margin-bottom: 10px;
    border-radius: 50%;
    border: 3px solid var(--card);
    background: #eaf0ff;
}

.profile-widget-name {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.profile-widget-role {
    margin-top: 3px;
    color: var(--text-2);
    font-size: 12px;
}

.profile-widget-divider {
    width: 100%;
    height: 1px;
    margin: 14px 0;
    background: var(--border);
}

.profile-widget-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    width: 100%;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.profile-stat-val {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 600;
}

.profile-stat-lbl {
    color: var(--muted);
    font-size: 10px;
}

.widget {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.widget-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
}

.widget-title {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
}

.widget-action {
    margin-left: auto;
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}

.widget-action:hover {
    text-decoration: underline;
}

.widget-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 16px 14px;
}

.widget-empty {
    color: var(--muted);
    font-size: 12px;
}

.event-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.date-badge.date-badge-sm {
    width: 44px;
    height: 44px;
}

.date-badge.date-badge-sm .day {
    font-size: 17px;
}

.event-mini-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.event-mini-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.event-mini-meta {
    color: var(--muted);
    font-size: 11px;
}

.member-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-mini-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.member-mini-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.member-mini-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.member-mini-role {
    color: var(--muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-tags {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-btn {
    gap: 6px;
    border: 1px solid rgba(36, 87, 255, .2);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.chip-btn:hover {
    border-color: var(--blue);
}

.chip-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.chip-count {
    opacity: .6;
    font-weight: 600;
}

.topic-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-chip {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.topic-chip:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.topic-chip.active {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

.compose-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.compose-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compose-symbol {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
}

.compose-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.compose-input::placeholder {
    color: var(--muted);
}

.compose-actions {
    display: flex;
    justify-content: flex-end;
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border-color: var(--border-card);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-author-avatar {
    width: 36px;
    height: 36px;
}

.post-author-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.post-author-title {
    color: var(--muted);
    font-size: 12px;
}

.post-body {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.55;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-actions {
    display: flex;
    gap: 22px;
    padding-top: 2px;
}

.post-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    padding: 0;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.post-action svg {
    width: 15px;
    height: 15px;
}

.post-action:hover {
    color: var(--blue);
}

.post-owner-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: none;
    padding: 0;
    color: var(--muted);
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease;
}

.post-icon-btn:hover {
    background: var(--card-hover, rgba(0, 0, 0, .05));
    color: var(--blue);
}

.post-icon-btn-danger:hover {
    color: var(--danger);
}

.post-icon-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.post-edit {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-edit-input {
    resize: vertical;
    min-height: 64px;
    font: inherit;
    font-size: 13px;
    line-height: 1.55;
}

.post-edit-actions {
    display: flex;
    gap: 8px;
}

.post-confirm-delete {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--danger);
    border-radius: 8px;
    background: var(--danger-tint);
    color: var(--text-2);
    font-size: 13px;
}

/* ==========================================================================
   MEDLEMMER
   ========================================================================== */
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    /* Chips overflower vandret på smalle skærme => vandret scroll i stedet for
       at sprænge sidebredden. */
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-label {
    flex-shrink: 0;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.chip-button {
    flex-shrink: 0;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}

.chip-button:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.chip-button.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ---- Sammenklappeligt filter: chips på desktop, dropdown på mobil -------- */
/* Bruges på Viden (single-select) og Medlemmer (multiselect). På mobil ligger
   dropdownen i den hvide topbar (.topbar-filter), og chip-rækken
   (.filter-row-desktop) skjules, så filtrene ikke løber ud af siden. */
.filter-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .14s ease;
}

.filter-dropdown-toggle:hover {
    border-color: var(--blue);
}

.filter-dropdown-caret {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform .16s ease;
}

.filter-dropdown.open .filter-dropdown-caret {
    transform: rotate(180deg);
}

.filter-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    border: 0;
    background: transparent;
    cursor: default;
}

.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 20;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 12px 28px rgba(8, 20, 38, .16);
}

.filter-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease;
}

.filter-dropdown-option:hover {
    background: var(--surface);
}

.filter-dropdown-option.active {
    color: var(--blue);
    font-weight: 600;
}

.filter-check {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--card);
    color: transparent;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.filter-dropdown-option.active .filter-check {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

/* ---- Filter-dropdown i topbar på mobil (Viden + Medlemmer) -------------- */
/* Dropdownen ligger i den hvide topbar og fylder en hel række under
   titel/søgning. Chip-rækken vises kun på desktop. */
.topbar-filter {
    display: none;
    position: relative;
}

@media (max-width: 640px) {
    .app-topbar .topbar-filter {
        display: block;
        order: 4;
        flex: 1 1 100%;
    }

    .filter-row-desktop {
        display: none;
    }
}

/* Elementer der kun giver mening på desktop (fx knapper der er dækket af den
   nederste mobil-tab-bar). */
@media (max-width: 900px) {
    .app-desktop-only {
        display: none;
    }
}

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

.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px 20px;
    text-align: center;
    border-color: var(--border-card);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.member-card:hover {
    border-color: var(--blue);
    box-shadow: 0 6px 20px rgba(8, 20, 38, .08);
    transform: translateY(-2px);
}

.member-card .app-avatar {
    width: 52px;
    height: 52px;
    margin-bottom: 8px;
}

.member-avatar-img {
    object-fit: cover;
    border-radius: 26px;
}

.member-name {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.member-role {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.member-card-cta {
    margin-top: auto;
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
}

.member-card .app-btn-primary {
    width: 100%;
    justify-content: center;
}

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

.resource-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border-color: var(--border-card);
}

.type-tag {
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(36, 87, 255, .05);
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
}

.resource-title {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.25;
}

.resource-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
}

.resource-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 4px;
}

.read-btn {
    margin-left: auto;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .14s ease, color .14s ease;
}

.read-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* ==========================================================================
   ARRANGEMENTER
   ========================================================================== */
.events-area {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.events-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.events-side {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.event-card {
    display: flex;
    gap: 16px;
    padding: 18px;
    border-color: var(--border-card);
}

.date-badge {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
}

.date-badge .month {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    opacity: .85;
}

.date-badge .day {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.event-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.event-title {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 500;
}

.event-tag {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(36, 87, 255, .06);
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
}

.event-info {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.event-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
}

.event-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.event-spots {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

.event-footer .app-btn-primary {
    margin-left: auto;
}

.past-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
}

.past-date {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.past-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.past-card .read-btn {
    align-self: flex-start;
    margin-top: 4px;
}

/* ==========================================================================
   ADMIN – ADGANGSANMODNINGER
   ========================================================================== */
.admin-area {
    max-width: 820px;
}

.admin-area-full {
    max-width: none;
}

.admin-lead {
    margin: 0 0 20px;
    color: var(--text-2);
    font-size: 13px;
}

.admin-alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.admin-alert-success {
    background: var(--success-tint);
    border-color: rgba(31, 157, 87, .25);
    color: var(--success);
}

.admin-alert-error {
    background: var(--danger-tint);
    border-color: rgba(214, 69, 69, .25);
    color: var(--danger);
}

.admin-empty {
    padding: 32px 20px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ---- Toolbar: filtre + visningsskift ------------------------------------ */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-toolbar-spacer {
    flex: 1;
    min-width: 0;
}

.seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 8px;
    background: var(--surface);
}

.seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.seg-btn:hover {
    color: var(--text);
}

.seg-btn.active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(8, 20, 38, .1);
}

.seg-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.seg-btn.active svg {
    color: var(--blue);
}

.seg-count {
    color: var(--muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.seg-btn.active .seg-count {
    color: var(--blue);
}

.request-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.request-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    border-color: var(--border-card);
}

.request-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.request-avatar {
    width: 40px;
    height: 40px;
}

.request-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.request-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.request-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.request-name {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.request-email {
    color: var(--muted);
    font-size: 12px;
}

.request-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin: 12px 0 0;
}

.request-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
}

.request-meta-item dt {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.request-meta-item dd {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.request-meta-item dd a {
    color: var(--blue);
    font-weight: 600;
}

.request-meta-item dd a:hover {
    text-decoration: underline;
}

.request-message {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
}

.request-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.request-actions .app-btn-primary,
.request-actions .app-btn-danger {
    justify-content: center;
    min-width: 104px;
}

@media (max-width: 640px) {
    .request-card {
        flex-direction: column;
        gap: 16px;
    }

    .request-actions {
        flex-direction: row;
        width: 100%;
    }

    .request-actions .app-btn-primary,
    .request-actions .app-btn-danger {
        flex: 1;
    }
}

/* ==========================================================================
   ADMIN – BRUGERE (tabel)
   ========================================================================== */
.admin-table-card {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table thead th {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table tbody tr:hover {
    background: var(--blue-tint);
}

.admin-table-actions-col {
    text-align: right;
    white-space: nowrap;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

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

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-avatar {
    width: 36px;
    height: 36px;
}

.admin-user-info {
    min-width: 0;
}

.admin-user-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.admin-user-email {
    color: var(--muted);
    font-size: 12px;
}

.admin-role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

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

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

.status-badge-pending {
    background: rgba(36, 87, 255, .08);
    color: var(--blue);
}

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

/* ==========================================================================
   ADMIN – INDSTILLINGER (settings-formularer)
   ========================================================================== */
.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    border-color: var(--border-card);
}

.settings-card-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-card-title {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 500;
}

.settings-card-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-label {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    transition: border-color .14s ease, box-shadow .14s ease;
}

.form-input::placeholder {
    color: var(--muted);
}

.form-input:focus {
    outline: 0;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-08);
}

.form-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: 10px;
}

/* ---- Min profil --------------------------------------------------------- */
.profile-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 36px;
    flex-shrink: 0;
}

.profile-identity {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-name {
    color: var(--text);
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 400;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--success-tint);
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
}

.profile-badge svg {
    width: 14px;
    height: 14px;
}

.profile-email {
    color: var(--text-2);
    font-size: 13px;
}

.profile-meta {
    color: var(--muted);
    font-size: 12px;
}

.profile-textarea {
    min-height: 96px;
    resize: vertical;
}

/* ---- Profilbillede-upload (Min profil) ---------------------------------- */
.profile-avatar-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.profile-avatar-img {
    object-fit: cover;
}

.profile-avatar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-avatar-upload {
    position: relative;
    overflow: hidden;
}

.profile-avatar-upload input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.profile-avatar-upload.is-disabled {
    opacity: .55;
    pointer-events: none;
}

.profile-avatar-remove {
    border: 0;
    background: transparent;
    padding: 6px 4px;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.profile-avatar-remove:hover:not(:disabled) {
    color: var(--danger);
}

.profile-avatar-remove:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ---- Medlemsprofil (offentlig visning) ---------------------------------- */
.app-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 8px;
    border-radius: 6px;
    background: var(--surface, rgba(36, 87, 255, .07));
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color .14s ease, background-color .14s ease;
}

.app-back-link:hover {
    color: var(--blue);
}

.app-back-arrow {
    font-size: 16px;
    line-height: 1;
}

.profile-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-view-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    flex-wrap: wrap;
}

.profile-view-avatar {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-view-avatar-fallback {
    display: grid;
    place-items: center;
}

.profile-view-identity {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.profile-view-name {
    margin: 0;
    color: var(--text);
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 400;
}

.profile-view-subtitle {
    color: var(--text-2);
    font-size: 14px;
}

.profile-view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.chip-static {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--blue-tint);
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
}

.profile-view-actions {
    display: flex;
    gap: 10px;
}

.profile-view-actions .app-btn-primary {
    text-decoration: none;
}

.profile-view-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

.profile-view-section {
    padding: 24px;
}

.profile-view-section-title {
    margin: 0 0 12px;
    color: var(--text);
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 400;
}

.profile-view-bio {
    margin: 0;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-line;
}

.profile-view-empty {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.profile-detail-list {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.profile-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-top: 1px solid var(--border-card);
}

.profile-detail-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.profile-detail-row dt {
    color: var(--muted);
    font-size: 13px;
}

.profile-detail-row dd {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

@media (max-width: 900px) {
    .profile-view-grid {
        grid-template-columns: 1fr;
    }

    .profile-view-hero {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .profile-view-identity {
        align-items: center;
    }
}

/* ---- Toggle-switches ---------------------------------------------------- */
.settings-toggles {
    display: flex;
    flex-direction: column;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.toggle-row + .toggle-row {
    border-top: 1px solid var(--border);
}

.toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--border);
    transition: background-color .16s ease;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(8, 20, 38, .2);
    transition: transform .16s ease;
}

.toggle-input:checked + .toggle-switch {
    background: var(--blue);
}

.toggle-input:checked + .toggle-switch::after {
    transform: translateX(18px);
}

.toggle-input:focus-visible + .toggle-switch {
    box-shadow: 0 0 0 3px var(--blue-08);
}

.toggle-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

/* ---- Allowlist ---------------------------------------------------------- */
.settings-subtitle {
    margin: 0;
    color: var(--text);
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
}

.allowlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.allowlist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.allowlist-email {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.allowlist-row .app-btn-danger {
    margin-left: auto;
}

.allowlist-add {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.allowlist-add .form-field {
    flex: 1;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* Drop the right dashboard column first, then the left, as width shrinks.
   Below 900px the sidebar is gone and only the feed remains (mobile). */
@media (max-width: 1200px) {
    .feed-aside-right {
        display: none;
    }
}

@media (max-width: 1000px) {
    .feed-aside-left {
        display: none;
    }
}

@media (max-width: 1100px) {
    .member-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Bottom tab bar (mobile PWA navigation) ----------------------------- */
.app-tabbar {
    display: none;
}

.app-mobile-only {
    display: none;
}

@media (max-width: 900px) {
    /* Skjul desktop-sidebaren; navigation flyttes til den nederste tab-bar. */
    .app-sidebar {
        display: none;
    }

    .app-shell {
        display: block;
    }

    /* Flydende, kapselformet tab-bar der matcher Pencil-designet. */
    .app-tabbar {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 50;
        display: flex;
        gap: 2px;
        height: 64px;
        padding: 6px;
        border-radius: 32px;
        background: rgba(255, 255, 255, .9);
        border: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(8, 20, 38, .12);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    .app-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border-radius: 26px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 500;
        text-decoration: none;
        transition: background-color .14s ease, color .14s ease;
    }

    .app-tab-icon {
        width: 22px;
        height: 22px;
    }

    .app-tab.active {
        background: var(--blue-08);
        color: var(--blue);
        font-weight: 600;
    }

    /* Vis admin-genveje på profilsiden, når sidebaren er skjult. */
    .app-mobile-only {
        display: block;
    }

    /* Giv plads til den flydende tab-bar under indholdet. */
    .app-content {
        padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .app-topbar {
        flex-wrap: wrap;
    }

    .app-topbar .app-search {
        flex: 1 1 100%;
        order: 3;
    }

    .app-search input {
        width: 100%;
        max-width: none;
    }

    .feed-area,
    .events-area {
        flex-direction: column;
    }

    .feed-column,
    .events-side {
        width: 100%;
    }

    .member-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .app-content {
        padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    }

    .app-topbar {
        padding: 14px 18px;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

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

    .allowlist-add {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ==========================================================================
   FEED – interaktive tilføjelser (reaktioner, kommentarer, tomme tilstande)
   ========================================================================== */
.post-action.active {
    color: var(--blue);
    font-weight: 600;
}

.post-time {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.comment-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.comment-empty {
    color: var(--muted);
    font-size: 13px;
}

.comment-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.comment-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.comment-time {
    color: var(--muted);
    font-size: 11px;
}

.comment-body {
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.45;
}

.comment-compose {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comment-compose .form-input {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   ADMIN-GENVEJE PÅ PROFIL (kun mobil – erstatter sidebarens admin-sektion)
   ========================================================================== */
.admin-quicklinks-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-quicklinks-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .14s ease, color .14s ease;
}

.admin-quicklinks-nav a:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.admin-quicklinks-nav svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--blue);
}

.profile-logout {
    margin: 0;
}

.profile-logout button {
    width: 100%;
    justify-content: center;
}
