.sidebar { width: 220px; flex-shrink: 0; min-height: calc(100vh - 56px); }
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
}
.sidebar-section {
    padding: 14px 16px 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    color: var(--bs-secondary-color); letter-spacing: 0.03em;
}
.sidebar .nav-link { padding: 6px 16px 6px 24px; color: var(--bs-body-color); border-left: 3px solid transparent; }
.sidebar .nav-link:hover { background: var(--bs-secondary-bg); }
.sidebar .nav-link.active { color: var(--bs-primary); background: var(--bs-primary-bg-subtle); border-left-color: var(--bs-primary); font-weight: 600; }
.main-content { min-width: 0; }
.login-card { width: 100%; max-width: 380px; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.4rem; margin: 0; }
.page-header .actions { margin-left: auto; display: flex; gap: 8px; }

/* Load form: jumpers table with exit groups */
.jumps-table { border-collapse: separate; border-spacing: 0; }
.jumps-table td, .jumps-table th { white-space: nowrap; }
.jumps-table td.field-jumper, .jumps-table td.field-enrollment { min-width: 170px; }
.jumps-table td.field-radio_operators { min-width: 180px; }
.jumps-table .drag-handle { cursor: grab; color: var(--bs-secondary-color); font-size: 1.1rem; padding: 0 4px; user-select: none; }
.jumps-table .leave-group { display: none; color: var(--bs-secondary-color); }
.jumps-table tr.grp .leave-group { display: inline-block; }
.jumps-table input[name$="-DELETE"] { display: none; }
.jumps-table .not-applicable > *, .formset .not-applicable > * { visibility: hidden; }
.jumps-table tr.dragging { opacity: 0.5; }
.jumps-table tr.grp > td { background: color-mix(in srgb, var(--grp) 7%, transparent); border-top: 0; border-bottom: 0; }
.jumps-table tr.grp > td:first-child { border-left: 3px solid var(--grp); }
.jumps-table tr.grp > td:last-child { border-right: 3px solid var(--grp); }
.jumps-table tr.grp-start > td { border-top: 3px solid var(--grp); }
.jumps-table tr.grp-end > td { border-bottom: 3px solid var(--grp); }
.jumps-table tr.grp-start > td:first-child { border-top-left-radius: 8px; }
.jumps-table tr.grp-start > td:last-child { border-top-right-radius: 8px; }
.jumps-table tr.grp-end > td:first-child { border-bottom-left-radius: 8px; }
.jumps-table tr.grp-end > td:last-child { border-bottom-right-radius: 8px; }
.jumps-table tr.drop > td { background: var(--bs-primary-bg-subtle); }
.jumps-table tr.drop > td:first-child { border-left: 2px dashed var(--bs-primary); }
.jumps-table tr.drop > td:last-child { border-right: 2px dashed var(--bs-primary); }
.jumps-table tr.drop-start > td { border-top: 2px dashed var(--bs-primary); }
.jumps-table tr.drop-end > td { border-bottom: 2px dashed var(--bs-primary); }
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0; }
/* Only errors are highlighted after a submit, not every valid field. */
.form-control.is-valid, .form-select.is-valid { border-color: var(--bs-border-color); }
.form-control.is-valid:focus, .form-select.is-valid:focus { border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25); }
.form-control.is-valid { background-image: none; padding-right: .75rem; }
.form-select.is-valid:not([multiple]):not([size]) { --bs-form-select-bg-icon: none; padding-right: 2.25rem; }
.jumps-table td.field-role, .jumps-table td.field-aff_level, .jumps-table td.field-rig { min-width: 100px; }
.jumps-table td.field-kind { min-width: 130px; }
/* Model field names are lower case ("date"); show them capitalised in English. */
.table thead th::first-letter, .form-label::first-letter { text-transform: uppercase; }
/* Theme switch shows the sun in dark mode (go light) and the moon in light mode. */
[data-bs-theme="dark"] .theme-icon-light, [data-bs-theme="light"] .theme-icon-dark { display: none; }
.table > thead > tr > th { background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] .navbar.bg-primary { background-color: #0b3d91 !important; }
/* Rig page: component drawer */
.component-drawer { --bs-offcanvas-width: min(560px, 100vw); }
.component-drawer iframe { width: 100%; }
body.embedded { background: var(--bs-body-bg); }
/* Tables inside cards line up with the card's padding. */
.card .table > :not(caption) > * > *:first-child { padding-left: 1rem; }
.card .table > :not(caption) > * > *:last-child { padding-right: 1rem; }
/* A checkbox beside other inputs sits level with them, not with their labels. */
@media (min-width: 768px) {
    .form-section .row > [class*="col-md"]:has(> .form-check:first-child) { padding-top: 2.1rem; }
}
/* Radio and checkbox lists flow across the line. */
#id_category .form-check, #id_groups .form-check { display: inline-block; margin-right: 1.5rem; }
#id_instructional_rating { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.permission-matrix td:first-child { width: 40%; }
/* Searchable selects (Tom Select) use the theme's colours, like the plain selects next to them. */
.ts-wrapper .ts-control, .ts-wrapper.single.input-active .ts-control { background-color: var(--bs-body-bg); color: var(--bs-body-color); }
.ts-wrapper .ts-control .item, .ts-wrapper .ts-control input { color: var(--bs-body-color); }
.ts-wrapper .ts-control input::placeholder { color: var(--bs-secondary-color); }
.ts-wrapper.multi .ts-control > .item { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); color: var(--bs-body-color); }
.ts-dropdown { background: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }
.ts-dropdown .option.active { background: var(--bs-primary-bg-subtle); color: var(--bs-body-color); }
.ts-dropdown .option, .ts-dropdown .no-results, .ts-dropdown .optgroup-header { color: var(--bs-body-color); }
/* Small searchable selects are as tall as the small selects in the same row. */
.ts-wrapper.form-select-sm { min-height: calc(1.5em + .5rem + var(--bs-border-width) * 2); padding-top: 0; padding-bottom: 0; display: flex; align-items: center; }
.ts-wrapper.form-select-sm .ts-control { padding: .125rem 0 .125rem .5rem; min-height: 0; font-size: .875rem; line-height: 1.5; }
.ts-wrapper.form-select-sm .ts-control > .item, .ts-wrapper.form-select-sm .ts-control > input { margin-top: 0; margin-bottom: 0; }
.ts-wrapper.form-select-sm.multi .ts-control > .item { padding: 0 .375rem; }
/* Chosen items and the search box share one line; the placeholder only shows while empty. */
.ts-wrapper.form-select-sm.multi .ts-control { flex-wrap: nowrap; overflow: hidden; }
.ts-wrapper.multi.has-items .ts-control > input { flex: 1 1 1ch; min-width: 1ch !important; }
.ts-wrapper.multi.has-items .ts-control > input::placeholder { color: transparent; }
.ts-wrapper.multi.full .ts-control > input { display: none; }
/* Cells keep their width when radio operator chips need room; the table scrolls instead. */
.jumps-table .field-role .form-select, .jumps-table .field-aff_level .form-select, .jumps-table .field-rig .form-select { min-width: 100px; }
.jumps-table .field-kind .form-select { min-width: 130px; }
.jumps-table .field-jumper .ts-wrapper, .jumps-table .field-enrollment .ts-wrapper { min-width: 170px; }
.jumps-table .field-radio_operators .ts-wrapper { min-width: 180px; }
.ts-wrapper.form-select-sm.multi .ts-control > .item { font-size: .8rem; }
/* Product package lines: room for the item names. */
.formset td.field-item select { min-width: 220px; }
