.research-group-public-page {
    overflow-x: clip;
}
.research-group-public-page .group-dashboard {
    padding-top: 0 !important;
}
.research-group-public-page .group-dashboard-toolbar {
    margin-top: 0.75rem;
    margin-bottom: 1.25rem;
}
.group-dashboard:not(.is-editing) .group-dashboard-grid > .group-dashboard-module:first-child:not(.is-full-bleed) {
    margin-top: 1.25rem;
}

/* Keep breakpoints in sync with research-group-dashboard.js. Use normal grid
   flow: content determines row height, so modules can never collide. */
.group-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.group-dashboard-module {
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--bs-body-bg);
    box-shadow: 0 .25rem 1rem rgba(7, 38, 49, .04);
    overflow-wrap: anywhere;
    container-type: inline-size;
}

.group-dashboard-module-body { min-width: 0; }
.group-dashboard-module[data-module-height],
.group-dashboard-module[style*="--module-height"] {
    height: var(--module-height);
    display: flex;
    flex-direction: column;
}
.group-dashboard-module[data-module-height] .group-dashboard-module-body,
.group-dashboard-module[style*="--module-height"] .group-dashboard-module-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--research-group-accent, #0c6a80) 40%, transparent) transparent;
}
.group-dashboard-grid.is-page-scrolling .group-dashboard-module-body {
    pointer-events: none;
}
.group-dashboard-module[data-module-height] .group-dashboard-module-body::-webkit-scrollbar,
.group-dashboard-module[style*="--module-height"] .group-dashboard-module-body::-webkit-scrollbar {
    width: 6px;
}
.group-dashboard-module[data-module-height] .group-dashboard-module-body::-webkit-scrollbar-thumb,
.group-dashboard-module[style*="--module-height"] .group-dashboard-module-body::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--research-group-accent, #0c6a80) 40%, transparent);
    border-radius: 4px;
}
.group-dashboard-module[data-module-height] .group-dashboard-module-body > :is(.card, .research-group-post-feed, .research-group-hero),
.group-dashboard-module[style*="--module-height"] .group-dashboard-module-body > :is(.card, .research-group-post-feed, .research-group-hero) {
    min-height: 100%;
}
.group-dashboard-module[data-module-height] .group-dashboard-module-tools,
.group-dashboard-module[style*="--module-height"] .group-dashboard-module-tools {
    flex: 0 0 auto;
}
.group-dashboard-module .d-grid { grid-template-columns: minmax(0, 1fr); }
.group-dashboard-module-body > .card {
    border-radius: 1.1rem;
    box-shadow: none !important;
}
.group-dashboard .research-group-member-card { position: static; }
.group-dashboard .research-group-member-list { max-height: none; overflow: visible; }
.group-dashboard-module .card-body { padding: 1.25rem !important; }
.group-dashboard-module .research-group-post-card .card-body { padding: 0 !important; }
.group-dashboard .research-group-post-feed { max-width: none; margin: 0 !important; padding: 1.25rem; }
.group-dashboard .research-group-member { flex-wrap: wrap; }
.group-dashboard .research-group-member > .min-w-0 { flex-basis: 6rem; }
.group-dashboard .research-group-member > .badge { max-width: 100%; white-space: normal; }
.group-dashboard .research-group-publication-item > div,
.group-dashboard .research-group-post-document > span { min-width: 0; }
.group-dashboard .research-group-post-document { min-width: 0; }
.group-dashboard .research-group-post-document > span { flex: 1 1 0; }
.group-dashboard .research-group-publication-list { grid-template-columns: minmax(0, 1fr); }
.group-dashboard .research-group-publication-item { min-width: 0; }
.group-dashboard .research-group-publication-tabs .nav-link { text-align: start; }
.group-dashboard .research-group-graph-legend > span { min-width: 0; }
.group-dashboard .research-group-graph-legend .ms-lg-auto { margin-left: 0 !important; }
.group-dashboard .pagination { flex-wrap: wrap; gap: .25rem; }
.group-dashboard-module :is(img, video, canvas, iframe) { max-width: 100%; }
.group-dashboard-module :is(input, select, textarea) { min-width: 0; max-width: 100%; }
.group-dashboard-module .research-group-post-text table { table-layout: fixed; }
.group-dashboard-module .research-group-post-text :is(td, th) { min-width: 0; }

