/* ==========================================================================
   overrides.css — Third-party widget overrides
   --------------------------------------------------------------------------
   Fixes for vendor widgets (Pendo, etc.) that need style adjustments
   to integrate cleanly with our UI.
   ========================================================================== */

.pendo-resource-center-badge-notification-bubble {
    transform: scale(0.75);
    z-index: 999;
    left: -8px !important;
    top: -10px !important;
}

/* flex: 1 1 0 alone won't shrink below the content's min-width. Without this the journal
   table's ~840px floor prevents the form fields above from scaling down on narrow viewports. */
.content_wrapper_2 {
    min-width: 0;
}

/* Prevent an action bar from covering content at the bottom of the page.
   Only pages that have one: unconditional padding gave no-bar full-viewport apps (Control Tower) a
   dead-space page scrollbar. Presence not visibility — a hidden bar can appear on a row select. */
.content_wrapper_2:has(.novus_action_bar, .action_bar, .app-detail-page__actions--fixed) {
    padding-bottom: 5rem;
}

/* Prevent page scroll while the loading indicator backdrop is visible */
body:has(> #loading_indicator_backdrop) {
	overflow: hidden;
}

.common_modal_overlay.show {
	z-index: 1000;
}

.common_modal_popup.show {
	z-index: 1001;
}

/* base.css paints every <a> #0081c9, a blue outside the palette; plain links take the link tokens.
   Same specificity as base.css, so any classed link (app-btn, nav, tabs) keeps its own colour. */
a {
    color: var(--color-link-default);
}

a:hover,
a:focus {
    color: var(--color-link-hover);
}

/* ========== Legacy filter bar overrides ========== */

.main_list_filter {
    margin-top: var(--spacing-md);
}

.novus_filter_input_block {
    margin: var(--spacing-xs) var(--spacing-sm) var(--spacing-xs) 0;
}

/*
.novus_filter_select {
    height: 34px;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0 var(--spacing-md);
    transition: border-color var(--transition-fast);
}
*/


/* ========== Filter bar — new design ==========
   BEM block: .app-filter-bar
   Self-contained — no dependency on legacy classes.
   ================================================ */
.app-filter-bar {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: max-content;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--accent-50);
    border: 1px solid var(--accent-100);
    box-sizing: border-box;
	border-radius: var(--radius-lg);
	gap:  var(--spacing-lg);
}

.app-filter-bar form {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    gap: var(--spacing-md);
}

.app-filter-bar form:last-of-type {
    flex-grow: 1;
}

/* Push clear-filter button to the far right of the filter bar */

.app-filter-bar form > .app-btn {
    margin-left: auto;
}

/* Filter tag remove icon — smaller than the default symbol size */

.filter_tag_remove_button .sym {
    font-size: 14px;
}

.app-filter-bar .novus_filter_select,
.app-filter-bar input.novus_filter_input,
.app-filter-bar .app-input,
.app-filter-bar .app-select {
    min-width: 240px;
    border-radius: var(--radius-md);
}

.app-filter-bar .novus_filter_input_block {
    flex: 1;
    max-width: 15rem;
}

/* A checkbox filter has no field to fill the block, so it would sit centred in 15rem of dead space.
   A lone help icon is the same case. */
.app-filter-bar .novus_filter_input_block:has(> .app-radio-group__option),
.app-filter-bar .novus_filter_input_block.help {
    flex: 0 0 auto;
    max-width: none;
    justify-content: flex-start;
}

/* The filter-tags row reuses .novus_filter_input_block but is a full-width row under the
   inputs, not an input. Its inline flex: 1 0 100% cannot beat the 15rem cap above — that
   caps a max-width, which the inline flex never sets — so it rendered 240px wide beside the
   clear-filter button instead of wrapping. */
.app-filter-bar .novus_filter_input_block:has(.novus_filter_tag_list) {
    max-width: none;
}

.app-filter-bar .novus_filter_select.ally-focus-within:not([disabled]) {
    border: 1px solid var(--tertiary-700);
    box-shadow: 0 0 0 var(--focus-ring-offset) color-mix(in srgb, var(--tertiary-400) 40%, transparent);
}

.novus_filter_select:hover {
    border-color: var(--tertiary-500);
}

.novus_filter_select .selected_filter_text {
    line-height: 32px;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-primary);
}

/* A disabled Briox.Select reads like the other locked fields. */
.novus_filter_select[disabled] .selected_filter_text,
.novus_filter_select[disabled]::after {
    color: var(--color-disabled-text);
}

.novus_filter_select::after {
    color: var(--text-tertiary);
}

.novus_filter_select_list {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.1));
}

.novus_filter_select_list li {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
}

.novus_filter_select_list li:hover,
.novus_filter_select_list li.ally-focus-within {
    background-color: var(--color-hover-bg);
    color: var(--text-primary);
}

.novus_filter_select_list li:hover p,
.novus_filter_select_list li.ally-focus-within p {
    color: var(--text-primary);
}

.novus_filter_select_list li.selected {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

/* When novus_filter_select is used as an app-btn icon trigger, strip the
   default select chrome so app-btn controls all visual styling */

.novus_filter_select.app-btn--secondary.app-btn--ghost {
    border-color: transparent;
    background-color: transparent;
    padding: 0;
}

.novus_filter_select.app-btn--secondary.app-btn--ghost:hover {
    border-color: transparent;
    background-color: var(--btn-tint);
}

.novus_filter_select.app-btn--secondary.app-btn--ghost::after {
    display: none;
}


/* Assistant header strip. Its legacy rules in assistant.css are built for a half-width box:
   `.multi_fieldset_list_form .info_fieldset` is width: 50% and `.info_fieldset .column` is
   width: 50%. As a filter bar it should span the list below it, and two 50% columns plus the
   bar's gap overflow and wrap onto separate rows. Only the two assistant edit templates use
   these classes. */
.multi_fieldset_list_form .info_fieldset:has(.app-filter-bar) {
    width: 100%;
}

.info_fieldset .app-filter-bar > .column {
    width: auto;
}

.info_fieldset .app-filter-bar > .column:first-child {
    flex: 1;
}

/* .assignment_name_header is width: 100% + space-between, which parked the edit pencil 1300px
   from the title once the column grew. Keep it beside the name. */
.info_fieldset .app-filter-bar .assignment_name_header {
    width: auto;
    justify-content: flex-start;
    gap: var(--spacing-sm);
}

/* When common_modal_popup contains app-dialog markup, adopt the design system border-radius.
   Named classes, not [class^=]: attribute tests inside :has() make Chrome restyle the whole page on class changes. */
.common_modal_popup:has(.app-dialog, .app-dialog__header, .app-dialog__title, .app-dialog__body, .app-dialog__footer, .app-dialog__backdrop, .app-dialog__frame) {
    border-radius: var(--radius-xl);
}

/* Export journals modal: legacy general.css gives the button row a 40px top margin,
   which pushes the app-dialog footer past Modalbox's fixed 260px height */
#export_voucher_buttons.app-dialog__footer {
    margin-top: 0;
}

/* Same modal: general.css makes #select_file_options inline-block, which shrink-wraps the app-form
   to its widest option (65px) — the select never reaches the row width. The id stays because the
   caller inserts the download link after it. */
#select_file_options.app-form {
    display: flex;
}

/* Modalbox builds its own chrome and classes every part of it as app-dialog__* EXCEPT
   MB_content, which keeps modal.css's 6px/.75em and sits flush against the dialog edge.
   Match the design system body so a Modalbox modal is spaced like any other dialog. */
#MB_content {
    padding: var(--spacing-lg);
}

/* While the content loads, modalbox.js shows the design-system spinner. A dialog opened without a height
   loads in a 90px window that the header nearly fills, so the window gets room while loading, and the
   placeholder fills what is left under the header so the spinner sits centred in any window. */
#MB_window:has(#MB_loading) {
    min-height: 160px;
}
#MB_window:has(#MB_loading) > #MB_frame {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
#MB_window:has(#MB_loading) #MB_content {
    flex: 1 1 auto;
    display: flex;
}
#MB_loading {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MB_content pads templates that are bare body markup; one that carries app-dialog__body pads
   itself, so the two stack into 28px of dead space. Scoped to the body+footer shape below, which
   is the one measured — a body-only template keeps whatever it renders today. */
#MB_content:has(> form > .app-dialog__footer),
#MB_content:has(> div > .app-dialog__footer) {
    padding: 0;
}

/* Modalbox pins an explicit height on MB_content and makes it the scroller, so a template that
   supplies BOTH a body and a footer can fill it: the body takes the slack and the footer sits on
   the bottom edge, instead of floating mid-dialog with dead space under it or being pushed below
   the fold when a hidden row appears. Scoped to that shape on purpose — a template with a body but
   no footer has nothing to pin and is left exactly as it was.

   The flex goes on the template's own root, never on MB_content: with DEBUG defined, Layout.php
   appends its debugtable output there as siblings, and as flex items they crush the form to zero
   height. As ordinary block children they just flow below and scroll. */
#MB_content > form:has(> .app-dialog__body):has(> .app-dialog__footer),
#MB_content > div:has(> .app-dialog__body):has(> .app-dialog__footer) {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

/* The body carries .common_modal_content alongside app-dialog__body, and modal.css makes that
   justify-content: space-between. Inert while the body sized to its content; give it slack and it
   flings the rows to the top and bottom edges. */
#MB_content > form:has(> .app-dialog__footer) > .app-dialog__body,
#MB_content > div:has(> .app-dialog__footer) > .app-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    justify-content: flex-start;
}

/* Voucher import: the column headers are read-only inputs that open a picker, so they get select styling
   instead of the readonly grey. */
#item_import #item_list .app-table__th > input.app-input[readonly] {
    min-width: 9rem;
    padding-right: calc(var(--spacing-sm) + 16px);
    background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236883a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right var(--spacing-sm) center;
    border-color: var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
}

#item_import #item_list .app-table__th > input.app-input[readonly]:hover {
    border-color: var(--tertiary-500);
}

/* Agency client import: same picker headers, but the chevron is a real element (#down_arrow_N has its own handler). */
#client_import #item_list .app-table__th > .app-input {
    min-width: 9rem;
    cursor: pointer;
}

#client_import #item_list .app-table__th .app-input__field {
    cursor: pointer;
}

/* The fieldset is min-width: min-content, and a legacy #scroller { width: auto } inside the centring
   .stacked_in_column_item let the preview grow to the table, so the page scrolled sideways. */
#client_import > .app-detail-page__section {
    min-width: 0;
}

#client_import #scroller {
    width: 100%;
}

/* The column picker JS places with viewport coordinates, so it is fixed; show()/hide() toggle it. */
#client_import #multiselect {
    position: fixed;
    display: none;
    z-index: 1001;
    min-width: 260px;
    max-width: 480px;
    overflow: auto;
    padding: var(--spacing-xs);
}

/* Briox.Modal gives .common_modal_popup no width, so it sizes to content and a width:100% table
   stretches it to the viewport. modal_item and modal_contact used to cap that with app-dialog--xl
   on the template root, which nested a second .app-dialog whenever Modalbox opened them (their
   afterSort handler does). Keep the 1000px --xl gave them, as max-width so a Modalbox caller's
   width: option still wins. */
.common_modal_popup:has(#item_list),
.common_modal_popup:has(#contact_list) {
    max-width: 1000px;
}

/* A role="dialog" wrapper around header + body is a flex item of the capped popup, so it grew past
   the cap and clipped the list; pass the height down so the body scrolls instead. */
.common_modal_popup > div[role="dialog"] {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.common_modal_popup > div[role="dialog"] > .app-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
}

/* List pager: the edit-view toolbar's controls (#toolbar_pagination), so the same tight row
   instead of the legacy 290px space-evenly strip, and no legacy margin-top on the jump field. */
#multi_page_pagination,
#mini_pagination {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 2px;
}

#multi_page_pagination .pagination_input {
    margin-top: 0;
}

/* Modal pager (common_pagination_modal.htm): the same controls, page text left, controls right. */
fieldset.pagination_element:has(> div > .modal_pagination) > div {
    flex: 1 1 auto;
}

.modal_pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm) var(--spacing-lg);
}

.modal_pagination_controls,
.modal_pagination_rows {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.modal_pagination_rows {
    gap: var(--spacing-sm);
}

.modal_pagination .pagination_input {
    margin-top: 0;
}

/* The current page among the short list's page numbers. */
#mini_pagination .pagination_current_link {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

/* The shared modal pagination inherits 14px; match the table's body size. */
.common_modal_popup:has(#item_list) .pagination_element,
.common_modal_popup:has(#contact_list) .pagination_element {
    font-size: var(--font-body-sm-size);
}

/* Same problem, three more templates. A modal body template may not set a size class on its root
   (see modal-revamp.md), so the width their root app-dialog--md/--xl used to supply is capped here
   instead. Each body carries an id purely so this rule has something to aim at. */
#modal_acct_classes_body {
    max-width: 35rem;
}

#modal_company_information_retrieve_body,
#modal_company_information_retrieve_search_body {
    max-width: 62.5rem;
}

/* ========== List settings dialog ==========
   Structural overrides only — content handled by app-dialog / app-field.
   =========================================== */


/* Center the dialog panel — backdrop is set to flex by JS on open */
.settings_dialog {
    align-items: center;
    justify-content: center;
}

/* Gap between consecutive standalone checkboxes */
.settings_dialog .app-checkbox__option + .app-checkbox__option {
    margin-top: var(--spacing-sm);
}

/* Form div is transparent to the app-dialog flex layout */
.settings_dialog .form {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
    display: contents;
}

/* Column visibility — 2 app-checkbox__option divs per row */
.list_settings_column_visibility_options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.list_settings_column_visibility_options br {
    display: none;
}

/* ========== Daterangepicker — design system overrides ==========
   Reskins the vendor daterangepicker to match our tokens.
   ================================================================ */

.daterangepicker {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
    color: var(--text-primary);
}

.daterangepicker:before {
    border-bottom-color: var(--border-primary);
}

.daterangepicker:after {
    border-bottom-color: var(--bg-primary);
}

.daterangepicker.drop-up:before {
    border-top-color: var(--border-primary);
}

.daterangepicker.drop-up:after {
    border-top-color: var(--bg-primary);
}

.daterangepicker .calendar-table {
    border-color: var(--bg-primary);
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
}

.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    border-radius: var(--radius-sm);
}

.daterangepicker .calendar-table th.month {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.daterangepicker .calendar-table .next span,
.daterangepicker .calendar-table .prev span {
    border-color: var(--text-secondary);
}

.daterangepicker td.available:hover,
.daterangepicker th.available:hover {
    background-color: var(--color-hover-bg);
    color: var(--text-primary);
}

.daterangepicker td.off,
.daterangepicker td.off.in-range,
.daterangepicker td.off.start-date,
.daterangepicker td.off.end-date {
    background-color: var(--bg-primary);
    color: var(--text-tertiary);
}

.daterangepicker td.in-range {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.daterangepicker td.active,
.daterangepicker td.active:hover,
.drp-calendar .weekend.active,
.drp-calendar .weekend.active:hover {
    background-color: var(--accent);
    color: #fff;
}

.drp-calendar .weekend,
.drp-calendar .weekend.in-range {
    color: var(--accent-dark);
}

.daterangepicker td.disabled,
.daterangepicker option.disabled {
    color: var(--text-tertiary);
}

.daterangepicker .drp-buttons {
    border-top: 1px solid var(--border-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
}

.daterangepicker .drp-buttons .btn {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.daterangepicker .drp-buttons .btn.btn-default {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.daterangepicker .drp-buttons .btn.btn-default:hover {
    background-color: var(--color-hover-bg);
    border-color: var(--neutral-400);
}

.daterangepicker .drp-buttons .btn.btn-primary {
    background-color: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
}

.daterangepicker .drp-buttons .btn.btn-primary:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
}

.daterangepicker .drp-selected {
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

.daterangepicker select.monthselect,
.daterangepicker select.yearselect {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    padding: var(--spacing-xs);
}

.daterangepicker .ranges li {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.daterangepicker .ranges li:hover {
    background-color: var(--color-hover-bg);
}

.daterangepicker .ranges li.active {
    background-color: var(--accent);
    color: #fff;
}


/* ========== Action bar — bridge to app-detail-page__actions visual ==========
   The legacy #novus_action_bar is position:fixed + JS-managed padding (syncActionBarPadding).
   These rules give it the same gradient-fade + blur look as .app-detail-page__actions without
   changing any HTML or JS. Scoped broadly so it applies on both .app-list and non-.app-list pages.
   ============================================================================= */

.novus_action_bar {
    background: linear-gradient(0deg, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0.2) 100%);
    backdrop-filter: blur(2px);
    border-top: none;
    border-radius: 0;
    gap: var(--spacing-md);
    min-height: auto;
    padding-block: var(--spacing-xl);
}

/* When the PDF side panel is open, drop the gradient for a solid white bar */
.content_wrapper_2:has(~ .open_side_panel) .novus_action_bar {
    background: var(--bg-primary);
    backdrop-filter: none;
}


.novus_action_bar:has(.novus_action_bar_group + .novus_action_bar_group) {
    justify-content: space-between;
}

.novus_action_bar_group {
    gap: var(--spacing-md);
}

/* A label and its control are one unit in the bar; the group gap only spaces the units from each
   other. The wrapper is also what keeps a Briox.Select in place — custom_select.js appends the
   markup it generates to the select's parent, so without it every dropdown jumps to the end of the
   group. Keyed on app-field__label so it reaches only the facelifted pairs, not the legacy blocks
   some bars already carry. */
.novus_action_bar .novus_filter_input_block:has(> .app-field__label) {
    gap: var(--spacing-sm);
    margin: 0;
}

.novus_action_bar_group button:not(:last-child),
.novus_action_bar_group .novus_action_button {
    margin-right: 0;
}


/* ========== Header bar padding ========== */

/* padding-right removed — #main.main-sidebar handles horizontal spacing */

/* The id beats .app-tabs, so state the component's own clearance here: 8px put the
   first heading right on top of the tab strip. */
#third_header {
    margin-bottom: var(--spacing-xl);
}

/* ========== Reports page overrides ========== */

.reports_section_header {
    text-transform: none;
    font-family: var(--font-family-primary);
    font-size: var(--font-display-sm-size);
    font-weight: var(--font-display-sm-weight);
    line-height: var(--font-display-sm-line-height);
    letter-spacing: var(--font-display-sm-letter-spacing);
    color: var(--text-primary);
    gap: var(--spacing-sm);
}

.reports_section_header .sym {
    font-size: var(--icon-size-lg);
    color: var(--text-secondary);
}

/* ── Report favorite pin icons ── */

.report_favorite_toggle {
    opacity: 0;
    color: var(--text-tertiary);
    transition: opacity var(--transition-fast), color var(--transition-fast);
    padding: var(--spacing-sm) var(--spacing-md);
    margin: calc(-1 * var(--spacing-sm)) 0;
    border-radius: var(--radius-sm);
}

.reports_section ul li:hover .report_favorite_toggle,
.report_favorite_toggle.is_favorite {
    opacity: 1;
}

.report_favorite_toggle:hover {
    color: var(--accent);
    background-color: var(--accent-light);
}

.report_favorite_toggle.is_favorite {
    color: var(--accent);
}

.report_favorite_icon .sym {
    font-size: var(--icon-size-md);
}

/* ========== Autocomplete dropdown — align with app-select ==========
   Overrides jQuery UI autocomplete (.novus_autocomplete) to match the
   design-system dropdown panel (app-select__list / app-select__option).
   ==================================================================== */

.ui-autocomplete.novus_autocomplete {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
    padding: var(--spacing-xs) 0;
    color: var(--text-primary);
    font-family: var(--font-family-primary);
}

.ui-autocomplete.novus_autocomplete li {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: auto;
    line-height: var(--font-body-md-line-height);
    transition: background var(--transition-fast);
}

.ui-autocomplete.novus_autocomplete li:hover,
.ui-autocomplete.novus_autocomplete li.selected {
    background: var(--accent-light);
    color: var(--text-primary);
}

/* Category headers (Search, Filters, Similar results) */
.ui-autocomplete.novus_autocomplete .ui-autocomplete-category {
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: transparent;
    opacity: 1;
    padding: var(--spacing-xs) var(--spacing-md);
    height: auto;
    cursor: default;
}

.ui-autocomplete.novus_autocomplete .ui-autocomplete-category:not(:first-child) {
    border-top: 1px solid var(--border-secondary);
    margin-top: var(--spacing-xs);
    padding-top: var(--spacing-sm);
}

/* "LIST ALL RESULTS" button — matches app-btn--primary (Briox dark + accent text) */
.ui-autocomplete.novus_autocomplete li.show_more {
    background: var(--neutral-900);
    color: var(--accent-300);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-body-sm-size);
    border-radius: var(--radius-md);
    margin: var(--spacing-xs) var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ui-autocomplete.novus_autocomplete li.show_more:hover {
    background: var(--neutral-950);
    color: var(--accent-300);
}

/* "Add new" option */
.ui-autocomplete.novus_autocomplete li.add_new {
    font-weight: var(--font-weight-medium);
    font-size: var(--font-body-md-size);
    padding-left: var(--spacing-lg);
}

/* Filter name bold text within results */
.ui-autocomplete.novus_autocomplete .filter_name {
    font-weight: var(--font-weight-semibold);
}

.ui-autocomplete.novus_autocomplete .filter_text {
    opacity: 1;
    color: var(--text-secondary);
}

/* Scrollbar — match app-select */
.ui-autocomplete.novus_autocomplete::-webkit-scrollbar {
    width: 6px;
}

.ui-autocomplete.novus_autocomplete::-webkit-scrollbar-track {
    background: transparent;
}

.ui-autocomplete.novus_autocomplete::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 3px;
}

.ui-autocomplete.novus_autocomplete::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* ========== Filter tags — restyle as app-chip ==========
   Legacy .novus_filter_tag mapped onto app-chip tokens.
   ======================================================== */

.novus_filter_tag_list {
    gap: var(--spacing-sm);
    min-height: auto;
    color: var(--text-primary);
    font-size: var(--font-body-sm-size);
}

.novus_filter_tag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    height: 28px;
    padding: 0 var(--spacing-sm) 0 var(--spacing-md);
    margin: 0;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-medium);
    color: var(--accent-800);
    background: var(--accent-50);
    border: 1px solid var(--accent-200);
    border-radius: var(--radius-full);
    box-sizing: border-box;
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.novus_filter_tag:hover {
    background: var(--accent-100);
}

.novus_filter_tag span {
    cursor: default;
    line-height: 1;
}

.novus_filter_tag span.novus_filter_tag_name {
    font-weight: var(--font-weight-semibold);
    color: var(--accent-700);
}

.filter_tag_remove_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--accent-400);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.filter_tag_remove_button:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--error);
}

.filter_tag_remove_button .sym {
    font-size: 14px;
}

.filter_tag_remove_button svg {
    fill: currentColor;
    width: 12px;
    height: 12px;
}

.filter_tag_remove_button:hover > svg,
.filter_tag_remove_button:focus > svg,
.filter_tag_remove_button.ally-focus-within > svg {
    fill: var(--error);
}

/* Tablet: horizontal padding now handled by #main.main-sidebar */

/* ========== Custom select — the widget Briox.Select builds ==========
   Briox.Select replaces the <select> with a div, so app-input never reaches what the user sees.
   custom_select.js copies the element's class attribute onto that div, so the size modifier
   rides along and can be keyed on directly. Keyed on the size rather than on .app-field, which
   forced every widget inside a field to 34px — 33 selects across seven templates are --sm and
   were rendered a size too large.
   ===================================================================== */

.novus_filter_select.app-input {
    /* The option list is absolutely positioned, and the only legacy rule that gives the widget a
       positioning context is .novus_filter_select.novus_open_on_top. Without that class the list
       resolves against <body> and lands off-screen — measured at y=1306 in a 1069px viewport. */
    position: relative;
    box-sizing: border-box;
    font-family: var(--font-family-primary);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0 var(--spacing-md);
    transition: border-color var(--transition-fast);
}

/* Briox.Select sets the `disabled` *attribute* on this div (custom_select.js disable()), not the
   property — `:disabled` only matches form elements, so none of app-input.css's disabled selectors
   can reach it. The legacy `.novus_filter_select[disabled]` is (0,2,0), the same as the block
   above, so the block wins on order and a disabled picker renders as a live one. Restate it here
   with the design system's disabled tokens. */
.novus_filter_select.app-input[disabled] {
    background: var(--color-disabled-bg);
    border-color: var(--border-secondary);
    color: var(--color-disabled-text);
    cursor: default;
}

.novus_filter_select.app-input--sm {
    height: 28px;
    font-size: var(--font-body-sm-size);
}

.novus_filter_select.app-input--md {
    height: 34px;
    font-size: var(--font-body-md-size);
}

/* The text sits in a child that the base .selected_filter_text rule pins to 14px; let it follow the
   size modifiers above like any other field. */
.novus_filter_select.app-input .selected_filter_text {
    font-size: inherit;
}

/* A select standing among an action bar's buttons carries the button's own classes
   (app-btn--secondary app-btn--soft), so it takes that button's tint and text from the same tokens. */
.app-input.app-btn--soft,
.novus_filter_select.app-input.app-btn--soft {
    background: var(--btn-tint);
    /* Same edge as .app-btn--soft; the field rules above would otherwise win on specificity. */
    border-color: color-mix(in srgb, var(--btn-tint) 75%, var(--btn-accent));
    color: var(--btn-accent);
    font-weight: var(--btn-weight, var(--font-weight-semibold));
}

.app-input.app-btn--soft:hover,
.novus_filter_select.app-input.app-btn--soft:hover {
    background: var(--btn-tint-hover);
    border-color: color-mix(in srgb, var(--btn-tint) 75%, var(--btn-accent));
}

.novus_filter_select.app-input.app-btn--soft:not([disabled]) .selected_filter_text,
.novus_filter_select.app-input.app-btn--soft:not([disabled])::after {
    color: var(--btn-accent);
}

/* forms.css hardcodes line-height: 34px on the label, which is only right for --md. */
.novus_filter_select.app-input--sm .selected_filter_text {
    line-height: 26px;
}

.novus_filter_select.app-input.ally-focus-within:not([disabled]) {
    border-color: var(--tertiary-700);
    box-shadow: 0 0 0 var(--focus-ring-offset) color-mix(in srgb, var(--tertiary-400) 40%, transparent);
}

/* ========== Embedded action icons in migrated fields ==========
   .action_icon carries a hard-coded #0081c9 from general.css. Scoped to migrated fields and
   tables so the add-buttons match the other field icons, and so a Material Symbol gets a
   size — the legacy rule only sized the sprite <svg>.
   ============================================================== */

.app-field .action_icon,
.app-table .action_icon {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

.app-field .action_icon .sym,
.app-table .action_icon .sym {
    font-size: var(--icon-size-lg);
}

/* Legacy .listdisabled marks a locked / read-only value. The design-system input sets its own
   colour, so it has to be dimmed again here (budget_edit toggles the class from JS). */
.app-input.listdisabled {
    background: var(--color-disabled-bg);
    color: var(--color-disabled-text);
}

/* ========== Material Symbols in the edit-view toolbar ==========
   The legacy .toolbar_button rules only reach the sprite <svg>; a Material Symbol inherits
   the button's black text instead. Same muted-to-solid hover as the sprite it replaces.
   =============================================================== */

.toolbar_button > .sym {
    font-size: var(--icon-size-lg);
    color: var(--text-secondary);
    opacity: 0.8;
}

.toolbar_button:hover > .sym,
.toolbar_button.sidebar_open > .sym {
    color: var(--text-primary);
    opacity: 1;
}

/* A collapsible summary panel above a list sits in `.stacked_in_column_item`, which is a column
   flex container with `align-items: center`, and `.novus_edit_block_body` has no rules of its own.
   In a column flex container that property runs horizontally, so the body is both shrunk to
   content width and centred — a narrow block floating over a left-aligned table. `flex-start`
   corrects the placement while keeping the content width, so the pair stays readable without a
   width cap; the block then also follows the longer Finnish and Estonian labels. `:has()` keeps
   this to bodies that actually hold a migrated list — the class is in 62 legacy templates that
   must not shift. */
.stacked_in_column_item > .novus_edit_block_body:has(> .app-data-list) {
    align-self: flex-start;
}

/* A list table in this container sits inside a `<fieldset>`, which carries a UA
   `min-inline-size: min-content`. That is an explicit floor rather than `auto`, so now that the
   table is `width: max-content` the fieldset refuses to shrink and `.app-list--scroll`'s
   `overflow: hidden` clips the right-hand columns instead of the wrapper scrolling. `:has()` keeps
   this off the ~62 other legacy templates carrying the class. Nothing is needed on the wrapper
   itself: its own `width: 100%` is a definite cross size, so `align-items: center` never shrank it.
   Matched as a descendant, not a child: `import_statement` puts the wrapper inside a visibility
   div, and min-content propagates up from any depth. */
.stacked_in_column_item:has(.app-table-wrap--scroll) {
    min-width: 0;
}

/* lists.css draws a separator under every fieldset.stacked_in_column_item; under a bare list table it shows
   as a stray line below the rounded border (statement_history). Child only: account_reconciliation needs it. */
.app-list fieldset.stacked_in_column_item:has(> .app-table-wrap--scroll) {
    border-bottom: none;
}

/* ========== Client overview ==========
   clientmanager/clientoverview.htm builds its rows and its totals in JS, so these are the
   classes that replaced the inline styles that markup used to carry.
   ====================================== */

/* The package breakdown and client total the list prints under itself. Capped because the block
   is label/value pairs, not table columns, and the table beside it can run past 1700px. */
.client_sum {
    max-width: 420px;
    margin-top: var(--spacing-xl);
}

/* Licence totals, only rendered when the agency is not invoiced by package. */
.client_licence_summary {
    pointer-events: none;
}

.client_licence_total {
    border: 0;
    text-align: right;
    font-weight: var(--font-weight-semibold);
}

/* Edit client dialog (modal_editclient): the bare section headers sit between blocks with no fieldset
   to space them, so the block above gets the gap and the header keeps only a small one to its content. */
#form_client > :has(+ legend.app-section-header) {
    margin-bottom: var(--spacing-2xl);
}
#form_client > legend.app-section-header {
    margin-bottom: var(--spacing-md);
}

