.msw-event-archive-toolbar{
    direction:rtl;
    display:flex;
    align-items:flex-end;
    gap:18px;
    flex-wrap:wrap;
    margin:0 0 28px;
    padding:18px 20px;
    background:#fff;
    border:1px solid rgba(0,0,0,.08);
    border-radius:14px;
    box-shadow:0 8px 28px rgba(0,0,0,.05);
}
.msw-event-filter-section{display:flex;flex-direction:column;gap:8px}
.msw-event-filter-title{font-size:13px;font-weight:700;color:#333}
.msw-event-filter-buttons,.msw-event-view-switcher{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.msw-event-filter-button,.msw-event-view-button{
    min-height:40px;
    padding:8px 12px;
    border:1px solid #d9d9d9;
    border-radius:8px;
    background:#fff;
    cursor:pointer;
    font:inherit;
    line-height:1.4;
    transition:.18s ease;
}
.msw-event-filter-button:hover,.msw-event-filter-button.is-active,
.msw-event-view-button:hover,.msw-event-view-button.is-active{
    border-color:#2271b1;
    background:#2271b1;
    color:#fff;
}
.msw-event-view-switcher{margin-inline-start:auto}
.msw-event-view-label{font-size:13px;font-weight:700;margin-left:4px}
.msw-event-filter-result{width:100%;font-size:12px;color:#666;margin-top:-4px}

.msw-event-item{position:relative;box-sizing:border-box;transition:opacity .18s ease,transform .18s ease}
.msw-event-item.msw-event-hidden{display:none!important}
.msw-event-item:before{display:none!important;content:none!important}

/* Dedicated image stack: the theme thumbnail can clip overflow, so the action
   sits as a sibling below it rather than inside the thumbnail box. */
.msw-event-media-stack{
    width:var(--msw-event-media-width,auto);
    max-width:100%;
    flex:0 0 var(--msw-event-media-width,auto);
    min-width:0;
    box-sizing:border-box;
    background:transparent!important;
}
.msw-event-media-stack>.msw-event-media{
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    float:none!important;
}

/* Text-only status/action, centered under the image. */
.msw-event-card-action{
    width:100%;
    box-sizing:border-box;
    margin:0;
    padding:8px 4px 4px;
    position:relative;
    z-index:8;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
}
.msw-event-card-button{
    display:inline!important;
    width:auto!important;
    max-width:100%;
    padding:0!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    background:transparent!important;
    text-align:center!important;
    font-weight:800;
    text-decoration:none!important;
    line-height:1.8;
    cursor:pointer;
}
.msw-event-card-action-registerable .msw-event-card-button{color:#16833d!important}
.msw-event-card-action-registerable .msw-event-card-button:hover{color:#0f6b30!important;text-decoration:underline!important}
.msw-event-card-action-expired .msw-event-card-button{color:#737b86!important;cursor:default}
.msw-event-card-action-closed .msw-event-card-button{color:#c36a00!important;cursor:default}
.msw-event-card-action-full .msw-event-card-button{color:#c62828!important;cursor:default}

/* List mode leaves the Studiare layout intact. */
.msw-event-item.msw-view-list{
    width:auto!important;
    max-width:none!important;
    float:none!important;
    clear:both!important;
    margin-left:0!important;
}

/* When all course rows share a list parent, make ONLY that parent a 3-column
   grid. Sidebar/page wrappers remain untouched. */
.msw-event-items-container.msw-items-grid-3{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:24px!important;
    align-items:start!important;
}
.msw-event-items-container.msw-items-grid-3>.msw-event-item.msw-view-grid-3{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    float:none!important;
    clear:none!important;
    margin:0!important;
    overflow:hidden;
    background:#fff;
    border:1px solid rgba(0,0,0,.08);
    border-radius:14px;
    box-shadow:0 8px 28px rgba(0,0,0,.05);
}
.msw-event-item.msw-view-grid-3 .msw-event-layout-shell{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    width:100%!important;
    max-width:100%!important;
    float:none!important;
}
.msw-event-item.msw-view-grid-3 .msw-event-media-stack{
    width:100%!important;
    max-width:100%!important;
    flex:0 0 auto!important;
}
.msw-event-item.msw-view-grid-3 .msw-event-media img{
    display:block;
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    margin:0 auto!important;
    object-fit:cover;
}
.msw-event-item.msw-view-grid-3 .msw-event-content,
.msw-event-item.msw-view-grid-3 .summary,
.msw-event-item.msw-view-grid-3 .event-content,
.msw-event-item.msw-view-grid-3 .event-info,
.msw-event-item.msw-view-grid-3 .event-list-content{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    float:none!important;
    margin:0!important;
    padding:16px!important;
    box-sizing:border-box!important;
}

.msw-course-status{display:inline-block;padding:5px 9px;border-radius:999px;font-weight:700;font-size:12px;margin-bottom:7px}
.msw-course-status-registerable{background:#e9f8ef;color:#137a3c}
.msw-course-status-expired{background:#f0f0f1;color:#646970}
.msw-course-status-closed{background:#fff4e5;color:#9a5a00}
.msw-course-status-full{background:#fdecec;color:#a22727}

@media (max-width:1100px){
    .msw-event-items-container.msw-items-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))!important}
    .msw-event-view-switcher{margin-inline-start:0}
}
@media (max-width:700px){
    .msw-event-archive-toolbar{align-items:stretch;padding:14px}
    .msw-event-filter-section,.msw-event-view-switcher{width:100%}
    .msw-event-filter-buttons{width:100%}
    .msw-event-filter-button{flex:1 1 auto}
    .msw-event-items-container.msw-items-grid-3{grid-template-columns:1fr!important}
    .msw-event-media-stack{width:100%!important;flex:0 0 auto!important}
}