.group-dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: var(--bs-body-bg);
}
.group-dashboard [hidden] { display: none !important; }
.group-dashboard-toolbar-copy { flex: 1 1 20rem; min-width: 0; }
.group-dashboard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.group-dashboard-breakpoint {
    padding: .4rem .7rem;
    border-radius: 2rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--research-group-accent);
    background: var(--bs-tertiary-bg);
}
.group-dashboard-status { margin: .5rem 0 1rem; min-height: 1.25rem; }
.group-dashboard-status:empty { display: none; margin: 0; min-height: 0; }
.group-dashboard-module-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .65rem;
    border-bottom: 1px dashed var(--bs-border-color);
    border-radius: 1.1rem 1.1rem 0 0;
    background: var(--bs-tertiary-bg);
}
.group-dashboard-module-name { flex: 1 1 5rem; min-width: 0; font-size: .8rem; font-weight: 600; }
.group-dashboard-icon-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}
.group-dashboard-icon-button:disabled { opacity: .35; }
.group-dashboard-icon-button:hover:not(:disabled) { color: var(--research-group-accent); border-color: currentColor; }
.group-dashboard-icon-button:focus-visible,
.group-dashboard-width select:focus-visible { outline: 3px solid var(--research-group-accent); outline-offset: 2px; }
.group-dashboard-drag { cursor: grab; touch-action: none; }
.group-dashboard-resize { cursor: ew-resize; touch-action: none; }
.group-dashboard-width { display: flex; align-items: center; gap: .35rem; font-size: .75rem; margin: 0; }
.group-dashboard-width select {
    min-height: 2.75rem;
    padding: .35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}
.group-dashboard.is-editing .group-dashboard-module { border-color: var(--research-group-accent); }
.group-dashboard-module.is-dragging { opacity: .65; }
.group-dashboard-module.is-resizing,
.group-dashboard-module.is-resizing-height { outline: 2px solid var(--research-group-accent); }
.group-dashboard-module.drop-before { box-shadow: 0 -5px 0 var(--research-group-gold); }
.group-dashboard-module.drop-after { box-shadow: 0 5px 0 var(--research-group-gold); }
.group-dashboard.is-interacting { user-select: none; }

/* Height controls */
.group-dashboard-height {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.group-dashboard-height-btn {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    min-height: 2.75rem;
    padding: .35rem .65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: .75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.group-dashboard-height-btn:hover {
    color: var(--research-group-accent);
    border-color: currentColor;
}
.group-dashboard-height-btn:focus-visible {
    outline: 3px solid var(--research-group-accent);
    outline-offset: 2px;
}
.group-dashboard-height-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1050;
    min-width: 9.5rem;
    padding: .35rem 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .12);
}
.group-dashboard-height-menu[hidden] {
    display: none !important;
}
.group-dashboard-height-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .4rem .85rem;
    border: 0;
    background: transparent;
    color: var(--bs-body-color);
    font-size: .8rem;
    text-align: start;
    cursor: pointer;
}
.group-dashboard-height-item:hover,
.group-dashboard-height-item:focus-visible {
    background: var(--bs-tertiary-bg);
    color: var(--research-group-accent);
    outline: none;
}
.group-dashboard-height-item.is-active {
    font-weight: 600;
    color: var(--research-group-accent);
    background: color-mix(in srgb, var(--research-group-accent) 8%, var(--bs-body-bg));
}
.group-dashboard-height-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16px;
    flex: 0 0 16px;
    cursor: ns-resize;
    touch-action: none;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-top: 1px dashed var(--bs-border-color);
    border-radius: 0 0 1.1rem 1.1rem;
    font-size: .75rem;
    opacity: .75;
    transition: opacity .15s, background-color .15s, color .15s;
}
.group-dashboard-height-handle:hover,
.group-dashboard-height-handle:focus-visible {
    opacity: 1;
    background: color-mix(in srgb, var(--research-group-accent) 15%, var(--bs-tertiary-bg));
    color: var(--research-group-accent);
}

/* Theme customization bar in toolbar */
.group-dashboard-theme-bar {
    width: 100%;
    padding-top: .85rem;
    margin-top: .25rem;
    border-top: 1px solid var(--bs-border-color);
}
.group-dashboard-color-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    font-size: .8rem;
    font-weight: 500;
}
.group-dashboard-color-input {
    width: 2.25rem;
    height: 2.25rem;
    padding: .15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    cursor: pointer;
}
.group-dashboard-color-input:focus-visible {
    outline: 3px solid var(--research-group-accent);
    outline-offset: 2px;
}
.group-dashboard-palettes {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.group-dashboard-palette-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: transform .12s, border-color .12s;
}
.group-dashboard-palette-btn:hover,
.group-dashboard-palette-btn:focus-visible {
    transform: scale(1.15);
    border-color: var(--research-group-accent);
    outline: none;
}
.group-dashboard-palette-btn .palette-swatch {
    width: 11px;
    height: 18px;
    display: inline-block;
}
.group-dashboard-palette-btn .palette-swatch:first-child {
    border-radius: 999px 0 0 999px;
}
.group-dashboard-palette-btn .palette-swatch:last-child {
    border-radius: 0 999px 999px 0;
}