/* The CRM edit-client dialog (crm/modal/modal_edit_client_database) shares the form id. toggle.css
   centres the slider in a 70px box, leaving a gap after "Aktivera Portalen"; size the box to the slider. */
#form_client .app-form__row--inline > .switch {
    width: 38px;
    height: 20px;
}
#form_client .app-form__row--inline > .switch > .slider {
    inset: 0;
}

/* ========== Migrated modal footers ==========
   `modal_action_button` stays on a migrated button because the modals disable them through it
   (`jQuery('.modal_action_button').attr('disabled', …)`), but it also carries a fixed 143px width
   from `modal.css`, which clips any label longer than it — `modal_action_button_wide` was the
   legacy opt-in for that. An `app-btn` sizes to its own label, so let it.
   ============================================= */
.app-btn.modal_action_button,
.app-btn.modal_action_button_cancel {
    width: auto;
    height: var(--btn-h);
    /* modal.css forces `border-radius: 4px !important`, so the button kept 4px corners where every
       other app-btn--md has 8px - and the focus ring follows the radius, so it read as a different
       component the moment it was tabbed to. Needs !important to outrank the legacy one. */
    border-radius: var(--btn-radius) !important;
}

/* modal.css also gives it `box-shadow: 0 0 10px #0081c9` on hover and focus, and modal_popup.js
   focuses the button as the dialog opens — so a migrated modal opened with a blue halo. Keyboard
   focus is left alone so .app-btn:focus-visible still draws the design system's ring. */
.app-btn.modal_action_button:hover,
.app-btn.modal_action_button:focus:not(:focus-visible),
.app-btn.modal_action_button_cancel:hover,
.app-btn.modal_action_button_cancel:focus:not(:focus-visible) {
    box-shadow: none;
}

/* modal.css also paints the label on :focus - #FFFFFF at (0,2,0), #444444 for the cancel variant -
   which outranks .app-btn's own colour, and modal_popup.js focuses the button as the dialog opens,
   so a migrated button showed the wrong label colour from the first frame. Restated per appearance:
   the filled variants take --btn-fg, the outlined ones --btn-accent. */
.app-btn.modal_action_button:focus,
.app-btn.modal_action_button_cancel:focus {
    color: var(--btn-fg);
}

.app-btn--soft.modal_action_button:focus,
.app-btn--outline.modal_action_button:focus,
.app-btn--ghost.modal_action_button:focus,
.app-btn--soft.modal_action_button_cancel:focus,
.app-btn--outline.modal_action_button_cancel:focus,
.app-btn--ghost.modal_action_button_cancel:focus {
    color: var(--btn-accent);
}

/* modal.css paints a disabled `.modal_action_button` grey with !important; keep each appearance's own
   colours so it dims like every other disabled app-btn. */
.app-btn.modal_action_button:disabled {
    background-color: var(--btn-bg) !important;
    color: var(--btn-fg) !important;
    border: 1px solid var(--btn-bg) !important;
}

.app-btn--soft.modal_action_button:disabled {
    background-color: var(--btn-tint) !important;
    color: var(--btn-accent) !important;
    border: 1px solid color-mix(in srgb, var(--btn-tint) 75%, var(--btn-accent)) !important;
}

.app-btn--outline.modal_action_button:disabled {
    background-color: transparent !important;
    color: var(--btn-accent) !important;
    border: 1px solid currentColor !important;
}

.app-btn--ghost.modal_action_button:disabled,
.app-btn--link.modal_action_button:disabled {
    background-color: transparent !important;
    color: var(--btn-accent) !important;
    border: 1px solid transparent !important;
}

/* ========== Chosen inside a migrated modal ==========
   Chosen's option list is `position: absolute`, so it adds no height, and three ancestors clip it:
   `.common_modal_form` (overflow auto — the nearest, and what actually cut the list off right under
   the field), `.app-dialog__body` and the popup itself. Reserve room under the form while the list
   is open, so the modal grows instead of clipping and shrinks back on close. 250px covers the worst
   case — `.chosen-results` caps at 240px. Both `:has()` are load-bearing: the open state keeps the
   space from being reserved permanently, and `app-dialog__body` keeps this off the ~50 Chosen
   templates that have not been migrated and were not measured.
   ===================================================== */
/* `:not(#write_up_form)` — modal_write_up_asset is tall enough that the open list never reaches
   its form's bottom edge (measured: list bottom 244, form bottom 552 with the reservation off), so
   there the 250px only pushes the fields below the picker down and puts a scrollbar in the dialog.
   The two that do need it were measured the same way: modal_asset_link_sinvoice clips at 429
   against 426 without it. Measure before adding a modal to either side of this.
   An --overflow-visible body never clips the list, so it needs no reservation either: there the 250px
   only grew the dialog (modal_edit_template_activity, 413 -> 655px). */
.common_modal_popup:has(.app-dialog__body:not(.app-dialog__body--overflow-visible)):has(.chosen-with-drop) .common_modal_form:not(#write_up_form) {
    padding-bottom: 250px;
}

/* app-dialog__body--overflow-visible (components/app-dialog.css) inside a Briox.Modal: the legacy
   popup (overflow hidden, capped at 80vh) and the legacy form (overflow auto) clip it too. */
.common_modal_popup:has(> .app-dialog__body--overflow-visible),
.app-dialog__body--overflow-visible > .common_modal_form {
    overflow: visible;
}

/* modal_edit_card: two fields per row need more than the 453px content width. */
#edit_card_form {
    width: 600px;
}

/* Open Banking pickers: radio cards have no intrinsic width, and .common_modal_form's wrap would
   push them into a second column. */
#open_payment_bank_list_form,
#open_payment_account_list_form {
    display: flex;
    flex-flow: column nowrap;
    align-items: stretch;
    gap: var(--spacing-lg);
    width: min(640px, 85vw);
}

/* Bank cards: radio centred, logo and name centred beside it. */
#open_payment_bank_list_form .app-radio-group--cards > .app-radio-group__option {
    align-items: center;
}

#open_payment_bank_list_form .app-radio-group--cards > .app-radio-group__option > input {
    margin-top: 0;
}

#open_payment_bank_list_form .app-radio-group__text {
    flex: 1;
    align-items: center;
    gap: var(--spacing-sm);
    text-align: center;
}

#open_payment_bank_list_form .app-radio-group__label {
    font-size: var(--font-body-md-size);
    line-height: var(--font-body-md-line-height);
}

/* Fixed box so cards line up and the modal's height doesn't change when the logos load. */
.open_payment_bank_logo {
    width: 160px;
    max-width: 100%;
    height: 48px;
    object-fit: contain;
}

/* Direct payment (modal_create_direct_payment): IBAN/BIC and amount/date share a row. */
#direct_payment_form {
    width: min(500px, 85vw);
}

/* Licence column headers on the client overview and Manage Users. The symbol replaces a 35px
   circled sprite from applications.svg. At --icon-size-md they match the row icons and the 15
   licence columns still fit without the wrapper scrolling.
   The selector has to reach past `.app-list thead .novus_table_row th .sym`, which is (0,3,2) and
   was silently rendering these at --icon-size-sm — smaller than the check marks in the rows below. */
.client_licence_symbol,
.app-list thead .novus_table_row th .sym.client_licence_symbol {
    font-size: var(--icon-size-md);
    /* That rule also pins line-height to --icon-size-sm, and .sym clips to its line box,
       so a 24px glyph in a 16px box lost its top and bottom. */
    line-height: 1;
    height: auto;
    /* Same ink as the application icons in the main navigation, which these mirror. */
    color: var(--icon-color-primary);
    vertical-align: middle;
}

/* Printable company card (crm + cpnl iframe_showcontact.php?print=yes): nothing to fold or load on paper. */
.showcontact_print .app-detail-page__section-header > .sym,
.showcontact_print .app-detail-page__section-actions,
.showcontact_print .app-action {
    display: none;
}

/* The colour boxes and status dots are background colours, which browsers drop on paper by default. */
.showcontact_print .tinybox,
.showcontact_print .filter_color {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Visa statistik (crm/modal/modal_show_stats.htm): the stat boxes wrap to one column when the
   caller opens the dialog 450px wide for a single box, and sit two abreast at 910px. */
.show_stats_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--spacing-md);
}

/* Company and person cards: no rules between the information columns. */
fieldset div.card_three_column1,
fieldset div.card_three_column2,
fieldset div.card_two_column1 {
    border-right: none;
}

/* ========== Linked-document side panel ==========
   The panel is injected into the legacy #common_content_side_panel shell, so only its inner
   chrome is migrated — the shell keeps .common_content_side_panel and its own open/close JS.
   Shared by invoice_edit, supplier_invoice_edit and voucher_edit.
   ================================================= */

/* The shell is a flex column that stretches to page height, so the injected root and the body
   have to stretch too — otherwise the surface below ~200px of content was bare shell. The grey
   #F3F3F3 was what separated the panel from the page; a border does that job on a white surface,
   and every ContentSidePanel.Open call is this panel, so nothing else is restyled by it. */
.common_content_side_panel {
    background-color: var(--bg-tertiary);
}

.side_panel_content {
    display: flex;
    flex-flow: column nowrap;
    flex: 1;
}

.linked_document__header {
    border-bottom: 1px solid var(--border-primary);
}

.linked_document__body {
    display: flex;
    flex-flow: column nowrap;
    flex: 1;
    gap: var(--spacing-2xl);
    padding: var(--spacing-sm) var(--spacing-xl) var(--spacing-xl);
}

/* The body's gap only reaches the two tabs; the controls inside a tab are its grandchildren and
   had none. Same gap one level down. */
.linked_document__body > .linked_file_tab,
.linked_document__body > .inbox_file_tab {
    display: flex;
    flex-flow: column nowrap;
    gap: var(--spacing-2xl);
}

/* The file name row heads the receipt details below it, so keep the two close. */
.linked_document__body > .linked_file_tab {
    gap: var(--spacing-sm);
}

/* The inbox picker has no row above it, so it gets back the air the body's top padding gave up. */
.linked_document__body > .inbox_file_tab {
    padding-top: var(--spacing-lg);
}

/* Restated because .hidden lives in the earlier legacy bundle and would lose to the display
   above — that class is how the panel's JS switches tabs. */
.linked_document__body > .linked_file_tab.hidden,
.linked_document__body > .inbox_file_tab.hidden {
    display: none;
}

.linked_file_row {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: var(--spacing-md);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.linked_file_row__actions {
    margin-left: auto;
}

/* .app-btn carries its own display and sits in the later facelift bundle, so it wins over legacy
   .hidden — which is exactly how the panel's JS hides the prev/next and cancel buttons. */
.side_panel_content .app-btn.hidden {
    display: none;
}

/* ---------- Link / unlink badge ----------
   One badge holds both icons and the CSS swaps them on hover, so the row shows what a click will
   do. .svg_link / .svg_unlink are the legacy hooks and stay as class names on the symbols. */

.linked_document .badge,
.document_row .unlinked_document.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    color: var(--color-text-inverse);
}

.linked_document .badge {
    background-color: var(--accent);
}

.linked_document:hover .badge {
    background-color: var(--text-tertiary);
    cursor: pointer;
}

.linked_document .svg_unlink,
.linked_document:hover .svg_link,
.linked_document:active .svg_link {
    display: none;
}

.linked_document:hover .svg_unlink,
.linked_document:active .svg_unlink {
    display: inline-flex;
}

/* A read-only linked file (a supplier invoice's document shown on an asset): the name stays, the unlink badge goes. */
#button_unlink.is-readonly {
    pointer-events: none;
    cursor: default;
}

#button_unlink.is-readonly .badge {
    display: none;
}

/* ---------- Inbox list (unlinked documents) ---------- */

.document_row .unlinked_document.badge {
    background-color: var(--text-tertiary);
}

.document_row:hover .unlinked_document.badge {
    background-color: var(--accent);
}

.document_row:hover .document_filename {
    font-weight: var(--font-weight-medium);
}

.document_row .unlinked_document .svg_link,
.document_row:hover .unlinked_document .svg_unlink,
.document_row:active .unlinked_document .svg_unlink {
    display: none;
}

.document_row:hover .unlinked_document .svg_link,
.document_row:active .unlinked_document .svg_link {
    display: inline-flex;
}

/* ========== Custom select — dropdown arrow ==========
   The legacy arrow is the text glyph ▼ (forms.css: content: '\25bc'), so it renders in whatever
   font the widget happens to have. Once the widget carries the design system's font it stopped
   matching the Material Symbols arrows used everywhere else. Keyed on .app-input, which rides
   along from the <select>, so only migrated selects are affected.
   ==================================================== */

.novus_filter_select.app-input::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    font-feature-settings: 'liga';
    font-size: var(--icon-size-md);
    font-weight: var(--icon-weight);
    line-height: 1;
    color: var(--text-secondary);
    margin-left: auto;
}

/* No arrow when there is nothing to open. A real option is an <li>; a group label is a
   <div class="optgroup"> and a placeholder emits nothing at all, so :has(li) is precisely
   "has a selectable option". :has() is live, so re-populating the list brings the arrow back. */
.novus_filter_select.app-input:not(:has(.novus_filter_select_list li))::after {
    content: none;
}

.toolbar_button.greyed_out_icon > .sym {
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* The legacy hover chip is a hard-coded #2C7BFF at 0.2. --accent-light is what app-btn--ghost's
   own --btn-tint resolves to, and unlike --btn-tint it is a :root token, so it is in scope on a
   .toolbar_button — which is not an .app-btn and would otherwise get an empty var(). An open
   side panel keeps the same chip, so its button reads as the active one. */
.toolbar_button:not(.greyed_out_icon):hover::before,
.toolbar_button.sidebar_open::before {
    background: var(--accent-light);
    opacity: 1;
}

/* ========== Completed status in the edit-view toolbar meta row ==========
   Printed / e-mailed are facts, not settings — they render as a check plus text and are
   absent until they have happened, instead of as a permanently disabled checkbox.
   ======================================================================== */

.toolbar_meta_item--done {
    color: var(--text-secondary);
}

.toolbar_meta_item--done > .sym {
    font-size: var(--icon-size-md);
    color: var(--success);
}

/* ========== Divider above the edit-view toolbar ==========
   Separates the breadcrumb row from the meta row (Fakt.nr, status, toolbar actions).
   ========================================================= */

.novus_toolbar--divided {
    border-top: 1px solid var(--border-secondary);
    padding-top: var(--spacing-md);
}

/* A third-level tab strip already closes with its own border 8px above, so this divider lands as
   a second hairline with an empty band between the two. #third_header only renders when a page
   has sibling tabs, so pages without one keep their divider. */
main:has(> #third_header) .novus_toolbar--divided {
    border-top: none;
}

/* View-mode toggle, hosted in the toolbar to the left of the action icons */
.toolbar_view_mode {
    margin-right: var(--spacing-md);
    white-space: nowrap;
}

/* The icon buttons sat flush against each other — .toolbar_view_mode carried its own margin but
   nothing separated the icons. Same token, so the whole row is spaced at 10px. */
.toolbar_button + .toolbar_button {
    margin-left: var(--spacing-md);
}

/* ========== Dropzone frame in the linked-document panel ==========
   The frame only. The default-message markup is load-bearing — it had to be restored once
   already (sc-37107) — so it stays legacy and untouched. Dashed is kept because that is what
   reads as a drop target. Scoped to the panel, and dropzone_customizations.css is left alone.
   Colours, border width, hover and drag-over come from components/app-dropzone.css (app-dropzone on the element).
   ================================================================== */

.side_panel_content .dropzone,
#createFinancialYearForm .dropzone {
    min-height: 88px;
    padding: var(--spacing-xl);
    border-style: dashed;
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

/* ========== Custom select's option list ==========
   Briox.Select builds a legacy .novus_filter_select_list, which keeps its own chrome and a
   2010-era bright blue hover. Mirror the design system's dropdown here so a migrated select's
   menu matches the ones in the action bar. Scoped to .app-input, so unmigrated selects elsewhere
   keep the look their pages still have.
   ================================================== */

.novus_filter_select.app-input .novus_filter_select_list {
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xs) 0;
    /* Size to the longest row rather than to the trigger — the legacy min-width: 95% left the
       list narrower than its own text, so labels wrapped. Never narrower than the trigger, and
       the legacy 420px ceiling is kept so one long option cannot run away with it. */
    width: max-content;
    min-width: 100%;
    max-width: 420px;
}

.novus_filter_select.app-input .novus_filter_select_list li {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    color: var(--text-primary);
}

/* The legacy rules paint the row and its <p> bright blue with white text; both need answering. */
.novus_filter_select.app-input .novus_filter_select_list li:hover,
.novus_filter_select.app-input .novus_filter_select_list li.ally-focus-within,
.novus_filter_select.app-input .novus_filter_select_list li:hover p,
.novus_filter_select.app-input .novus_filter_select_list li.ally-focus-within p {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.novus_filter_select.app-input .novus_filter_select_list li.selected {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

/* ========== Inline inputs in a migrated table ==========
   The design system's pattern is a bordered app-input--sm in the cell. .novus_table_input_embed
   sets `border: none !important` for the borderless look, so the chrome needs the same weight to
   come through. The legacy class stays on the element: seven rules hang off it, including the
   .embedded_input_field_icon_right sibling, and dropping it would take them with it.
   ======================================================== */

.app-table .novus_table_input_embed.app-input,
.novus_list_table .novus_table_input_embed.app-input {
    /* The field's own border, as on list-row inputs: with the warm palette it is already light, and
       half strength left blank entry rows (Enheter's new-unit rows) nearly invisible. */
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-md);
    padding: 0 var(--spacing-md);
    height: 28px;
    /* A narrow cell hard-clipped its text — "Sök artikel" came out as "Sök arti" running under
       the add icon. Truncation is by available width, not character count, so this degrades
       gracefully at any column width rather than producing a fixed stem. */
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* app-table.css tints an editable embedded input instead of bordering it — the same problem
   solved a second way. Stacked, both ended up grey and editable was indistinguishable from
   readonly. The border is the design system's answer, so the tint comes off for inputs that
   carry app-input; tables whose inputs do not still rely on it, so it stays for them. The two
   approaches want reconciling app-wide, which is its own change. The :not()s match that rule's
   specificity so this one wins. */
.app-table .novus_table_input_embed.app-input:not([readonly]):not(:disabled),
.novus_list_table .novus_table_input_embed.app-input:not([readonly]):not(:disabled) {
    /* background-color, not the shorthand: that wipes select.app-input's chevron image. */
    background-color: var(--bg-primary);
}

.app-table .novus_table_input_embed.app-input:focus,
.novus_list_table .novus_table_input_embed.app-input:focus {
    border-color: var(--color-focus-ring) !important;
    box-shadow: 0 0 0 var(--focus-ring-offset) rgba(104, 131, 160, 0.12);
}

/* Read-only cells stay quiet so the editable ones are what the eye finds. */
.app-table .novus_table_input_embed.app-input[readonly],
.app-table .novus_table_input_embed.app-input:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* A flagged value (income tax returns' accounting column) keeps its warning red when read-only. */
.app-table .novus_table_input_embed.app-input.novus_table_row_warning_color {
    color: var(--error);
}


/* ========== Field columns in a migrated section card ==========
   .novus_edit_block_column is flex: 1 1 15%, so three columns never fill a row and shrink
   indefinitely instead of wrapping — the fields squash rather than stacking. Measured at 268px
   each when there is room, so a 260px basis with a matching min-width keeps that width and wraps
   to two columns, then one, as the space runs out. Scoped to the migrated card; the shape is in
   62 legacy templates that must not shift.
   =============================================================== */

.app-section-card.novus_edit_block_body > .novus_edit_block_column {
    flex: 1 1 260px;
    min-width: 260px;
}

/* The .app-field .action_icon .sym rule above sizes field action icons at --icon-size-lg, which
   suits the add (+) icons it was written for. It also catches the dropdown arrow in an
   autocomplete field's right-hand slot, leaving Vår/Er referens with a 24px arrow next to the
   20px one every select has. Same glyph, same colour — only the size was off. */
.app-field .embedded_input_field_icon_right .sym {
    font-size: var(--icon-size-md);
}

/* A unit text in a field's right-hand slot (år, %) follows the field's size; forms.css fixes it at 15px. */
.app-input--sm ~ .embedded_input_field_icon_right {
    font-size: var(--font-body-sm-size);
}
.app-input--md ~ .embedded_input_field_icon_right {
    font-size: var(--font-body-md-size);
}

/* The left-hand slot is `position: absolute; left: 5px` and its input carries
   `padding-left: 25px !important`, a box measured for the 18px sprite that used to sit there. A
   Material Symbol at --icon-size-md is 20px, so it reaches x=25 and butts against the first
   character; the !important means the padding cannot simply be widened. --icon-size-sm is 16px, so
   the glyph ends at x=21 and the text clears it — slightly more room than the sprite had. Only the
   left slot; the right-hand one above does not sit against the text. */
/* Not scoped to `.app-field`: the selector is its own scope. A Material Symbol in this slot exists
   in exactly the templates that have been migrated to one — asset_edit and the two asset modals
   today — and every legacy user of the slot still holds an <svg>, which `forms.css` already sizes
   to 18px. Modals use `app-form__row`, not `app-field`, so an `.app-field` prefix would have left
   their glyphs at 20px against the same 25px padding: measured touching the first character. */
.embedded_input_field_icon .sym {
    font-size: var(--icon-size-sm);
}

/* ---------- asset_edit: bottom-align the controls in a row ----------
   `.novus_form_row` is `align-items: center`, which is right when every field in the row has a
   one-line label. This card has a row holding four: "Anskaffningsdag" (one line), "Startdatum för
   avskrivning" (wraps to two), "Nyttjandeperiod" (one line plus an info icon) and the months field
   (no label at all). Centring four different field heights put the four inputs at four different
   tops — measured 423 / 432 / 424 / 414. Aligning on the bottom edge lands every input on the same
   line whatever its label does above it.

   Scoped to this form rather than to `.app-section-card`: the same shape is in company_information
   and invoice_edit, and whether they want it is a separate look. */
#asset_form .novus_form_row {
    align-items: flex-end;
}

/* ---------- asset_edit: an action glyph must not make its row taller ----------
   A Material Symbol that IS a cell's content defaults to --icon-size-md (20px) against a 12px/1.5
   text line, and as an inline-level box it also brings the line's descender space — so the history
   table's icon rows measured 37px against the depreciation plan's text-only 31px, and the two
   tables on this page stood 6px apart. Boxing the glyph to the text's own line height levels them
   without shrinking the icon; `td.app-col--center > *` re-centres it.

   Scoped to this form on purpose. The same selector unscoped reaches ten other templates
   (register_project_edit, register_assignment_edit, three register modals, three crm modals, two
   crm contact pages). It is safe there — the glyph is alone in its cell in every one, so nothing
   can be pushed onto a new line — but each of those tables carries the icon on every row, so they
   have no mismatch to fix and would only get 6px shorter for no reason. Promoting this to
   `app-table.css` is a design-system call; see open-questions. */
/* asset_edit read-only figures: a grid on the card's width, so a narrow page (the side panel open) wraps them
   into even rows of 4 + 3, then 2 per row, instead of 6 + 1 with clipped values. */
#asset_form .app-section-card:has(> .app-data-list--stats) {
    container: asset-figures / inline-size;
}

#asset_form .app-data-list--stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    flex: 1 1 100%;
    margin-left: calc(-1 * var(--spacing-lg));
}

@container asset-figures (max-width: 1180px) {
    #asset_form .app-data-list--stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@container asset-figures (max-width: 640px) {
    #asset_form .app-data-list--stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The label may break onto two lines; the value sits at the bottom of every cell so a row's figures share a baseline. */
#asset_form .app-data-list--stats .app-data-list__row {
    min-width: 0;
    padding: 0 var(--spacing-lg);
}

#asset_form .app-data-list--stats .app-data-list__label {
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}

#asset_form .app-data-list--stats .app-data-list__value input[readonly] {
    width: 100%;
    min-width: 0;
}

/* The second column's dates and useful life go two per row once the column is too narrow for four. */
#group_type_info > .novus_edit_block_column {
    container: asset-fields-col / inline-size;
}

@container asset-fields-col (max-width: 640px) {
    #group_type_info .novus_form_row:has(#acquisition_date) > .app-field {
        flex: 1 1 calc(50% - var(--spacing-xl));
    }
}

/* Rows line up across the asset form's columns: a label with an icon (Nyttjandeperiod, Avskrivningsmetod, the
   pickers) is as tall as one without, as on the compact detail pages. */
#asset_form .app-section-card .app-field__label {
    min-height: var(--icon-size-md);
}

/* Depreciation plan: the collapsible wrapper spans the centred column, so the segment ends at the table's right edge. */
#depreciation_plan_content {
    align-self: stretch;
}

/* Asset history: the tracking and note icons share one cell, side by side. */
#asset_history .asset_history_icons {
    display: inline-flex;
    gap: var(--spacing-sm);
    vertical-align: middle;
}

#asset_form .app-table__td > .sym,
#asset_history .asset_history_icons > .sym {
    display: block;
    height: calc(var(--font-body-sm-size) * var(--font-body-sm-line-height));
    line-height: calc(var(--font-body-sm-size) * var(--font-body-sm-line-height));
}

/* ========== Label-beside-field rows ==========
   .novus_form_row_with_gap is space-between and the field wrapper grows, so the field started
   where its own label ended: measured 185 / 199 / 226 px for Fraktavgift, Fakturaavgift and
   Fakturarabatt, with widths 312 / 299 / 272 — three ragged left edges and three widths. A fixed
   label column lines them up. The longest label measures 103px, so 7.5rem clears it.
   Only migrated rows match, and today that is these three.
   ============================================== */

.novus_form_row_with_gap > .app-field__label {
    /* 9rem, not 7.5: Fakturarabatt (%) carries an info icon and measures 128px, so a narrower
       column wrapped the icon onto its own line. nowrap keeps a label and its icon together. */
    flex: 0 0 9rem;
    white-space: nowrap;
}

/* ========== Horizontal gap between side-by-side fields ==========
   .novus_form_row is a flex row with no gap, so two fields in the same row sat flush against
   each other — measured 0px between Förfallodatum and Leveransvillkor, Leveranssätt and
   Leveransdatum, and across the three currency fields. The row's children are .app-field
   wrappers with their labels inside, so a column gap separates the fields without touching the
   label-to-field spacing. --spacing-xl is what .app-form puts between fields.
   Vertical rhythm is deliberately left alone.
   ================================================================= */

.app-section-card .novus_form_row {
    column-gap: var(--spacing-xl);
}

/* ========== Logotype dropzone row ==========
   The row is a flex container and the dropzone carries width:100%, so it wraps onto its own flex
   line - which is what makes it fill the column, and also why it cannot be wrapped in an .app-field
   without collapsing to the label's width. Flex lines have no gap by default, so the label sat
   tight against it while every .app-field on the page separates the two by --spacing-xs.
   Both classes in the selector: ten other templates carry drop_zone_container on a plain block,
   where row-gap would be inert today but not necessarily after someone makes one of them flex.
   ============================================ */
.novus_form_row.drop_zone_container {
    row-gap: var(--spacing-xs);
}

/* The drop target used to get its 200px from an inline-styled wrapper; the legacy .dropzone is
   height: 100% and would otherwise sink to its 50px dashed-border minimum. Width 100% is what
   wraps it onto its own flex line under the label. The frame itself deliberately keeps the legacy
   dropzone look on this page (decision 2026-09-29). */
#company_information_form .dropzone {
    width: 100%;
    height: 200px;
}

/* ========== Logotype preview card ==========
   The stored logo sits in an app-card; the body centres it and the image keeps the 250px cap
   the legacy inline styles gave it, so a wide or tall logo cannot blow the column up.
   ============================================ */
#company_information_form .image_container .app-card__body {
    align-items: center;
}

#company_information_form #logo_image {
    max-width: 250px;
    max-height: 250px;
}

/* Företagsinformation and the asset and asset type edit pages draw no section box, like the settings pages (asset_general,
   einvoice, year …). The card class stays for its column, gap and lone-field rules; only the
   frame goes, so the fields start at the legend's edge. */
#company_information_form .app-section-card,
#asset_form .app-section-card,
#asset_type_form .app-section-card {
    border: none;
    border-radius: 0;
    padding: 0;
}

