/* Typeface, body size and link colours come from theme.css. */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:root {
    --navbar-height: 56px;
    /* Toggled via .sidebar-collapsed on <html> (static/js/sidebar-collapse.js). */
    --sidebar-width: 210px;
    --sidebar-collapsed-width: 58px;
    /* Drives the navbar accent line and sidebar active states (dark: dark-mode.css). */
    --app-brand: #1f4d5a;
    --app-primary: var(--app-brand);
    --app-primary-hover: color-mix(in srgb, var(--app-brand) 75%, #000);
    --app-primary-subtle: color-mix(in srgb, var(--app-brand) 12%, transparent);
    --bs-focus-ring-color: color-mix(in srgb, var(--app-primary) 25%, transparent);
}

/* Inset shadow, not a border, so the navbar height stays --navbar-height. */
.navbar.bg-dark {
    box-shadow: inset 0 -3px 0 var(--app-primary);
}


.sidebar {
    /* Matches the offcanvas bg to .sidebar-inner's so a short menu leaves no strip below it. */
    --bs-offcanvas-width: 260px;
    --bs-offcanvas-bg: #e9ecef;
    /* Darker than the page default so the rail reads as its own surface. */
    --bs-light-rgb: 233, 236, 239;
    /* A variable so dark-mode.css can re-tint it without a specificity fight with .nav-link.active. */
    --sidebar-rail: rgba(0, 0, 0, .14);
}

@media (min-width: 768px) {
    #sidebarMenu {
        flex: 0 0 var(--sidebar-width);
        align-self: flex-start;
        position: sticky;
        top: var(--navbar-height);
        height: calc(100vh - var(--navbar-height));
        overflow-y: auto;
    }

    /* offcanvas-md forces a transparent body at >=768px; .sidebar-inner carries the background instead. */
    #sidebarMenu .offcanvas-body {
        display: block;
        height: 100%;
    }

    #sidebarMenu .sidebar-inner {
        min-height: 100%;
    }

    .sidebar {
        box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    }
}

.sidebar .nav-link {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1rem 1.5rem 1rem calc(1.75rem - 4px);
    border-left: 4px solid transparent; /* reserved so .active doesn't shift the text */
}

.sidebar .nav-link.disabled {
    padding-bottom: 0.5rem;
}

/* The rows' own left borders stack into one rail so .active can light up its segment. */
.sidebar .nav-link.section-open {
    font-weight: 700;
    color: #212529;
    padding-bottom: 0.6rem;
}

.sidebar .sidebar-subnav {
    margin-bottom: 0.75rem;
}

.sidebar .nav-link.sidebar-sub {
    /* Puts the rail under the middle of the parent item's icon. */
    margin-left: 2.1rem;
    padding: 0.4rem 1rem 0.4rem 0.85rem;
    border-left: 3px solid var(--sidebar-rail);
    font-size: 0.9rem;
    color: #495057;
}

.sidebar .nav-link.active {
    color: var(--app-primary);
    background-color: var(--app-primary-subtle);
    border-left-color: var(--app-primary);
    font-weight: 600;
}

.sidebar .nav-link:hover {
    background-color: rgba(0, 0, 0, .05);
}

/* Collapsed rail: labels shrink to font-size 0, not display:none, so they stay in the accessibility tree. */
.sidebar-collapse-toggle {
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .6rem 1.5rem .6rem calc(1.75rem - 4px);
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, .1);
    background: transparent;
    color: #6c757d;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapse-toggle:hover {
    background-color: rgba(0, 0, 0, .05);
    color: #333;
}

@media (min-width: 768px) {
    html.sidebar-collapsed #sidebarMenu {
        flex-basis: var(--sidebar-collapsed-width);
    }

    html.sidebar-collapsed .sidebar .nav-link,
    html.sidebar-collapsed .sidebar-collapse-toggle {
        position: relative;
        padding-left: 0;
        padding-right: 0;
        text-align: center;
        justify-content: center;
        gap: 0;
        font-size: 0;
    }

    html.sidebar-collapsed .sidebar .nav-link i,
    html.sidebar-collapsed .sidebar-collapse-toggle i {
        font-size: 1rem;
    }

    /* Counts don't fit a 58px rail; the badge becomes a dot. */
    html.sidebar-collapsed .sidebar .nav-link .badge {
        position: absolute;
        top: .5rem;
        right: .75rem;
        width: 8px;
        height: 8px;
        min-width: 0;
        padding: 0;
        margin: 0;
        border-radius: 50%;
        font-size: 0;
    }

    /* Sub-items (user-written planning periods) have no icon to stand in for them. */
    html.sidebar-collapsed .sidebar .sidebar-subnav {
        display: none;
    }
}