/* Page-wide theme color enhancement for hero and buttons */
.research-group-public-page .research-group-hero {
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 255, 255, .18), transparent 28%),
        linear-gradient(125deg, color-mix(in srgb, var(--research-group-accent) 70%, #000), var(--research-group-accent) 68%, color-mix(in srgb, var(--research-group-gold) 75%, #000));
}

/* Hero module inside dashboard */
.group-dashboard-module[data-module-id="hero"] {
    background: transparent;
    border: none;
    box-shadow: none;
}
.group-dashboard-module[data-module-id="hero"] .research-group-hero {
    border-radius: 1.1rem;
}
.group-dashboard.is-editing .group-dashboard-module[data-module-id="hero"] {
    border: 1px solid var(--research-group-accent, var(--bs-border-color));
    background: var(--bs-body-bg);
    box-shadow: 0 .25rem 1rem rgba(7, 38, 49, .04);
}
@container (max-width: 820px) {
    .group-dashboard-module[data-module-id="hero"] .row > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    .group-dashboard-module[data-module-id="hero"] .display-5 {
        font-size: clamp(1.5rem, 3.5cqi, 2.25rem) !important;
    }
}
@container (max-width: 520px) {
    .group-dashboard-module[data-module-id="hero"] .research-group-hero {
        padding: 1.25rem !important;
    }
    .group-dashboard-module[data-module-id="hero"] .lead {
        font-size: 1rem !important;
    }
}
.research-group-public-page .btn-primary {
    --bs-btn-bg: var(--research-group-accent);
    --bs-btn-border-color: var(--research-group-accent);
    --bs-btn-hover-bg: color-mix(in srgb, var(--research-group-accent) 80%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--research-group-accent) 80%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--research-group-accent) 70%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--research-group-accent) 70%, #000);
}
.research-group-public-page .btn-outline-primary {
    --bs-btn-color: var(--research-group-accent);
    --bs-btn-border-color: var(--research-group-accent);
    --bs-btn-hover-bg: var(--research-group-accent);
    --bs-btn-hover-border-color: var(--research-group-accent);
    --bs-btn-active-bg: color-mix(in srgb, var(--research-group-accent) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--research-group-accent) 80%, #000);
}

/* Filters follow the module width, not just the viewport width. */
@container (max-width: 500px) {
    .group-dashboard-module .academic-publication-filter-panel .row > div { width: 100%; }
    .group-dashboard-module .research-group-post-card :is(header, .research-group-post-copy) { padding: 1rem !important; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
    .group-dashboard-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .group-dashboard-module { grid-column: span var(--module-span, 6); }
    .group-dashboard-module--narrow { grid-column: span var(--module-span, 3); }
    .group-dashboard-module--wide { grid-column: span var(--module-span, 6); }

    .group-dashboard-module.is-full-bleed,
    .group-dashboard-module[data-module-full="true"] {
        grid-column: 1 / -1;
        width: 100vw;
        max-width: none;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
}
@media (min-width: 1200px) {
    .group-dashboard-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .group-dashboard-module { grid-column: span var(--module-span, 8); }
    .group-dashboard-module--narrow { grid-column: span var(--module-span, 4); }
    .group-dashboard-module--wide { grid-column: span var(--module-span, 12); }

    .group-dashboard-module.is-full-bleed,
    .group-dashboard-module[data-module-full="true"] {
        grid-column: 1 / -1;
        width: 100vw;
        max-width: none;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
}

/* Full-bleed inner content alignment and toolbar styling */
@media (min-width: 768px) {
    .group-dashboard-module.is-full-bleed .group-dashboard-module-tools,
    .group-dashboard-module[data-module-full="true"] .group-dashboard-module-tools {
        border-radius: 0;
        padding-left: max(.65rem, calc((100% - 1320px) / 2 + .65rem));
        padding-right: max(.65rem, calc((100% - 1320px) / 2 + .65rem));
    }

    .group-dashboard-module.is-full-bleed .group-dashboard-module-body > :not(.research-group-hero),
    .group-dashboard-module[data-module-full="true"] .group-dashboard-module-body > :not(.research-group-hero) {
        max-width: 1320px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    .group-dashboard-module.is-full-bleed .group-dashboard-height-handle,
    .group-dashboard-module[data-module-full="true"] .group-dashboard-height-handle {
        border-radius: 0;
    }

    .group-dashboard-module[data-module-id="hero"].is-full-bleed .research-group-hero,
    .group-dashboard-module[data-module-id="hero"][data-module-full="true"] .research-group-hero {
        border-radius: 0;
        padding-left: max(1.5rem, calc((100% - 1320px) / 2 + 1.5rem)) !important;
        padding-right: max(1.5rem, calc((100% - 1320px) / 2 + 1.5rem)) !important;
    }
}
@media (max-width: 767.98px) {
    .group-dashboard-module { grid-column: 1 / -1; }
    .group-dashboard .group-dashboard-width,
    .group-dashboard .group-dashboard-resize { display: none; }
    .group-dashboard-toolbar { padding: 1rem; }
    .group-dashboard-actions { width: 100%; }
    .group-dashboard-actions .btn { flex: 1 1 auto; }
    .group-dashboard-breakpoint { flex-basis: 100%; text-align: center; }
}