/* ========== Field width caps inside a migrated section card ==========
   The legacy flex_stretch_* classes cap width in absolute pixels — long 385px, medium 192.5px,
   short 138px — from a fixed-width era. In a flexible column that leaves a lone field short of
   the column edge: measured Vår referens and Er referens ending at 1382 against 1405 for the
   Valuta/Kurs/Enhet row, so rows in one column had ragged right edges.
   Only a field that is alone on its row is released; where fields share a row the caps are what
   give them their relative widths, so Kurs and Enhet stay narrow.
   ====================================================================== */

/* :only-of-type, not :only-child — several rows carry hidden <input> siblings alongside the
   field wrapper, so :only-child never matched them. Among the div children the wrapper is the
   only one, and a row with two fields still has two, so those keep their caps. */
.app-section-card .novus_form_row > .app-field:only-of-type {
    max-width: none;
}

/* ==========================================================================
   Third-level menu (#third_header) — let app-tabs win over the legacy rules
   --------------------------------------------------------------------------
   common_header.htm already emits app-tabs/app-tabs__list/app-tabs__tab on the
   breadcrumb sibling links, but `#third_header a.sibling_button[.breadcrumb_selected]`
   in the legacy bundle outranks every one of them: the tabs kept 10pt/0-10px sizing,
   a near-black inactive label and the old blue selected state, so they did not look
   like components/app-tabs anywhere in the app. Restated at matching specificity.
   ========================================================================== */

#third_header a.sibling_button.app-tabs__tab {
    height: auto;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--font-body-md-line-height);
    color: var(--color-text-muted);
}

#third_header a.sibling_button.app-tabs__tab:hover {
    background-color: transparent;
    color: var(--color-text-default);
}

#third_header a.sibling_button.app-tabs__tab.is-active {
    margin-top: 0;
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: var(--font-weight-medium);
}

/* The tab strip is the page's own header row: no 40px indent before the first tab, no 98% width
   stopping short of the right edge, and one line under it. The underline is #third_header.app-tabs'
   own border (app-tabs.css); the legacy box-shadow sat 1px under it and read as a second strip. */
#third_header {
    box-shadow: none;
}

#third_header #third_header_scroll_container.app-tabs__list {
    width: 100%;
    padding: 0;
}

/* When the tabs do not fit, common_header.htm makes the list draggable — jQuery UI's own
   .ui-draggable is the only marker for that branch — and the two 42px scroll buttons are
   painted over its ends. Only then does the list need room for them. */
#third_header #third_header_scroll_container.app-tabs__list.ui-draggable {
    padding: 0 42px;
}

/* ==========================================================================
   Chosen inside a section card — company_information's country pickers
   (and inside any migrated section: einvoice's country picker sat outside a card and stayed square)
   and inside every migrated modal body, so a Chosen looks the same in a dialog as on the page
   --------------------------------------------------------------------------
   app-form.css styles Chosen under .app-form__inline as borderless; this rule gives it
   the field border back there too. A novus page like company_information has bordered
   .app-input fields, so its three Chosen selects rendered as raw plugin chrome beside
   them. Same look as .app-input--md.
   ========================================================================== */

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .chosen-container {
    width: 100% !important;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
}

/* min-height: forms.css floors every novus Chosen at 35px, a pixel off the fields beside it. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single {
    min-height: 0;
    height: 34px;
    line-height: 32px;
    padding: 0 var(--spacing-md);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    box-shadow: none;
    color: var(--text-primary);
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single div b {
    background: none;
}

/* Multi-select, same box as .app-input--md. forms.css draws #BDC1C3 borders, a bordered search input and
   a 2px black border when active on novus rows; these match its specificity and load later. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container.chosen-container-multi .chosen-choices {
    min-height: 34px;
    padding: 2px var(--spacing-sm);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-primary) !important;
    background-image: none;
    box-shadow: none;
    line-height: normal;
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-multi.chosen-container-active .chosen-choices {
    border: 1px solid var(--color-focus-ring) !important;
    box-shadow: 0 0 0 var(--focus-ring-offset) rgba(104, 131, 160, 0.12);
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-multi .chosen-choices li.search-choice {
    margin: 3px var(--spacing-xs) 3px 0;
    padding: 2px 22px 2px var(--spacing-sm);
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary) none;
    box-shadow: none;
    color: var(--text-primary);
    font-size: var(--font-body-sm-size);
    line-height: 20px;
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    top: 7px;
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-multi .chosen-choices li.search-field input.chosen-search-input {
    height: 28px;
    margin: 0;
    padding: 0 var(--spacing-xs);
    border: 0;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-primary);
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-multi .chosen-choices li.search-field input.chosen-search-input::placeholder {
    color: var(--text-tertiary);
    font-size: inherit;
}

/* Filter bars (account reconciliation, history log, assistant client/consultant filters): the same box as the
   Briox.Select beside it, at its width. The pages pass a fixed pixel width to Chosen, which lands inline. */
.app-filter-bar .chosen-container {
    min-width: 240px;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
}

.app-filter-bar .chosen-container-single {
    width: 100% !important;
}

/* forms.css styles filter-bar Chosen with :not(#codingtemplate_chosen), an id's weight: a ▼ glyph on top of the
   chevron, 13px text pushed down 2px, and a 2px grey border on keyboard focus. Same weight here to undo them. */
.app-filter-bar .novus_filter_input_block .chosen-container-single:not(#codingtemplate_chosen)::after {
    content: none;
}

.app-filter-bar .novus_filter_input_block .chosen-container-single:not(#codingtemplate_chosen) .chosen-single span {
    padding-top: 0;
    font-size: inherit;
}

.app-filter-bar .novus_filter_input_block .chosen-container-single:not(#codingtemplate_chosen) .chosen-single.ally-focus-within {
    border: 1px solid var(--color-focus-ring);
}

/* 28px Chosen, to sit beside .app-input--sm fields: put app-chosen--sm on the <select>. Chosen does
   not copy the select's classes, but inserts its container straight after it, hence the + selector
   (0,3,1 — one element above the 34px rules). */
select.app-chosen--sm + .chosen-container {
    font-size: var(--font-body-sm-size);
}
select.app-chosen--sm + .chosen-container-single .chosen-single {
    height: 28px;
    line-height: 26px;
    padding: 0 var(--spacing-sm);
    border-radius: var(--radius-sm);
}
select.app-chosen--sm + .chosen-container.chosen-container-multi .chosen-choices {
    min-height: 28px;
    padding: 0 var(--spacing-xs);
    border-radius: var(--radius-sm);
}
select.app-chosen--sm + .chosen-container-multi .chosen-choices li.search-choice {
    margin: 2px var(--spacing-xs) 2px 0;
    line-height: 18px;
}
select.app-chosen--sm + .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    top: 6px;
}
select.app-chosen--sm + .chosen-container-multi .chosen-choices li.search-field input.chosen-search-input {
    height: 24px;
    font-size: var(--font-body-sm-size);
}

/* Disabled matches a disabled .app-input. chosen.min.css fades it and forms.css paints it white,
   both with !important, hence the two here. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container.chosen-disabled {
    opacity: 1 !important;
}
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container.chosen-disabled .chosen-single {
    background: var(--color-disabled-bg) !important;
    border-color: var(--border-secondary);
    color: var(--color-disabled-text);
    cursor: not-allowed;
}

/* The plugin's arrow is a sprite; draw the same chevron the selects use instead. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single div {
    display: flex;
    align-items: center;
    width: 24px;
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single div::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined', sans-serif;
    font-size: var(--icon-size-md);
    color: var(--text-tertiary);
    line-height: 1;
}

/* The deselect cross (allow_single_deselect) is a sprite at chosen.min.css's fixed top: 6px; draw it as the same
   symbol glyph and grey as the chevron beside it, centred on the field. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single abbr {
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-size-md);
    height: var(--icon-size-md);
    transform: translateY(-50%);
    background: none;
    background-image: none !important; /* chosen.min.css forces its @2x sprite on high-DPI screens */
    color: var(--text-tertiary);
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single abbr::before {
    content: 'close';
    font-family: 'Material Symbols Outlined', sans-serif;
    font-size: var(--icon-size-sm);
    line-height: 1;
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-single .chosen-single abbr:hover {
    background: none;
    color: var(--text-primary);
}

/* forms.css paints an open Chosen with `border: 2px solid #000 !important`, which is why the
   control jumped to a heavy black outline the moment it opened. Matched with !important, since
   there is no way to outrank it otherwise. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-active .chosen-single,
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container-active.chosen-with-drop .chosen-single {
    border: 1px solid var(--color-focus-ring) !important;
    background: var(--bg-primary);
    box-shadow: 0 0 0 var(--focus-ring-offset) rgba(104, 131, 160, 0.12);
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container .chosen-drop {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: var(--spacing-xs);
}

/* The row under the cursor reads as a hover, not as a selection: a full-bleed accent bar down a
   250-item country list is the loudest thing on the page. Same treatment as .app-dropdown__item. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container .chosen-results li.highlighted {
    background-color: var(--color-hover-bg);
    background-image: none;
    color: var(--text-primary);
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body, .app-filter-bar) .chosen-container .chosen-results li.result-selected {
    background-color: var(--accent-light);
    background-image: none;
    color: var(--accent);
    font-weight: var(--font-weight-medium);
}

/* The plugin's own arrow element sits under the chevron drawn above; it has no glyph of its own
   but still takes 4px of the 24px box. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .chosen-container-single .chosen-single div b {
    display: none;
}

/* forms.css draws a literal ▼ on the container itself, so the control carried two arrows: that
   character plus the chevron above. Its selector borrows an id through :not(), so this one has to
   carry the same :not() to outrank it. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input_block .chosen-container-single:not(#codingtemplate_chosen)::after,
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input_block .chosen_old_style .chosen-container-single:not(#codingtemplate_chosen)::after {
    content: none;
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .chosen-container-single .chosen-search input[type=text] {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-family-primary);
    background-image: none;
}

/* An icon after a field label sits on the label's own line. .sym is display:flex, which on its
   own puts every one of them on a line of their own and doubles the label's height. */
/* app-form__label is the modal twin of app-field__label; the tooltip JS also stamps
   custom_tooltip_container on the icon, and legacy `span.custom_tooltip_container` is (0,1,1)
   display:flex - so without this the anchor takes a line of its own. */
.app-field__label,
.app-form__label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.app-field__label .sym,
.app-field__label .app-info-icon,
.app-form__label .sym,
.app-form__label .app-info-icon {
    display: inline-flex;
    vertical-align: middle;
}

/* Info tooltip icons sit beside the label text, after any list/picker icon */
.app-field__label > .app-info-icon[title],
.app-form__label > .app-info-icon[title] {
    order: 99;
}

.app-field__label .app-info-icon,
.app-form__label .app-info-icon {
    font-size: var(--icon-size-md);
}

/* Chosen sizes itself from the <select>, but its wrapper is a shrink-to-fit flex box, so the 100%
   above would collapse it to the arrow; the legacy 4px margin put it 4px below the fields beside it. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input_block {
    width: 100%;
    margin: 0;
}

:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input_block > .novus_filter_select,
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input_block > select {
    width: 100%;
    box-sizing: border-box;
}

/* forms.css sets margin-right:10px on .novus_filter_input (and the Briox.Select trigger inherits
   that class). Inside design-system containers fields are full-width, so strip the margin. */
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_select,
:is(.app-section-card, .app-detail-page__section-content, .app-dialog__body) .novus_filter_input {
    margin-right: 0;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
}

/* Dropzone message inside a section card — dropzone_customizations.css sets 20px bold, which on a
   200px logo box shouted over every field around it. The text is a hint, so it reads like one. */
.app-section-card .dropzone .dz-message,
#createFinancialYearForm .dropzone .dz-message {
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    font-weight: var(--font-weight-regular);
    color: var(--text-secondary);
}

/* ========== Modal-edit layout header ==========
   `BeginModalEditLayout` renders a standalone full-page form — 19 pages use it, seven of them
   already facelifted. Its header was the legacy `.header` black bar; it is now the same `.top-bar`
   as the regular layout. Two things that layout gets from its surroundings have to be supplied
   here: `.top-bar` has no horizontal padding of its own (in the regular layout `#main` provides
   it), and `.app-nav__logo` is `width: 100%`, which is right inside the sidebar and wrong in a
   flex bar.
   ============================================== */
.modal_edit_layout .top-bar {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
    border-bottom: 1px solid var(--border-secondary);
}

.modal_edit_layout .app-nav__logo {
    width: 12rem;
    flex-shrink: 0;
}

/* A white-label theme paints the logo as an accent chip (`custom_style.css`, inside its
   `THEME_TAG` blocks: accent-dark background, --radius-md, 5px 12px padding) so the default Briox
   mark reads against it. `app-nav.css:73` undoes that when the tenant has uploaded its own logo —
   but it is written as `.app-nav:not(.app-nav--collapsed) .app-nav__logo:has(…)`, and this shell
   has no `.app-nav` at all: the logo sits directly in `header.top-bar`. So a themed tenant with a
   custom logo got the chip behind it here and nowhere else. Same reset, without the nav ancestor.
   Specificity (0,5,0) — `:has()` takes its argument's — so it beats the theme's (0,1,0) on its own
   and does not depend on custom_style.css's load order. */
.modal_edit_layout .app-nav__logo:has(.app-nav__logo-mark[src]:not([src=""])) {
    background-image: none;
    background-color: transparent;
    border-radius: 0;
    padding: 0;
}

/* Logo and title read as one group on the left; the close button stays right. */
.modal_edit_layout .top-bar__title {
    margin-right: auto;
}

/* In the regular layout the detail page's left offset comes from the sidebar, and
   `.content_wrapper` has had its own margins commented out for years. Without a sidebar
   `app-detail-page__nav` sits flush against the viewport edge. Same gutter as the header
   above, so the nav lines up with the logo. Scoped to `.app-detail-page` so pages with
   their own centred layout — `modal_add_client` — are untouched. */
.modal_edit_layout .app-detail-page {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
    box-sizing: border-box;
}

/* ---------- date_picker_input inside an .app-input box ----------
   `date_picker_input` looks cosmetic but carries `display: block !important` (general.css:989),
   which counters daterangepicker setting display:none on the input after a date is picked — remove
   it and the date vanishes, leaving a lone calendar glyph (see facelift-list-page SKILL.md). So it
   stays on the field. Its other two declarations were only ever there to clear the old absolutely
   positioned glyph and to centre the date; inside .app-input the icon is a flex sibling and the
   field should read left-aligned like every other input. Three classes beat general.css's (0,1,0). */
.app-input > .app-input__field.date_picker_input {
    padding-left: 0;
    text-align: left;
}

/* ---------- A table must not clip a dropdown opened in its cells ----------
   `.app-table` clips to its radius with `overflow: hidden`, which also cut off the option list of
   any Briox.Select in the last rows (consultant roles, LV Moms periods, household type on SE
   invoice_edit). A table holding one stops clipping, and its corner cells take the radius
   themselves; head/foot paint their background on the cells so those corners stay rounded. */
.app-table:has(.novus_filter_select) {
    overflow: visible;
}
.app-table:has(.novus_filter_select) > .app-table__head > tr > th,
.app-table:has(.novus_filter_select) > .app-table__foot > tr > td {
    background: inherit;
}
.app-table:has(.novus_filter_select) > :first-child > tr:first-child > :first-child {
    border-top-left-radius: calc(var(--radius-lg) - 1px);
}
.app-table:has(.novus_filter_select) > :first-child > tr:first-child > :last-child {
    border-top-right-radius: calc(var(--radius-lg) - 1px);
}
.app-table:has(.novus_filter_select) > :last-child > tr:last-child > :first-child {
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}
.app-table:has(.novus_filter_select) > :last-child > tr:last-child > :last-child {
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

/* ---------- A collapsible legend inside a helpbox ----------
   The Crediflow panel on modal_add_client keeps `.novus_legend` because Briox.GroupToggler is bound
   to that class (global.js:126) and toggles `legend.next()` — so the class and the sibling order are
   both load-bearing. Its own chrome is not: a fixed 47px row with rules above and below (both
   !important in general.css), which inside a helpbox draws a line across the top of the box and a
   second one under the title. The helpbox already is the container. */
.app-helpbox > .novus_legend {
    height: auto;
    padding: 0;
    border-top: none !important;
    border-bottom: none !important;
}

/* ---------- Validator error state on a migrated input ----------
   Briox.Validator marks a failed field by adding `invalid` (validator.js:163), and forms.css:602
   styles that as `box-shadow: 0 0 5px red` + `border-radius: 1px` — a fuzzy pure-red glow that
   also squares off an .app-input's corner, while leaving the border itself neutral grey, so the
   field does not read as errored at all. The design system already has this state as
   .app-input--error (red border, soft ring on focus); map `invalid` onto it.

   Two classes beat forms.css's `input.invalid` (0,1,1), so no !important is needed. Not scoped to
   one page: any migrated input the validator marks should look like this. */
.app-input.invalid {
    border-color: var(--error);
    box-shadow: none;
}

.app-input.invalid:focus-within {
    box-shadow: 0 0 0 var(--focus-ring-offset) rgba(239, 68, 68, 0.12);
}

/* The legacy rule also forces `border-radius: 1px`; give each size its own radius back rather
   than hardcoding one, or an --sm input would come out with the --md corner. */
.app-input--sm.invalid { border-radius: var(--radius-sm); }
.app-input--md.invalid { border-radius: var(--radius-md); }
.app-input--lg.invalid { border-radius: var(--radius-lg); }

/* ---------- Spacing between side-by-side fields in modal_add_client ----------
   forms.css gives every legacy input `margin-right: 10px` as part of its shared rule; `.app-input`
   has no margin, because the design system spaces with gap. So converting the inputs closed every
   two-field row to a 0px gap — postcode/city, e-mail/phone, bankgiro/plusgiro, IBAN/BIC,
   first/last name, e-mail/confirm. --spacing-md is 10px, so this restores exactly what was lost.

   Scoped to this form, not to `.modal_edit_layout`: pages still on `fluid_input` keep their
   margin-right, and a row gap there would double it. */
#add_client_form .novus_form_row {
    gap: var(--spacing-md);
}

/* The two Briox.Select pickers kept their legacy classes, so they still carry that margin-right —
   with the gap above it would apply twice between Abonnemang and Tilläggstjänster. */
#add_client_form .novus_form_row .novus_filter_select {
    margin-right: 0;
}

/* ---------- Control corner radius in the modal-edit shell ----------
   The design system rounds controls to --radius-md (8px). Three controls in this shell predate
   that and read as square next to a migrated input — measured 4px, 3px and 2px against 8px.

   Buttons are handled with the other `.app-btn.modal_action_button` overrides further up. */

/* Briox.Select: custom_select.js copies the <select>'s classes onto its generated trigger, which
   picks up forms.css's shared 3px (`.novus_filter_input, .novus_long_input, …`). That rule is
   app-wide, so override it scoped to this shell rather than changing it. No !important needed —
   two classes beat one. */
.modal_edit_layout .novus_filter_select {
    border-radius: var(--radius-md);
}

/* Chosen: modal.css:532 sets 2px at (1,3,0) — the `:not(#codingtemplate_chosen)` carries an ID's
   weight — but without !important, so !important alone is enough to win. */
.modal_edit_layout .chosen-container-single .chosen-single,
.modal_edit_layout .chosen-container-multi .chosen-choices {
    border-radius: var(--radius-md) !important;
}

/* ========== Add-on services overview ==========
   clientmanager/addon_overview.htm had these in a page-level <style> block. Scoped to the table
   because `highlighted` and `clickable_table_row` are both shared names — `highlighted` is a
   Chosen results state in forms.css, and `clickable_table_row` is also used by
   bf/income_tax_returns/tax_code_mapping.htm, which has its own copy.
   The two colours are carried over verbatim; they predate the design system and want a
   selected-row token rather than a value picked here.
   ============================================== */
#client_list .clickable_table_row {
    transition: all 0.2s ease-in-out;
}

#client_list .clickable_table_row:hover {
    transform: scale(1);
    box-shadow: 0 1px 8px #c6edff;
}

/* A client row stays underlined and tinted while its service rows are expanded. */
#client_list .novus_table_row.underlined {
    box-shadow: inset 0 -1px 0 0 #0381ba;
}

#client_list .novus_table_row.highlighted {
    background-color: #E5F2F8;
}

/* The gap between the filter bar and the table is supplied by `.novus_table_header_block`, which is
   55px tall and holds the pagination and list-settings controls. Nine migrated list pages have no
   pagination and no list settings, so they have no header block either, and their table butts
   straight up against the filter bar. Give those the gap the others get for free; the `:has()`
   keeps it off every page that does carry the block. */
.app-list .app-filter-bar:not(:has(+ .novus_table_header_block)) {
    margin-bottom: var(--spacing-lg);
}


/* The import history's empty state lines up with the form above it rather than sitting centred
   in a column whose content is all left-aligned. */
.import_history_empty {
    margin-inline: 0;
}

/* ========== CRM required-field marker ========== */

/* Crm_General::CreateInput marks a required field with a star after the input (it used to be
   bullet_star.gif). The design system has no required indicator, and the bare `sym` default of
   20px reads as an info icon rather than a marker, so size it down and colour it as an error. */
.app-field__required {
    font-size: 14px;
    line-height: 1;
    color: var(--error);
    flex-shrink: 0;
}

/* CreateInput returns the marker glued after the input, so in a three-column layout it lands on
   the column edge and reads as belonging to the NEXT column's label. Push the input past it so the
   row renders label, marker, input. */
.app-field--inline:has(> .app-field__required) > .app-input,
.app-field--inline:has(> .app-field__required) > .app-radio-group__option {
    order: 1;
}

/* ...but then the marker's own width moved the field it marks 24px right of every other field in
   the column, so the one field that is supposed to stand out was the only one out of line. Give it
   no width and let the glyph overflow into the gap between the label and the field instead. */
.crm_field > .app-field__required {
    width: 0;
    overflow: visible;
    margin-right: calc(-1 * var(--spacing-md));
    transform: translateX(-16px);
}

/* CRM form fields are laid out in columns, and a field that flexes takes whatever its row leaves
   over - so a row with a picker button, an ID button or a required marker beside it ended up with
   a narrower field than the row above. Measured on Lägg till företag: six different widths in one
   form, from 89px to 240px. A fixed basis makes every field in the form the same. */
.crm_field > .app-input {
    flex: 0 0 auto;
    width: 15rem;
}


/* ========== CRM list tables: read-only value cells ========== */

/* These tables lost `table.editview` in the facelift, and with it the rule that made their
   read-only inputs borderless. The cell draws the grid line, so the input is a readout, not a
   control. Keyed on the
   `noborder` the markup already carried (it had no rule of its own), so editable table inputs
   elsewhere keep their border. */
.app-table input.noborder:not([type="checkbox"]):not([type="radio"]) {
    border: 0;
    background: transparent;
    width: 100%;
    padding: 0;
    /* An <input> takes the UA font, not the cell's - without this the readout renders
       Roboto 11px next to Geist 12px table text. */
    font: inherit;
    color: inherit;
}

/* ========== Fortnox migration (bf/import/import_migrate_fortnox.htm) ==========
   The page's 786-line <style> block, reduced to the pieces that have no design-system component
   yet and ported onto tokens: the wizard stepper, the progress bar, the accordion open state and
   the rows the page's own script builds (uploaded files, financial years, import summary,
   warnings). Each is tracked in ref/open-questions.md; the rest of the page uses app-card,
   app-helpbox, app-info-state, app-badge, app-grid and app-btn directly.
   ============================================================================ */

.migration_api_view {
    display: none;
}

/* --- Method selection --- */
.migration_method_icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}
.migration_method_icons > .sym {
    color: var(--accent);
}
.migration_method_options {
    max-width: 720px;
    margin: 0 auto var(--spacing-2xl);
}
/* Same column as the method cards above it */
.migration_method_column {
    max-width: 720px;
    margin: 0 auto;
}
.migration_method_option {
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.migration_method_option:hover {
    border-color: var(--color-border-strong);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.migration_method_option .app-card__header > .sym,
.migration_recent_item .app-card__header > .sym {
    flex-shrink: 0; /* a long failure reason beside it squeezed the glyph */
    font-size: var(--icon-size-xl);
    color: var(--color-text-muted);
}
.migration_method_option .app-card__header,
.migration_recent_item .app-card__header {
    justify-content: flex-start;
}
.migration_recent_item {
    cursor: pointer;
}
.migration_browse_link {
    color: var(--color-link-default);
    font-weight: var(--font-weight-semibold);
}

/* --- Progress bar (no app-progress component yet) --- */
.migration_progress_meta {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-body-sm-size);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xs);
}
.migration_progress_meta--sub {
    margin: var(--spacing-xs) 0 0;
    font-size: 11px;
    color: var(--color-text-subtle);
}
.migration_progress_track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    height: 8px;
    overflow: hidden;
}
.migration_progress_bar {
    background: var(--accent);
    height: 100%;
    width: 0;
    border-radius: var(--radius-sm);
    transition: width .3s ease;
}
.migration_progress_bar--error {
    background: var(--color-error);
}

/* --- Wizard stepper (no app-stepper component yet) --- */
.migration_wizard_steps {
    display: flex;
    flex-direction: column;
    margin-top: var(--spacing-lg);
}
.migration_wizard_step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: 0 0 var(--spacing-xl) var(--spacing-xl);
    border-left: 2px solid var(--color-border-default);
    margin-left: 9px;
    user-select: none;
}
.migration_wizard_step:last-child,
.migration_wizard_step.completed:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}
.migration_wizard_step_indicator {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border-strong);
    flex-shrink: 0;
    margin-left: -31px;
    background: var(--color-bg-default);
}
.migration_wizard_step.current .migration_wizard_step_indicator {
    border-color: var(--accent);
}
.migration_wizard_step.completed {
    border-left-color: var(--accent);
}
.migration_wizard_step.completed .migration_wizard_step_indicator {
    border-color: var(--accent);
    background: var(--accent);
}
.migration_wizard_step.completed .migration_wizard_step_indicator::after {
    content: '\2713';
    color: var(--color-text-inverse);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.migration_wizard_step_name {
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-default);
}
.migration_wizard_step_desc {
    font-size: 12px;
    color: var(--color-text-muted);
}
.migration_wizard_panel .app-info-state > .sym {
    font-size: 48px;
    color: var(--color-text-muted);
}

/* --- Year and data-type lists (rows built by the page script) --- */
.migration_year_select_all,
.migration_type_select_all {
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-default);
    margin-bottom: var(--spacing-xs);
}
.migration_year_list {
    display: flex;
    flex-direction: column;
    margin: var(--spacing-sm) 0 var(--spacing-lg);
}
.migration_year_item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}
/* A year's problem lines up under its label, past the 16px checkbox and the option gap. */
.migration_year_item .app-form__hint {
    padding-left: calc(16px + var(--spacing-sm));
}
.migration_type_list {
    margin-top: var(--spacing-md);
}
.migration_type_item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}
.migration_type_disabled {
    opacity: .5;
}
.migration_type_disabled label {
    cursor: default;
}
.migration_type_error {
    color: var(--color-error);
    font-size: 11px;
    margin-left: var(--spacing-sm);
}

/* --- File view: dropzone message and uploaded-file rows --- */
/* Two classes so the height also holds while a file is dragged over (app-dropzone's drag rule is (0,2,0)). */
.dropzone.migration_dropzone {
    min-height: 350px;
}
/* The migration's own message keeps the legacy weight and colour app-dropzone would soften
   (dropzone_customizations.css values); its title, subtitle and link set the rest themselves. */
.migration_dropzone.app-dropzone .dz-message {
    color: #4A565D;
    font-weight: var(--font-weight-bold);
}
.migration_drop_icon {
    margin-bottom: var(--spacing-md);
}
.migration_drop_icon .sym {
    font-size: 40px;
    color: var(--color-text-subtle);
}
.migration_drop_title {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
}
.migration_drop_subtitle,
.migration_drop_browse {
    color: var(--color-text-muted);
    font-size: var(--font-body-sm-size);
    margin-bottom: var(--spacing-sm);
}
.migration_drop_badges {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}
.migration_uploaded_files {
    margin-top: var(--spacing-md);
}
.migration_uploaded_file {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-body-sm-size);
}
.migration_uploaded_file.error {
    border-color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 8%, var(--color-bg-default));
}
.migration_uploaded_file_name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.migration_uploaded_file_type {
    color: var(--color-success);
    font-weight: var(--font-weight-semibold);
    margin-left: var(--spacing-sm);
}
.migration_uploaded_file_type.error {
    color: var(--color-error);
}
.migration_uploaded_file_remove {
    margin-left: var(--spacing-sm);
    color: var(--color-text-subtle);
    cursor: pointer;
    font-size: 12px;
}
.migration_uploaded_file_remove:hover {
    color: var(--color-error);
}

/* --- Accordion cards (open state toggled by the page script) --- */
.migration_accordion_header {
    cursor: pointer;
}
.migration_accordion_item.completed {
    border-color: var(--color-success);
}
.migration_accordion_arrow {
    transition: transform .2s;
}
.migration_accordion_arrow.open {
    transform: rotate(180deg);
}
.migration_accordion_body {
    display: none;
}
.migration_accordion_steps {
    margin: 0 0 var(--spacing-sm);
    padding-left: var(--spacing-xl);
    font-size: var(--font-body-sm-size);
    line-height: 1.8;
}
.migration_accordion_info {
    color: var(--color-info);
    font-size: var(--font-body-sm-size);
    margin-top: var(--spacing-sm);
}
.migration_accordion_preview {
    display: none;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: color-mix(in srgb, var(--color-success) 10%, var(--color-bg-default));
    border-radius: var(--radius-md);
    font-size: 12px;
}
.migration_accordion_preview_title {
    font-weight: var(--font-weight-semibold);
}
.migration_accordion_preview_details {
    color: var(--color-text-muted);
}