/* A row shows either the value or its editor; the class toggle also lets the server reopen a rejected row. */
.setting-row .setting-editor,
.setting-row.setting-row-open .setting-display,
.setting-row.setting-row-open .setting-edit {
    display: none;
}

.setting-row.setting-row-open .setting-editor {
    display: block;
}

/* 44px touch target. */
.setting-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

/* The save confirmation fades: it is an event, not the row's state. */
.setting-saved {
    animation: setting-saved-fade 4s ease-out forwards;
}

@keyframes setting-saved-fade {
    0%, 60% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

.feature-icon {
    width: 1.75rem;
    padding-top: 0.15rem;
}

/* Without this a long unbroken value widens the row past the card. */
.min-width-0 {
    min-width: 0;
}

.main {
    min-width: 0; /* allow the flex child to shrink so .table-responsive can scroll */
}

/* Scroll instead of wrapping. Not on a nav with a dropdown: the overflow clips the menu. */
.nav-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
}



/* Invitation pages start at the top: the registration form is long and usually opened on a phone. */
.public-panel {
    width: 100%;
    max-width: 32rem;
    margin: auto;
}

#cal-slide-content a.event-item {
    font-weight: normal;
    line-height: 22px;
}

.data-left {
    width: 150px;
    float: left;
    overflow-wrap: break-word;
    font-weight: bold;
}

.data-right {
    overflow-wrap: break-word;
    width: calc(100% - 150px);
    float: left;
    padding-bottom: 3px;
}

.data.row {
    margin-bottom: 10px;
}

.small_text {
    color: #6c6a6a;
    font-size: 90%;
}

.indent {
    margin-left: 40px;
}


.error-text {
    color: #a94442;
}

.list-group {
    margin-bottom: 0;
}

.custom-file-label {
    width: 100%;
}

.custom-file-border {
    line-height: 1.5;
    padding: .375rem .75rem;
    color: #495057;
    background-color: #ffffff;
    border: 1px solid #ced4da;
}

.custom-file-ext-border {
    margin-left: -.5rem;
    padding: .5rem 1rem .8rem .7rem;
    line-height: 1.5;
    color: #495057;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
}

.custom-modal-title {
    display: inline;
}

.table-responsive .dt-buttons {
    margin-bottom: 0.5rem;
}

/* Event table toolbar: buttons + length/search on one row, so no per-item bottom margin. */
.table-responsive .dt-top-row .dt-buttons {
    margin-bottom: 0;
}

.table-responsive {
    margin-bottom: 3rem;
}

.margin_top_1 {
    margin-top: 0.5rem;
}

.dt-left {
    text-align: left !important;
}

#calendar {
    margin-top: 0.5rem;
}

.draft {
    font-style: italic;
    color: #000000; /* #a9a9a9 was too light for datatables view*/
}

.draft a {
    color: #000000; /* #b0c4de was too light for datatables view*/
}

.loader-box {
    text-align: center;
    text-align: -webkit-center;
    padding: 6rem;
}

.loader {
    border: 16px solid var(--bs-secondary-bg);
    border-top: 16px solid var(--app-primary);
    border-radius: 50%;
    width: 120px;
    height: 120px;
    -webkit-animation: spin 2s linear infinite;
    animation: spin 2s linear infinite;
}

.text-white {
    color: #d3d3d3;
}

.mb-2 {
    margin-bottom: 2rem;
}