/* --- Import summary (rows built by the page script) --- */
.migration_summary_type {
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}
.migration_summary_type_header {
    display: flex;
    align-items: center;
    font-size: var(--font-body-md-size);
}
.migration_summary_type_name {
    font-weight: var(--font-weight-semibold);
}
.migration_summary_type_count {
    color: var(--color-success);
    margin-left: var(--spacing-sm);
}
.migration_summary_type_runs {
    margin-top: var(--spacing-xs);
    font-size: var(--font-body-sm-size);
    color: var(--color-text-subtle);
}
.migration_summary_type_note {
    margin-top: var(--spacing-xs);
    font-size: var(--font-body-sm-size);
    color: var(--color-text-muted);
}
.migration_summary_warnings_btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-default);
    cursor: pointer;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-warning) 10%, var(--color-bg-default));
}
.migration_summary_warnings_btn:hover {
    background: color-mix(in srgb, var(--color-warning) 18%, var(--color-bg-default));
}
.migration_summary_warnings_list {
    display: none;
    background: color-mix(in srgb, var(--color-warning) 8%, var(--color-bg-default));
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-top: var(--spacing-sm);
}
.migration_summary_warnings_list.open {
    display: block;
    margin-bottom: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
}
.migration_summary_warn_row {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    font-size: 12px;
}
.migration_summary_warn_icon {
    flex-shrink: 0;
    margin-top: 1px;
}
.migration_summary_warn_name {
    width: 200px;
    flex-shrink: 0;
    font-weight: var(--font-weight-semibold);
}
.migration_summary_warn_field {
    width: 130px;
    flex-shrink: 0;
}
.migration_summary_warn_msg {
    flex: 1;
}

/* --- Page-owned dialogs (disclaimer, company-number mismatch) --- */
.fortnox_disclaimer_modal {
    min-width: 440px;
    max-width: 520px;
}
.fortnox_disclaimer_modal p {
    margin: 0 0 var(--spacing-md);
}
.fortnox_disclaimer_modal a {
    color: var(--color-link-default);
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
}


/* ========== Briox.Modal dialogs with tabs (set/modal/modal_edit_user.htm) ==========
   Briox.Generic.ModalTabs toggles `active` on .modal_tab_button and `hidden` on .modal_tab_content,
   so the app-tabs look is bridged onto those classes instead of changing the script. The 65rem x 38rem
   panel size used to be inline on each tab panel. Each panel is body + footer, laid out like a dialog
   so the footer stays pinned while the body scrolls.
   Every panel keeps the legacy 38rem height so the dialog is the same size on every tab: Briox.Modal
   centres the popup once when it opens, so a taller tab would otherwise grow past the viewport.
   min-height: 0 lets the panel shrink on short screens; the body scrolls in both cases.
   ============================================================================ */
/* The legacy tab buttons are flex: 1 with left-aligned text; centre the label in each. */
/* modal.css draws the tab underline as an ::after (its border: none hides the app-tabs one); recolour it. */
.common_modal_tabs.app-tabs__list .modal_tab_button::after {
    background: var(--color-nav-fg-active);
}
.common_modal_tabs.app-tabs__list .modal_tab_button {
    justify-content: center;
}
/* The rights-source row is a legacy two-column grid (select column capped at 420px); the toggle
   link in the second column lines up with the select, not the label above it. */
.rights_source_row > .rights_source_toggle {
    align-self: end;
    justify-self: start;
}
.common_modal_popup > .modal_tab_content {
    display: flex;
    flex-direction: column;
    width: 65rem;
    max-width: 100%;
    height: 38rem;
    min-height: 0;
}
.common_modal_popup > .modal_tab_content.hidden {
    display: none;
}
.common_modal_popup > .modal_tab_content > .app-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}
/* The legacy form is its own scroller (overflow-x: auto) and would clip the last row inside the
   body; let the body scroll instead. */
.common_modal_popup > .modal_tab_content > .app-dialog__body > .common_modal_form {
    overflow: visible;
    flex: 0 0 auto;
}
/* toggle.css centres the slider in a 70px box, which leaves a gap after the Aktiv label; size the box to the slider. */
#personal_settings .app-form__row--inline > .switch {
    width: 38px;
    height: 20px;
}
#personal_settings .app-form__row--inline > .switch > .slider {
    inset: 0;
}

/* ========== Subscription overview: invoice status pill ==========
   The variant class (paid / unpaid / overdue) is emitted by PHP, so the pill keeps its legacy
   class and is coloured here on tokens. Replaces the template's own <style> block. */
.customer_invoice_status {
    display: inline-flex;
    align-items: center;
    margin-left: var(--spacing-sm);
    padding: 2px var(--spacing-md);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    vertical-align: middle;
}
.customer_invoice_status.paid {
    border-color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 18%, var(--color-bg-default));
}
.customer_invoice_status.overdue {
    border-color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 15%, var(--color-bg-default));
}

/* Cancel-subscription dialog (set/modal/modal_billing_cancel.htm): the 800px that was inline on its
   form. Briox.Modal gives the popup no width, so long paragraphs would otherwise set it. */
.common_modal_popup #confirm_user_and_company_info_form.common_modal_form {
    max-width: 50rem;
}

/* Role template dialog (set/modal/modal_edit_role_template.htm): Briox.Modal gives the popup no
   width, so expanding a module row in the rights table made the whole dialog grow and shrink. Fix
   the width to what the Edit User tabs use; a wider expanded row scrolls inside the body instead. */
.common_modal_popup:has(> .app-dialog__body > #user_rights_form),
.common_modal_popup:has(> .app-dialog__body > form[id^="user_rights_form_"]) {
    width: 65rem;
    max-width: calc(100vw - 2rem);
}

/* Package change (admin/subscription/package_change.htm): the fixed action bar covered the bottom of
   the "Compare packages" footer link; give the packages footer its own clearance. The rest of that
   page is bespoke and waits for design. */
.brx-packages .brx-packages-footer {
    padding-bottom: 5rem;
}

/* Same page: the package cards are laid out with justify-content: flex-end, so with fewer cards than
   fill the 1440px row they hang off the right edge. Align them with the rest of the page instead. */
.brx-packages .brx-packages-items {
    justify-content: flex-start;
}

/* The inner block is capped at 1440px and centred with auto margins, so on a viewport
   wider than that it drifts right of the text above it. Keep the cap, drop the centring. */
.brx-packages .brx-packages-inner {
    margin-left: 0;
    margin-right: auto;
}

/* ── Package change — typography ───────────────────────────
   The page predates the type system and sets Montserrat on everything, which is
   the DISPLAY family only. Put body copy back on the primary family and map the
   sizes onto the scale; headings and the price keep the display face. */

.brx-packages,
.brx-packages .brx-packages-inner,
.brx-packages .brx-packages-inner * {
    font-family: var(--font-family-primary);
}

.brx-packages > div > p.is-small {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    line-height: var(--font-body-md-line-height);
    letter-spacing: var(--font-body-md-letter-spacing);
    color: var(--color-text-default);
}

.brx-packages .brx-packages-inner .brx-packages-item-details-header-heading {
    font-family: var(--font-family-display);
    font-size: var(--font-display-sm-size);
    font-weight: var(--font-display-sm-weight);
    line-height: var(--font-display-sm-line-height);
    letter-spacing: var(--font-display-sm-letter-spacing);
}

/* The page gives every h1-h6 a 30px top margin, which opens a gulf between the
   package name and its price. Close it inside the cards. */
.brx-packages .brx-packages-item-details-header-heading,
.brx-packages .brx-packages-item-details-price-item {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.brx-packages .brx-packages-item-details-order {
    margin-top: var(--spacing-md);
}

.brx-packages .brx-packages-item-details-price-item {
    font-family: var(--font-family-display);
    font-size: var(--font-display-lg-size);
    font-weight: var(--font-display-lg-weight);
    line-height: var(--font-display-lg-line-height);
    letter-spacing: var(--font-display-lg-letter-spacing);
}

.brx-packages .brx-packages-item-details-price-item-detail {
    display: block;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: 400;
    color: var(--color-text-muted);
}

.brx-packages .brx-packages-item-feature-text,
.brx-packages .brx-packages-item-feature-text p {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-regular);
    line-height: var(--font-body-md-line-height);
    letter-spacing: var(--font-body-md-letter-spacing);
    color: var(--color-text-default);
}

/* Sub-headings inside the description keep their own weight and colour */
.brx-packages .brx-packages-item-feature-text b,
.brx-packages .brx-packages-item-feature-text strong {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-default);
}

.brx-packages .brx-packages-item-details-header-label-text {
    font-size: var(--font-body-sm-size);
    font-weight: 500;
    line-height: var(--font-body-sm-line-height);
}

.brx-packages .brx-packages-footer-button {
    font-size: var(--font-body-md-size);
    font-weight: 400;
}

/* The package buttons were legacy novus_action_button, centred with auto margins.
   As app-btn they are inline-flex, so the row needs to do the centring. */
.brx-packages .brx-packages-item-details-order {
    align-items: center;
}

.brx-packages .brx-packages-item-button {
    width: 100%;
}

/* ── Todaysevents mass-tag modal ────────────────────────────
   Two of the five radios own a control. Give every option the same label
   column so the labels line up and none of them wraps, and stop the control
   stretching — .app-input is width:100% and would eat the row. */

.masstag_options .app-radio-group__option {
    flex: 0 0 11rem;
}

.masstag_options .masstag_options__control {
    width: 11rem;
    flex: 0 0 auto;
}

/* ── addevent: bound the inline field widths ────────────────
   .app-input is width:100%, and the scoped rules that bound it cover .app-list and
   .app-dialog__body only — not a detail page — so every field stretched the full row. Same
   page-scoped workaround as pre_acct.htm and accrual.html; see open-questions.md. Fields that
   carry app-input--narrow keep their own 7rem cap, since that is a max-width. */

#addevent .app-detail-page__section-content .app-field--inline > .app-input {
    flex: 0 1 22rem;
    width: 22rem;
}

/* The contact person / company selects sit in a span that ajax_updater.php refills. */
#addevent .app-detail-page__section-content .app-field--inline > span[id$="_div"]:has(> select.app-input) {
    flex: 0 1 22rem;
    width: 22rem;
}

#addevent .app-detail-page__section-content .app-field--inline > textarea.app-input {
    flex: 0 1 30rem;
    width: 30rem;
}

/* The reminder rows put two or three checkbox labels after a select; without this "E-post" breaks
   across two lines and the row grows to 40px. */
#addevent .app-detail-page__section-content .app-radio-group__label {
    white-space: nowrap;
}

/* ========== Report pages (com/report/*.htm) ==========
   .warning_box stays on the accounts-moved banner because LoadReport() hides it by that class;
   general.css gives it its own yellow, margin and padding, which the helpbox replaces. */
.app-helpbox.warning_box {
    margin: 0 0 var(--spacing-2xl);
    padding: var(--spacing-lg) var(--spacing-xl);
    background-color: #fff3cd;
}

/* A radio that leads a row of inputs (interval from - to, series) must not give up its width to
   the 100%-wide inputs beside it; "Show Interval" wrapped onto two lines otherwise. */
.app-field--inline > .app-radio-group__option {
    flex-shrink: 0;
}

/* The settings fieldset on a report page. .app-input is width:100% and nothing bounds it in the
   field grid, so a date field ran the full column; give text fields and selects a reading width
   and dates a date width. */
.app-report-settings .app-field--inline > .app-input,
#modal_print .app-field--inline > .app-input {
    flex: 0 1 16rem;
    width: auto;
    min-width: 0;
}

/* Chosen copies the <select>'s measured width onto its container as an inline style; without the
   legacy novus_long_input the multi-select measured 736px and forced a horizontal scroll. */
.app-report-settings .app-field--inline > .chosen-container {
    width: 16rem !important;
    flex: 0 0 auto;
}

/* The spinner LoadReport() drops into the output area while the report is fetched */
.in_page_report_area > .app-spinner {
    display: block;
    margin: var(--spacing-3xl) auto;
}

/* VAT report period ticks are PHP-built display-only checkboxes (readonly does not stop a click), drawn like app-checkbox. */
.in_page_report_area input[type="checkbox"][readonly] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0 var(--spacing-xs) 0 0;
    vertical-align: middle;
    border: 1.5px solid var(--neutral-300);
    border-radius: var(--radius-sm, 4px);
    background-color: var(--bg-primary);
    pointer-events: none;
}

.in_page_report_area input[type="checkbox"][readonly]:checked {
    border-color: var(--accent);
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* ========== Report print popup (generic/modal/req_modal_print.php) ==========
   Fifteen report pickers rendered from one PHP file into a window.open popup with no template
   layer, so the design system is applied from here rather than by rewriting the markup. Scoped to
   #modal_print; the legacy fieldset / legend / .column / <p> skeleton stays because the popup's
   Prototype script (FillForm, disableFilters, clearTextFields) keys off element ids inside it. */

#container_popup:has(#modal_print) {
    background: var(--bg-primary);
}

#modal_print {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    color: var(--text-primary);
}

#modal_print > .app-dialog__header {
    padding: var(--spacing-md) var(--spacing-lg);
}

#modal_print > form {
    padding: 0 var(--spacing-lg);
}

/* Each legacy fieldset is a form group: title with a hairline under it, fields below. */
#modal_print fieldset {
    margin: var(--spacing-lg) 0 0;
    padding: 0;
    border: 0;
}

#modal_print legend {
    width: 100%;
    padding: 0 0 var(--spacing-sm);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    line-height: var(--font-body-md-line-height);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-tertiary);
}

#modal_print legend.toggleclosed {
    border-bottom-color: var(--border-tertiary);
    color: var(--text-secondary);
}

/* forms.css draws the toggle triangle in ::before with a 1rem box; keep it, colour it. */
#modal_print legend.togglelegend::before {
    color: var(--text-tertiary);
}

#modal_print .fieldset_wrapper {
    padding: var(--spacing-md) 0 0;
    background: transparent;
}

#modal_print fieldset .column.one {
    padding-left: 0;
}

#modal_print fieldset .column {
    border-right-color: var(--border-tertiary);
}

/* A <p> is a field row: a 110px label (or a radio + inline label) followed by its controls. */
#modal_print fieldset p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs) var(--spacing-sm);
    margin: 0 0 var(--spacing-sm);
    padding: 0;
    line-height: var(--font-body-sm-line-height);
}

#modal_print fieldset p label {
    float: none;
    width: 110px;
    padding: 0;
    text-align: left;
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--font-body-sm-line-height);
    color: var(--text-secondary);
}

#modal_print fieldset p label.inline {
    width: auto;
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
}

/* pickdate()'s calendar glyph is a label too; undo the row-label metrics inside its app-input box. */
#modal_print .app-input--date {
    gap: var(--spacing-sm);
}

/* Beats legacy fieldset input.date (80px), which leaves no slack for a full date. */
#modal_print .app-input--date > .app-input__field {
    width: 5.75rem;
}

#modal_print fieldset p .app-input > label.sym {
    width: auto;
    font-size: var(--icon-size-md);
    line-height: 1;
    color: var(--text-tertiary);
}

/* In a narrow .column a long radio label wrapped under its radio; let the closing label take the
   remaining row width and wrap its own text instead. */
#modal_print fieldset p > label.inline:last-child {
    flex: 1 1 0;
    min-width: 0;
}

#modal_print fieldset h1,
#modal_print fieldset h3 {
    margin: 0 0 var(--spacing-sm);
    padding: 0;
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

/* Native text inputs and selects take the app-input--md metrics. Selects stay native: the popup
   restores saved selections through Prototype FillForm by element id and value. Controls already
   migrated to app-input / app-radio-group / app-checkbox are left to their own components. */
#modal_print input[type="text"]:not(.app-input__field),
#modal_print select:not(.app-input) {
    box-sizing: border-box;
    height: 34px;
    min-width: 4.5rem;
    padding: 0 var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--font-body-md-line-height);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#modal_print select:not(.app-input) {
    padding-right: var(--spacing-xl);
}

#modal_print input[type="text"]:not(.app-input__field):hover,
#modal_print select:not(.app-input):hover {
    border-color: var(--neutral-400);
}

#modal_print input[type="text"]:not(.app-input__field):focus,
#modal_print select:not(.app-input):focus {
    outline: none;
    border-color: var(--color-focus-ring);
    box-shadow: 0 0 0 var(--focus-ring-offset) rgba(104, 131, 160, 0.12);
}

#modal_print input[type="text"]:not(.app-input__field):disabled,
#modal_print input[type="text"]:not(.app-input__field).readonly,
#modal_print input[type="text"]:not(.app-input__field)[readonly],
#modal_print select:not(.app-input):disabled {
    background: var(--color-disabled-bg);
    color: var(--color-disabled-text);
    border-color: var(--border-tertiary);
}

#modal_print input[type="radio"]:not(.app-radio-group__option > input),
#modal_print input[type="checkbox"]:not(.app-radio-group__option > input, .app-checkbox__option > input) {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

/* The button row is a <p align="right"> in the 20 inline branches; it reads as the dialog footer and
   stays in view while a tall picker scrolls. Their markup order is On screen, PDF, Excel, Cancel;
   row-reverse puts Cancel first and the primary action last, as in app-dialog__footer. */
#modal_print p:has(> input.app-btn) {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0 0;
    padding: var(--spacing-md) 0 var(--spacing-lg);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-secondary);
}

/* Chart of accounts (report/modal/modal_acctchrt.htm) is the one branch with its own template and a real
   app-dialog__footer in reading order. Same sticky bottom as the <p> rows, flush with the fieldsets. */
#modal_print .app-dialog__footer {
    position: sticky;
    bottom: 0;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) 0 var(--spacing-lg);
    background: var(--bg-primary);
}

/* ========== Registry edit pages — inline fields fill their row ==========
   app-input.css caps an inline field at 240px when it sits straight in a detail-page section,
   because on the settings pages nothing bounds it and it stretches the page open. The registry
   edit pages have that exact shape but their sections do bound the field, so the cap only took
   them from filling the row to 240px. Keyed on the form id, the way pre_acct already scopes its
   own width rule. Revisit when the cap itself can be narrowed to the pages that need it.
   ======================================================================= */

#item_input .app-detail-page__section-content > .app-field--inline > .app-input,
#contact_input .app-detail-page__section-content > .app-field--inline > .app-input,
#contact_supplier_input .app-detail-page__section-content > .app-field--inline > .app-input {
    width: 100%;
}


/* ========== Integrations marketplace (integration/integrations.htm) ==========
   Replaces stylesheets/integrations.css. The cards are app-card in an app-grid; what is left here is
   the page's own state logic (which footer button shows for a card's activation state, driven by the
   data-* attributes the script toggles), the brand-logo block, and the spacing between the intro,
   helpbox, filter bar and grid. Natural home for the logo block: a card media variant, if design
   wants one.
   ============================================================================ */
.integrations-wrapper > .app-page__intro,
.integrations-wrapper > .app-filter-bar {
    margin-bottom: var(--spacing-xl);
}

/* Header: logo then titles, not the component's space-between; titles stack. */
.integrations-wrapper .app-card__header.integration-header-layout {
    justify-content: flex-start;
}
.integrations-wrapper .header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
    min-width: 0;
}
.integrations-wrapper .app-card__title > .app-badge {
    margin-left: var(--spacing-xs);
    vertical-align: middle;
}

/* Brand logo with the optional "via" partner mark overlapping its corner. */
.integrations-wrapper .logo-wrapper {
    position: relative;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
}
.integrations-wrapper .integration-logo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-default);
    object-fit: contain;
}
.integrations-wrapper .overlay-logo {
    position: absolute;
    right: -0.5rem;
    bottom: -0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-default);
    background: var(--color-bg-default);
    object-fit: contain;
}

/* The description takes the slack so the price and footer line up across a row of cards. */
.integrations-wrapper .integration-body > .description {
    flex: 1 1 auto;
    margin: 0;
    color: var(--color-text-muted);
}

/* The first link in the footer sits left, the rest right. */
.integrations-wrapper .card-footer-actions > .button1 {
    margin-right: auto;
}
.integrations-wrapper .card-footer-actions .btn-buy,
.integrations-wrapper .card-footer-actions .btn-connect {
    order: 1;
}
/* Labels stay on one line; a footer that runs out of room wraps whole buttons onto a second row
   (Finnish and Estonian labels run longer than the Swedish and English on screen). */
.integrations-wrapper .card-footer-actions {
    flex-wrap: wrap;
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
}
/* Tighter horizontal padding so two labelled buttons fit one 327px card row (measured 279px free
   at the component's padding, 295px at this). */
.integrations-wrapper .card-footer-actions .app-btn {
    --btn-px: var(--spacing-md);
}
.integrations-wrapper .card-footer-actions .app-btn--ghost {
    --btn-px: var(--spacing-sm);
}

/* State: the script flips data-activated, the CSS decides which of the two buttons shows. */
.integrations-wrapper .integration-item[data-activated="0"] .button4,
.integrations-wrapper .integration-item[data-activated="1"] .button3,
.integrations-wrapper .integration-item[data-btn-type="toggle"] .btn-link {
    display: none;
}
.integrations-wrapper .integration-item[data-activated="0"] .btn-connect {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
/* Beside a buy or connect button the toggle is the secondary action: outline, not filled. */
.integrations-wrapper .btn-buy ~ .btn-toggle,
.integrations-wrapper .btn-connect ~ .btn-toggle {
    background-color: transparent;
    color: var(--btn-accent);
    border-color: currentColor;
}
.integrations-wrapper .btn-buy ~ .btn-toggle:hover,
.integrations-wrapper .btn-connect ~ .btn-toggle:hover {
    background-color: var(--btn-tint);
}

/* The script hides cards and the no-results block with the legacy .hidden, which loses to the
   components' own display. Same case as .app-spinner.hidden in app-spinner.css. */
.integrations-wrapper .app-card.hidden,
.integrations-wrapper .app-empty-state.hidden {
    display: none;
}

/* Terms-of-service dialog (fs/modal/modal_tos_confirm.htm): Briox.Modal gives the popup no width, so the
   intro sentence set it; the two documents are link rows in text colour, not orange text links. */
.common_modal_popup:has(#read_tos) {
    width: 32rem;
    max-width: calc(100vw - 2rem);
}
.tos_document_link {
    color: var(--text-primary);
    text-decoration: none;
}
.tos_document_link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}
.tos_document_link .sym {
    color: var(--text-secondary);
}
/* The confirmation is the decision, so it reads at body size, not as a 12px caption. */
.common_modal_popup:has(#read_tos) .app-checkbox__label {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-regular);
}

/* CRM extended search (crm/modal/modal_search*.htm): Crm_General::CreateInputRows emits inline
   label + input rows shared with 16 CRM pages; in this modal's three columns stack them instead. */
.modal_search_section .app-field--inline {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-xs);
    margin-bottom: 0;
}

.modal_search_section .app-field--inline > .app-field__label {
    min-width: 0;
}

.modal_search_section .app-field--inline > .app-input {
    width: 100%;
    min-width: 0;
}

/* The type-colour icon the modal's script inserts, the retrieve button, radio groups. */
.modal_search_section .app-field--inline > :not(.app-input):not(.app-field__label) {
    align-self: flex-start;
}

/* The type-colour icons (inserted after their select) and the org-no retrieve button sit beside the label. */
.modal_search_section .app-field--inline:has(> #icon_company_type, > #icon_person_type, > #bt_retrieve_company_info) {
    flex-flow: row wrap;
    align-items: center;
    column-gap: var(--spacing-xs);
}

.modal_search_section .app-field--inline > :is(#icon_company_type, #icon_person_type, #bt_retrieve_company_info) {
    order: 1;
    align-self: center;
}

/* CreateInputRows renders the retrieve link as a ghost button; match the label icon on the supplier
   invoice (a bare app-info-icon inside the label). */
.modal_search_section #bt_retrieve_company_info {
    width: auto;
    height: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
}

.modal_search_section #bt_retrieve_company_info > .sym {
    font-size: var(--icon-size-md);
    color: var(--text-tertiary);
}

.modal_search_section .app-field--inline:has(> #icon_company_type, > #icon_person_type, > #bt_retrieve_company_info) > .app-input {
    order: 2;
    flex: 1 0 100%;
}

/* Modalbox content inherits 14px and .app-dialog__body p caps at 600px; match a page helpbox. */
.modal_search_tip .app-helpbox__body p {
    font-size: var(--font-body-sm-size);
    max-width: none;
}

.modal_search_section + .modal_search_section {
    margin-top: var(--spacing-lg);
}

/* Payment cancellation (bf/modal/modal_confirm_payment_cancellation.htm): Briox.Modal sizes the popup to
   its content, so the longest bullet set it on one line (1025px). */
.common_modal_popup:has(#button_continue_with_cancellation) {
    width: 42rem;
    max-width: calc(100vw - 2rem);
}

/* Mobile-app invitation (set/modal/modal_send_user_mobile_app_invitation.htm): the note's bullet
   list comes from the language string, so it cannot take a class; give it air above and below. */
.common_modal_popup:has(#app_invite_send) #invite_user_form ul {
    margin-block: var(--spacing-lg);
}

/* Account reconciliation: tables.css caps #account_list_container at 70vh (250px from JS once an
   account is ticked) and scrolls it, so the horizontal bar of the scroll wrapper inside sat at the
   bottom of the whole table. The wrapper takes the cap instead and is the only scroller. */
#account_list_container:has(> .app-table-wrap--scroll) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#account_list_container > .app-table-wrap--scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Account reconciliation overview: headers may break onto two lines, so the table fits a large screen instead of
   every column holding its one-line caption width. app-list--scroll sizes the table to max-content, which never lets
   a caption wrap; auto width shrinks the columns first and only scrolls when even the wrapped captions don't fit.
   A wrapped right-aligned caption keeps its lines right-aligned. */
.app-list--scroll #account_list.novus_list_table {
    width: auto;
}

#account_list thead th,
#account_list thead th > div,
#account_list thead th > div > span {
    white-space: normal;
}

#account_list thead th.right > div,
#account_list thead th.right > div > span {
    text-align: right;
}

/* tables.css paints the sticky overview header white so rows don't show through it, covering the list's grey header;
   the same opaque grey as the transactions table below keeps both. */
table#account_list thead th {
    background: var(--bg-tertiary);
}

/* Transactions: a document icon without documents and the status lock are greyed out by PHP; give them the
   action icon's disabled state instead of a faded icon that still takes the hover and hand cursor. */
#transaction_list .app-col--actions .app-action.greyed_out_icon {
    opacity: 1;
    color: var(--color-disabled-text);
    background: none;
    cursor: default;
    pointer-events: none;
}

/* Summary checkbox: left edge under the header's select-all box, and the label hugs the box so a click beside it in
   the cell doesn't toggle (and save) the summary. */
#account_list td > .app-checkbox__option:has(> .summary_checkbox) {
    justify-content: flex-start;
    width: fit-content;
}

/* E-invoice supplier dialog (register/modal/modal_supplier_contact_einvoice.htm): one match card per grid row
   in the second column, so the e-invoice card lines up with the first match instead of the whole stack. */
.supplier_einvoice_matches {
    display: contents;
}
@media (min-width: 641px) {
    .supplier_einvoice_matches > .app-card {
        grid-column: 2;
    }
}

/* Crona token dialog: Briox.Modal gives the popup no width, so the one-sentence title set it (665px). */
.common_modal_popup:has(> .app-dialog__body .crona-token-field) {
    width: 32rem;
    max-width: calc(100vw - 2rem);
}


/* Side panel image viewer: the rotate button sticks to the top of the viewer's scroll box, and the
   negative margin keeps it from pushing the image down. */
#linked_file_viewer .image_rotate_icon {
    --rotate-btn-size: calc(var(--icon-size-md) + 2 * var(--spacing-xs));
    position: sticky;
    top: var(--spacing-sm) !important;
    left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--rotate-btn-size);
    height: var(--rotate-btn-size);
    margin: var(--spacing-sm) 0 calc(-1 * (var(--rotate-btn-size) + var(--spacing-sm))) var(--spacing-sm);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Incoming documents, "Skapa leverantörsfaktura eller verifikat": the two choices sit in separate bars (one inside the
   form, one after it), so trim the bars' and the form's padding to stack them close (keeping room for the 4px focus
   ring), and size both from the longest translation (Lithuanian) instead of a fixed 200px that clipped the Swedish label. */
.common_modal_content:has(#button_create_journal) #modal_payment_form {
    padding-bottom: 0;
}

.common_modal_content:has(#button_create_journal) > .common_modal_action_bar,
.common_modal_content:has(#button_create_journal) #modal_payment_form > .common_modal_action_bar {
    min-height: 0;
    padding-block: var(--spacing-xs);
}

/* The dialog focuses this body on open (modal_button_to_focus_on), so neither choice starts out selected. */
.common_modal_content:has(#button_create_journal):focus {
    outline: none;
}

#button_create_supplier_invoice,
#button_create_journal {
    min-width: 18rem;
}

/* ========== Incoming documents: automation banner (app-helpbox--success) ==========
   Its body is HTML from IncomingDocumentAutomation::BuildAutomationBannerText: a category list whose
   rows each carry a toggle that slides a hidden list of links open. */
.app-helpbox.automation_banner {
    margin: var(--spacing-lg) 0 0;
}

/* The close button is pinned top-right; keep the title and rows clear of it. */
.app-helpbox.automation_banner > .flex-row {
    padding-right: calc(28px + var(--spacing-md));
}

.automation_banner li + li {
    margin-top: var(--spacing-xs);
}

.automation_banner .automation_banner_toggle {
    background: none;
    border: none;
    padding: 0;
    margin-left: var(--spacing-xs);
    color: inherit;
    cursor: pointer;
    vertical-align: middle;
}

.automation_banner .automation_banner_toggle .sym {
    font-size: var(--icon-size-sm);
    transition: transform var(--transition-fast);
}

.automation_banner .automation_banner_toggle.open .sym {
    transform: rotate(180deg);
}

.automation_banner .automation_banner_details {
    margin: var(--spacing-xs) 0 var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-body-sm-size);
}

/* Orange links on the green box read poorly; they take the body text colour and underline on hover. */
.automation_banner a,
.automation_banner a:visited,
.automation_banner a:hover {
    color: var(--text-primary);
}

.automation_banner a {
    text-decoration: none;
}

.automation_banner a:hover {
    text-decoration: underline;
}

/* Image viewers: RotateImage (archive.js) gives the image's parent a negative margin-top on portrait
   images; without a formatting context here it collapses outward and lifts the rotate icon out of view. */
div:has(> .image_rotate_icon) {
    display: flow-root;
}

/* Accrual modal: the days-calculation note is one long sentence, and Briox.Modal sizes the popup to
   its content, so showing it widened the dialog 860 -> 1147px. Containment makes it wrap instead. */
#accrual_form .days_calculation_info {
    contain: inline-size;
}

/* Accrual modal: fixed leading columns so fields line up across rows - Bokföringsdatum under Antal
   periodiseringar, and the VAT and amount-2 accounts under the first account row. */
#accrual_form .modal_form_row:has(#accrual_modal_start_date) > .label_input_wrapper:nth-child(-n+2),
#accrual_form .modal_form_row:has(#accrual_modal_posting_date_select) > :nth-child(-n+2) {
    flex: 0 0 13rem;
}

/* The journal variant adds a VAT amount field to the VAT row, so that row is left out there. */
#accrual_form .modal_form_row > .label_input_wrapper:has(> #accrual_modal_accrual_amount),
#accrual_form .modal_form_row > .label_input_wrapper:has(> #accrual_modal_accrual_amount_2),
#accrual_form .modal_form_row > .label_input_wrapper:has(> #accrual_modal_journal_vat_amount),
#accrual_form .vat_select_show_hide:not(:has(#accrual_modal_journal_vat_amount)) > .flex_stretch_medium_intermediate {
    flex: 0 0 16rem;
}

/* Bottom-align, so a label that wraps in a longer locale does not push its input out of line. */
#accrual_form .modal_form_row:has(#accrual_modal_posting_date_select),
#accrual_form .modal_form_row:has(> .label_input_wrapper > #accrual_modal_accrual_amount),
#accrual_form .modal_form_row:has(> .label_input_wrapper > #accrual_modal_accrual_amount_2),
#accrual_form .vat_select_show_hide:not(:has(#accrual_modal_journal_vat_amount)) {
    align-items: flex-end;
}

/* Radio blocks match .label_input_wrapper's 7px margin and an input's height, so they centre on the inputs. */
#accrual_form .modal_form_row:has(#accrual_modal_posting_date_select) > .flex_stretch_medium_intermediate,
#accrual_form .vat_select_show_hide:not(:has(#accrual_modal_journal_vat_amount)) > .flex_stretch_medium_intermediate {
    margin-bottom: 7px;
}

#accrual_form .modal_form_row:has(#accrual_modal_posting_date_select) > .flex_stretch_medium_intermediate > .app-radio-group,
#accrual_form .vat_select_show_hide:not(:has(#accrual_modal_journal_vat_amount)) > .flex_stretch_medium_intermediate > .app-radio-group {
    min-height: 34px;
}

/* Credit settlement confirm: the yes/no toggle's wrapper spans the form and forms.css centres its content. */
.novus_filter_input_block:has(> .novus_radio_toggle > #radio_confirm_credit_quit_yes) {
    justify-content: flex-start;
}

/* Factoring modal: the total row draws its own rule above, so the row before it drops the divided
   rule (no double line), and the total keeps none below since the row after it is usually hidden. */
#invoice_factoring_modal .app-data-list--divided .app-data-list__row:has(+ .app-data-list__row--total),
#invoice_factoring_modal .app-data-list--divided .app-data-list__row--total {
    border-bottom: none;
}

/* The hidden payout row counts as the last child, so the total row keeps the divided bottom padding. */
#invoice_factoring_modal .app-data-list--divided .app-data-list__row--total {
    padding-bottom: 0;
}

/* The distribution segment sits in a stretching form row; keep it as wide as its options. */
#invoice_factoring_modal .app-form__row > .app-segment {
    align-self: flex-start;
}

/* CustomTooltips makes the info icon's wrapper display:flex, which drops it below the label text. */
#invoice_factoring_modal .app-data-list__label > .custom_tooltip_container {
    display: inline-flex;
    vertical-align: middle;
}

/* Year page: the create form is a column of equally wide cards; chart of accounts and accounting method
   are picked from radio cards, which the design system has no component for yet. */
#createFinancialYearForm .year_create {
    display: flex;
    flex-direction: column;
    /* novus_edit_block_body (lists.css) sets row wrap + align-items: flex-start, which shrinks each card. */
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--spacing-xl);
    width: 100%;
    max-width: 880px;
    /* The fieldset is a centring flex column; a capped child would otherwise sit in the middle. */
    align-self: flex-start;
}

#createFinancialYearForm .year_create > .app-helpbox {
    margin: 0;
}

/* The info icons' tooltips open inside the cards; overflow: hidden would cut them off. The card
   headers have no background, so the rounded corners need no compensation. */
#createFinancialYearForm .year_create > .app-card {
    overflow: visible;
}

#createFinancialYearForm .year_card_body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* The segment is inline-flex; in the card's flex column it would stretch to full width. */
#createFinancialYearForm .year_presets {
    align-self: flex-start;
}

#createFinancialYearForm .year_new_chart:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

#createFinancialYearForm .year_new_chart_toggle {
    align-self: flex-start;
}

/* A legacy switch under its label (not in a .horizontal row): toggle.css centres the slider in a 70px
   box, which leaves it 30px right of the label. Pin it to the left edge instead. */
.label_input_wrapper:not(.horizontal) > .novus_filter_input_block > .switch > .slider,
.label_input_wrapper:not(.horizontal) > .switch > .slider {
    left: 0;
}

/* Year page, existing years: a frameless card as wide as the create form's cards, the auto-create
   switch in its header and the table in its own rounded frame; its rows select the year. */
.year_existing {
    width: 100%;
    max-width: 880px;
    min-inline-size: 0;
    align-self: flex-start;
    margin: var(--spacing-xl) 0 0;
    padding: 0;
    border: 0;
}

.year_existing__title,
.year_existing__auto {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* The title takes the section-header look of "Create new year" above; the card header drops its rule
   line and the header's bottom margin, since the table's own frame follows directly. */
.year_existing > .app-card > .app-card__header {
    border-bottom: 0;
    padding-top: 0;
}

.year_existing .year_existing__title {
    margin: 0;
    cursor: default;
}

/* toggle.css pins the slider to the right of a 70px box, 2px above centre; size the box to the slider. */
.year_existing__auto > .switch {
    width: 38px;
    height: 20px;
    margin-left: var(--spacing-xs);
}

.year_existing__auto > .switch > .slider {
    inset: 0;
}

/* The row actions are buttons for keyboard access; drop the browser's button chrome. */
.year_existing button.app-action {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
}

/* The from-date stays a link for keyboard users but reads as the other cells. */
.year_existing .year_existing__select {
    color: inherit;
    text-decoration: none;
}

/* Year page, own chart of accounts: a low full-width drop row, then the help line and the document
   links in small muted text. jQuery show()/hide() owns the outer div's display,
   so the column layout sits on an inner wrapper. */
#createFinancialYearForm .year_own_chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

#createFinancialYearForm #file_upload_drop_area {
    min-height: 48px;
    padding: 0;
}

#createFinancialYearForm .year_own_chart__help {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

#createFinancialYearForm .year_own_chart__docs > a {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

#createFinancialYearForm .year_own_chart__docs > a > .sym {
    font-size: 16px;
}

#createFinancialYearForm .year_own_chart__docs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs) var(--spacing-md);
    padding-left: calc(var(--icon-size-md) + var(--spacing-sm));
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

/* Settings pages built from label ... help + toggle rows (stacked_in_row): no page title inside, left
   aligned, and capped so each toggle stays within reach of its label instead of the far edge. */
.settings_toggle_page {
    max-width: 940px;
}

/* Settings form sections: one label column, so every inline control starts at the same x.
   Opt-in per section — form ids like #settings_input are shared by ten settings pages. */
.settings_label_column .app-field--inline > .app-field__label {
    flex: 0 0 18rem;
}
/* Prisuppdatering (set/registry/settings_itempricelistupdate.htm): radio options carry their own
   controls, so labels sit on the first option's line and every control has a fixed width. */
#settings_itempricelistupdate_input .app-field--inline:has(> .app-radio-group--vertical, > .pricelist_change_table) {
    align-items: flex-start;
}
/* One label track for all four cards; a long label wraps instead of pushing its controls right. */
#settings_itempricelistupdate_input .app-field--inline:has(> .app-radio-group--vertical, > .pricelist_change_table) > .app-field__label {
    flex: 0 0 11rem;
    padding-top: var(--spacing-sm);
}
#settings_itempricelistupdate_input .pricelist_option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}
#settings_itempricelistupdate_input .pricelist_option > select.app-input {
    flex: 0 0 16rem;
}
/* The new-list fields open under "Skapa ny prislista", indented to its text and without row rules. */
#settings_itempricelistupdate_input .pricelist_new_fields {
    padding-left: 26px;
}
#settings_itempricelistupdate_input .pricelist_new_fields .app-field--inline {
    margin-bottom: var(--spacing-sm);
    padding-bottom: 0;
    border-bottom: none;
}
#settings_itempricelistupdate_input .pricelist_new_fields .app-field--inline > .app-field__label {
    flex: 0 0 7rem;
}
#settings_itempricelistupdate_input .pricelist_new_fields .app-field--inline > .app-input {
    flex: 0 0 16rem;
}
#settings_itempricelistupdate_input .pricelist_change_table {
    margin: calc(-1 * var(--spacing-xs)) 0 0;
    border-collapse: collapse;
    font-size: var(--font-body-sm-size);
}
#settings_itempricelistupdate_input .pricelist_change_table td {
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-xs) 0;
    vertical-align: middle;
    white-space: nowrap;
}
#settings_itempricelistupdate_input .pricelist_change_table select.app-input {
    width: 8rem;
}
#settings_itempricelistupdate_input .pricelist_change_table input.app-input {
    width: 7rem;
}
#settings_itempricelistupdate_input .pricelist_change_table .pricelist_change_sublabel {
    color: var(--text-secondary);
}
#settings_itempricelistupdate_input .pricelist_change_divider hr {
    margin: var(--spacing-sm) 0;
    border: 0;
    border-top: 1px solid var(--border-tertiary);
}

/* Utskriftsmallar "Lägg till ny mall": fixed-width selects, so the widget no longer resizes to each option. */
#add_template_form .app-field--inline > div {
    flex: 0 0 20rem;
    min-width: 0;
}
#add_template_form .app-field--inline > div > .novus_filter_select {
    width: 100%;
}
/* Dokumenttexter: code + text pairs separated by a rule; AddEmptyRow appends more in JS. */
.settings_text_list > hr {
    border: 0;
    border-top: 1px solid var(--border-tertiary);
    margin: var(--spacing-lg) 0;
}
.settings_text_list .app-field--inline > textarea.app-input {
    max-width: 40rem;
}
.settings_text_list .app-field--inline > input.app-input {
    flex: 0 0 12rem;
}

.settings_label_column .app-field--inline > .app-input--narrow {
    flex: 0 0 7rem;
    min-width: 0; /* the section-content inline-input rule sets min-width: 240px */
}
/* Two label columns side by side (Autoskapande aktiviteter) need a shorter label track. */
.settings_label_column--compact .app-field--inline > .app-field__label {
    flex-basis: 12rem;
}
/* Year / month / day boxes hold one to three digits. */
.settings_label_column .settings_autoevent_time > .app-input--narrow {
    flex-basis: 4rem;
}

/* An input that sits beside its label on such a row keeps a fixed width - .app-input is 100% wide. */
.settings_toggle_page .stacked_in_row_item > .app-input {
    display: inline-flex;
    width: 10rem;
    vertical-align: middle;
}

/* Deviation match-rule modal: label_input_wrapper aligns its children to the start, so each Briox.Select
   shrank to its options (transaction type has an empty first option) while inputs kept their own
   width. Stretch them so every control fills its column. */
#create_deviation_automatic_match_form .label_input_wrapper {
    align-items: stretch;
}

/* Sub-setting marker on the toggle-row settings pages: replaces the "└─" text glyphs. */
.settings_sub_arrow {
    font-size: var(--icon-size-sm);
    color: var(--text-tertiary);
    margin-right: var(--spacing-sm);
    vertical-align: -3px;
}

/* Accordion header on a toggle-row settings page (Attest / Betalförslag): title, the on/off summary and
   the chevron in one row. Keeps novus_legend, which Briox.GroupToggler binds to. */
.settings_accordion_header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
}

.settings_accordion_header .settings_page_section_title {
    flex: 0 0 55%;
}

.settings_accordion_header .novus_legend_icon {
    margin-left: auto;
}

/* Attest / Betalförslag: a section header after the first one needs its own space from the accordion
   above; the app-mt--* utilities load before .app-detail-page__section-header and lose to its margin. */
#authorization_levels_form .settings_toggle_page > .app-detail-page__section-header:not(:first-child) {
    margin-top: var(--spacing-3xl);
}

/* Notification settings: every type heading after the first needs space from the accordion above it. */
.settings_notification_page > .app-detail-page__section-header:not(:first-child) {
    margin-top: var(--spacing-3xl);
}

/* Notification settings: the page JS hides the Briox.Select widgets, not their wrappers, so size the widgets. */
.settings_email_frequency > div {
    display: contents;
}
.settings_email_frequency .novus_filter_select {
    flex: 0 0 12rem;
}

/* Advanced search modals (CRM search + price-update item selection): one label column so the controls line up. */
#advsearchform .app-dialog__body .app-field--inline > .app-field__label {
    flex: 0 0 9rem;
}
#advsearchform .app-dialog__body .app-field--inline > .app-input,
#advsearchform #searchbox {
    flex: 1 1 0;
    min-width: 0;
}
#advsearchform #searchbox > .app-input {
    width: 100%;
}

/* Konto ID (cpnl database info): the caller asks for 1300px and sizes the height once at open. Cap both to the
   viewport and keep it centred on resize, so small screens (or a vertical tab strip) don't clip it. */
#MB_window:has(#db_info_form, #db_not_connected) {
    width: min(1300px, calc(100vw - 32px)) !important;
    height: calc(100vh - 50px) !important;
    inset: 0 !important;
    margin: auto;
}
#MB_window:has(#db_info_form, #db_not_connected) #MB_frame {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#MB_window:has(#db_info_form, #db_not_connected) #MB_content {
    height: auto !important;
    flex: 1 1 auto;
    min-height: 0;
}

/* The tab bar sits outside the scrolling body so it stays put; give it the body's side padding. */
#MB_content:has(#db_info_form) > div > .app-tabs__list {
    flex: 0 0 auto;
    padding: var(--spacing-sm) var(--spacing-lg) 0;
}
#MB_content:has(#db_info_form) > div > .app-tabs__list > .app-tabs__tab {
    float: none !important;
}
/* Eleven tabs: wrap to a second line on a narrow dialog instead of hiding the last ones off-screen. */
#MB_content:has(#db_info_form) > div > .app-tabs__list {
    flex-wrap: wrap;
}

/* Taggar: the tag name is a <label> that legacy modal CSS floats right; descriptions are prose and wrap. */
#db_tags_container td > label {
    float: none;
    width: auto;
}
#db_tags_container td.app-col--fill {
    white-space: normal;
}
/* forms.css gives a switch in a cell width 0 and a 35% margin, so a narrow column clips the slider. */
#db_tags_container td .switch {
    width: 38px;
    margin-right: 0;
}
#db_tags_container td .switch .slider {
    left: 0;
    right: 0;
}

.db_info_section,
.db_info_fieldset,
.db_info_toolbar,
.db_info_delete {
    margin-bottom: var(--spacing-xl);
}
.db_info_fieldset {
    border: none;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    min-width: 0;
}
.db_info_subtitle {
    margin: 0 0 var(--spacing-md);
    text-align: left;
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}
.db_info_stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}
.db_info_actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}
.db_info_actions--start {
    justify-content: flex-start;
}
.db_info_actions--between {
    justify-content: space-between;
}
.db_info_narrow_field {
    max-width: 240px;
}
/* The dialog's Chosen skin stretches the widget to its parent, so cap the row instead. */
.db_info_select_field {
    max-width: 360px;
}
.db_info_narrow_list {
    max-width: 640px;
}
.db_info_filter_row {
    flex-wrap: wrap;
    margin: var(--spacing-lg) 0;
}
.db_info_filter_row > .app-input {
    width: 140px;
}
.db_info_link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* cpnl ORDER lists: lists.css draws #div_info as a bordered panel, so its empty placeholder showed as a bar
   over the table until a row loaded a contact into it. */
#div_info:has(> div:only-child > span:only-child:empty) {
    display: none;
}

/* Settings > Kontrollpanel > Webhooks (set/cpnl/webhook_config.htm): ACTIVE_CLASS comes from req_webhook_config.php. */
#webhook_config_table .status_active {
    color: var(--color-success);
    font-weight: var(--font-weight-semibold);
}
#webhook_config_table .status_inactive {
    color: var(--color-error);
}
#webhook_config_form .input_with_button {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    width: 100%;
}
.main_content:has(> .app-list #webhook_config_table) > .app-list {
    margin-bottom: var(--spacing-2xl);
}
#webhook_config_form .input_with_button > .app-input {
    flex: 1 1 auto;
}
#app_id_chosen .chosen-results {
    max-height: 250px;
    overflow-y: auto;
}

/* cpnl rights panel (showcontact_showrights.htm, loaded into the Konto ID Användarlista tab): rows and checkboxes
   as in the admin rights matrix (fs/fs/user_rights_table.htm), sections stay GroupToggler legends. */
.db_rights_personal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl) var(--spacing-3xl);
}
.db_rights_cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
}
/* Author display: grid would beat the UA [hidden] rule. */
.db_rights_cols[hidden] {
    display: none;
}
.db_rights_cols > .column {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
}
.db_rights_personal .app-input {
    max-width: 360px;
}
.db_rights_item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 3px 0;
}
.db_rights_item--l1 { padding-left: 20px; }
.db_rights_item--l2 { padding-left: 40px; }
.db_rights_item--l3 { padding-left: 60px; }
.db_rights_item > label {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    text-align: left;
}
.db_rights_item > .app-checkbox__option {
    flex: 0 0 auto;
}
.db_rights_item > .rights_list_label {
    cursor: pointer;
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    color: var(--text-primary);
}
.db_rights_subheading {
    margin: var(--spacing-sm) 0 var(--spacing-xs);
    font-weight: var(--font-weight-semibold);
}
.db_rights_actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-tertiary);
}
.db_rights_actions__start {
    margin-right: auto;
}

/* cpnl log popups (Db-logg, Mailkö-logg) opened by window.open from the Konto ID Loggar tab. */
.cpnl_log_popup {
    padding: var(--spacing-xl);
}
.cpnl_log_popup__title {
    margin: 0 0 var(--spacing-md);
    font-size: var(--font-body-lg-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}
.cpnl_log_popup .pagination_info {
    margin: var(--spacing-md) 0;
    padding: 0;
    height: auto;
}
/* One page of results leaves the page-links block empty but 55px tall. */
.cpnl_log_popup .pagination_block:not(:has(*)) {
    display: none;
}
.cpnl_log_popup__pre {
    margin: 0;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-tertiary);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    font-size: var(--font-body-sm-size);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.cpnl_log_popup__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

/* Briox API: compact application cards; ChangeSelectedApplication() toggles api_application_box_selected. */
#applications_activation {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md);
}
#applications_activation > :not(.api_application_box) {
    grid-column: 1 / -1;
}
#applications_activation .api_application_box {
    width: auto;
    float: none;
    margin: 0;
    padding: var(--spacing-md);
    border: 1px solid var(--border-tertiary);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-body-sm-size);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
#applications_activation .api_application_box img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 100%;
    margin: 0 auto var(--spacing-sm);
    border-radius: var(--radius-sm);
}
#applications_activation .api_application_box:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
    color: var(--text-primary);
}
#applications_activation .api_application_box_selected,
#applications_activation .api_application_box_selected:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-primary));
}

/* Verktyg: one card per tool, two columns that stack once the dialog is narrow. */
.db_info_tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: var(--spacing-lg);
    align-items: start;
}
.db_info_tools__column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    min-width: 0;
}
.db_info_tool {
    border: 1px solid var(--border-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}
.db_info_tool > form > p,
.db_info_tool > p {
    margin: 0 0 var(--spacing-md);
}
/* Layout tables kept for their ids: label left, control right. */
.db_info_tool_table {
    border-collapse: collapse;
}
.db_info_tool_table td {
    padding: var(--spacing-xs) 0;
    vertical-align: middle;
    color: var(--text-secondary);
}
.db_info_tool_table td + td {
    padding-left: var(--spacing-md);
}
.db_info_tool_table td > .app-input {
    width: 100%;
    max-width: 260px;
}
.db_info_inline_fields {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}
.db_info_inline_fields > .app-input {
    width: 110px;
}

/* Cost-centre user picker (set/bf/cc.htm passes no height): the rows decide the height, the window stays
   centred as they come and go, and the body scrolls once header + body + footer would not fit the viewport.
   Modalbox writes an inline height and top at open; both give way to the rules below. */
#MB_window:has(#cc_table) {
    height: fit-content !important;
    top: 0 !important;
    bottom: 0;
    margin-top: auto;
    margin-bottom: auto;
}
#MB_window:has(#cc_table) #MB_content {
    height: auto !important;
}
/* 60px viewport margin plus the dialog's own header and footer. */
#MB_window:has(#cc_table) .app-dialog__body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* Konteringsmallar: the Aktiv checkbox sits on the input line of the field beside it (Ver. text). */
#codingtemplateform .app-field > .app-checkbox__option {
    min-height: 28px;
}

/* Stacked settings sections: the next section's heading otherwise sits flush on the previous one's bottom rule. */
fieldset.stacked_in_column_item + fieldset.stacked_in_column_item:has(> legend.app-detail-page__section-header) {
    margin-top: var(--spacing-xl);
}

/* Verifikationsserier / Dagskassemallar: one label column, so every control starts at the same x. */
#settings_vseries_main_form .app-field--inline > .app-field__label {
    flex: 0 0 14rem;
}

#dailytakingsform .app-field--inline > .app-field__label {
    flex: 0 0 18rem;
}

/* Registrera dagskassa: every amount ends in a fixed icon slot, so rows with and without an info icon
   line up, and the sums sit under the inputs. */
#daily_sales .app-data-list__row {
    align-items: center;
}

#daily_sales .app-data-list__value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

#daily_sales .daily_takings_icon_slot {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    width: 3rem;
}

#daily_sales .daily_takings_sum {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) calc(3rem + var(--spacing-sm)) 0 0;
}

#daily_sales .app-detail-page__section-title {
    margin-bottom: var(--spacing-md);
}

#daily_sales .app-data-list + .app-detail-page__section-title,
#daily_sales .daily_takings_sum + .app-detail-page__section-title {
    margin-top: var(--spacing-2xl);
}

/* A transaction-info icon whose account info has been filled in. */
#daily_sales .app-info-icon.is-set {
    color: var(--accent);
}

/* LV Moms: a date picker fills its cell otherwise; the legacy novus_medium_input was 160px. */
#client_massop_list .app-table__td > .app-input {
    width: 10rem;
}

/* ========== Salary list (Vue, images/apps/salary/list) and the shared Vue components ==========
   Replaces stylesheets/brx-salary-list.css. The Vue components now render the design-system classes
   directly (list contract, app-dialog, app-badge, app-btn, app-checkbox, app-radio-group, app-form);
   what stays here is page glue and the bridges the shared components in images/apps/shared need.
   Natural homes are noted per rule.
   ============================================================================================ */
.brx-salary-list-result-count {
    margin: var(--spacing-sm) 0;
    color: var(--color-text-muted);
    font-size: var(--font-body-sm-size);
}
.brx-salary-list-clickable-row {
    cursor: pointer;
}
.brx-salary-list-cell-date,
.brx-salary-list-voucher-cell.is-none {
    color: var(--color-text-muted);
}
/* The AGI status badge in the page actions carries the signing / error-report link. */
.brx-salary-list-agi-status-link {
    color: inherit;
    text-decoration: underline;
    font-weight: var(--font-weight-semibold);
}

/* Page intro with actions (natural home: layouts/app-page.css). The description is flex: 1 1 100%, but
   its 64ch max-width caps the flex basis, so with a short title and a badge it fitted on the first row
   and only dropped below the title once the badge was gone — the subtitle jumped between two places.
   A grid pins the three: title left, actions right, description on its own row. */
.app-page__intro:has(> .app-page__actions) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}
.app-page__intro:has(> .app-page__actions) > .app-page__desc {
    grid-column: 1 / -1;
}

/* --- Salary dialogs --- */
.brx-agi-modal-error,
.brx-bookkeep-modal-error,
.brx-spec-modal-error {
    margin: 0;
    color: var(--color-error);
}
.brx-spec-modal-error {
    padding: var(--spacing-xl);
    text-align: center;
}
/* The PDF preview: app-dialog__frame is sized for a popup that shrinks to it (1100px), but here it sits
   inside the padded body of an --xl dialog, so it fills the body instead. */
.app-dialog__body > .brx-spec-modal-frame {
    width: 100%;
    height: min(760px, 70vh);
}
.brx-agi-modal-period,
.brx-bookkeep-modal-period {
    margin: 0;
}
/* Employees without a valid personal number are tinted in the AGI preview. */
.brx-agi-modal-row-missing > .app-table__td {
    background: color-mix(in srgb, var(--color-warning) 12%, var(--color-bg-default));
}
.brx-agi-modal-success {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
}
.brx-agi-modal-success-text {
    margin: 0;
    font-weight: var(--font-weight-semibold);
}
.brx-agi-modal-success.is-rejected .brx-agi-modal-success-text {
    color: var(--color-error);
}
.brx-agi-modal-success-meddelande {
    margin: 0;
    color: var(--color-text-muted);
}
/* .app-input is display: flex, which makes a native date input block-level, so width: auto fills the
   dialog row; give it a fixed width instead. */
.app-dialog__body .brx-modal-field > .app-input[type="date"] {
    width: 12rem;
}

/* --- Shared Vue dialog (images/apps/shared/components/modal-component.vue). Natural home: app-dialog.css --- */
/* The component has no max-height, so a tall preview table pushed the footer below the viewport. */
.app-dialog.brx-modal-dialog {
    max-height: calc(100vh - var(--spacing-3xl) * 2);
}
/* brx-modal.css (still loaded for the other Vue apps) gives the body its own padding. */
.app-dialog__body.brx-modal-content-body {
    padding: var(--spacing-lg);
}
.brx-modal-content-header-text {
    margin: var(--spacing-xs) 0 0;
    color: var(--color-text-muted);
    font-size: var(--font-body-sm-size);
}
.brx-modal-content-body-loader {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}
.brx-modal-content-body-loader-text {
    margin: 0;
}

/* --- Shared select (brx-select.vue). Natural home: app-input.css --- */
/* .app-list--scroll clips its overflow so a wide table scrolls in its wrapper; on a short list the
   open dropdown pokes out of the bottom and was cut off. Let it show while a select is open. */
.app-list--scroll:has(.brx-select.is-open) {
    overflow: visible;
}