@-webkit-keyframes spin {
    0% {
        -webkit-transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* Planning tabs: notes/design/tapahtumien-suunnittelutyokalu.md. */
:root {
    --planning-paper: var(--bs-tertiary-bg);
    --planning-paper-deep: var(--bs-secondary-bg);
    --planning-ink: var(--bs-body-color);
    --planning-ink-soft: var(--bs-secondary-color);
    --planning-draft: transparent;
    --planning-final: transparent;
    --planning-line: var(--bs-border-color);
    --planning-accent: var(--bs-primary);
}

.planning-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* The checkbox stays in the document (.btn-check hides it), so keyboard and tests work. */
.planning-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.planning-chip {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border: 1px solid var(--planning-line);
    border-radius: 999px;
    background-color: var(--bs-body-bg);
    color: var(--planning-ink-soft);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    user-select: none;
}

.planning-chip:hover {
    border-color: var(--planning-ink-soft);
}

.btn-check:checked + .planning-chip,
.planning-chip--static {
    background-color: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary-border-subtle);
    color: var(--bs-primary-text-emphasis);
}

.planning-chip--static {
    cursor: default;
}

.btn-check:focus-visible + .planning-chip {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.planning-chip-link {
    padding: 0.3rem 0.4rem;
    border: 0;
    background: none;
    color: var(--bs-link-color);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.planning-chip-link:hover {
    text-decoration: underline;
}

/* Separators between groups: adjacent actions without a border read as one series. */
.planning-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.planning-toolbar__divider {
    align-self: stretch;
    width: 1px;
    margin: 0 0.25rem;
    background-color: var(--planning-line);
}

.planning-toolbar__end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.planning-search {
    width: 18rem;
    max-width: 100%;
    border-radius: 0.6rem;
    border-color: var(--planning-line);
}

/* Help popover content comes from planning_toolbar.js. */
.planning-help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--planning-accent);
    border-radius: 50%;
    background-color: var(--bs-body-bg);
    color: var(--planning-accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.planning-help-popover {
    --bs-popover-max-width: 26rem;
    --bs-popover-border-color: var(--planning-line);
}

.planning-help p {
    margin-bottom: 0.6rem;
}

.planning-help__title {
    color: var(--planning-ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.planning-count,
.planning-summary {
    font-size: 0.9rem;
}

/* Rows set --bs-table-bg, as a direct background would hide Bootstrap's hover (--bs-table-bg-state).
   Draft rows are yellow across: with hundreds of rows the row colour is read first. */
.planning-grid {
    --bs-table-border-color: var(--planning-line);
}

.planning-grid > thead > tr > th {
    background-color: var(--planning-paper);
    color: var(--planning-ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.planning-grid > tbody > tr {
    --bs-table-bg: var(--planning-final);
}

.planning-grid > tbody > tr.planning-row--draft {
    --bs-table-bg: var(--planning-draft);
}

.planning-grid td.planning-cell--name {
    font-weight: 700;
}

.planning-grid td.planning-cell--date,
.planning-grid td.planning-cell--date,
.planning-grid td.planning-cell--time {
    font-family: var(--app-font-mono);
    font-size: 0.875em;
    white-space: nowrap;
}

/* Compact toggle state is kept in browser storage (planning_toolbar.js). */
.planning-grid--compact > tbody > tr > td,
.planning-grid--compact > thead > tr > th {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    font-size: 0.85rem;
    line-height: 1.25;
}

.planning-grid--compact .planning-band > td {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

/* Sticky headers: .table-responsive's overflow-x makes it a vertical scroll container, so it stops being one.
   A height-capped wrapper would clip the cell editor's Choices dropdown; cost: below ~1200px the page scrolls sideways. */
@media (min-width: 768px) {
    .planning-scroll {
        overflow: visible;
    }

    .planning-scroll > table > thead > tr > th {
        position: sticky;
        /* The navbar is sticky too. */
        top: var(--navbar-height);
        /* Below Choices' 1000 so an open cell menu is not hidden, and below the navbar's 1030. */
        z-index: 2;
        /* Borders don't travel with a sticky cell; the shadow separates the header. */
        box-shadow: inset 0 -1px 0 var(--planning-line);
    }
}

/* Frozen columns (Feedback #122): planning_freeze.js measures the offsets and adds the class after, so without JS
   the columns don't stack at the left edge. Opaque so scrolled content doesn't show through. */
@media (min-width: 768px) {
    .planning-grid--frozen > thead > tr > th:nth-child(-n+5),
    .planning-grid--frozen > tbody > tr:not(.planning-band, .planning-row--empty) > td:nth-child(-n+5) {
        position: sticky;
    }

    .planning-grid--frozen > tbody > tr:not(.planning-band, .planning-row--empty) > td:nth-child(-n+5) {
        z-index: 1;
        background-color: var(--bs-body-bg);
        background-image: linear-gradient(var(--bs-table-bg), var(--bs-table-bg));
    }

    .planning-grid--frozen > thead > tr > th:nth-child(-n+5) {
        z-index: 3;
    }

    .planning-grid--frozen > * > tr > :nth-child(1) { left: var(--planning-freeze-0); }
    .planning-grid--frozen > * > tr > :nth-child(2) { left: var(--planning-freeze-1); }
    .planning-grid--frozen > * > tr > :nth-child(3) { left: var(--planning-freeze-2); }
    .planning-grid--frozen > * > tr > :nth-child(4) { left: var(--planning-freeze-3); }
    .planning-grid--frozen > * > tr > :nth-child(5) { left: var(--planning-freeze-4); }

    .planning-grid--frozen > tbody > tr:not(.planning-band, .planning-row--empty) > td:nth-child(5) {
        box-shadow: inset -1px 0 0 var(--planning-line),
            inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
    }

    .planning-grid--frozen > thead > tr > th:nth-child(5) {
        box-shadow: inset -1px 0 0 var(--planning-line), inset 0 -1px 0 var(--planning-line);
    }

    .planning-band__label {
        position: sticky;
        left: 0.5rem;
    }
}

/* Month/week bands: on a half-year period the reader loses track. box-shadow, not background-color:
   Bootstrap 5.3's inset cell shadow would win. */
.planning-band > td {
    box-shadow: inset 0 0 0 9999px var(--planning-band-bg);
    color: var(--planning-band-fg);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    /* The server sends lowercase month names; uppercase is presentation. */
}

.planning-band--month > td {
    --planning-band-bg: var(--bs-secondary-bg);
    --planning-band-fg: var(--bs-body-color);
    font-size: 0.95rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.planning-band--week > td {
    --planning-band-bg: var(--bs-tertiary-bg);
    --planning-band-fg: var(--bs-secondary-color);
    font-size: 0.8rem;
    padding-left: 1.25rem;
}

/* Multi-day general calendar entry: same colour as a holiday next to the weekday. */
.planning-band--day > td {
    --planning-band-bg: var(--bs-danger-bg-subtle);
    --planning-band-fg: var(--bs-danger-text-emphasis);
    font-size: 0.8rem;
    padding-left: 1.25rem;
    text-transform: none;
    letter-spacing: normal;
}

/* Below 768px .table-stack turns rows into cards; a band row must not become one. */
@media (max-width: 767.98px) {
    .table-stack > tbody > tr.planning-band {
        display: block;
        margin: 0.75rem 0 0.35rem;
        padding: 0;
        border: 0;
        border-radius: 0;
    }

    .table-stack > tbody > tr.planning-band > td {
        display: block;
        padding: 0.2rem 0.6rem;
        border-radius: 0.25rem;
        /* The card layout resets the inset shadow that paints the band. */
        background-color: var(--planning-band-bg);
    }
}

/* Weekday cell only: the row colour already means draft/final. */
.planning-holiday {
    color: var(--bs-danger-text-emphasis);
    font-weight: 600;
    white-space: nowrap;
}

.planning-holiday-name {
    font-weight: 400;
}

/* Colour on the note text, so an empty note colours nothing. */
.planning-note {
    color: var(--bs-danger-text-emphasis);
}

/* A created or moved row flashes so the user sees where it went. Animates the inset box-shadow, as custom
   properties do not interpolate. */
@keyframes planning-row-flash {
    from {
        box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--bs-info) 55%, transparent);
    }
    to {
        box-shadow: inset 0 0 0 9999px transparent;
    }
}

.planning-row--flash > td {
    animation: planning-row-flash 4s ease-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .planning-row--flash > td {
        animation: none;
        box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--bs-info) 35%, transparent);
    }
}

.planning-share-group {
    max-width: 34rem;
}

/* The server omits [data-field] from locked cells, so this file decides no permissions. */
.planning-grid td[data-field] {
    cursor: pointer;
    border-bottom: 1px dashed color-mix(in srgb, var(--bs-emphasis-color) 35%, transparent);
}

.planning-grid td[data-field]:hover {
    --bs-table-bg-state: color-mix(in srgb, var(--bs-emphasis-color) 10%, transparent);
}

/* A pseudo-element, not an element: the editor reads the cell's current value from textContent. */
.planning-grid td[data-field]::after {
    content: "\f304"; /* fa-pen */
    font-family: "Font Awesome 7 Free";
    font-weight: 900;
    font-size: 0.7em;
    margin-left: 0.35rem;
    opacity: 0.25;
}

.planning-grid td[data-field]:hover::after {
    opacity: 0.8;
}

/* :empty relies on the template leaving no whitespace inside the cell (planning/_grid_rows.html). */
.planning-grid td[data-field]:empty::before {
    content: var(--planning-placeholder);
    color: color-mix(in srgb, currentcolor 45%, transparent);
    font-style: italic;
}

/* Phones: the column name takes the cell's ::before (.stack-pair), so cards showed bare "Lisää…" rows (Feedback #138). */
@media (max-width: 767.98px) {
    .planning-grid td[data-field][data-placeholder]:empty::before,
    .planning-grid td[data-field][data-placeholder][data-display=""]:not(:focus-within)::before {
        content: attr(data-placeholder);
        color: color-mix(in srgb, currentcolor 45%, transparent);
        font-style: italic;
    }

    .table-stack.planning-grid > tbody > tr:not(.planning-band) > td.stack-pair {
        align-items: center;
        min-height: 2.75rem;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .table-stack.planning-grid td.planning-names {
        font-size: inherit;
    }
}

/* Desktop: the pen is absolute so it never wraps onto its own line; select cells use a background-image arrow,
   as ::before is taken by the empty-cell hint. */
@media (min-width: 768px) {
    .planning-grid td[data-field] {
        position: relative;
        padding-right: 1.1rem;
    }

    .planning-grid td[data-field]::after {
        position: absolute;
        top: 0.25rem;
        right: 0.3rem;
        margin-left: 0;
    }

    .planning-grid td.planning-cell--select[data-field] {
        padding-right: 2.3rem;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%237a7268' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1.2rem center;
        background-size: 0.65rem;
    }
}

/* One worker per line, never broken inside a name: the column is narrow. */
.planning-name-list {
    display: flex;
    flex-direction: column;
}

.planning-name {
    white-space: nowrap;
}

/* An open cell is a field with its own border; two lines on top look broken. */
.planning-grid td[data-field]:focus-within {
    border-bottom-color: transparent;
    background-image: none;
}

.planning-grid td[data-field]:focus-within::after,
.planning-grid td[data-field]:focus-within::before,
.planning-grid td[data-field]:has(> [data-add-turn])::after {
    content: none;
}

/* Keeps the status toggle's label from wrapping under it in narrow tables. */
@media (min-width: 768px) {
    .planning-grid td[data-state-cell] {
        white-space: nowrap;
    }
}

/* min-width so the select is not squeezed to the narrow column. */
.planning-turn-editor {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 14rem;
    padding: 0.25rem;
}

.planning-turn-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.planning-turn-label {
    flex: 0 0 6rem;
    font-size: 0.75rem;
    text-align: right;
    overflow-wrap: anywhere;
}

.planning-turn-row > select,
.planning-turn-row > input {
    flex: 1 1 auto;
}

/* The list scrolls in its own box so Valmis stays visible with many areas. */
.planning-area-editor {
    display: flex;
    flex-direction: column;
    min-width: 12rem;
    padding: 0.25rem;
    text-align: left;
}

.planning-area-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: 14rem;
    overflow-y: auto;
}

.planning-area-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
    cursor: pointer;
}

.planning-turn-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.planning-turn-done {
    margin-left: auto;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
}

@media (max-width: 767.98px) {
    .planning-search {
        width: 100%;
    }

    .planning-toolbar__end {
        width: 100%;
        margin-left: 0;
    }
}

/* Sized by content: a full-width table of narrow numbers leaves the eye travelling half a metre per row. */
@media (min-width: 768px) {
    .table-fit {
        width: auto;
        max-width: 100%;
    }
}

/* Speaker's own form: a narrow column on desktop too; full-width fields are harder to fill. */
.speaker-form {
    max-width: 36rem;
}

/* Green: the speaker checked them via the link; blue: the coordinator did. Not accent-color:
   .form-check-input is appearance: none. */
.speaker-check {
    cursor: pointer;
}

.speaker-check--self:checked {
    background-color: var(--bs-success);
    border-color: var(--bs-success);
}

.calendar-legend {
    display: inline-block;
    min-width: 8rem;
    padding: 0.25rem 0.75rem;
    text-align: center;
    border-radius: 0.25rem;
}

.scroll-menu{
   min-width: 220px;
   max-height: 90vh;
   overflow: auto;
 }

.org-search-container {
   position: sticky;
   top: 0;
   background: inherit;
   z-index: 1;
   padding-top: 0.25rem;
 }


/* Without this a long title pushes the action buttons off screen. */
.min-w-0 {
    min-width: 0;
}

/* base.html's top margin plus the breadcrumb's own spend ~36px before the title. */
.detail-breadcrumb {
    --bs-breadcrumb-margin-bottom: 0.25rem;
    margin-top: -0.5rem;
}

.detail-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 0;
}

.detail-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.05rem 1rem;
    padding: 0.3rem 0.25rem;
    border-top: 1px solid var(--bs-border-color);
    min-width: 0;
}

.detail-item > dt {
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.detail-item > dd {
    margin-bottom: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Flex drops inter-element whitespace, so no space before the comma. */
.detail-place {
    display: flex;
    flex-wrap: wrap;
    column-gap: 0.35rem;
}

.detail-place > span:not(:last-child)::after {
    content: ",";
}

.detail-place > .detail-place-name:not(:last-child)::after {
    content: " \2013";
}

.detail-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem 1rem;
    margin-top: 1.5rem;
}

.detail-block > .detail-block-title {
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: 1rem;
    margin-bottom: 0;
}

.detail-block > .detail-block-body {
    min-width: 0;
}

/* The global .table-responsive reserves 3rem for DataTables controls. */
.detail-block .table-responsive {
    margin-bottom: 0.75rem;
}

/* CKEditor's black Helvetica is unreadable on the dark theme (Feedback #137); `body` outweighs its later rule. */
body .ck-content {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

/* Choices.js through --choices-* variables: its later-loaded `.choices__list[aria-expanded]` ties with our dark rule. */
.choices {
    /* Default 1 puts the open menu under CKEditor's toolbar; 1000 is Bootstrap's dropdown level. */
    --choices-z-index: 1000;
}

/* !important because the library writes the cloned input's width inline. */
.choices__input--cloned {
    min-width: 12rem !important;
}

/* Indent by ORGANISATION_PERMISSION_LEVELS (erp/lib/permissions.py), dropdown rows only. */
.choices__item--choice .perm-depth-1 {
    margin-left: 1.25rem;
}

.choices__item--choice .perm-depth-2 {
    margin-left: 2.5rem;
}

.choices__item--choice .perm-depth-3 {
    margin-left: 3.75rem;
}

@media (min-width: 768px) {
    .detail-title {
        font-size: 2rem;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 2rem;
    }

    .detail-item {
        grid-template-columns: 10rem minmax(0, 1fr);
        align-items: baseline;
    }

    .detail-item--wide {
        grid-column: 1 / -1;
    }

    .detail-item--wide > dd {
        max-width: 60rem;
    }

    .detail-block {
        grid-template-columns: 10rem minmax(0, 1fr);
    }
}

/*
 * Tables that become cards below 768px (.table-stack), cells by role: .stack-title and .stack-actions share the
 * first line, then .stack-people, .stack-time, .stack-fill; .stack-pair is "label ..... value" (label from
 * data-stack-label, as the card drops the heading row); .stack-chips get thumb-sized hit areas; .stack-hide is
 * not shown. Anything else gets a line of its own.
 */

@media (max-width: 767.98px) {
    .table-stack > thead {
        display: none;
    }

    .table-stack,
    .table-stack > tbody {
        display: block;
        width: auto;
    }

    .table-stack > tbody > tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 0.75rem;
        align-items: start;
        margin-bottom: 0.5rem;
        padding: 0.3rem 0.6rem 0.35rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
        /* Row variants (.table-success, ...) set these variables on the row. */
        background-color: var(--bs-table-bg);
        color: var(--bs-table-color);
    }

    /* `hidden`'s display: none comes from the UA stylesheet, which our display rule beats. */
    .table-stack > tbody > tr[hidden] {
        display: none;
    }

    .table-stack > tbody > tr > td,
    .table-stack > tbody > tr > th {
        grid-column: 1 / -1;
        padding: 0.1rem 0;
        border: 0;
        /* Bootstrap's 9999px inset shadow would spill over the rounded corners. */
        box-shadow: none;
        /* The row paints the card; translucent cells again would leave the grid gaps a paler block. */
        background-color: transparent;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .table-stack .stack-title {
        grid-row: 1;
        grid-column: 1;
        font-weight: 600;
        font-size: 1.15rem;
    }

    .table-stack .stack-actions {
        grid-row: 1;
        grid-column: 2;
        justify-self: end;
        padding: 0;
    }

    .table-stack .stack-people {
        grid-row: 2;
        font-size: 1.15rem;
        line-height: 1.35;
    }

    .table-stack .stack-time {
        grid-row: 3;
        grid-column: 1;
        white-space: nowrap;
        /* Not opacity: that would also dim the nested .time-differs highlight. */
        color: color-mix(in srgb, currentcolor 80%, transparent);
    }

    .table-stack .stack-fill {
        grid-row: 3;
        grid-column: 2;
        justify-self: end;
        text-align: right;
        color: color-mix(in srgb, currentcolor 80%, transparent);
    }

    /* Not .stack-time, which is pinned to the third row; these cards vary in length. */
    .table-stack .stack-sub {
        white-space: nowrap;
        color: color-mix(in srgb, currentcolor 80%, transparent);
    }

    /* ::before: planning_speakers.js replaces the cell's text with an input, which would wipe a real label. */
    .table-stack .stack-pair {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.75rem;
        text-align: right;
    }

    .table-stack .stack-pair::before {
        content: attr(data-stack-label);
        flex: 0 1 auto;
        text-align: left;
        font-weight: 400;
        color: color-mix(in srgb, currentcolor 65%, transparent);
        /* A heading broken mid-word reads as damage; the value breaks instead. */
        overflow-wrap: normal;
    }

    .table-stack .stack-pair .form-control,
    .table-stack .stack-pair .form-select {
        width: auto;
        flex: 1 1 6rem;
    }

    .table-stack .stack-chips {
        padding-top: 0.35rem;
    }

    .table-stack .stack-chips .btn {
        --bs-btn-padding-y: 0.3rem;
        --bs-btn-padding-x: 0.6rem;
        margin-bottom: 0.25rem;
    }

    .table-stack .stack-hide {
        display: none;
    }

    .table-stack .stack-actions .btn {
        --bs-btn-padding-y: 0.4rem;
        --bs-btn-padding-x: 0.7rem;
        --bs-btn-font-size: 1rem;
    }
}

/* Fixed colour: these rows are always the pale success/warning variants, dark text in both themes. */
.time-differs {
    font-weight: 700;
    color: #b02a37;
    white-space: nowrap;
}

@media print {
    .navbar { display: none !important; }
    .sidebar { display: none !important; }

    .main {
        width: 100% !important;
    }

    .dropdown,
    .breadcrumb,
    .murupolku,
    .pagination,
    .ryhman_kommentit,
    #sidebar,
    .feedback-widget-container
    {
        display: none !important;
    }

    .left_site {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    body {
        font-size: 12pt;
        color: #000 !important;
    }

    a { color: #000 !important; }

    html[data-bs-theme="dark"] { color-scheme: light !important; }
}
/* Readable width for full-width form pages; reuse instead of writing max-width again. */
.form-page {
    max-width: 1080px;
}

/* Room on the right for the fixed feedback widget button, which would cover Tallenna. */
.form-actions {
    padding-right: 5rem;
}

/* Dimmed: a selected channel that will still not publish (draft, public API off, SMS off). */
.event-preview-off .event-preview-mock {
    opacity: 0.45;
}

.event-preview-screen {
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: #000;
    overflow: hidden;
}

.event-preview-screen-title {
    background: #000;
    color: #fff;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
}

.event-preview-screen-row {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
}

.event-preview-screen-time {
    flex-shrink: 0;
    white-space: nowrap;
}

.event-preview-paper {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    font-family: Georgia, 'Times New Roman', serif;
    padding: 0.5rem 0.75rem;
}

.event-preview-sms {
    background: var(--bs-success-bg-subtle);
    border-radius: 1rem;
    max-width: 90%;
    padding: 0.5rem 0.75rem;
}

.event-preview-box {
    position: sticky;
    /* Height minus the navbar, or the last card can't be scrolled to. */
    top: calc(var(--navbar-height) + 1rem);
}

.event-preview-panel {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--navbar-height) - 2rem);
    overflow: hidden;
}

.event-preview-panel-header,
.event-preview-rail {
    background: var(--bs-secondary-bg);
    border: 0;
    color: inherit;
}

.event-preview-panel-header:hover,
.event-preview-panel-header:focus-visible,
.event-preview-rail:hover,
.event-preview-rail:focus-visible {
    background: color-mix(in srgb, var(--bs-secondary-bg) 85%, var(--bs-emphasis-color));
}

.event-preview-panel-header {
    align-items: center;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    text-align: left;
    width: 100%;
}

.event-preview-panel-hide {
    color: var(--bs-secondary-color);
}

.event-preview-panel-body {
    overflow-y: auto;
    padding: 0.75rem 0.75rem 0;
}

.event-preview-rail {
    align-items: center;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    width: 100%;
}

.event-preview-rail-title {
    font-weight: 600;
}

@media (min-width: 1200px) {
    .event-preview-rail {
        flex-direction: column;
        padding: 0.75rem 0.25rem;
        width: 2.25rem;
    }

    .event-preview-rail-title {
        letter-spacing: 0.05em;
        writing-mode: vertical-rl;
    }

    .event-preview-collapsed > .event-preview-col {
        flex: 0 0 auto;
        width: auto;
    }

    /* flex-basis 0 like .col, so wide content does not push the rail onto a new line. */
    .event-preview-collapsed > [data-event-preview-main] {
        flex: 1 0 0%;
        max-width: 100%;
        min-width: 0;
    }
}

/* Dismissible help text; which part shows is decided in static/js/help_box.js. */
.help-box {
    position: relative;
}

.help-box-hide {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
}

/* Text must not run under the close button (like .alert-dismissible). */
.help-box > .alert {
    padding-inline-end: 2.5rem;
}

.help-box > :not(.alert) {
    padding-inline-end: 2rem;
}

[data-help-reveal] {
    display: none;
}

/* A filtered column shows in the header button, tint and pill row, all read off th.event-col-filtered. */
.event-table-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
}

.event-table-toolbar {
    position: relative; /* the mass-action menu is positioned against this */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.event-table-actions,
.event-table-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.event-table-tools {
    gap: 8px;
    margin-left: auto;
}

.event-table-actions div.dt-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.event-table-tools div.dt-search {
    width: 260px;
    max-width: 100%;
}

.event-table-tools div.dt-search label:empty {
    display: none;
}

.event-table-tools div.dt-search input {
    width: 100%;
}

.event-table-help {
    min-width: 34px;
}

.dropdown-menu.event-table-view-menu {
    min-width: 260px;
    padding: 12px;
}

.dropdown-menu.event-table-view-menu.show {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-table-view-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.event-table-view-heading {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.event-table-view-group div.dt-length {
    width: 100%;
}

.event-table-view-group div.dt-length label {
    display: none;
}

.event-table-view-switch {
    margin: 0;
    font-size: 13px;
}

/* Narrow screens: groups become display: contents so controls join the toolbar's flex; JS still finds them by id. */
@media (max-width: 767.98px) {
    .event-table-toolbar {
        gap: 8px;
        padding: 10px 12px;
    }

    .event-table-actions,
    .event-table-tools {
        display: contents;
    }

    /* Buttons' stylesheet makes its container full-width and centred under 768px. */
    .event-table-actions div.dt-buttons {
        width: auto;
        float: none;
        margin: 0;
        text-align: left;
    }

    .event-table-tools > .dropdown {
        margin-left: auto;
    }

    .event-table-tools div.dt-search {
        order: 10;
        flex: 1 0 100%;
        width: auto;
    }

    .event-table-filters {
        padding: 0 12px 10px;
    }
}

.event-table-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px;
    flex-wrap: wrap;
    font-size: 13px;
}

.event-table-count {
    font-weight: 500;
}

.event-table-count-total {
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.event-table-filter-separator {
    width: 1px;
    height: 20px;
    background: var(--bs-border-color);
    margin: 0 2px;
}

.event-table-pills {
    display: contents;
}

.event-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--app-primary-hover);
    background: var(--app-primary-subtle);
    border: 1px solid color-mix(in srgb, var(--app-primary) 35%, transparent);
}

.event-filter-pill .btn-close {
    padding: 0;
    width: 0.5rem;
    height: 0.5rem;
    background-size: 0.5rem;
}

.event-table-clear {
    padding: 0 4px;
    font-size: 13px;
}

/* Only the table scrolls sideways so the active filters stay readable. */
.event-table-scroll {
    position: relative; /* so ColumnControl accounts for this element's scroll offset */
    overflow-x: auto;
}

.event-table-body div.dt-container {
    padding: 0;
}

table.event-table {
    margin: 0;
    font-size: 13px;
    min-width: 1060px;
    --bs-table-bg: transparent;
}

table.event-table thead th {
    padding: 8px 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Inset shadow, not a border, so the row height does not change. */
table.event-table thead th.event-col-filtered {
    background: var(--app-primary-subtle);
    box-shadow: inset 0 -2px 0 var(--app-primary);
}

table.event-table tbody td {
    padding: 9px 12px;
}

table.event-table tbody td.event-col-filtered {
    background-color: color-mix(in srgb, var(--app-primary) 6%, transparent);
}

table.event-table div.dt-column-header {
    align-items: center;
    gap: 6px;
}

table.event-table span.dtcc {
    gap: 2px;
    --dtcc-button-icon_color: currentColor;
}

table.event-table span.dtcc button.dtcc-button {
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius-sm);
    background: transparent;
    color: var(--bs-secondary-color);
    opacity: 1;
    line-height: 1;
    align-items: center;
}

table.event-table span.dtcc button.dtcc-button:hover {
    border-color: transparent;
    background: transparent;
    color: var(--bs-body-color);
}

table.event-table span.dtcc button.dtcc-button_order.dtcc-button_active {
    color: var(--app-primary);
}

table.event-table span.dtcc button.dtcc-button_order.dtcc-button_active:hover {
    color: var(--app-primary-hover);
}

table.event-table thead th.event-col-filtered span.dtcc button.dtcc-button_dropdown {
    padding: 2px 8px;
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--bs-body-bg);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

table.event-table thead th.event-col-filtered span.dtcc button.dtcc-button_dropdown:hover {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
    color: var(--bs-body-bg);
}

table.event-table span.dtcc .event-filter-value {
    margin-left: 5px;
    white-space: nowrap;
}

table.event-table span.dtcc .event-filter-value:empty {
    display: none;
}

div.dtcc-dropdown .event-date-range {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 8px;
}

div.dtcc-dropdown .event-date-range label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    font-size: 13px;
}

div.dtcc-dropdown .event-date-range input[type="date"] {
    width: 10.5em;
}

div.dtcc-dropdown .event-date-range-warning {
    font-size: 12px;
    color: var(--bs-danger);
}

div.dtcc-dropdown .event-date-range-recent {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--bs-border-color);
}

div.dtcc-dropdown .event-date-range-recent-title {
    font-size: 12px;
    color: var(--bs-secondary-color);
}

div.dtcc-dropdown .event-date-range-recent-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

div.dtcc-dropdown .event-date-range-recent-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

div.dtcc-dropdown .event-date-range-use {
    flex: 1 1 auto;
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

.event-table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 12px;
    color: var(--bs-secondary-color);
    font-size: 13px;
}

.event-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--bs-border-color);
    font-size: 13px;
}

.event-table-footer div.dt-paging {
    margin: 0;
}

.event-table-footer div.dt-paging .pagination {
    margin: 0;
}

/* Bootstrap's 10rem default wraps every title. */
.notifications-dropdown-panel {
    width: 24rem;
    max-width: calc(100vw - 2rem);
}

.notifications-dropdown-panel .js-notifications-body {
    max-height: 70vh;
}

.own-information {
    max-width: 40rem;
}

.own-info-row:not(.is-editing) .own-info-edit,
.own-info-row.is-editing .own-info-view {
    display: none;
}