/* --- Shared checkbox (brx-checkbox.vue). Natural home: app-input.css --- */
/* The header checkbox shows a partial selection as a dash; the component has no indeterminate state. */
.app-checkbox__option input[type="checkbox"]:indeterminate {
    border-color: var(--accent);
    background: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* --- Shared date input (brx-date-input.vue, vue-datepicker). Natural home: a shared Vue stylesheet --- */
/* The popup is themed with the tokens of Briox.DatePicker (the reskinned daterangepicker above), so the
   Vue pickers match the rest of the app. It is teleported to <body>, hence the global theme class, and
   the library's own app.css loads later, so the theme is keyed on body to outrank its .dp__theme_light.
   Moved here from brx-report-generator.css on 2026-10-01 so the settings copy tool's pickers share it. */
body .dp__theme_light {
    --dp-font-family: var(--font-family-primary);
    --dp-font-size: var(--font-body-sm-size);
    --dp-background-color: var(--bg-primary);
    --dp-text-color: var(--text-primary);
    --dp-hover-color: var(--color-hover-bg);
    --dp-hover-text-color: var(--text-primary);
    --dp-hover-icon-color: var(--text-primary);
    --dp-primary-color: var(--accent);
    --dp-primary-disabled-color: var(--accent-light);
    --dp-primary-text-color: #fff;
    --dp-secondary-color: var(--text-tertiary);
    --dp-border-color: var(--border-primary);
    --dp-menu-border-color: var(--border-primary);
    --dp-border-color-hover: var(--border-primary);
    --dp-border-color-focus: var(--tertiary-700);
    --dp-disabled-color: var(--color-disabled-bg);
    --dp-disabled-color-text: var(--color-disabled-text);
    --dp-icon-color: var(--text-tertiary);
    --dp-highlight-color: var(--accent-light);
    --dp-range-between-dates-background-color: var(--accent-light);
    --dp-range-between-dates-text-color: var(--text-primary);
    --dp-range-between-border-color: var(--accent-light);
    --dp-border-radius: var(--radius-md);
    --dp-cell-border-radius: var(--radius-sm);
}

body .dp__menu.dp__theme_light,
body .dp__theme_light .dp__menu {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

body .dp__theme_light .dp__month_year_select,
body .dp__theme_light .dp__calendar_header_item {
    font-weight: var(--font-weight-semibold);
}

body .dp__theme_light .dp__calendar_header_item {
    color: var(--text-secondary);
}

/* Template editor (set/common/template_edit.htm): the block toolbar links hold Material Symbols now,
   so the edit.png / trashcan.png backgrounds go; template_editor.css still sizes and shows them. */
#block_toolbar a.toolbar_button_edit,
#block_toolbar a.toolbar_button_remove {
    background-image: none;
    color: var(--text-tertiary);
    line-height: 16px;
}
#block_toolbar a.toolbar_button_edit:hover,
#block_toolbar a.toolbar_button_remove:hover {
    color: var(--text-primary);
}
#block_toolbar a .sym {
    font-size: 16px;
}
/* The section chip sits in a 100px legacy toolbar: size it to its label and give it a surface. */
.section_toolbar .toolbar_button_settings {
    width: max-content;
    margin-left: var(--spacing-xs);
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}
.section_toolbar .toolbar_button_settings:hover {
    background-color: var(--bg-secondary);
}

/* Template editor canvas off grey. fieldset#editor because template_editor.css loads later; the
   pane's template_block_outside tint (drop = remove) is left alone. */
fieldset#editor {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
}
/* The pane is the drop-to-remove target; run it up to the 243px sidebar so no dead strip is left between. */
#editor #editor_pane {
    right: 243px;
    width: auto;
}
#editor #editor_pane:not(.template_block_outside),
#editor #section_settings {
    background: var(--bg-primary);
}
#editor #section_settings {
    border-left-color: var(--border-primary);
}
/* A ring, not a border: template.js positions blocks from the sheet's offset. */
#editor #sheet {
    box-shadow: 0 0 0 1px var(--border-primary), var(--shadow-md);
}
fieldset#editor .block_type {
    margin: var(--spacing-sm) 12px;
    padding: var(--spacing-sm) var(--spacing-md);
    font: var(--font-weight-medium) var(--font-body-sm-size) / var(--font-body-sm-line-height) var(--font-family-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
fieldset#editor .block_type:hover {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}
fieldset#editor .block_type.disabled {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    box-shadow: none;
}

/* Block editor popup (template_editor.css + template.js). The overlay stays as the click-to-cancel target, just unpainted. */
#editor #block_editor .block_editor_background {
    background: transparent;
}
/* template.js sizes the frame at 300px and places it assuming 4px side padding, so the content is inset instead. */
#editor #block_editor .block_editor_toolbar,
#editor #block_editor .block_editor_item_list_toolbar {
    padding: var(--spacing-sm) 4px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
#editor #block_editor .block_editor_tablist.app-tabs__list,
#editor #block_editor .block_editor_tabs,
#editor #block_editor .block_editor_buttons {
    margin-left: var(--spacing-sm);
    margin-right: var(--spacing-sm);
}
#editor #block_editor .block_editor_tablist.app-tabs__list {
    height: auto;
    padding: 0;
    border-bottom-color: var(--border-primary);
}
#editor #block_editor .block_editor_tablist li a.app-tabs__tab {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
}
#editor #block_editor .block_editor_tablist li a.app-tabs__tab.active_tab {
    color: var(--color-nav-fg-active);
    border-bottom-color: var(--color-nav-fg-active);
}
#editor #block_editor .block_editor_tab {
    padding-top: var(--spacing-md);
}
#editor #block_editor .block_editor_format > p {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-height: 28px;
    margin: 0 0 var(--spacing-xs);
    padding: 0;
}
#editor #block_editor .block_editor_format > p > label.normal,
#editor #block_editor .block_editor_border_format label.normal {
    flex: 0 0 7.5rem;
    width: 7.5rem;
    float: none;
    padding: 0;
    text-align: left;
    line-height: var(--font-body-sm-line-height);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}
#editor #block_editor label.app-radio-group__option {
    display: flex;
    width: auto;
    float: none;
    padding: 0;
    line-height: var(--font-body-sm-line-height);
    font-size: var(--font-body-sm-size);
}
#editor #block_editor .app-input--sm {
    width: auto;
}
#editor #block_editor .block_editor_fontsize,
#editor #block_editor .block_editor_border {
    width: 3.5rem;
}
#editor #block_editor .block_editor_width {
    width: 7rem;
}
#editor #block_editor .block_editor_border_format {
    margin: var(--spacing-sm) 0 var(--spacing-md);
    border-collapse: separate;
    border-spacing: 0 var(--spacing-xs);
}
#editor #block_editor .block_editor_border_format th {
    font-size: var(--font-body-sm-size);
    color: var(--text-tertiary);
    text-align: left;
}
#editor #block_editor .sp-replacer .sp-preview {
    width: 48px;
    height: 26px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
#editor #block_editor .block_editor_border_format .sp-replacer .sp-preview {
    height: 26px;
}
#editor #block_editor .block_editor_buttons {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-md) 0 0;
    border-top: 1px solid var(--border-primary);
}

/* Archive access group edit (set/user/users_editrights_dagroups_edit.htm): the folder tree cell is
   PHP-indented text with a folder symbol; .sym is a flex box and would drop to its own line. Natural
   home: app-table.css next to the info-icon rule. */
#folder_access_list .app-table__td > .sym {
    display: inline-flex;
    vertical-align: middle;
    margin-right: var(--spacing-xs);
    color: var(--text-secondary);
}
/* The header checkboxes carry their column label; the option is inline-flex, so the label text would
   otherwise inherit the header's small caps. Read/Write hug their content so the folder column fills. */
#folder_access_list .app-table__th > .app-checkbox__option {
    white-space: nowrap;
}

/* CRM field editor (crm/modal/modal_settings_*fieldsedit.htm): NewField() appends one input per
   select option; they stack under the type select instead of the legacy <br /> list. */
.crm_field_options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.crm_field_options:empty {
    display: none;
}

/* CRM field-format settings: CreateHeaderBlock's show/hide checkbox and move arrows share the section
   legend; the legacy &nbsp; spacer between them is gone. */
.crm_header_arrows {
    display: inline-flex;
    margin-left: var(--spacing-xs);
}

/* Colour picker (crm/modal/modal_pick_color.htm): the nine swatches ReturnColor() picks from; the
   colour itself comes from the legacy .grey/.pink/... background classes. */
.crm_color_grid {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    gap: var(--spacing-xs);
    justify-content: center;
}

/* Buttons, so Modalbox focuses the first swatch instead of the close icon and Enter picks. */
.crm_color_grid > button {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-secondary);
    opacity: 1;
}

/* Klienthanteraren opening hours: two Chosen selects share one row, and the section's Chosen skin
   (width: 100% on container and wrapper) would split it to their content; 10rem = the JS width 160. */
.client_manager_hours > .novus_filter_input_block {
    flex: 0 0 10rem;
}

/* ========== Assistant task overview + calendar (assistant/task/client_task_overview.htm, client_task_calendar.htm) ==========
   A client x activity-group matrix, not a list: the nine activity columns must share the width
   equally, so this table keeps fixed layout and scrolls below a floor instead of squeezing. */
.app-list--scroll .novus_list_table.assistant_task_matrix {
    table-layout: fixed;
    width: 100%;
    min-width: 1100px;
}
/* Single-word headers (Leverantörsfaktura) are wider than a column: hyphenate where the browser can. */
.app-list--scroll .assistant_task_matrix > thead > .novus_table_row > th {
    white-space: normal;
    hyphens: auto;
}
.app-list--scroll .assistant_task_matrix > thead > .novus_table_row > th:nth-child(1) {
    width: 170px;
}
.app-list--scroll .assistant_task_matrix > thead > .novus_table_row > th:nth-child(2) {
    width: 100px;
}
.app-list--scroll .assistant_task_matrix > thead > .novus_table_row > th:last-child {
    width: 80px;
}
/* Expanded client row / selected calendar day: the design system's selected-row colour, not the grey hover. */
.app-list--scroll .assistant_task_matrix > tbody > tr.novus_table_row.hovered,
.app-list--scroll .task_calendar .task_calendar_day.high_light_calendar_day {
    background-color: var(--accent-light);
}
.app-list--scroll .assistant_task_matrix .high_light_selected,
.app-list--scroll .task_calendar .high_light_selected {
    box-shadow: inset 0 -6px 0 0 var(--accent-warm);
}
/* Calendar grid (assistant/task/client_task_calendar.htm): one rounded frame in the list border colour;
   the header and the weeks drew the outer edges themselves in assistant.css. */
.app-list--scroll .task_calendar {
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
}
/* No overflow: hidden here or on the wrapper - it would clip the status dropdowns in a detail row under
   the last week. The calendar has nothing to scroll sideways, and the bottom corner cells round instead. */
.app-list--scroll:has(> .task_calendar) {
    overflow: visible;
}
.app-list--scroll .task_calendar > .task_calendar_week:last-child > :first-child,
.app-list--scroll .task_calendar > .task_detail:last-child {
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}
.app-list--scroll .task_calendar > .task_calendar_week:last-child > :last-child,
.app-list--scroll .task_calendar > .task_detail:last-child {
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}
.app-list--scroll .task_calendar .task_calendar_header,
.app-list--scroll .task_calendar .task_calendar_week {
    border: 0;
}
.app-list--scroll .task_calendar .task_calendar_day {
    border-color: var(--border-secondary);
}


/* ========== Time grids (time/time_time/time_massop.htm, time/time_invoice/*.htm) ==========
   The request files emit the legacy cell classes (listborder / list / listborderlast / listlast,
   colreadonly, comment / nocomment) and they stay on the cells; tables.css keys borders, an 18px
   height and an orange focus fill on them, all of which fight the app-table. Scoped to the pages'
   own list containers (#invoice_list and #invoice_details are filled by AJAX). */
#time_register_maindiv .app-table td.listborder,
#time_register_maindiv .app-table td.listborderlast,
#time_register_maindiv .app-table td.list,
#time_register_maindiv .app-table td.listlast,
#invoice_list .app-table td.listborder,
#invoice_list .app-table td.listborderlast,
#invoice_list .app-table td.list,
#invoice_list .app-table td.listlast {
    border-right: 0;
    height: auto;
}
/* The values are read-only display text, not locked fields: no app-input skin, just the borderless
   embed at body size. Editable cells carry app-input as well and keep its padding. */
#time_register_maindiv .app-table td.listborder input:not([type='image']),
#time_register_maindiv .app-table td.list input:not([type='image']),
#invoice_list .app-table td.listborder input:not([type='image']),
#invoice_list .app-table td.list input:not([type='image']),
#invoice_list .app-table td > input.novus_table_input_embed {
    height: 28px;
    padding: 0;
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
}
#invoice_list .app-table td.listborder input.app-input,
#invoice_list .app-table td.list input.app-input {
    padding: 0 var(--spacing-sm);
}

/* time_register's text fields take the inline input's padding; the day columns cannot. They are
   33px wide, and measured against "8,25" anything over 2px clips the value — so the numeric cells,
   which are the right-aligned ones, keep the zero above. */
#time_register_maindiv .app-table td.listborder input.app-input:not(.text-right),
#time_register_maindiv .app-table td.list input.app-input:not(.text-right) {
    padding: 0 var(--spacing-md);
}
#time_register_maindiv .app-table td.listborder input[readonly]:focus,
#time_register_maindiv .app-table td.list input[readonly]:focus,
#invoice_list .app-table td.listborder input[readonly]:focus,
#invoice_list .app-table td.list input[readonly]:focus,
#invoice_list .app-table td.listborder input:disabled,
#invoice_list .app-table td.list input:disabled {
    background: transparent;
    color: inherit;
}
/* Mass approval: fixed px widths spread the slack onto the icon column too; shares send it to the text. */
.time_massop_week .app-table .app-col--sm {
    width: 16%;
}
.time_massop_week .app-table .app-col--xs {
    width: 4%;
}
/* Mass approval: PHP emits the week totals inside tbody, so they borrow the table-foot look. */
#time_register_maindiv .app-table__row.time_massop_sum_row > .app-table__td {
    background: var(--bg-tertiary);
    font-weight: var(--font-weight-semibold);
    border-top: 1px solid var(--border-secondary);
    border-bottom: none;
}
/* Registration-code swatch: PHP never fills its colour table, so it stays hidden; the id is kept. */
.time_massop_swatch {
    display: none;
}
/* Rows without a comment show the icon muted; with one, as an action. */
/* time_register: editable cells get their tint, hover and focus ring from app-table.css's embedded
   cell-input rules; only the disabled embeds (contact, activity before an assignment is chosen) need
   help — lists.css paints .novus_table_input_embed:disabled #eee !important, which is why this needs
   the same weight. The rows now carry the design system's inline inputs, so a disabled cell reads
   like a readonly one — same tint, same muted text — rather than like an empty editable field. */
#time_register_maindiv .app-table td.listborder input:disabled,
#time_register_maindiv .app-table td.list input:disabled {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary);
}
/* Assignment group rows (bold header + group total) sit on a raised surface so they separate from the
   input rows between them. Natural home: an app-table__row--group modifier in components/app-table.css. */
#time_register_maindiv .app-journal__row.time_register_group_row > .app-journal__td {
    background: var(--bg-secondary);
}
/* time_register rows are an app-journal; PHP still emits listborder / listborderlast on the cells, whose
   tables.css height and #ccc divider would override the journal's own. */
#time_register_maindiv .app-journal td.listborder,
#time_register_maindiv .app-journal td.listborderlast {
    height: auto;
}
#time_register_maindiv .app-journal td.listborder {
    border-right-color: var(--border-tertiary);
}
/* The comment / delete cells carry listborder from PHP too; as on invoice_edit they sit together with no
   divider between them. */
#time_register_maindiv .app-journal td.app-journal__td--actions {
    border-right: none;
}
/* A row with no editable day (a locked row or a submitted / approved week) tints its icon cells like the
   read-only fields beside them, so the whole row reads as locked. */
#time_register_maindiv .app-journal__body .app-journal__row:not(:has(input[id^="day_"]:not(:read-only):not(:disabled))) > td.app-journal__td--actions {
    background: var(--bg-secondary);
}
#time_register_maindiv .app-journal__body .app-journal__row:not(:has(input[id^="day_"]:not(:read-only):not(:disabled))):hover > td.app-journal__td--actions {
    background: var(--bg-tertiary);
}
/* tables.css sizes every `td.listborder input` at 18px with em padding and paints its focus solid orange;
   give the journal input back its own height, padding and focus. */
#time_register_maindiv .app-journal td.listborder input.app-journal__input {
    height: 32px;
    padding: 0 var(--spacing-sm);
}
#time_register_maindiv .app-journal td.listborder input.app-journal__input:focus {
    background: var(--bg-primary);
    color: var(--text-primary);
}
/* Customer name is disabled, not readonly: give it the journal's readonly tint. */
#time_register_maindiv .app-journal__input:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
/* Group-row collapse toggle: it sits first in the assignment cell and ToggleVisibleRows swaps
   list_column_minus_4ds / list_column_plus_4ds on the chevron itself, so it turns with it. */
#time_register_maindiv .time_register_group_toggle {
    flex: 0 0 auto;
    margin-left: var(--spacing-xs);
    /* The journal colours in-cell actions with the accent; a collapse chevron stays neutral. */
    color: var(--text-tertiary);
}
#time_register_maindiv .time_register_group_toggle:hover {
    color: var(--text-primary);
}
#time_register_maindiv .time_register_group_toggle.list_column_plus_4ds {
    transform: rotate(-90deg);
}
/* Versions picker (set/archive/settings.htm): Briox.Select copies the select's class attribute onto
   the widget it builds, so this sizes the trigger. It holds 0-10 and otherwise shrink-wraps its value,
   which moved the info icon 7px when the count reached two digits. A short-select width like
   app-input--narrow's 7rem would suit other settings pages too. */
.archive_versions_select {
    width: 5rem;
    flex: 0 0 5rem;
}

/* ========== Recycle-bin quota slider (set/archive/settings.htm) ==========
   Prototype's Control.Slider measures track.offsetWidth and handle.offsetWidth once, when it is
   constructed, then sets handle.style.left in px — so the geometry can live in CSS as long as the
   track carries no border or padding and the handle stays in flow at the track's left edge. The two
   PNGs are gone: the rail is the track's ::before, and the handle draws the filled part with its own
   ::before (clipped by the track) and the knob with ::after, so the knob paints over the fill with
   no z-index anywhere. Still no design-system slider and still no keyboard support — open-questions. */
.archive_quota_slider {
    position: relative;
    width: 200px;
    height: 20px;
    overflow: hidden;
    cursor: pointer;
}
.archive_quota_slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 6px;
    transform: translateY(-50%);
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}
.archive_quota_slider__handle {
    position: relative;
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    cursor: grab;
}
/* The filled part: a rail-height bar running left from the knob's centre, clipped by the track.
   pointer-events: none, or it would cover the track and swallow the click-to-jump on that half —
   Control.Slider only jumps when the mousedown target is the track itself. */
.archive_quota_slider__handle::before {
    content: '';
    pointer-events: none;
    position: absolute;
    top: 50%;
    right: 50%;
    width: 200px;
    height: 6px;
    transform: translateY(-50%);
    background: var(--accent);
    border-radius: var(--radius-full);
}
.archive_quota_slider__handle::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--bg-primary);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.archive_quota_slider__handle:hover::after {
    background: var(--accent-light);
}
/* Pressed state is :active, not Control.Slider's .selected — it marks the handle it last touched and
   never clears it, and on a one-handle slider setValue() adds it during construction. */
.archive_quota_slider__handle:active {
    cursor: grabbing;
}
.archive_quota_slider__handle:active::after {
    background: var(--accent);
}
/* The readout sits beside the track; hold its width so 5 % and 100 % do not shift the info icon. */
.archive_quota_value {
    min-width: 3.5rem;
}

/* Month calendar on time_register (shared common/common_calendar.htm, rendered by BaseCalendar):
   skinned like the daterangepicker dropdown. Scoped to the page wrapper so the CRM/cpnl small
   calendars and the old modal calendar keep their look. The renderer writes the day colours inline
   (#000000 / #ffa0a0 weekend+holiday / #eaeaea other month, font-weight: bold for today) and the
   Sunday header colour inline in the template, hence the attribute selectors and !important. */
/* The frame sits on the wrapper, not on the table: padding on a <table> is ignored between its
   border and its rows, so the 6px it used to carry gave no room above the month or below the last
   week — measured 0.5px at both edges. */
.time_register_calendar {
    padding: var(--spacing-md);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
}

.time_register_calendar table.calendarhead {
    width: auto;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-spacing: 0;
    background: transparent;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
}
/* Square cells: a stretched 12.5% column is wider than it is tall, so a disc centred in it has more
   air beside it than above it. 34px against a 26px disc leaves 8px in both directions. */
.time_register_calendar table.calendarhead td {
    width: 34px;
    height: 34px;
    padding: 0;
    line-height: 34px;
    text-align: center;
    vertical-align: middle;
}
.time_register_calendar tr.calendarhead,
.time_register_calendar tr.calendarhead td {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom: 0;
    font: inherit;
    font-weight: var(--font-weight-semibold);
}
.time_register_calendar tr.calendarhead:first-child td {
    height: 28px;
    line-height: 28px;
    padding-bottom: var(--spacing-xs);
    white-space: nowrap;
}
.time_register_calendar tr.calendarhead a {
    display: inline-block;
    padding: 0 var(--spacing-xs);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
}
.time_register_calendar tr.calendarhead a:hover {
    background: var(--color-hover-bg);
    color: var(--text-primary);
}
.time_register_calendar tr.calendarhead + tr.calendarhead td {
    color: var(--text-secondary);
    font-size: var(--font-caption-md-size);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
}
.time_register_calendar tr.calendarhead td[style*="#ff0000"] {
    color: var(--accent-dark) !important;
}
.time_register_calendar td.calendarweeknumber {
    font-size: inherit;
    text-align: left;
    padding-right: var(--spacing-xs);
    color: var(--text-tertiary);
}
.time_register_calendar a.calendarweeknumber,
.time_register_calendar a.calendarweeknumberselected {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 26px;
    border-radius: 50%;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    text-decoration: none !important;
}
.time_register_calendar a.calendarweeknumber:hover {
    background: var(--color-hover-bg);
    color: var(--text-primary);
}
.time_register_calendar a.calendarweeknumberselected,
.time_register_calendar a.calendarweeknumberselected:hover {
    background: var(--accent);
    color: #fff;
}
/* Every day marker - today's ring, a week's status tint - is a disc drawn on the day's own <div>,
   not on the cell: the cell is a 34px square, so a 26px disc keeps 8px of air on every side of its
   neighbour. Tinting the cell instead would run the seven days together into one band. */
.time_register_calendar td.calendartransparentborder > div,
.time_register_calendar td.calendarredborder > div {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    line-height: 26px;
    border-radius: 50%;
}
.time_register_calendar td div[style*="#000000"] {
    color: var(--text-primary) !important;
}
.time_register_calendar td div[style*="#ffa0a0"] {
    color: var(--accent-dark) !important;
}
.time_register_calendar td div[style*="#eaeaea"] {
    color: var(--text-tertiary) !important;
}
.time_register_calendar td div[style*="font-weight: bold"] {
    font-weight: var(--font-weight-semibold);
    box-shadow: inset 0 0 0 1px var(--accent);
}
/* Week-status legend beside the month calendar; the colours are the legacy .available / .delivered /
   .attested / .undelivered classes the calendar itself paints with. */
/* The legend belongs under the calendar it explains, not in a column beside it: side by side it
   set the filter panel's width, and the four labels read as a second list competing with the
   month. Underneath, it wraps to the calendar's own width. */
.time_register_calendar_block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: stretch;
}

.time_register_legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-flow: row wrap;
    column-gap: var(--spacing-lg);
    row-gap: var(--spacing-xs);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
}
.time_register_legend li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}
.time_status_swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid var(--color-border-default);
    border-radius: 50%;
}

/* Week status, on the legend and on the calendar's own rows — the renderer puts the class on the
   <tr> as calendarweek*, while the legend swatches carry the shorter .available / .delivered
   names from tables.css. Both are listed so the two always agree. The legacy .available / .delivered /
   .attested / .undelivered hexes in tables.css are shared with other modules' filter colours, so
   the palette tints are set here rather than on those classes. The mapping reads as a progression:
   open is untinted, submitted is waiting (blue), attested is done (green), passed without being
   submitted is the one that needs attention (red). */
/* tables.css paints the legacy status hex on the <tr> itself, which would show through as the band
   the discs replace. */
.time_register_calendar tr[class*="calendarweek"] {
    background-color: transparent;
}

.time_register_legend .time_status_swatch.available,
.time_register_calendar tr.calendarweekavailable > td > div {
    background-color: var(--bg-primary);
}

.time_register_legend .time_status_swatch.delivered,
.time_register_calendar tr.calendarweekdelivered > td > div {
    background-color: var(--blue-100);
}

.time_register_legend .time_status_swatch.attested,
.time_register_calendar tr.calendarweekattested > td > div {
    background-color: var(--green-100);
}

.time_register_legend .time_status_swatch.undelivered,
.time_register_calendar tr.calendarweekundelivered > td > div {
    background-color: var(--red-100);
}
.time_register_sunday {
    color: var(--color-error);
}
#time_register_maindiv .app-action.nocomment {
    color: var(--color-disabled-text);
}

/* Calendar month/year navigation (BaseCalendar, shared by time_register and the CRM, group-panel
   and modal calendars). The links were "<" / "<<" text; they are Material Symbols now, sized down
   from .sym's default so they still fit the small calendars' 170px header. The two backward links
   sit at the left edge and the two forward ones at the right, with the month between them, so the
   direction of travel is where the eye expects it. */
.calendar_nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.calendar_nav__group {
    display: inline-flex;
    align-items: center;
}

.calendar_nav__title {
    flex: 1 1 auto;
    text-align: center;
    white-space: nowrap;
}

.calendar_nav_icon {
    font-size: var(--icon-size-md);
    vertical-align: middle;
}

.time_register_calendar .calendar_nav_icon {
    font-size: var(--icon-size-lg);
}

/* time_register's two panel headings read alike: the section legend and the user field's label are
   the same rank on this page. Set here rather than with the text-body-lg / font-medium utilities,
   which are (0,1,0) and lose to .app-detail-page__section-header and .app-field__label. */
/* Both panel headings read as a field label does — .app-field__label's own values, applied to the
   section legend so the two rank alike. The label itself needs no rule; it is left to the component
   and only listed here for the reader. */
#time_register_userform .app-detail-page__section-header {
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

/* The section legend carries a 24px margin meant to separate a legend from a form; here it sits
   over a table and should read like the user label over its field, which is 4px. */
#time_register_userform .app-detail-page__section-header {
    margin-bottom: var(--spacing-xs);
}


/* process_transactions: fixed-width filters so the bar does not jump; longer options ellipsize.
   Scoped to the filter block: the match-rule modal has its own #transaction_type. */
.novus_filter_input_block > #transaction_type_select,
.novus_filter_input_block > #matched_object_list_type_select {
    width: 220px;
}

/* The chevron's menu is a zero-size select in the split button's corner; its own arrow would show under the chevron. */
#matches_to_process_select::after {
    content: none;
}

/* Match modals: the full-width dialog block rule made the currency picker claim the whole row and
   squeezed the account field to nothing; size it like the --narrow amount beside it. */
#deviation_table .novus_filter_input_block,
.novus_filter_input_block:has(#deviation_prepayment_currency) {
    width: 7rem;
    flex: none;
}

/* process_transactions matches: the JS tags each row finalpayed (perfect match) or unposted. Bare
   .finalpayed / .unposted paint a background, so keep the row clear and show the state as the
   legacy .dataset stripe did, in the same colours (tables.css). */
#matches_list .match_row.finalpayed,
#matches_list .match_row.unposted {
    background-color: transparent;
}

#matches_list .match_row.finalpayed > .match_status {
    box-shadow: inset 4px 0 0 #97D065;
}

#matches_list .match_row.unposted > .match_status {
    box-shadow: inset 4px 0 0 #F2BD48;
}

/* process_transactions: the Bank column's 605px min-width and nowrap keep the two columns side by side, so a
   narrow window makes that block wider than the page. Stretch, not centre: every block keeps the left edge. */
.stacked_in_column:has(> #create_voucher_link_view) {
    align-items: stretch;
}

/* Link-to-voucher form: the same grey panel as a match row's form, full width under the two columns.
   The view sits in a centring stacked_in_column, which would otherwise size it to its fixed-layout table. */
#create_voucher_link_view {
    width: 100%;
}

#create_voucher_link_form {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin: 0;
}

/* Match form: stacked_in_column centres its children; the key figures and fields span the row. */
#match_form > .stacked_in_column {
    align-items: stretch;
}

/* The four key figures share the card equally. A grid, not flex: 1 1 0 - that makes the wrapping
   flex row size its height as if every caption wrapped, leaving a band under the figures. */
#match_form .app-data-list--stats,
#create_voucher_link_form .app-data-list--stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0;
}

/* A step below the stats default: the figures sit in a form row, not a page summary. */
#match_form .app-data-list--stats .app-data-list__value,
#create_voucher_link_form .app-data-list--stats .app-data-list__value {
    font-size: var(--font-body-lg-size);
    line-height: var(--font-body-lg-line-height);
}

/* A bank transaction without an account number: its description takes the figure's place instead of a lone sub line. */
#create_voucher_link_form .create_voucher_link_account:empty {
    display: none;
}

#create_voucher_link_form .create_voucher_link_account:empty + .app-data-list__sub {
    font-size: var(--font-body-lg-size);
    font-weight: var(--font-weight-semibold);
    line-height: var(--font-body-lg-line-height);
    color: var(--color-text-default);
}

/* The card hugs its figures; only the base-currency lines make it taller. */
#match_form .app-card__body,
#create_voucher_link_form .app-card__body {
    padding-block: var(--spacing-md);
}

/* A bank-vs-voucher deviation must be booked before processing: the amount shares its icon's error colour. */
#journals_list .diff_amount {
    color: var(--color-error);
}

/* The payment rows read like the coding rows above them, whose readonly inputs are 13px (lists.css). */
#match_transaction_list tbody td {
    font-size: 13px;
}

/* A legacy fieldset p rule indents the base-currency line. */
#match_form .app-data-list__sub,
#create_voucher_link_form .app-data-list__sub {
    padding: 0;
}

/* Match form: a read-only value beside the date and account inputs sits on their 28px line. */
#match_form .match_form_value {
    min-height: 28px;
    display: flex;
    align-items: center;
}

#match_form table.match_form_value {
    display: table;
}

/* The first control in a one-row filter names something — a user, an assignment — so it gets a
   fixed measure wide enough for a full name, instead of sizing itself to whatever is selected.
   time_massop's user picker and time_invoice's assignment field. */
#time_massop_form .app-detail-page__section-content > .flex-row:first-of-type > .app-field:first-child,
#main_filter > .flex-row:first-of-type > .app-field:first-child {
    flex: 0 0 16rem;
}

#time_massop_form .app-detail-page__section-content > .flex-row:first-of-type > .app-field:first-child .novus_filter_select,
#time_massop_form .app-detail-page__section-content > .flex-row:first-of-type > .app-field:first-child .app-input,
#main_filter > .flex-row:first-of-type > .app-field:first-child .app-input {
    width: 100%;
    max-width: none;
}

/* A filter laid out as one bottom-aligned row — time_massop and time_invoice both do this, with
   the fields and the search button side by side. .app-field carries a 10px bottom margin, and flex
   align-end aligns margin boxes, so the fields' visible edge sat 10px above the button's. The row
   supplies its own spacing through its gap, so the margin comes off inside it. */
.app-detail-page__section-content > .flex-row.items-end > .app-field {
    margin-bottom: 0;
}

/* Detaljvy, Fakturatext and Fakturadatum share the row evenly, so the three land on a fixed width
   instead of each hugging whatever its current value happens to be. */
.time_invoice_create > .flex-row > .app-field {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
}

.time_invoice_create > .flex-row > .app-field > .app-input,
.time_invoice_create > .flex-row > .app-field > .app-input--md {
    width: 100%;
    max-width: none;
}

/* Fakturering and Massfakturering: the customer details read as one row under the filter, shown once
   a customer is loaded. Empty values drop out, except the address, which shows a dash when missing. */
.time_invoice_context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--spacing-sm) var(--spacing-2xl);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: var(--font-body-sm-size);
}
.time_invoice_context:has(#contact_name:empty),
.invoice_bulk_context:not(:has([data-mirror]:not(:empty))),
.time_invoice_context__item:has(> .time_invoice_context__value:empty) {
    display: none;
}
.time_invoice_context__item {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    min-width: 0;
}
.time_invoice_context__label {
    color: var(--text-secondary);
}
.time_invoice_context__value {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}
#contact_address:not(:empty) + #contact_zip:not(:empty)::before,
[data-mirror="contact_address"]:not(:empty) + [data-mirror="contact_zip"]:not(:empty)::before {
    content: ', ';
}
.time_invoice_context__item--address .time_invoice_context__value:not(:has(span:not(:empty)))::after {
    content: '\2013';
    color: var(--text-tertiary);
    font-weight: var(--font-weight-regular);
}

/* Each Massfakturering customer's free text is one settings column wide. */
.invoice_bulk_text {
    display: block;
    width: calc((100% - 3 * var(--spacing-lg)) / 4);
    min-width: 12rem;
}
/* Massfakturering's options column starts level with the inputs, not with their labels. */
.invoice_bulk_options {
    padding-top: calc(var(--font-body-sm-size) * var(--font-body-sm-line-height) + var(--spacing-xs));
}
.invoice_bulk_options > .app-checkbox__option:first-child {
    min-height: 28px;
    align-items: center;
}

/* The results get room before the Skapa faktura section. */
#invoice_list.time_invoice_results:not(:empty) {
    margin-bottom: var(--spacing-3xl);
}
/* Plussaldo and the quote read as section headers; theirs has no top margin, and the utilities lose to it. */
#invoice_list.time_invoice_results > .app-detail-page__section-header {
    margin-top: var(--spacing-2xl);
}
/* The free text is at most 50 characters, so it sits in Fakturering's settings row at field height. */
.time_invoice_settings textarea.app-input {
    height: 28px;
    min-height: 28px;
    overflow: hidden;
    resize: none;
}

/* ========== Aktivera funktioner (set/general/activation.htm) ==========
   Each feature is a card, and the cards flow in as many columns as fit. The page is wider than the
   usual contained settings page so three columns keep room for the interest fields. */
#settings_activation_form .app-detail-page--contained {
    max-width: 1400px;
}
#settings_activation_form .activation_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
    gap: var(--spacing-lg);
    align-items: stretch;
}
#settings_activation_form .activation_card .app-card__header {
    padding: var(--spacing-md) var(--spacing-lg);
}
#settings_activation_form .activation_card .app-card__title {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-body-md-size);
}
#settings_activation_form .activation_card .app-card__body {
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
}
#settings_activation_form .activation_card .app-field {
    margin-bottom: 0;
}
/* Labelled rows inside a card share one label column, and wrap rather than overflow a narrow card. */
#settings_activation_form .activation_card .app-field--inline {
    flex-wrap: wrap;
    row-gap: var(--spacing-xs);
}
#settings_activation_form .activation_card .app-field--inline > .app-field__label {
    flex: 0 0 12rem;
    min-width: 0;
    white-space: normal;
}
#settings_activation_form .activation_card .app-field--inline > .app-input:not(.app-input--narrow) {
	flex: 1 1 0;
	min-width: 8rem;
}
/* A checkbox alone in its row wraps its text instead of running past the card (Periodiseringar);
   the global no-shrink rule for options is meant for a radio that leads a row of inputs. */
#settings_activation_form .activation_card .app-field--inline > .app-radio-group__option:only-child {
    flex-shrink: 1;
    min-width: 0;
}

/* ========== Bokslutsnoter (report/financial_statement_questions.htm) ==========
   Each note reads question on the left, answer on the right, with the free text opening under the
   answer. The two equity tables arrive by AJAX; their script keys on the legacy icon and warning
   classes, so those stay and only their look is set here. */
.fsq_page {
    margin-top: var(--spacing-lg);
}
.fsq_question {
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border-tertiary);
}
.fsq_question .question-sort-buttons {
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}
.fsq_question .question-sort-button {
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
}
.fsq_question .question-sort-button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.fsq_question .question-sort-button .sym {
    font-size: 18px;
}
.fsq_header {
    display: flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: var(--spacing-sm);
}
.fsq_heading {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    cursor: pointer;
}
.fsq_header_edit {
    position: relative;
    display: flex;
    align-items: center;
}
.fsq_header_edit > .app-input {
    width: 32rem;
    max-width: 100%;
    padding-right: 28px;
}
.fsq_header_clear {
    position: absolute;
    right: 6px;
    font-size: 18px;
    color: var(--text-tertiary);
    cursor: pointer;
}
.fsq_header_edit_button {
    margin-left: var(--spacing-xs);
}
.fsq_header_edit_button .sym,
.fsq_row > .fsq_header > .app-action {
    font-size: 18px;
    color: var(--text-tertiary);
}
.fsq_header_clear:hover,
.fsq_header_edit_button a:hover .sym,
.fsq_row > .fsq_header > .app-action:hover {
    color: var(--text-primary);
}
.fsq_row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--spacing-sm) var(--spacing-2xl);
    align-items: start;
}
.fsq_question_text {
    font-size: var(--font-body-md-size);
    line-height: var(--font-body-md-line-height);
    color: var(--text-secondary);
}
.fsq_answer {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-width: 0;
}
.fsq_answer_text > textarea.app-input {
    width: 100%;
}
/* A note the user added: its title and delete sit in the question column. */
.fsq_row > .fsq_header {
    gap: var(--spacing-sm);
    margin-bottom: 0;
}
.fsq_row > .fsq_header > .app-input {
    flex: 1 1 auto;
}
.fsq_equity {
    margin-top: var(--spacing-lg);
}
.fsq_equity_table_container {
    position: relative;
    width: 100%;
}
#id28_dividend_display_row {
    margin-bottom: var(--spacing-md);
}
.fsq_equity_table .fsq_equity_cell {
    position: relative;
    display: flex;
    align-items: center;
}
.fsq_equity_table .fsq_equity_cell > .app-input {
    width: 100%;
}
.fsq_equity_table .embedded_input_field_icon.on_left {
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: var(--text-tertiary);
    cursor: pointer;
    z-index: 1;
}
.fsq_equity_table .embedded_input_field_icon.on_left .sym {
    font-size: 18px;
}
.fsq_equity_table .embedded_input_field_icon.on_left:hover {
    color: var(--text-primary);
}
.fsq_equity_table .change_in_equity_editable_input {
    padding-left: 28px;
}
.fsq_equity_table .change_in_equity_editable_input.modified {
    background: var(--yellow-100);
}
.fsq_equity_table .blank_row .app-input,
.fsq_equity_table .blank_row .app-input:disabled {
    background: transparent;
    border-color: transparent;
}
.fsq_equity_table .tax_code_summary > .app-table__td {
    background: var(--bg-tertiary);
    font-weight: var(--font-weight-semibold);
}
.fsq_equity_table input.novus_table_row_warning_color,
.fsq_equity_table input.novus_table_row_warning_color:disabled,
.fsq_equity_table td.novus_table_row_warning_color input {
    color: var(--color-error) !important;
}

/* .common_modal_action_bar in modal.css is justify-content: flex-end. A modal whose action belongs
   with the fields above it — a search over a filter, not a save over a form — puts it at the start
   instead. Same weight as the rule it counters, and loaded later. */
.common_modal_action_bar.modal_action_bar--start {
    justify-content: flex-start;
    padding-left: 0;
}

/* The contact filter is one bottom-aligned row: two search fields and the inactive toggle. The
   fields take a measure rather than the grid's equal thirds, which made them needlessly long for
   a customer number and a name. */
.modal_contact_filter > .app-field {
    flex: 0 1 15rem;
    margin-bottom: 0;
}

.modal_contact_filter > .app-checkbox__option {
    min-height: 34px;
    align-items: center;
}

/* Subscription overview — the summary boxes read as tinted panels rather than
   bordered cards, so the accent's lightest tone replaces fill and border. */
.subscription_overview_boxes > .app-card {
    background: var(--accent-50);
    border-color: transparent;
}

/* Tick services — the price list opens a modal and filters nothing, so it sits
   below the filter bar. Pull the ghost button's own padding so its label lines
   up with the list's left edge. */
.tick_service_price_list_row {
    margin: var(--spacing-md) 0;
}

.tick_service_price_list_row > .app-btn {
    margin-left: calc(-1 * var(--btn-px));
}

/* Headings and the price keep the display face — stated after the block above so they
   win the tie against .brx-packages-inner *. */
.brx-packages .brx-packages-inner .brx-packages-item-details-header-heading,
.brx-packages .brx-packages-inner .brx-packages-item-details-price-item {
    font-family: var(--font-family-display);
}

/* The details block reserves min-height: 400px for a short package description that
   is commented out of the markup, leaving a void between the name and the price
   (the price row is absolutely positioned against the bottom). Reserve only what the
   name, price and button need, so the prices still line up across the cards. */
@media (min-width: 67.5em) {
    .brx-packages .brx-packages-inner .brx-packages-item-details {
        min-height: 240px;
    }
}

/* ── Subscription settings ─────────────────────────────────
   The fields stack their label above the control. Without app-field--inline's
   label column nothing caps the width, so .app-input's width: 100% ran the
   selects across the whole section. */
#subscription_settings_form .app-field {
    max-width: 320px;
}

/* forms.css has `fieldset p { padding-left: 10px }`, which indents the address lines
   and the frequency help text 10px past the card title and the inputs above them. */
#subscription_settings_form .app-card__body p,
#subscription_settings_form .app-form__hint,
#subscription_settings_form .app-detail-page__section-content > p {
    padding-left: 0;
}

/* A card title is an h3, so it also picks up the section heading's 10px bottom margin.
   Inside the card header that margin is what stops it centring vertically. */
.app-detail-page__section-content .app-card__title {
    margin-bottom: 0;
}

/* The Frekvens and Fakturaspråk labels repeat the section heading directly above them.
   Hidden rather than deleted: the <label for> stays the select's accessible name, and
   no language key is lost. There is no visually-hidden utility in the system yet. */
#subscription_settings_form .app-field__label[for="invoicing_frequency"],
#subscription_settings_form .app-field__label[for="invoicing_language"],
#subscription_settings_form .app-field__label[for="tick_invoicing_language"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* A coding-row card under an incoming-document row is a legacy `novus_edit_table`, which tables.css
   makes `table-layout: fixed; width: 100%`. Inside a colspan cell of a `width: max-content` list
   (the --scroll / --pinned variants) Chrome resolves that to ~1e6px and the whole list grows with
   it. Auto layout lets the card size to its cell instead. */
.app-list--scroll .app-list__detail-panel > .novus_edit_table,
.app-list--pinned .app-list__detail-panel > .novus_edit_table {
    table-layout: auto;
}

/* app-table.css gives a right-pinned cell only its base background; mirror the left pins' hover
   and zebra rules so a frozen actions column follows its row like the frozen id columns do. */
tbody > .novus_table_row:hover .app-col--pin-end,
tbody > .novus_table_row.hovered .app-col--pin-end,
tbody > .novus_table_row.odd:hover .app-col--pin-end,
tbody > .novus_table_row.odd.hovered .app-col--pin-end {
    background: linear-gradient(var(--color-hover-bg), var(--color-hover-bg)), var(--bg-primary);
}

tbody > .novus_table_row.odd .app-col--pin-end {
    background-color: var(--neutral-50);
}

/* ========== FI income tax returns (bf/income_tax_returns/*.htm) ==========
   Collapsible section cards (page-owned toggler, see import_sie) and the tax-code tables. */
/* The divider moves to the body, so a collapsed card has no rule above its bottom border. */
.income_tax_returns .section_header.app-card__header,
#import_area .app-card__header {
    border-bottom: 0;
}
.income_tax_returns .section_form_content.app-card__body,
#import_area .app-card__body {
    border-top: 1px solid var(--color-border-subtle);
}
/* The page JS toggles on a click anywhere in the header; the status select is the exception. */
.income_tax_returns .section_row > .section_header {
    cursor: pointer;
}
.income_tax_returns .section_header .relative_flex_container {
    cursor: default;
}
/* app-card clips its content; the status list must open past a collapsed card's header. */
.income_tax_returns .section_row.app-card {
    overflow: visible;
}
/* The toggle arrows are links; they read as the section-header chevron, not as link text. */
.income_tax_returns .section_header .form_toggler > .sym,
#import_area .app-card__header .form_toggler > .sym {
    color: var(--text-tertiary);
}
/* Status badge select: Briox.Select fills its wrapper, so the wrapper sets the measure. */
.income_tax_returns .section_header .relative_flex_container,
#uploaded_attachments .relative_flex_container {
    width: 12rem;
}
.income_tax_returns .tax_group_header > .app-table__td {
    background: var(--bg-secondary);
    font-weight: var(--font-weight-semibold);
}
.income_tax_returns .tax_code_summary > .app-table__td {
    background: var(--bg-tertiary);
    font-weight: var(--font-weight-medium);
}
.income_tax_returns .clickable_table_row {
    cursor: pointer;
}
/* Fill-in forms (5_2025 / 6b_2024): sections start closed (no saved state) and stack with a gap. */
#income_tax_returns_form .section_form_content {
    display: none;
}
/* stacked_in_row used to stretch the rows; the step sections centre their children. */
#income_tax_returns_form .section_row {
    width: 100%;
    box-sizing: border-box;
}
#income_tax_returns_form .section_row + .section_row,
#import_area .app-card + .app-card {
    margin-top: var(--spacing-md);
}
/* Subsections were shadowed boxes inside the card; now flat blocks split by a rule. */
.income_tax_returns .subsection {
    padding: var(--spacing-lg) 0;
}
.income_tax_returns .subsection + .subsection {
    border-top: 1px solid var(--color-border-subtle);
}
.income_tax_returns .subsection_header {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}
.income_tax_returns .subsection_text {
    max-width: 1000px;
    margin: 0 0 var(--spacing-sm);
    padding-left: 0;
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}
/* Question rows: the question takes a fixed share of the row so the answers line up in one column. */
.income_tax_returns .label_input_wrapper.horizontal > .label_left_column {
    flex: 0 0 40%;
    max-width: none;
}
.income_tax_returns .label_input_wrapper.horizontal > .app-input {
    flex: 0 0 20rem;
}
.income_tax_returns .label_input_wrapper.horizontal > .app-input--narrow {
    flex-basis: 7rem;
}
.income_tax_returns .app-table__td[onclick] {
    cursor: pointer;
}
.income_tax_returns .attachment_button_row .app-helpbox {
    margin: 0;
}
/* PDF viewers in a Briox.Modal (components/modal/modal_show_image.htm, bf/modal/modal_file_preview.htm):
   near full screen. SetModalPosition centres with a 30px offset, so 100vh - 80px keeps 10px below. */
.common_modal_popup:has(iframe.connected_pdf),
.common_modal_popup:has(#pdf-js-viewer) {
    width: 92vw;
    max-width: 92vw;
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
}
.common_modal_popup:has(iframe.connected_pdf) > .common_modal_content,
.common_modal_popup:has(#pdf-js-viewer) > .common_modal_content {
    flex: 1 1 auto;
    min-height: 0;
}
/* stacked_in_column_item centres its column, which then shrinks to the frame's intrinsic 300px. */
.common_modal_popup .stacked_in_column_item:has(iframe.connected_pdf) {
    align-items: stretch;
}
.common_modal_popup iframe.connected_pdf {
    width: 100%;
    height: calc(100vh - 320px);
    min-height: 400px;
}
/* The preview form reuses the account picker's id; here it only holds the frame. */
.common_modal_popup #modal_account_select_form:has(#pdf-js-viewer) {
    display: block;
    width: 100%;
    height: 100%;
}
.common_modal_popup #pdf-js-viewer {
    width: 100%;
    height: 100%;
}
/* Distribution dialog (report/modal/modal_distribution.htm): the inline 700px. Without it the dialog
   resizes when the type swaps the field blocks, and the one-select grid shrinks to its text. */
#distribution_modal_form {
    width: min(44rem, 85vw);
    flex-flow: column nowrap;
    align-items: stretch;
}
/* The long date labels wrap to different heights; keep the inputs of a row on one line. */
#distribution_modal_form .app-form__row {
    justify-content: flex-end;
}
/* Attachment editor (edit_form_attachment.htm): the asset-type card and the PDF.js frame, from inline styles. */
#asset_type_panel {
    max-width: 860px;
}
#asset_type_panel .flex-row > .app-field__label {
    flex: 0 0 9rem;
}
#asset_type_panel .relative_flex_container {
    width: 20rem;
}
#pdf-js-viewer {
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
}
/* Attachment type picker (report/modal/modal_select_attachment_type.htm): replaces the inline 1200 × 400px.
   Wide enough for the longest form names; tall enough for the option list to open inside the body. */
.common_modal_form:has(#available_attachments_select) {
    display: block;
    width: min(56rem, 85vw);
    min-height: 18rem;
}
/* Account picker (bf/modal/modal_account_select.htm, Briox.Modal — no width option, so the form sets it).
   The filter row stays put and the tree scrolls; the form keeps its inline 70vh height. */
#modal_account_select_form {
    width: min(56rem, 85vw);
    display: flex;
    flex-flow: column nowrap;
    align-items: stretch;
    gap: var(--spacing-lg);
}
/* It also carries .common_modal_form (a wrapping flex row); the tree is plain block flow. */
#account_class_tree_container {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-md);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
}
/* The tree markup is built in PHP (ModalAccountSelect) and walked by the modal's JS, so it is styled, not rewritten. */
#account_class_tree_container ul {
    list-style: none;
    margin: 0;
    padding: 0 0 0 var(--spacing-xl);
}
#account_class_tree_container > ul {
    padding-left: 0;
}
/* Same box as the header text beside it (18px line + 2 × --spacing-xs), both top-aligned, so the
   glyph centres on the text instead of sitting on its baseline. */
#account_class_tree_container .acct_class_header::before {
    content: 'expand_more';
    display: inline-block;
    height: calc(18px + 2 * var(--spacing-xs));
    font-family: 'Material Symbols Outlined';
    font-size: var(--icon-size-md);
    line-height: calc(18px + 2 * var(--spacing-xs));
    vertical-align: top;
    color: var(--text-tertiary);
    cursor: pointer;
}
#account_class_tree_container .acct_class_header.closed::before {
    content: 'chevron_right';
}
#account_class_tree_container .acct_class_header_text {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    line-height: 18px;
    vertical-align: top;
    font-weight: var(--font-weight-semibold);
}
#account_class_tree_container .acct_class_connected_accounts > li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}
#account_class_tree_container .acct_class_connected_accounts > li:hover {
    background: var(--bg-tertiary);
}
#account_class_tree_container .acct_select_label,
#account_class_tree_container .acct_select_span {
    flex: 1 1 auto;
    cursor: pointer;
}
#account_class_tree_container .acct_balance_link {
    margin-left: auto;
    font-size: var(--font-caption-md-size);
}
/* Same look as .app-checkbox__option's box, which the PHP-built rows cannot be wrapped in. */
#account_class_tree_container input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    border: 1.5px solid var(--neutral-300);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-primary);
    cursor: pointer;
}
#account_class_tree_container input[type="checkbox"]:checked {
    border-color: var(--accent);
    background: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}
/* CustomTooltips appends its box inside the icon; in a header cell it would inherit uppercase and nowrap. */
.income_tax_returns .app-table__th .custom_tooltip {
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    font-weight: var(--font-weight-regular);
}

/* Manage Users — name and e-mail share the first column, the address as a quieter
   second line. The cell owns the ellipsis on each line rather than the <td>. */
.user_identity_cell {
    line-height: var(--font-body-md-line-height);
}

.user_identity_cell__name {
    font-weight: var(--font-weight-semibold);
}

.user_identity_cell__email {
    font-size: var(--font-body-sm-size);
    color: var(--color-text-muted);
}

/* Role templates — the sysadmin row is the only one that stands out, and only by its
   name. It used bold_text_700 on the <tr>, which bolded the description and the check
   marks with it. */
.role_template_name--sysadmin {
    font-weight: var(--font-weight-semibold);
}

/* lists.css sets this column to 10px/500 — the caption size, below the smallest body
   token, on the longest and most-read column in the list, and heavier than the cells
   around it. Body text at regular weight; the wrapping rules there still apply. */
/* lists.css puts `display: -webkit-box` + `-webkit-line-clamp: 2` on the CELL to clamp
   long descriptions. On a <td> that leaves the table's row layout — the cell rendered
   31px tall against its neighbours' 38 and drew its own border out of line. The cell
   goes back to being a cell; the clamp moves to the div inside it. */
.app-list td[id^="role_template_list_description_"] {
    display: table-cell;
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    font-weight: var(--font-weight-regular);
}

.role_template_description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Manage consultants (fs/fs/manage_consultants) ─────────
   A four-step assignment flow on the stacked_in_column layout, so the sections keep
   stacked_in_column_item rather than taking app-detail-page__section. These rules
   replace the 20 inline styles the page carried. */

.manage_consultants_intro {
    font-size: var(--font-body-md-size);
    line-height: var(--font-body-md-line-height);
    color: var(--color-text-muted);
}

/* Typography: the page ran its own sizes — 25px/500 section headings in #233037,
   neither on the scale nor in the palette. The 44px page title is gone; the top bar
   and the breadcrumb both already said "Hantera konsulter". */
.novus_first_header {
    font-size: var(--font-display-sm-size);
    font-weight: var(--font-display-sm-weight);
    line-height: var(--font-display-sm-line-height);
    letter-spacing: var(--font-display-sm-letter-spacing);
    color: var(--color-text-default);
}

/* The sections were .novus_centered_form: a drop-shadowed card with 30/35/20/40 padding
   and max-height: 777px + overflow: auto, a shape used nowhere else in the migrated app.
   The class carried width: 100% too, so the forms need that back or they collapse to 0. */
/* stacked_in_column is a flex column with align-items: center, so the 1000px sections sat
   centred in a 1116px column — 63px right of the breadcrumbs and the page title above them.
   Scoped: ten other templates use the class and none of them were looked at. */
.manage_consultants_column {
    align-items: flex-start;
}

/* .main_content's own `padding: 10px 5px` then left the content 5px right of the
   breadcrumbs; the vertical half is kept. */
.manage_consultants_page {
    padding-left: 0;
    padding-right: 0;
}

.manage_consultants_form {
    width: 100%;
    /* novus_centered_form ended with 20px of padding; without it a section whose last
       element is a bare button (Lägg till en ny roll) sits flush against the next heading. */
    padding-bottom: var(--spacing-xl);
}

/* The Företag empty state stands in for the client table, so its box matches the list
   wrapper beside it — app-card's own --color-border-default / --radius-xl would put two
   different boxes in one page. */
.manage_consultants_form > .app-card {
    border-color: var(--color-border-subtle);
    border-radius: var(--radius-lg);
}

/* The component caps itself at 520px, which broke the one-sentence message over two
   lines inside a 1000px card. It still wraps on a narrow window, and in the languages
   whose wording runs longer. */
.manage_consultants_form .app-empty-state {
    max-width: none;
}

/* The component gives the message 20px below it, which with the line's own leading put
   35px between the sentence and its button. */
.manage_consultants_form .app-empty-state__desc {
    margin-bottom: var(--spacing-sm);
}

/* The step number was white on #BDC1C3, a grey from outside the palette. The legacy rule
   is span.badge.novus_header_badge at (0,2,1), so this has to carry the element too. */
/* The step number was white on #BDC1C3, a grey from outside the palette. It now takes
   the same ink as the navigation icons, and a 28px circle sits better beside an 18px
   heading than the legacy 35px did. The legacy rule is span.badge.novus_header_badge
   at (0,2,1), so this has to carry the element too. */
span.badge.novus_header_badge {
    background: var(--neutral-700);
    width: 28px;
    height: 28px;
    margin-right: var(--spacing-md);
    font-size: var(--font-body-sm-size);
    font-weight: var(--font-weight-semibold);
}

.licence_app_icons {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* The role row is a bare flex with no gap: the icons sat 6px from the select and flush
   against the "add a new role" link. */
.manage_consultants_form .novus_form_row {
    gap: var(--spacing-3xl);
}

/* Add-a-new-role shares the row with the select and the application icons, pushed to the
   far right by the auto margin. */
.manage_consultants_role_action {
    margin-left: auto;
}

/* Application licence icons (manage consultants, add user) were #app-circled-* sprites in coloured
   rings. They are now the same glyphs and the same ink the navigation uses for those applications. */
.licence_app_icon {
    font-size: var(--icon-size-lg);
    color: var(--icon-color-primary);
    cursor: default;
}

/* The main-contact checkbox label is body copy, like every other sentence on the page. */
.manage_consultants_form .novus_input_label {
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-regular);
    line-height: var(--font-body-md-line-height);
    color: var(--color-text-default);
}

/* The section heading already says Roll; the label stays for the select's accessible name. */
.manage_consultants_role_label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* The client filter kept the legacy 210px search box; the row gap now spaces the checkboxes. */
.manage_consultants_search {
    width: 16rem;
}

.manage_consultants_actions {
    width: 100%;
}

/* ── Role template modal ───────────────────────────────────
   The toggle control itself is the toggles open question, but its label ran its own
   15px/700 in #535353 — not on the scale, heavier than the dialog title beside it, and
   a grey from outside the palette. Matched to the modal's other labels. */
/* The dialog's 14px gutter is tight for a body this wide — the rights table, its Placering
   selects and the two long permission descriptions all run edge to edge. Scoped to the role
   modal so no other dialog's gutter moves. */
.common_modal_popup:has(#user_rights_form) .app-dialog__header,
.common_modal_popup:has(#user_rights_form) .app-dialog__body,
.common_modal_popup:has(#user_rights_form) .app-dialog__footer {
    padding-left: var(--spacing-2xl);
    padding-right: var(--spacing-2xl);
}

/* Moved out of the cramped dialog header down beside Systemadministratör / Ägare, and from
   the legacy toggle to the design system's checkbox — which also takes it out of the toggles
   open question. The row borrows the shape those two already use. */
.role_default_row__text {
    flex: 1;
}

.role_default_row__title {
    margin: 0;
    font-size: var(--font-body-md-size);
    line-height: var(--font-body-md-line-height);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-default);
}

/* ── Role modal: the shared rights table ───────────────────
   user_rights_table.htm is its own migration run; this is alignment only. The header row
   and the module rows carry four cells, the rights rows a single colspan cell, so every
   selector is anchored on a module row or a <th>. */
#user_rights_table th:first-child,
#user_rights_table tr.module_rights_row > td:first-child {
    text-align: left;
    white-space: nowrap;
}

/* The header cells carried inline 10/30/20/15% widths that shared the slack out across every
   column, so Välj sat 130px wide around a 16px checkbox. Widths now live here: Modul absorbs
   the slack and the rest hug. */
#user_rights_table th.select_col,
#user_rights_table th.toggle_col {
    width: 1px;
}

#user_rights_table th.module_col {
    width: 100%;
}

#user_rights_table th.price_col,
#user_rights_table th.position_col {
    width: 1px;
    white-space: nowrap;
}

/* The price cells carry no class; without this "0 SEK" breaks onto two lines in the 1px column. */
#user_rights_table td[id^="price_"] {
    white-space: nowrap;
}

#user_rights_table th.position_col,
#user_rights_table tr.module_rights_row > td.position_col {
    text-align: left;
}

#user_rights_table th.toggle_col,
#user_rights_table tr.module_rights_row > td:last-child {
    text-align: center;
}

/* Placering holds a Briox.Select widget and the last cell a chevron — both are blocks,
   so text-align alone does not move them. */
#user_rights_table tr.module_rights_row > td.position_col,
#user_rights_table tr.module_rights_row > td:last-child {
    display: table-cell;
}

#user_rights_table tr.module_rights_row > td.position_col > * {
    margin-left: 0;
    margin-right: auto;
}

#user_rights_table tr.module_rights_row > td:last-child > * {
    margin-left: auto;
    margin-right: auto;
}

/* The Briox.Select widget carries a legacy 10px right margin inside its block. */
#user_rights_table tr.module_rights_row > td.position_col .novus_filter_select {
    margin-right: 0;
}

/* Air between the Placering widget and the accordion chevron beside it — they sat 3px apart. */
#user_rights_table tr.module_rights_row > td.position_col {
    padding-right: var(--spacing-xl);
}

/* The legacy caret is a filled ▼ (forms.css `content: '\25bc'`), which reads as a different
   language from the keyboard_arrow_down chevron sitting right next to it in the same row.
   Scoped to this table — every Briox.Select in the app still draws the triangle, and changing
   that is a design system decision, not this run's. */
#user_rights_table tr.module_rights_row > td.position_col .novus_filter_select::after {
    content: '\e5cf';
    font-family: 'Material Symbols Outlined', sans-serif;
    font-size: var(--icon-size-md);
    font-weight: var(--icon-weight);
    line-height: 1;
}

/* stylesheets/general.css floats every `td label` right with a 10px margin, so the
   checkbox sat at the cell's right edge whatever text-align said. */
#user_rights_table .app-checkbox__option {
    float: none;
    margin-right: 0;
}

/* Same 12px between a checkbox and the text it labels as in the rows above the table — here
   the two sit in separate cells, so it is split across their padding. */
#user_rights_table th:first-child,
#user_rights_table tr.module_rights_row > td:first-child {
    padding-left: 0;
    padding-right: var(--spacing-sm);
}

#user_rights_table th.module_col,
#user_rights_table tr.module_rights_row > td:nth-child(2) {
    padding-left: var(--spacing-sm);
}

/* The expander was an `arrow_up` sprite that the .flip class rotates 180°, so a collapsed row
   pointed up and an expanded one down — backwards, and in sprite rather than symbol. */
#user_rights_table .toggle_arrow,
#user_rights_table .toggle_arrow.flip {
    /* general.css makes this a block, so the inline-flex glyph inside sat on the line box's
       baseline and rode ~10px above the row's centre. */
    display: flex;
    align-items: center;
    justify-content: center;
}

#user_rights_table .toggle_arrow .sym {
    font-size: var(--icon-size-md);
    color: var(--icon-color-primary);
}

/* app-form__row's 4px gap is meant to sit between a label and its field. This cell holds the
   three role-wide checkbox rows and the rights table, which space themselves. */
.role_rights_cell {
    gap: 0;
}

/* Empty, Benämning should read as the same control as Rollnamn beside it rather than as a
   block three times its height. It still grows with its content and stays resizable. */
#user_rights_form #role_description {
    min-height: 34px;
    height: 34px;
}

/* Ange som förvald / Systemadministratör / Ägare: the row is top-aligned so the checkbox
   does not drift down beside a three-line description — this centres it on the heading
   line instead of on the block. */
.modal_row_toggle_container > .app-checkbox__option {
    min-height: calc(var(--font-body-md-size) * var(--font-body-md-line-height));
    align-items: center;
}

/* The Systemadministratör / Ägare descriptions ran 10px italic in #666 — below the
   smallest body token, off-palette, and the only italic copy in the dialog. */
.common_modal_popup .novus_table_row_subtext {
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
    font-style: normal;
    color: var(--color-text-muted);
}

/* Label and the MetaLang flag share a row so the field below them starts at the label's
   own left edge instead of being pushed in by the flag. */
.meta_lang_label_row {
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

/* The dialog body already pads the content; the form's own 16px on top of that put every
   field 16px right of the title, the default checkbox and the footer buttons. */
#user_rights_form {
    padding-left: 0;
    padding-right: 0;
}

/* The rights matrix marks a partly-selected module by setting the native `indeterminate`
   property from JS; the legacy .checkmark drew it as a plus. app-input.css has no
   :indeterminate rule, so without this a partial module reads as unselected. */
.app-checkbox__option input[type="checkbox"]:indeterminate {
    border-color: var(--accent);
    background: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* ========== Toggle / Switch — design system alignment ==========
   Covers all three legacy variants: .toggle_input, .switch .slider, .novus_toggle_input.
   Accent: blue-500 for the checked state. */

/* --- Track (unchecked) --- */
.toggle_input_label::before,
.novus_toggle_input_label::before,
.slider {
    background: var(--neutral-300);
    border-radius: var(--radius-full, 9999px);
    box-shadow: none;
    height: 20px;
    width: 38px;
    transition: background-color var(--transition-fast);
}

/* toggle.css centres its taller legacy tracks (26px / 16px); re-centre the 20px one under the thumb. */
.toggle_input_label::before,
.novus_toggle_input_label::before {
    top: calc(50% - 10px);
}

/* --- Track (hover) --- */
.toggle_input:focus + .toggle_input_label::before,
.toggle_input_label:hover::before,
.novus_toggle_input:focus + .novus_toggle_input_label::before,
.novus_toggle_input_label:hover::before,
input:hover + .slider {
    background: var(--neutral-400);
}

/* --- Track (checked) --- */
.toggle_input:checked + .toggle_input_label::before,
.novus_toggle_input:checked + .novus_toggle_input_label::before,
input:checked + .slider,
input:checked + .slider.sininen {
    background-color: var(--accent);
}

/* --- Thumb --- */
.toggle_input_label::after,
.novus_toggle_input_label::after,
.slider:before {
    background: #ffffff;
    border-radius: var(--radius-full, 9999px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.08);
    width: 18px;
    height: 18px;
    top: calc(50% - 9px);
}

/* --- Thumb (checked) --- */
.toggle_input:checked + .toggle_input_label::after,
.novus_toggle_input:checked + .novus_toggle_input_label::after,
input:checked + .slider:before,
input:checked + .slider.sininen:before {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.1);
    transform: translateX(19px);
}

/* --- Focus ring --- */
.switch input:focus + .slider,
.switch input:active + .slider {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* --- Disabled --- */
.toggle_input:disabled + .toggle_input_label::before,
.novus_toggle_input:disabled + .novus_toggle_input_label::before {
    background: var(--neutral-200);
}

/* register_assignment_edit / register_assignment_template_edit activity rows: an info icon in a journal header
   sits in the picker's 16px box, so the two line up beside one label. Scoped: the document editors carry their own
   header icons at the default size. */
#activitylist .app-journal__th > .app-info-icon {
    width: 16px;
    height: 16px;
    font-size: 16px;
    margin-left: var(--spacing-xs);
    vertical-align: top;
    margin-block: -2px;
}

/* The document-request status badge (lists.css) sizes an inline svg to 12px; the same rule for the
   Material Symbol that replaced it in modal_document_request_all. */
.document_request_icon > .sym {
    font-size: 12px;
}

/* Kontoklass on the account page is a one-column journal: the component's 600px floor (meant for
   multi-column journals) would scroll a single text column sideways in a narrow window. */
#table_vat_classes_connected.app-journal {
    min-width: 0;
}

/* Add-user wizard (fs/fs/add_new_user.htm): Briox.MultiStepForm keys on the briox_multi_step_form_*
   classes, so they stay; the legacy Roboto/blue palette from components.css is restated on tokens. */
.briox_multi_step_form_header {
    font-family: var(--font-family-primary);
    color: var(--text-primary);
}
.briox_multi_step_form_step_label {
    color: var(--text-secondary);
}
.briox_multi_step_form_divider {
    border-top-color: var(--border-primary);
}
.briox_multi_step_form_bar.active {
    background-color: var(--accent);
}
.briox_multi_step_form_bar.inactive {
    background-color: var(--bg-tertiary);
}

/* Add-user module flow (no package): one column as wide as the wizard, instead of full-width fields over
   a centred rights table. stacked_in_column centres its children, so the intro texts are stretched to read left. */
#add_new_user_container > .stacked_in_column_item:not(.briox_multi_step_form) {
    width: 100%;
    max-width: 700px;
}

#add_new_user_container > .stacked_in_column_item > p.text-body-md {
    align-self: stretch;
}

/* modal.css paints #role_template_id_select's list rows blue with an id-scoped rule that beats the
   class-scoped skin above; restate the skin at that specificity (add-user wizard, edit-user, role dialogs). */
#role_template_id_select .novus_filter_select_list li.selected,
#role_template_id_select .novus_filter_select_list li:hover,
#role_template_id_select .novus_filter_select_list li.ally-focus-within {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
#role_template_id_select .novus_filter_select_list li.selected p,
#role_template_id_select .novus_filter_select_list li:hover p,
#role_template_id_select .novus_filter_select_list li.ally-focus-within p {
    color: var(--text-secondary);
}

/* Rights matrix (fs/fs/user_rights_table.htm): its selects were novus_medium_input, 160px; as app-input they
   would fill a cell that hugs its content, so the legacy width is kept here. */
#user_rights_table .novus_filter_select.app-input {
    width: 10rem;
}

/* Invite dialog (modal_confirm_client_user_invitation): Briox.Modal sets no width; keep a fixed one and the 130px box. */
.common_modal_popup:has(textarea#custom_email_text) #invite_user_form.common_modal_form {
    width: 36rem;
    max-width: calc(100vw - 2rem);
}
.common_modal_popup:has(textarea#custom_email_text) textarea#custom_email_text {
    min-height: 8rem;
}

/* A contenteditable app-input is a textarea the JS reads with .text(); the flex row would lay its lines side by side. */
.app-input[contenteditable] {
    display: block;
    height: 130px;
    padding: var(--spacing-sm) var(--spacing-md);
    overflow-y: auto;
}

/* Role info card (add-user wizard, edit-user and role dialogs): the helpbox is sized as a page banner, but
   here it sits inside a form, so the name drops to body-md and the legacy `fieldset p` line-height is undone. */
#role_info_card .app-helpbox__header {
    font-size: var(--font-body-md-size);
}
#role_info_card_name {
    font-weight: var(--font-weight-semibold);
}
#role_info_card .app-helpbox__body p {
    font-size: var(--font-body-sm-size);
    line-height: var(--font-body-sm-line-height);
}

/* Rights matrix: forms.css sizes each right to max-content, so an expanded module's three columns could not wrap
   and overflowed the role and edit-user dialogs. Let the labels wrap inside their column. */
#user_rights_table .rights_list > .novus_table_input_block {
    width: auto;
    min-width: 0;
}

/* Edit-user Integrations tab: the application name + GUID column hugs so the GUID stays on one line;
   the other headers may wrap instead, as they did in the legacy dialog. */
#integrations .app-table__th:not(.app-col--hug) {
    white-space: normal;
}

/* Time register summary: the unit column hugs its label and the seven days plus the sum share the rest
   equally; max-width: 0 keeps each cell's text out of the width calculation. */
#time_schema_table .app-table__th:not(.app-col--hug),
#time_schema_table .app-table__td:not(:first-child) {
    width: 12.5%;
    max-width: 0;
}
/* The date row and the weekday row read as one header: no rule between them. */
#time_schema_table .app-table__head .app-table__row:first-child .app-table__th {
    border-bottom: none;
    padding-bottom: 0;
}

/* CRM report forms: the report-column picker lists its checkboxes in two columns. */
.crm_report_columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm) var(--spacing-xl);
}
/* Messages the prototype validator shows; they used to carry inline red and floats. */
.crm_report_form .custom-advice,
.crm_report_form .validation-advice {
    color: var(--color-error);
    font-size: var(--font-body-sm-size);
}
/* CRM order/offer report: type checkbox and its filter select in aligned columns. */
.crm_oof_type_row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 18rem);
    align-items: center;
    gap: var(--spacing-md);
}

/* ========== CRM import wizard step 2 (crm/crm_crm/settings_import_new2.htm) ==========
   The column-mapping rows are PHP-built <p>s (the page script hides rows with .up('p')), so they are laid
   out here instead of rewritten; the legacy `fieldset p label` float/width rules would otherwise win. */
#settings_import2 .crm_import_map_row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-xs);
    padding: 0;
    min-height: 28px;
}

#settings_import2 .crm_import_map_row > label {
    flex: 0 0 9rem;
    width: auto;
    float: none;
    margin: 0;
    padding: 0;
    text-align: left;
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

#settings_import2 .crm_import_map_row > .app-input {
    flex: 0 0 10rem;
    width: 10rem;
}

#settings_import2 .crm_import_settings,
#settings_import2 .crm_import_options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

#settings_import2 .crm_import_settings .app-input {
    width: 16rem;
}

#settings_import2 .crm_import_users {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 0;
}

/* A multi-select is a list box, not a one-line field. */
#settings_import2 select[multiple].app-input {
    width: 16rem;
    height: auto;
    padding: var(--spacing-xs);
}

/* ========== Header banners (common_header.htm: trial, system message, unpaid invoice, financial year) ==========
   Notices under the page header, drawn like a compact helpbox so header and page notices look alike. */
.header_banner {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-sm) calc(var(--spacing-md) + 32px) var(--spacing-sm) var(--spacing-lg);
    border: 1px solid var(--blue-200);
    border-radius: var(--radius-lg);
    background: var(--blue-50);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
    text-align: left;
}

.header_banner > .sym {
    font-size: 20px;
    color: var(--text-secondary);
}

.header_banner--warning {
    background: #fff3cd;
    border-color: #ffe69c;
}

.header_banner--danger {
    background: var(--red-50);
    border-color: var(--red-200);
}

.header_banner > .header_banner__close {
    position: absolute;
    right: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
}

/* ========== Trial conversion wizard (user/modal/modal_trial_convert.htm) ========== */
#trial_convert_form .trial_convert_header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
    margin-bottom: var(--spacing-xl);
}

/* lists.css makes the package buttons full width; app-btn's own width would otherwise win. */
#trial_convert_form .package_column .package_button {
    width: 100%;
}

#trial_convert_form .trial_convert_actions {
    gap: var(--spacing-sm);
    align-items: center;
    min-height: 0;
    margin-top: var(--spacing-xl);
}

/* Back sits on the left, Cancel and the primary on the right. */
#trial_convert_form .trial_convert_actions > .trial_convert_back {
    margin-right: auto;
}

#trial_convert_form .trial_convert_amounts {
    margin: var(--spacing-lg) 0;
}

#trial_convert_form .app-form__group + .app-form__group {
    margin-top: var(--spacing-xl);
}

/* cpnl API applications: the logo thumbnail rendered at its upload size, often 110px tall. */
.api_app_thumb {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Deepview (cpnl API lists, cpnl Dashboard): deepview.css sized the holder for two 24px PNGs and drew the panel with grey borders. */
#deepview_icon_holder {
    display: flex;
    gap: var(--spacing-xs);
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    margin-bottom: var(--spacing-sm);
}

#deepview_edit_holder {
    background: var(--color-bg-default);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* cpnl API application Deepview panel */
.api_app_panel {
    padding: var(--spacing-lg);
}

.api_app_panel__section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    border: none;
    margin: 0;
    padding: 0;
}

/* The connected-accounts fieldset carries both classes; the section reset above would zero its padding. */
.api_app_panel.api_app_panel__section {
    padding: var(--spacing-lg);
}

.api_app_panel__head {
    display: flex;
    gap: var(--spacing-xl);
    align-items: flex-start;
}

.api_app_panel__upload {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 160px;
}

.api_app_panel__logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.api_app_panel__data {
    flex: 1;
    min-width: 0;
}

.api_app_panel__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* forms.css floats and greys the rights as boxes; they read as chips, the granted ones accented. */
.api_application_rights_box {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

div.api_application_rights_box {
    margin: 0;
    padding: var(--spacing-md);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
}

span.api_application_right.app-chip {
    float: none;
    margin: 0;
    padding: 0 var(--spacing-sm);
    border: 1px solid var(--chip-border);
    border-radius: var(--radius-full);
    background: var(--chip-bg);
}

span.api_application_right.api_application_right_selected {
    --chip-bg: var(--accent-50);
    --chip-fg: var(--accent-800);
    --chip-border: var(--accent-200);
}

span.api_application_right_edit.app-chip {
    cursor: pointer;
}

span.api_application_right_edit.app-chip:hover {
    background: var(--chip-bg-hover);
    color: var(--chip-fg);
}

/* cpnl Onboard API developer: rows the page's JS shows and hides as a group sit in a wrapper div,
   out of reach of app-input.css's section-content rule, so they get the same 240px floor here. */
.onboard_rows > .app-field--inline > .app-input,
.onboard_rows > .app-field--inline > .relative_flex_container > .app-input {
    width: auto;
    min-width: 240px;
}

/* cpnl Onboard API developer: spacing for the result's sub-headings and the link below it. */
.onboard_result_title {
    margin-top: var(--spacing-lg);
}

/* cpnl Databasverktyg: the read-only facts and the move row stay at form width, not the page's. */
.database_tools_info {
    max-width: 640px;
}

.database_tools_move {
    justify-content: flex-start;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.database_tools_move > .relative_flex_container {
    flex: 0 0 240px;
}

.database_tools_text p + p,
.database_tools_text p + .app-detail-page__section-actions {
    margin-top: var(--spacing-md);
}

/* The tag name is the toggle's label; on one line it no longer runs under the switch. */
.database_tools_tag {
    white-space: nowrap;
}

/* cpnl Klienthanterarverktyg: the copy tool's sub-accordions are frameless fieldsets inside the
   section, with a header one step below the section header. Replaces the template's own <style>. */
fieldset.cmt_accordion_fieldset {
    border: none;
    padding: 0;
    margin: 0 0 var(--spacing-xs) 0;
}

.app-detail-page__section-header.cmt_accordion_header {
    font-size: var(--font-body-md-size);
    margin-bottom: var(--spacing-md);
}

.app-detail-page__section-header.cmt_accordion_header > .sym {
    font-size: 20px;
}

.cmt_section .novus_form_row:has(> .app-checkbox__option) {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--spacing-sm);
}

.cmt_section .novus_form_row:has(> .app-checkbox__option) > .app-field__label {
    flex: 1;
    min-width: 0;
}

.cmt_subheading {
    width: 100%;
}

/* app-detail-page.css zeroes a table-only section body, which put the clients list flush against the next header. */
.cmt_section > .app-detail-page__section-content:has(> .app-table:only-child) {
    margin-bottom: var(--spacing-2xl);
}

/* cpnl Verktyg pages that post a real <form>: its rows sit one level below the section-content 240px rule. */
.cpnl_tools_form > .app-field--inline > .app-input,
.cpnl_tools_form > .app-field--inline > .relative_flex_container > .app-input,
#open_banking_form .conditional-fields > .app-field--inline > .app-input,
#open_banking_form .conditional-fields > .app-field--inline > .relative_flex_container > .app-input {
    width: auto;
    min-width: 240px;
}

.cpnl_tools_form > .app-field--inline > .relative_flex_container,
#open_banking_form .conditional-fields > .app-field--inline > .relative_flex_container {
    flex: 0 0 auto;
}

/* cpnl Bankverktyg: the description above each tool's fields. */
.bst_intro {
    margin-bottom: var(--spacing-lg);
}

/* cpnl APIX tools: the lookup results sit below the form that fetched them. */
.apix_result {
    margin-top: var(--spacing-lg);
}

/* cpnl Importera byrå klienter: the Fetch data button sits straight in a flex column, which stretched it full width. */
#client_options #button_fetch_data {
    align-self: flex-start;
}

/* The consultant / role selects lost their width with the legacy novus_*_input classes; one fixed track each. */
#client_options .user_info {
    gap: var(--spacing-lg);
}

#client_options .user_info > .label_input_wrapper {
    flex: 0 0 240px;
}

/* cpnl Crediflow tools: the rows float (float_left) and shrink to their content, so the fields get the 240px floor here. */
#crediflow_tools_form .label_input_wrapper > .app-input {
    min-width: 240px;
}

/* cpnl Kontraktsplan edit: the product checkboxes sat centred in the stacked column with the label over the box. */
#prod_package_info {
    justify-content: flex-start;
}

#prod_package_info .novus_filter_input_block {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-sm);
}

/* cpnl Kampanjkod: the add form follows the list directly; novus_edit_block_body (kept for its width
   anchor in the stacked column) is a wrapping row, so the fields stack again here. */
#campaign_code_form {
    margin-top: var(--spacing-2xl);
}

#campaign_code_form .novus_edit_block_body {
    flex-flow: column nowrap;
}

/* cpnl Avtal edit: the price tables keep their floated 30% cards; the rest of the page's sub-blocks. */
.contract_price_table {
    width: 100%;
}

.app-detail-page__section-content > .app-field--inline > .app-input.contract_wide_input {
    min-width: min(480px, 100%);
}

.contract_subheading {
    clear: both;
    text-align: left;
    margin: var(--spacing-lg) 0 var(--spacing-sm);
}

/* Every section starts below the floated price cards of the one before it. */
#editContractForm fieldset.app-detail-page__section,
#newContractForm fieldset.app-detail-page__section {
    clear: both;
    padding-top: var(--spacing-lg);
}

.contract_pricing_type,
.contract_info {
    margin-bottom: var(--spacing-lg);
}

/* The contract selects stay native (five have no id for Briox.Select); held at field width. */
#editContractForm select.app-input,
#newContractForm select.app-input {
    width: auto;
    min-width: 240px;
}

/* cpnl lists with status rows (Avtal contract_type 2, cronjob failures, bank certificate renewals): like main's
   legacy dataset, the status is only a bar on the first cell; the rows stay plain. */
.cpnl_status_rows tr.overdue > td:first-child,
.cpnl_status_rows tr.red > td:first-child {
    box-shadow: inset 4px 0 0 #FF5000;
}

.cpnl_status_rows tr.finalpayed > td:first-child {
    box-shadow: inset 4px 0 0 var(--success);
}

/* cpnl Företag → Ladda ned databas: connect-users step. */
.ddb_dbid {
    margin-bottom: var(--spacing-md);
}

.ddb_apps .sym {
    font-size: var(--icon-size-md);
    color: var(--text-secondary);
}

.ddb_yes {
    color: var(--success);
}

.ddb_no {
    color: var(--text-tertiary);
}

/* ========== Prototype autocomplete (div.autocomplete, common_autocomplete.htm) ==========
   The Ajax.Autocompleter dropdown still used by ~44 legacy fields (cpnl Koppla användare, contact
   pickers…). Same panel as the jQuery UI dropdown above; position, width and z-index stay legacy.
   The selected colours in autocomplete.css are !important, so these have to be too. */
div.autocomplete:not(.novus_autocomplete) {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
    padding: var(--spacing-xs) 0;
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-primary);
    overflow: hidden;
}

div.autocomplete:not(.novus_autocomplete) ul li {
    padding: var(--spacing-sm) var(--spacing-md);
    line-height: var(--font-body-sm-line-height);
    transition: background var(--transition-fast);
}

div.autocomplete:not(.novus_autocomplete) ul li:hover,
div.autocomplete:not(.novus_autocomplete) ul li.selected {
    background-color: var(--accent-light) !important;
    color: var(--text-primary) !important;
    padding: var(--spacing-sm) var(--spacing-md);
}

div.autocomplete:not(.novus_autocomplete) ul li.autocomplete_group_name {
    font-size: var(--font-caption-lg-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: default;
}

/* cpnl Intern fakturering: cronjob health, the support_on/off PNGs replaced by a status symbol. */
.ii_health {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
}

.ii_health .sym {
    font-size: 32px;
}

.ii_health_ok {
    color: var(--success);
}

.ii_health_bad {
    color: var(--error);
}

/* A list row that opens something on click shows it, whether or not the template added `pointer`. */
.app-list tbody > .novus_table_row[onclick] {
    cursor: pointer;
}

/* cpnl log lists: free-text cells (Data, Message, Error) wrap. novus_list_table cells are nowrap, and a
   statistics Data value runs to 10k characters on one line, which collapsed the whole table to zero height. */
.novus_list_table td.cpnl_wrap_cell {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 240px;
}

/* cpnl Statistik log: its Data dumps make the table over a million px tall, and Chrome's first layout of a table
   that size inside an inline-size container (.app-list, .app-detail-page__section-content) comes out at zero
   height. So this one table sits outside .app-list and its section drops the containment. */
.stat_log_table {
    width: 100%;
}

.stat_log_section {
    container-type: normal;
}

/* cpnl Dashboard (Nyheter): the per-row language select, and the Deepview edit panel's button row. */
.app-input.news_lang_select {
    width: auto;
    min-width: 80px;
}

.news_edit_actions {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) 0 0;
}

/* cpnl Rapporter → Statistik: the legacy three-column filter keeps its layout (its script toggles the
   rows and controls by id); fields sit inline beside their labels at a fixed width. */
.rstat_filter .app-input.rstat_input,
.rstat_filter select.app-input {
    display: inline-flex;
    width: 140px;
    vertical-align: middle;
}

.rstat_filter select#report_id.app-input {
    width: 280px;
}

.rstat_type {
    padding: var(--spacing-sm) 0 var(--spacing-lg);
}

.rstat_filter p {
    margin-bottom: var(--spacing-sm);
}

.rstat_label {
    margin-left: var(--spacing-xs);
}

/* cpnl Locked Databases: long company names and emails truncate instead of widening the table into a scroll. */
/* The cap sits on a div: under auto table layout a cell's own max-width is ignored. */
.novus_list_table .ldb_cap {
    max-width: 260px;
}

/* cpnl Key Performance Indicators: five stat cards in a row, then the figure tables. */
.kpi_cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.kpi_card .app-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.kpi_value {
    font-size: 32px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    color: var(--text-primary);
}

.kpi_block {
    margin-bottom: var(--spacing-xl);
}

.kpi_range {
    min-width: 240px;
}

.key_performance_indicators_table .custom_tooltip_container_inline {
    display: inline-flex;
    vertical-align: middle;
    margin-left: var(--spacing-xs);
}

/* cpnl report modals: the licence list scrolls sideways inside the dialog; the notes list sits below the form. */
.mlh_scroll {
    overflow-x: auto;
}

.msn_title {
    margin-top: var(--spacing-xl);
}

/* Statistik: the period dates now carry their calendar icon inside the box; options stay on their row. */
.rstat_filter .app-input.rstat_date {
    display: inline-flex;
    width: 160px;
    vertical-align: middle;
}

.rstat_filter p:has(> .app-radio-group__option) {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-height: 30px;
}

/* A fixed label track so the period fields beside the radios start at one x. */
.rstat_filter p > .app-radio-group__option:has(input[type="radio"]) {
    min-width: 100px;
}

/* KPI: the filter bar sat flush against the stat cards. */
#kpi_filter + .kpi_cards,
.kpi_cards {
    margin-top: var(--spacing-xl);
}

/* KPI: the four figure tables share three equal columns, so the value columns line up from table to table. */
.app-table.key_performance_indicators_table {
    table-layout: fixed;
    width: 100%;
}

.app-table.key_performance_indicators_table th {
    width: 33.333%;
}

/* cpnl Add database modal: the licence picker is an icon row over a checkbox row. */
.mad_licences th,
.mad_licences td {
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: center;
}

.mad_licences .sym {
    font-size: var(--icon-size-md);
    color: var(--text-secondary);
}

.mad_group {
    margin-top: var(--spacing-xl);
}

#db_add_form .app-form__group-title {
    border-bottom: none;
    padding-bottom: 0;
}

/* cpnl ORDER → Aktiveringslänkar: the activation link the row click loads into #div_info. */
.activation_link_card {
    margin: 0 0 var(--spacing-lg);
}

.activation_link_text {
    overflow-wrap: anywhere;
}

/* Klienthanterarverktyg: the database facts list keeps one width whether it has one row or four. */
.cmt_section .database_tools_info {
    width: 100%;
    margin-bottom: var(--spacing-lg);
}

/* cpnl company card → Konto ID: space between the package counts and the load-licences button. */
.dbinfo_licence_action {
    margin-top: var(--spacing-md);
}

#container_modal_edit .content_wrapper {
    padding: 0rem 3.5rem;
}

/* Settings / modal form labels: medium weight for readability */
.modal_form_label,
.settings_page_text {
    font-weight: var(--font-weight-medium);
}

/* Lägg till assistentuppdrag: Briox.Modal sizes to its content, and without the old fixed-width toggles the
   two-column form shrank to 325px. Scoped by the consultant-action radios, which only this dialog's new mode has. */
.common_modal_popup:has(#consult_action_modal_add_to_missing) .common_modal_form {
    width: min(35rem, 85vw);
}

/* Assistant template activity dialog: the two switch rows share one label column, so the switches line up
   whatever the label lengths. The row wrappers step aside (display: contents) and their cells join the grid. */
#activity_template_form .activity_template_switches {
    display: grid;
    grid-template-columns: max-content max-content;
    align-items: center;
    column-gap: var(--spacing-md);
    row-gap: var(--spacing-md);
}

#activity_template_form .activity_template_switches > .modal_form_row,
#activity_template_form .activity_template_switches .app-form__row--inline {
    display: contents;
}
