/* ==========================================================================
   Dashboard Layout & Cards
   BEM structure — overrides legacy dashboard.css with design-system tokens.
   ========================================================================== */

/* ========== Dashboard header ========== */

#dashboard_header {
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    gap: var(--spacing-lg);
}

#dashboard_header p {
    color: var(--text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-display-md-size);
    font-weight: var(--font-display-md-weight);
    letter-spacing: var(--font-display-md-letter-spacing);
    line-height: var(--font-display-md-line-height);
}

#dashboard_company_logo {
    height: 40px;
    border-radius: var(--radius-md);
}

/* ========== Settings dropdown ========== */

.dashboard_header_actions_button {
    border-radius: var(--radius-md);
    color: var(--icon-color-secondary);
    transition: background-color var(--transition-fast);
}

.dashboard_header_actions_button:hover {
    background-color: var(--color-hover-bg);
}

.dashboard_header_actions_button .sym {
    font-size: var(--icon-size-lg);
    font-weight: var(--icon-weight);
}

.card_settings_dropdown_menu {
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.card_settings_dropdown_menu.open {
    opacity: 1;
    display: flex;
    transform: translateY(0);
}

.header_dropdown_header {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-tertiary);
}

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

.header_dropdown_list_item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-primary);
    gap: var(--spacing-xl);
}

.header_dropdown_action_bar {
    padding: var(--spacing-md) var(--spacing-xl);
    border-top: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: flex-end;
}

/* ========== Card grid ========== */

.dashboard_cards {
    gap: var(--spacing-xl);
    animation: dashboard-fade-in 0.4s ease-out;
}

@keyframes dashboard-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== Card chrome ========== */

.dashboard_card {
    border-radius: var(--radius-xl);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.dashboard_card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-primary);
}

.dashboard_card_header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-tertiary);
    min-height: auto;
}

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

.dashboard_card_titles {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dashboard_card_title {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-lg-size);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: var(--font-body-lg-line-height);
}

.dashboard_card_subtitle {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-tertiary);
    line-height: var(--font-body-sm-line-height);
}

.dashboard_card_content {
    padding: var(--spacing-xl);
}

/* ========== Card header text (tab buttons) ========== */

.dashboard_card_header_text {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.dashboard_card_header_text:hover {
    color: var(--text-primary);
}

.dashboard_card_header_text.active,
.dashboard_card_tab_button.active {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

/* ========== Card dismiss / icon buttons ========== */

.dashboard_card_header_buttons button {
    color: var(--icon-color-tertiary);
    transition: color var(--transition-fast);
}

.dashboard_card_header_buttons button:hover {
    color: var(--text-primary);
}

.card_dismiss_button svg {
    width: 20px !important;
    height: 20px !important;
    fill: var(--icon-color-tertiary);
}

.card_dismiss_button:hover svg {
    fill: var(--text-primary);
}

/* ========== Card action buttons ========== */

.card_button, .card_button_below {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-md);
    background-color: var(--accent);
    color: var(--text-inverse);
    border: none;
    padding: var(--spacing-sm) var(--spacing-xl);
    transition: background-color var(--transition-fast);
}

.card_button:hover, .card_button:focus,
.card_button_below:hover, .card_button_below:focus {
    background-color: var(--accent-dark);
    opacity: 1;
    color: var(--text-inverse);
}

.card_button.secondary {
    border: 1px solid var(--border-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.card_button.secondary:hover {
    background-color: var(--color-hover-bg);
}

/* ========== Tasks ========== */

.dashboard_task_block {
    color: var(--text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    border-top: 1px solid var(--border-tertiary);
    padding: var(--spacing-sm) 0;
}

.dashboard_task_name {
    color: var(--text-primary);
}

.dashboard_task_done_button {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xs);
    background-color: var(--bg-primary);
}

.task_dismissed .checkmark_icon {
    color: var(--success);
}

#add_new_task {
    color: var(--text-secondary);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
}

/* ========== Invoice counts ========== */

.invoice_type_count_unposted::before {
    background-color: var(--yellow-500);
}

.invoice_type_count_current::before {
    background-color: var(--green-500);
}

.invoice_type_count_overdue::before {
    background-color: var(--red-500);
}

.invoice_sum_row a, .invoice_sum_row span, .invoice_sum_row p {
    color: var(--text-secondary);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
}

/* ========== Bank balances ========== */

.bank_balance_row {
    border-bottom: 1px solid var(--border-tertiary);
    color: var(--text-primary);
    font-family: var(--font-family-primary);
    transition: background-color var(--transition-fast);
}

.bank_balance_row:hover, .bank_balance_row:focus {
    background-color: var(--color-hover-bg);
    color: var(--text-primary);
}

.bank_balance_row:last-child {
    border: none;
}

/* ========== Authorization card ========== */
/* Three due periods. Each period is a caption-style header carrying the period total, then one
   dashboard_card_row per status awaiting authorization (count badge, status, amount, chevron), the
   same row the invoice cards use. #main-prefixed like those rows, so the card's blanket
   `.dashboard_card_content span` colour does not recolour the muted parts. */

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

/* The same small section heading the Likviditet widget puts over its account rows. */
#main .dashboard_auth_period_header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin: 0;
    padding: 0 4px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary, #486b88);
}

#main .dashboard_auth_period_title {
    color: var(--text-secondary);
    min-width: 0;
}

#main .dashboard_auth_date {
    font-weight: var(--font-weight-regular);
    color: var(--text-tertiary);
    text-transform: none;
    letter-spacing: 0;
}

#main .dashboard_auth_period_total {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

/* Scrolls past 320px. As a scroll container its automatic minimum is 0, so with dashboard.css's
   125px flex basis the card sized to .dashboard_card_content's minimum and cut the last period off;
   an auto basis lets the rows set the height up to the cap. */
#dashboard_card_content_info_authorizations {
    overflow-y: auto;
    flex-basis: auto;
    max-height: 320px;
    height: auto !important;
}

/* ========== Reports card ========== */

.dashboard_reports_header td,
.dashboard_reports_row td {
    font-family: var(--font-family-primary);
    font-size: var(--font-body-md-size);
    color: var(--text-primary);
}

.dashboard_reports_name {
    color: var(--accent);
}

.dashboard_reports_name:hover {
    color: var(--accent-dark);
}

/* ========== Chart bar colors — design tokens ========== */

.bar_chart_bar_sum_overdue,
.bar_chart_bar_sum_expired {
    fill: var(--accent);
}

.bar_chart_bar_sum_revenue {
    fill: var(--blue-500);
}

.bar_chart_bar_sum_expense {
    fill: var(--green-600);
}

.bar_chart_bar_sum_revenue::before {
    background-color: var(--blue-500);
}

.bar_chart_bar_sum_expense::before {
    background-color: var(--green-600);
}

/* ========== Tax account ========== */

.tax_account_balance_positive {
    color: var(--green-600);
}

.tax_account_balance_negative {
    color: var(--red-500);
}

/* ========== Footer / links ========== */

.dashboard_welcome_block_footer {
    border-top: 1px solid var(--border-tertiary);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

/* ========== Dark theme overrides ========== */

html[data-theme="dark"] .dashboard_card {
    background-color: var(--bg-primary);
    border-color: var(--border-secondary);
}

html[data-theme="dark"] .dashboard_card_header_text {
    color: var(--text-tertiary);
}

html[data-theme="dark"] .dashboard_card_header_text.active {
    color: var(--text-primary);
}

/* ========== Hidden empty widgets row ========== */

.dashboard_hidden_cards {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    font-family: var(--font-family-primary);
    font-size: var(--font-body-sm-size);
    color: var(--text-secondary);
}

.dashboard_hidden_cards_icon {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* The names push the button to the far edge rather than sitting beside it */
.dashboard_hidden_cards_text {
    flex: 1;
}

/* ========== Widget widths ========== */
/* Prototype v3 models the dashboard as six columns and gives each widget a span. .dashboard_cards
   is already a twelve-column grid, so every span is doubled: v3's "span 3" is 6 of 12 here.

   Widths are declared per widget id, never by nth-of-type or sibling rules, because the user can
   drag the widgets into any order — a width that depends on your neighbour breaks the moment the
   neighbour moves.

   Packing is deliberately NOT `dense`. Dense fills the holes that mixed widths leave, but it fills
   them by pulling later widgets forward, which breaks the order the user dragged the widgets into.
   A hole in one row reads better than widgets that move on their own.

   Scoped under #main because req_main adds dashboard.css with order 900, i.e. AFTER this bundle:
   its `.dashboard_card#wizard + .dashboard_card` has the same specificity as a rule here would and
   would win on order. */

/* The default: half the grid. */
#main .dashboard_cards .dashboard_card {
    grid-column: span 6;
    /* dashboard.css floors every widget at 26rem, which a widget with nothing in it fills with air.
       The grid still levels the widgets within a row, so a lower floor only shortens rows that have
       little to show. */
    min-height: 14rem;
}

/* Same reasoning one level down: the content area's own 22.5rem floor is what a widget with nothing
   in it fills with air. */
#main .dashboard_cards .dashboard_card .dashboard_card_content {
    min-height: 12rem;
}

/* Full-width bands. */
#main .dashboard_cards .dashboard_card#wizard,
#main .dashboard_cards .dashboard_card#onboarding,
#main .dashboard_cards .dashboard_card#action_required {
    grid-column: span 12;
}

/* dashboard.css narrows whichever widget follows the wizard, which is exactly the "width depends on
   your neighbour" behaviour this block replaces. It loads after this bundle and ties on specificity,
   so it has to be named to be beaten. */
#main .dashboard_cards .dashboard_card#wizard + .dashboard_card {
    grid-column: span 6;
}

#main .dashboard_cards .dashboard_card#wizard + .dashboard_card#action_required {
    grid-column: span 12;
}

/* The cards carry their own <script> tags, which are grid children like any other element and
   would each take a cell — the holes that pushed the columns out of line. */
#main .dashboard_cards > script {
    display: none;
}

@media (max-width: 860px) {
    /* The widgets that set their own width do it with two ids, which outranks a rule naming the
       class alone — so on a phone they kept their desktop halves and their titles were cut off.
       Every one of them has to be named here to be brought back to full width. */
    #main .dashboard_cards .dashboard_card,
    #main .dashboard_cards .dashboard_card#wizard + .dashboard_card,
    #main .dashboard_cards .dashboard_card#wizard + .dashboard_card#action_required {
        grid-column: span 12;
    }
}

/* ---------------------------------------------------------------------------
   Customise drawer
   The dashboard's layout panel: one draggable row per widget, edited as a draft
   and only written on Save.
   --------------------------------------------------------------------------- */

#main .dashboard_header_actions_button {
	display: inline-flex;
	align-items: center;
	gap: var(--app-space-2, 8px);
	padding: var(--app-space-2, 8px) var(--app-space-3, 12px);
	border: 1px solid var(--app-color-border, #d9dee3);
	border-radius: var(--app-radius-md, 8px);
	/* Transparent against the page, so the outline alone marks the button; it fills with the card
	   surface on hover. The page behind it is --bg-secondary, which is what makes the two read
	   as different states rather than both as white. */
	background: transparent;
	color: var(--app-color-text, #253746);
	cursor: pointer;
	transition: background-color var(--transition-fast, 150ms);
}

#main .dashboard_header_actions_button:hover {
	background: var(--bg-primary, #fff);
}

#main .dashboard_header_actions_label {
	font-size: var(--app-font-size-sm, 13px);
	font-weight: 500;
}

/* The settings live in a dialog, not a right-hand drawer. Panel, backdrop, header, body and footer
   come from .app-dialog; only what the component has no equivalent for is set here. The dialog is
   moved to body to clear the top bar, and the component's z-index sits below it. */
.app-dialog-root#dashboard_layout_root,
#dashboard_layout_root .app-dialog__backdrop {
	z-index: 10000;
}

/* The backdrop centres the panel inside its own padding, so that box bounds it. */
.dashboard_layout_drawer {
	max-height: 100%;
}

.dashboard_layout_drawer_heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dashboard_layout_drawer_subtitle {
    font-size: 13px;
    color: var(--text-secondary, #486b88);
}

/* The label above the list, in the small caps the prototype uses for section headings. */
.dashboard_layout_section_label {
    margin: 0 0 var(--spacing-sm, 8px);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary, #486b88);
}

/* Auto-hide governs the whole list, so it sits above it rather than under its last row. */
.dashboard_layout_autohide {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    margin-bottom: var(--spacing-xl, 16px);
    padding-bottom: var(--spacing-md, 12px);
    border-bottom: 1px solid var(--border-secondary, #dde5ec);
    cursor: pointer;
}

.dashboard_layout_autohide_text {
    font-size: 14px;
    color: var(--text-primary, #203748);
}

/* A round accent checkbox, which is what the prototype shows in place of a toggle. */
.dashboard_layout_check {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.dashboard_layout_check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dashboard_layout_check_box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-primary, #cbd5df);
    border-radius: 999px;
    background: var(--bg-primary, #fff);
    transition: background 150ms, border-color 150ms;
}

.dashboard_layout_check_box .sym {
    font-size: 16px;
    color: transparent;
}

.dashboard_layout_check input:checked + .dashboard_layout_check_box {
    border-color: var(--accent, #ff5000);
    background: var(--accent, #ff5000);
}

.dashboard_layout_check input:checked + .dashboard_layout_check_box .sym {
    color: #fff;
}

.dashboard_layout_check input:focus-visible + .dashboard_layout_check_box {
    outline: 2px solid var(--color-focus-ring, #0081c9);
    outline-offset: 2px;
}

/* The list itself, and a row: handle, icon, name with its note, and the checkbox. */
/* The list scrolls, not the whole body, so the auto-hide checkbox and the section label stay put
   while the widgets move under them. app-dialog__body is the scroller by default, so it hands the
   job over here; min-height:0 is what lets a flex child shrink below its content and scroll. */
.dashboard_layout_drawer_body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard_layout_list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard_layout_row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md, 12px);
    padding: var(--spacing-md, 12px) var(--spacing-xs, 4px);
    border-bottom: 1px solid var(--border-secondary, #dde5ec);
    background: var(--bg-primary, #fff);
}

.dashboard_layout_row:last-of-type {
    border-bottom: none;
}

.dashboard_layout_row--hidden .dashboard_layout_row_name,
.dashboard_layout_row--hidden .dashboard_layout_row_icon {
    color: var(--text-tertiary, #9fb1c2);
}

.dashboard_layout_row--dragging {
    opacity: 0.5;
}

.dashboard_layout_row:focus-visible {
    outline: 2px solid var(--color-focus-ring, #0081c9);
    outline-offset: 2px;
}

.dashboard_layout_handle {
    flex: 0 0 auto;
    color: var(--text-tertiary, #9fb1c2);
    cursor: grab;
}

.dashboard_layout_row_icon {
    flex: 0 0 auto;
    font-size: 20px;
    color: var(--text-secondary, #486b88);
}

/* The note is a short aside after the name, not a second line, so the row stays one line tall. */
.dashboard_layout_row_text {
    flex: 1;
    min-width: 0;
}

.dashboard_layout_row_name {
    font-size: 14px;
    color: var(--text-primary, #203748);
    overflow-wrap: anywhere;
}

.dashboard_layout_row_note {
    font-size: 12px;
    color: var(--text-secondary, #486b88);
}

body.dashboard_layout_drawer_open {
	overflow: hidden;
}

/* The shared toggle sizes itself off its parent, which these rows do not give it. */
.dashboard_layout_drawer .switch {
	flex: 0 0 auto;
	width: 44px;
	height: 24px;
}

.dashboard_layout_drawer .switch .slider {
	left: 0;
}

.dashboard_layout_row:focus-visible {
	outline: 2px solid var(--app-color-focus, #0081c9);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Widget frame, from the prototype
   The prototype ships its own "will replace legacy dashboard.css" block, written
   against these same legacy class names, so it is taken as it stands. Every
   selector carries #main because req_main adds dashboard.css after this bundle
   and the prototype's plain class selectors would otherwise lose on order.
   --------------------------------------------------------------------------- */

#main .dashboard_cards {
    padding-bottom: var(--spacing-3xl);
}

/* --- Card Frame Override --- */
#main .dashboard_card {
    border-radius: 16px;
    padding: 12px;
    border: none;
    overflow: hidden;
}

/* --- Card Header --- */
#main .dashboard_card_header {
    border-bottom: none;
    padding: 0;
    gap: 16px;
    min-height: auto;
}

/* Icon box: bordered square with rounded corners */
#main .dashboard_card_logo {
    width: 40px;
    height: 40px;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-md);
    background-color: color-mix(in srgb, var(--bg-secondary) 50%, white);
    flex-shrink: 0;
}

#main .dashboard_card_logo .sym {
    font-size: var(--icon-size-lg, 1.5rem);
    color: var(--text-primary, #203748);
}

/* Hide legacy SVG icons inside the logo box */
#main .dashboard_card_logo svg,
#main .dashboard_card_logo span > svg {
    display: none;
}

/* Two-line header text area */
#main .dashboard_card_titles {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    flex: 1 1 auto;
}

#main .dashboard_card_title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary, #203748);
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#main .dashboard_card_subtitle {
    font-size: 13px;
    font-weight: var(--font-weight-regular, 400);
    color: var(--text-secondary, #486b88);
    line-height: 1.3;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Legacy tabs list — keep flex:1 but remove leftover padding */
#main .dashboard_card_tabs_list {
    flex: 1 1 auto;
}

/* Legacy header text — hide when new titles element is present */
#main .dashboard_card_titles + .dashboard_card_tabs_list {
    display: none;
}

/* Dismiss/action buttons in header */
#main .dashboard_card_header_buttons,
#main .dashboard_card_icons {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: auto;
    margin-top: calc(1 * var(--spacing-sm));
    margin-right: calc(1 * var(--spacing-sm));
}

/* --- Card Content --- */
#main .dashboard_card_content {
    padding: 12px 0 0;
}

/* --- Card Footer Buttons --- */
#main .dashboard_card_footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: var(--spacing-xl, 20px);
    margin-top: auto;
}

#main a.card_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-lg, 8px);
    font-size: 14px;
    font-weight: var(--font-weight-medium, 500);
    letter-spacing: -0.28px;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast, 150ms), border-color var(--transition-fast, 150ms);
}

#main a.card_button.card_button--secondary {
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #203748);
    border: 1px solid var(--border-primary, #cbd5df);
    box-shadow: 0 1px 0.5px rgba(223, 226, 228, 0.5);
}

#main a.card_button.card_button--primary {
    background: var(--bg-primary, #fff);
    color: var(--accent, #ff5000);
    border: 1px solid var(--accent, #ff5000);
    box-shadow: 0 1px 0.5px rgba(255, 80, 0, 0.5);
}

#main a.card_button.card_button--primary:hover {
    background: var(--accent-light, #fff4ed);
}

#main a.card_button.card_button--secondary:hover {
    background: var(--bg-tertiary, #f5f7f8);
}

/* ---------------------------------------------------------------------------
   Widget list rows, from the prototype
   The status lines in the invoice and order widgets: a count badge, the label,
   the amount in a tabular face, and a chevron. Same data as before, read as a
   list rather than as two columns of loose text.
   --------------------------------------------------------------------------- */

#main .dashboard_card_row {
    display: flex;
    /* In a narrow widget the amount drops to its own line rather than squeezing the label to a letter per line. */
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 4px;
    border-top: 1px solid var(--border-secondary, #dde5ec);
    font-size: 14px;
    color: var(--text-primary, #203748);
    text-decoration: none;
    transition: background var(--transition-fast, 150ms);
}

#main .dashboard_card_row:hover {
    background: var(--bg-tertiary, #f5f7f8);
}

#main .dashboard_card_row_main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#main .dashboard_card_row_label {
    min-width: 0;
    overflow-wrap: anywhere;
}

#main .dashboard_card_row_end {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Amounts line up across rows only in a tabular face. */
#main .dashboard_card_amount {
    font-family: var(--font-family-primary);
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    font-size: var(--font-display-md-size);
    white-space: nowrap;
}

#main .dashboard_card_row_chevron {
    font-size: 20px;
    color: var(--text-tertiary, #9fb1c2);
}

/* The client and time lists still use dashboard.css's rows, which hovered in the retired blue. */
#main .monolith_child_row {
    gap: 10px;
    padding: 10px 4px;
    border-top: 1px solid var(--border-secondary, #dde5ec);
    font-size: 14px;
    font-weight: var(--font-weight-regular, 400);
    line-height: 1.4;
    color: var(--text-primary, #203748);
    transition: background var(--transition-fast, 150ms);
}

#main .monolith_child_row:hover,
#main .monolith_child_row:hover .time_link {
    background: var(--bg-tertiary, #f5f7f8);
    color: var(--text-primary, #203748);
}

/* dashboard.css fixes the list at 206px, which five wrapped rows overflow onto the create button below. */
#main #client_manager .dashboard_card_content_monolith_child {
    flex: 0 0 auto;
}

/* v3 lets the widgets in a row share a height and pins footers to the bottom. */
#main .dashboard_cards .dashboard_card {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#main .dashboard_cards .dashboard_card .dashboard_card_content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#main .dashboard_cards .dashboard_card .dashboard_card_footer {
    margin-top: auto;
}

/* ---------------------------------------------------------------------------
   Banner widgets, from prototype v3
   The app and integrations widgets are not cards in v3 but dark full-bleed
   banners. They keep .dashboard_card so the grid still places them.
   --------------------------------------------------------------------------- */

#main .dashboard_cards .dashboard_card.dashboard_banner {
    position: relative;
    display: flex;
    /* The rule above puts every widget in a column; a banner reads across. */
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding: 24px 56px 24px 24px;
    border: none;
    border-radius: 16px;
    background: #253746;
    /* A quarter taller than the 180 they started at: the pair measured 219 with their content,
       and 275 gives the photograph and the carousel room to read as images rather than insets. */
    min-height: 275px;
    box-sizing: border-box;
}

#main .dashboard_banner_text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#main .dashboard_banner_eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #ffb088;
}

#main .dashboard_banner_heading {
    font-family: 'Montserrat', 'Geist', sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.25px;
    line-height: 1.2;
    color: #fff;
}

#main .dashboard_banner_body {
    font-size: 14px;
    line-height: 1.6;
    color: #dde5ec;
}

/* A banner that carries a photograph. The flat colour stays underneath as the fallback, and a
   dark wash over the image keeps the text at the contrast it has on the plain banners. */
#main .dashboard_cards .dashboard_card.dashboard_banner--image {
    background-position: center 40%;
    background-repeat: no-repeat;
    background-size: cover;
}

#main .dashboard_banner--image::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(37, 55, 70, .88) 0%, rgba(37, 55, 70, .62) 60%, rgba(37, 55, 70, .45) 100%);
}

/* The wash is a sibling of the content, so the content has to be lifted over it. */
#main .dashboard_banner--image > * {
    position: relative;
    z-index: 1;
}

/* The logo carousel fills the banner's right-hand side, where the app banner has its QR code.
   Its items are absolutely positioned off `left: 50% ± n` with translate(-50%, -50%), so the
   track needs a height and a centre line to hang them from. */
/* The text and the carousel are equal halves: both take a zero basis and grow, so the gap and the
   banner's padding come off the pair rather than out of one side. */
#main .dashboard_banner:has(.dashboard_banner_carousel) .dashboard_banner_text,
#main .dashboard_banner_carousel {
    flex: 1 1 0;
    min-width: 0;
}

#main .dashboard_banner_carousel {
    align-self: stretch;
}

#main .dashboard_banner_carousel .marketplace_showcase {
    display: flex;
    align-items: center;
    height: 100%;
    min-height: 132px;
    overflow: hidden;
}

/* The five tiles sat at fixed rem offsets from the centre and spanned 314px whatever the banner
   gave them — at 1280px the half is 216px, so the outer tile was cut 49px off the edge. The track
   caps at the size they were drawn for and shrinks below it, with every tile sized and placed as a
   share of the track, so the set always spans it exactly and never overflows. */
#main .dashboard_banner_carousel .marketplace_logos {
    position: relative;
    width: 100%;
    max-width: 314px;
    height: 100%;
    margin-inline: auto;
}

#main .dashboard_banner_carousel .logo_item {
    top: 50%;
    transition: width .3s ease, left .3s ease, opacity .3s ease;
    aspect-ratio: 1;
    height: auto;
}

#main .dashboard_banner_carousel .logo_item.carousel_center {
    width: 30.6%;
    left: 50%;
}

#main .dashboard_banner_carousel .logo_item.carousel_left {
    width: 24.5%;
    left: 24.5%;
}

#main .dashboard_banner_carousel .logo_item.carousel_right {
    width: 24.5%;
    left: 75.5%;
}

#main .dashboard_banner_carousel .logo_item.carousel_far_left {
    width: 18.3%;
    left: 9.2%;
}

#main .dashboard_banner_carousel .logo_item.carousel_far_right {
    width: 18.3%;
    left: 90.8%;
}

#main .dashboard_banner_link {
    padding: 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: #ffb088;
    text-decoration: none;
}

#main .dashboard_banner_media {
    width: 112px;
    height: 112px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #fff;
}

#main .dashboard_banner_media--transparent {
    background: transparent;
    width: 224px;
    height: 224px;
}

#main .dashboard_banner_media--transparent img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#main .dashboard_banner_dismiss {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #dde5ec;
    cursor: pointer;
}

#main .dashboard_banner_dismiss:hover {
    background: #fff4ed;
    color: #203748;
}

/* The status / due switch sits above the widget's rows; its look is the standard app-segment. */
#main .dashboard_card_segment {
    margin-bottom: 14px;
}

/* Long labels ("Tidrapporter som väntar på godkännande") share the row and ellipsis the rest. */
#main .dashboard_card_segment .app-segment__btn {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#main .dashboard_card_tabpanel[hidden] {
    display: none;
}

/* ---------------------------------------------------------------------------
   "Kräver åtgärd" widget, from prototype v3
   Four tiles on the accent tint, each one figure with a way into the list it
   came from.
   --------------------------------------------------------------------------- */

/* 230px is what a tile needs for the widest amount it can hold: 16 monospace characters
   ("1 234 567,00 SEK") at 20px is ~192px, inside 28px of padding. At 200px the figure was clipped
   from 900px down. */
#main .action_required_tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

#main .action_required_tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 1px solid #ffe6d5;
    border-radius: 12px;
    background: var(--accent-light, #fff4ed);
    text-decoration: none;
    transition: background var(--transition-fast, 150ms);
}

#main .action_required_tile:hover {
    background: #ffe6d5;
}


#main .action_required_label {
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary, #486b88);
    overflow-wrap: anywhere;
    hyphens: auto;
}

#main .action_required_value {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary, #203748);
    white-space: nowrap;
}

#main .action_required_foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}

#main .action_required_note {
    font-size: 13px;
    color: var(--text-secondary, #486b88);
}

#main .action_required_cta {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #203748);
}

#main .action_required_cta .sym {
    font-size: 18px;
}


/* ---------------------------------------------------------------------------
   "Likviditet" widget, from prototype v3
   One line per account under a small section heading. A narrow widget, so the
   figures are right-aligned and the labels wrap rather than truncate.
   --------------------------------------------------------------------------- */

#main .liquidity_heading {
    margin: 0;
    padding-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary, #486b88);
}

#main .liquidity_heading + .liquidity_row {
    border-top: 1px solid var(--border-secondary, #dde5ec);
}

#main .liquidity_row + .liquidity_heading {
    padding-top: 20px;
}

#main .liquidity_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--border-secondary, #dde5ec);
    font-size: 14px;
}

#main .liquidity_row_label {
    min-width: 0;
    font-weight: 500;
    color: var(--text-primary, #203748);
    overflow-wrap: anywhere;
}

#main .liquidity_row_meta {
    font-weight: 400;
    color: var(--text-secondary, #486b88);
}

#main .liquidity_row_value {
    flex-shrink: 0;
    color: var(--text-primary, #203748);
}

#main .liquidity_row_value.liquidity_row--negative {
    color: #dc2626;
}

/* ---------------------------------------------------------------------------
   Onboarding widget, from prototype v3
   A progress bar of one segment per section, then a tile per section, instead of
   the sidebar list. The section content below is unchanged.
   --------------------------------------------------------------------------- */

#main #wizard_progress {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

#main .wizard_segments {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
}

#main .wizard_segment {
    height: 4px;
    border-radius: 999px;
    background: var(--border-secondary, #dde5ec);
    transition: background 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

#main .wizard_segment.wizard_segment--done    { background: #16a34a; }
#main .wizard_segment.wizard_segment--current { background: #253746; }

#main .wizard_tiles {
    display: grid;
    /* All six sections on one row, so the whole path is visible at a glance. */
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#main .wizard_tiles .wizard_section_item {
    display: flex;
    min-width: 0;
    height: auto;
}

#main .wizard_tile {
    display: flex;
    flex: 1;
    flex-direction: column;
    /* dashboard.css sizes the old sidebar buttons at height:100% of a row that had a height.
       As a tile there is no such row, and the title spilled out of the box. */
    height: auto;
    align-items: flex-start;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--border-secondary, #dde5ec);
    border-radius: 12px;
    background: var(--bg-primary, #fff);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: background var(--transition-fast, 150ms), border-color var(--transition-fast, 150ms);
}

#main .wizard_tile:hover {
    background: var(--accent-light, #fff4ed);
}

#main .wizard_tile.active {
    border-color: #253746;
}

#main .wizard_tile_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

#main .wizard_tile_icon {
    font-size: 24px;
    color: var(--text-secondary, #486b88);
}

#main .wizard_tile .wizard_section_title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #203748);
    overflow-wrap: anywhere;
    hyphens: auto;
    max-width: 100%;
}

#main .wizard_tile .wizard_progress_icon {
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #486b88);
}

#main .wizard_tile .wizard_progress_icon--complete {
    color: #16a34a;
}

/* ---------------------------------------------------------------------------
   Onboarding step dialog, from prototype v3
   The section content moved out of the card and into a dialog the tiles open.
   Panel, backdrop, header and footer come from .app-dialog; only the pieces the
   component has no equivalent for are set here.
   --------------------------------------------------------------------------- */

/* The card sits in the same stacking context as the top bar, and the dialog is moved to body
   so it covers the page; the component's z-index is below the top bar's. */
.app-dialog-root#wizard_modal_root,
#wizard_modal_root .app-dialog__backdrop {
    z-index: 10000;
}

/* The backdrop centres the panel inside its own padding, so the panel is bounded by that box. */
.wizard_modal {
    max-height: 100%;
}

/* The tile's own icon is repeated in the header so the step is recognisable from the card. */
.wizard_modal_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--border-secondary, #dde5ec);
    border-radius: var(--radius-lg, 12px);
}

.wizard_modal_icon .sym {
    font-size: var(--icon-size-lg, 24px);
    color: var(--text-primary, #203748);
}

.wizard_modal_heading {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wizard_modal_eyebrow {
    font-size: var(--font-caption-md-size, 11px);
    font-weight: var(--font-weight-semibold, 600);
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-secondary, #486b88);
}

/* The content was laid out as a pane beside a sidebar; in a dialog it is the whole width. */
.wizard_modal_body #wizard_content {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
}

/* An action that belongs to what is directly above it, not to the foot of the step.
   .dashboard_card_action_bar is justify-content: flex-end with margin-top: auto, which pushed the
   Briox app step's button to the far corner, away from the QR code it goes with. */
.wizard_step_action_under {
    display: flex;
    justify-content: flex-start;
    margin-top: var(--spacing-md, 12px);
}

/* Either arrow is hidden at its end of the list, and space-between would then pull the remaining
   one to the wrong side. */
#wizard_modal_next {
    margin-left: auto;
}

body.wizard_modal_open {
    overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Dashboard header, from prototype v3
   A display-face greeting with today's date under it, and the Customise button
   as a labelled outline button rather than a bare gear.
   --------------------------------------------------------------------------- */

#main #dashboard_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 24px 0 20px;
}

#main .dashboard_greeting {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#main .dashboard_greeting_title {
    margin: 0;
    font-family: var(--font-family-display, 'Montserrat', sans-serif);
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--text-primary, #203748);
}

#main .dashboard_greeting_date {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary, #486b88);
}

#main .dashboard_header_actions_icon {
    font-size: 20px;
}

/* The prototype sets the page itself on the tinted background the widgets sit on. */
#main .dashboard_cards,
#main #dashboard_header {
    background: transparent;
}

/* The widgets' empty states are the design system's component now. dashboard.css still styles
   .dashboard_card_intro as a flex column with its own sizing, and that class stays on the element
   for the scripts and rules that key off it, so the component's own layout has to win. */
#main .dashboard_card .app-empty-state {
    max-width: 520px;
    margin-inline: auto;
    /* The component floors itself at 200px, which inside a widget pushed the button past the card's
       edge — and the card clips its overflow, so the button was cut in half. In here the content
       decides the height. */
    min-height: 0;
    padding: var(--spacing-xl) var(--spacing-lg);
}

/* A widget showing an empty state is a different shape from one showing data. Its wrappers were
   sized for a chart or a table, some with a fixed height in the markup, and the widget clips its
   overflow — which cut the call to action in half. Here the wrappers size to the empty state, the
   widget grows with it, and the whole thing sits centred in the space that is left. */
#main .dashboard_cards .dashboard_card:has(.app-empty-state) {
    /* Stretched to the row's height like every other widget, so a short empty state next to a tall
       neighbour leaves no grey gap. `height: auto` is what lets the grid stretch it; the min-height
       is the floor for a row where every widget is empty, and overflow stays visible because the
       card used to clip the call to action in half. */
    height: auto;
    overflow: visible;
    /* The floor for a row where every widget is empty. Measured: the tallest empty state needs
       197px including the header, so 13rem clears it without leaving a hand's width of nothing. */
    min-height: 13rem;
}

/* Centring the whole content column also centred widgets that carry an empty state beside real
   content — Kontosaldo's settings form started 109px down the card. The empty state centres itself
   in whatever room is left instead, and anything else stays at the top where it belongs. */
#main .dashboard_card .app-empty-state {
    margin-block: auto;
}

/* A list wrapper sized for rows keeps its height when there are no rows — the time widget's was
   flex: 0 0 206px under an empty state, which alone made its row 266px taller than it needed. */
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content_monolith_child {
    flex: 0 1 auto;
    min-height: 0;
}

/* These wrappers are sized for a chart or a table, which an empty state is not, so they size to
   their content instead. They no longer centre it: the empty state centres itself with its own
   auto margins, and a widget that carries one beside real content — Kontosaldo's settings form —
   had that content pushed 109px down the card. */
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content,
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content_info,
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content_chart,
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content_monolith {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    min-height: 0;
    max-height: none;
}

/* dashboard.css declares .dashboard_card_intro as position:absolute with height:150px and
   justify-content:space-around. Absolute took it out of the flow, so the widget never counted it
   when working out its own height, and the fixed 150px was shorter than the component's content —
   which is why the call to action sat on, or past, the card's bottom edge. The class stays for the
   rules and scripts that use it; here the element is back in the flow and sized by what is in it. */
#main .dashboard_card .app-empty-state.dashboard_card_intro {
    position: static;
    height: auto;
    justify-content: center;
    margin-block: auto;
}

/* A widget can carry something beside its empty state — the chart widget keeps its legend. Those
   siblings took an equal share of the height and squeezed the empty state out of the card. */
#main .dashboard_card:has(.app-empty-state) .dashboard_card_content > *:not(:has(.app-empty-state)):not(.app-empty-state) {
    flex: 0 0 auto;
}

/* A Material Symbol standing in for the illustration needs a size; the component's image rule is
   written for an <img>. */
#main .app-empty-state__image.sym {
    width: auto;
    font-size: 40px;
    color: var(--text-tertiary, #9fb1c2);
}

/* The onboarding tile's two lower lines: what the section covers, and where the user stands in it. */
#main .wizard_tile_desc {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary, #486b88);
    overflow-wrap: anywhere;
    max-width: 100%;
}

#main .wizard_tile_status {
    margin-top: auto;
    padding-top: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #486b88);
}

#main .wizard_tile_status.wizard_tile_status--done {
    color: #16a34a;
}

#main .wizard_tile_status.wizard_tile_status--next {
    color: var(--text-primary, #203748);
}

/* A finished section steps back from the ones still to do. */
#main .wizard_tile:has(.wizard_tile_status--done) {
    background: var(--bg-secondary, #f8f9fa);
}

/* dashboard.css lays .dashboard_card_content_info out as a flex row, which was fine when it held a
   list beside a chart. With the chart gone and a segment switch above the rows, the switch and the
   panel ended up side by side and the rows ran off the card. */
#main .dashboard_card .dashboard_card_content_info {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

#main .dashboard_card .dashboard_card_tabpanel,
#main .dashboard_card .dashboard_card_invoice_sum {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

/* .sym only picks up the icon font in the places that name it, so a Material Symbol anywhere else
   in a widget renders as its own word. */
#main .dashboard_card .sym,
#main .app-empty-state .sym,
#main .wizard_tile .sym {
    font-family: 'Material Symbols Outlined', sans-serif;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* With the chart gone from these widgets, dashboard.css's space-between pushed the rows to the
   bottom and left a hole under the segment switch. The rows belong right under it. */
#main .dashboard_card:not(:has(.app-empty-state)) .dashboard_card_content {
    justify-content: flex-start;
}

#main .dashboard_card .dashboard_card_content_info {
    justify-content: flex-start;
}

/* ---------------------------------------------------------------------------
   Figures and count badges, from the redesign reference
   --------------------------------------------------------------------------- */

/* The reference sets every figure in the mono face, which is what lines the
   decimals up between rows. --font-family-mono falls back to the system's
   monospace until Geist Mono is loaded. */
#main .dashboard_card_amount,
#main .liquidity_row_value {
    font-variant-numeric: tabular-nums;
}

#main .action_required_value {
    font-family: var(--font-family-primary);
    font-size: var(--font-display-md-size);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* Counts sit in a round badge, not a pill: a fixed circle with the figure centred. */
#main .dashboard_card_row .app-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border: none;
    border-radius: 999px;
    font-family: var(--font-family-mono, 'Geist Mono', monospace);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

#main .dashboard_card_row .app-badge--danger  { background: #fee2e2; color: #dc2626; }
#main .dashboard_card_row .app-badge--warning { background: #fef3c7; color: #b45309; }
#main .dashboard_card_row .app-badge--info    { background: #dbeafe; color: #1d4ed8; }
#main .dashboard_card_row .app-badge--success { background: #dcfce7; color: #15803d; }
#main .dashboard_card_row .app-badge--default { background: var(--bg-tertiary, #f5f7f8); color: var(--text-secondary, #486b88); }

/* Six tiles across leaves each one narrow, so the text has to wrap rather than
   force the column wider. */
#main .wizard_tile {
    min-width: 0;
    overflow-wrap: anywhere;
}

#main .wizard_tile .wizard_section_title {
    font-size: 13px;
    line-height: 1.3;
    hyphens: auto;
}

#main .wizard_tile_status {
    font-size: 11px;
}

/* Six across still reads at 132px a tile, so the row only breaks when the page
   itself goes narrow. */
@media (max-width: 900px) {
    #main .wizard_tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    #main .wizard_tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The widget's own legend kept dashboard.css's blue and green while the chart itself moved to the
   reference's dark and dashed red — the two were saying different things about the same lines. */
#main .bar_chart_bar_sum_revenue {
    fill: #253746;
}

/* A ring, not a disc: it matches the hollow anchors the chart draws on the revenue line, and it
   pairs with the dashed ring for costs. box-sizing keeps both keys the same 17px across. */
#main .bar_chart_bar_sum_revenue::before {
    background-color: transparent;
    border: 2px solid #253746;
    box-sizing: border-box;
}

#main .bar_chart_bar_sum_expense {
    fill: #dc2626;
}

/* The cost line is dashed in the chart, so its key is a dashed ring rather than a filled dot —
   the fill would say solid line. box-sizing keeps it the same 17px across as the revenue dot. */
#main .bar_chart_bar_sum_expense::before {
    background-color: transparent;
    border: 2px dashed #dc2626;
    box-sizing: border-box;
}

/* A tile with nothing due steps back: no accent tint, and a line saying so where the figure
   would be. It stays on the page so the four areas always read the same way. */
#main .action_required_tile--empty {
    border-color: var(--border-secondary, #dde5ec);
    background: var(--bg-primary, #fff);
}

#main .action_required_tile--empty:hover {
    background: var(--bg-tertiary, #f5f7f8);
}


#main .action_required_tile--empty .action_required_value {
    color: var(--text-tertiary, #9fb1c2);
}

/* "0" and "Visa" made an empty tile read as a task; hidden, not removed, so the figures still line up. */
#main .action_required_tile--empty .action_required_foot {
    visibility: hidden;
}

/* Labels wrap to one or two lines depending on their length, which started the figures at
   different heights across the row. Reserving two lines puts every figure on the same line.
   The footers already lined up, on margin-top:auto. */
#main .action_required_label {
    display: block;
    min-height: 3em;
}

/* ---------------------------------------------------------------------------
   Bank balances rows
   The rows are built from legacy size and layout classes that predate the
   palette, so the widget set its own type scale and its own black.
   --------------------------------------------------------------------------- */

/* .stacked_in_column is space-between, and the widget stretches to its row's height, so three
   accounts came out 60px apart — that is padding, not rhythm. */
#main #bank_balances .stacked_in_column {
    justify-content: flex-start;
}

/* The rows carried text_size_larger (16px) and text_size_large (14px), so an account name was set
   as large as the widget's own heading and its number nearly as large, both in flat black. Every
   other widget's rows are 12px, with weight and colour carrying the hierarchy. */
#main #bank_balances .bank_balance_row {
    color: var(--text-primary, #203748);
    border-bottom-color: var(--border-secondary, #dde5ec);
    gap: var(--spacing-md, 12px);
}

#main #bank_balances .bank_balance_row:last-child {
    border-bottom: none;
}

#main #bank_balances .bank_balance_name {
    font-size: var(--font-body-sm-size, 0.75rem);
    line-height: var(--font-body-sm-line-height, 1.5);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #203748);
}

#main #bank_balances .bank_balance_meta {
    font-size: var(--font-body-sm-size, 0.75rem);
    line-height: var(--font-body-sm-line-height, 1.5);
    color: var(--text-secondary, #486b88);
}

/* The second column is the balance and its import note; both read against the right edge. */
#main #bank_balances .stacked_in_row_item:last-child {
    text-align: right;
}

/* ---------------------------------------------------------------------------
   Tasks widget rows
   The rows predate the palette: the task title and the input were set in the
   legacy link blue at 15px, the placeholder in italics, and the done box was a
   grey 2px-radius square holding a dingbat.
   --------------------------------------------------------------------------- */

#main #todo .dashboard_task_name,
#main #todo .dashboard_task_name a,
#main #todo .task_input {
    font-size: var(--font-body-sm-size, 0.75rem);
    line-height: var(--font-body-sm-line-height, 1.5);
    color: var(--text-primary, #203748);
}

#main #todo .task_input::placeholder {
    font-style: normal;
    font-size: var(--font-body-sm-size, 0.75rem);
    color: var(--text-tertiary, #9fb1c2);
}

/* The done box reads as a checkbox, so it takes the checkbox's shape and its tick only once the
   row is hovered or the task is dismissed. */
#main #todo .dashboard_task_done_button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1.5px solid var(--neutral-300, #d1d5db);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-primary, #fff);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

#main #todo .dashboard_task_done_button:hover {
    border-color: var(--accent, #ff5000);
}

#main #todo .checkmark_icon {
    font-size: 14px;
    color: transparent;
    transition: color var(--transition-fast);
}

#main #todo .dashboard_task_block:hover .checkmark_icon,
#main #todo .task_dismissed .checkmark_icon {
    color: var(--accent, #ff5000);
}

/* The two buttons beside the input are icon buttons now, not 45px grey boxes. dashboard.css colours
   them by id, which outranks app-btn's own theme, so the theme token has to be restated here. */
#main #todo #dashboard_task_save_button,
#main #todo #dashboard_task_cancel_button {
    width: 28px;
    flex: 0 0 auto;
    color: var(--btn-accent, #486b88);
}

#main #todo .dashboard_card_header_buttons .dashboard_card_icon .sym {
    font-size: var(--icon-size-md, 20px);
    color: var(--icon-color-secondary, #486b88);
}

/* ---------------------------------------------------------------------------
   Narrow screens
   Found by measuring at 414px: the document was 9px wider than the viewport,
   so the whole page could be dragged sideways.
   --------------------------------------------------------------------------- */

/* Segment overflow handled above in the card_segment block. */

/* overflow-wrap on titles — nowrap is set earlier, so this only helps when wrapping is enabled at narrow widths */
#main .dashboard_card_title,
#main .dashboard_card_subtitle {
    overflow-wrap: anywhere;
}

/* A create button sitting directly in a widget's info column. .dashboard_card_content_info is a
   flex column with align-items: stretch, so the button ran the full width of the widget and read
   as a field rather than a button — the legacy .card_button it replaced sized itself. */
#main .dashboard_card_content_info > .app-btn {
    align-self: center;
}

/* ---------------------------------------------------------------------------
   Account balances settings
   The form is shown inside the widget, so it needs the same rhythm as the rest
   of the dashboard rather than bare <p><label><input> rows.
   --------------------------------------------------------------------------- */

#main #account_balances .card_config_columns {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3xl, 24px);
}

#main #account_balances .card_config_columns .time_column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 12px);
}

#main #account_balances .card_config_columns p {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 4px);
    margin: 0;
}

/* An account number is five digits and a count is one, so they take a column rather than the
   full width .app-input would otherwise give them. */
#main #account_balances .card_config_number {
    width: 7rem;
}

/* .app-input is width: 100%, which left the two dropdowns running the width of the widget beside
   the 7rem account fields. */
#main #account_balances .card_config_columns select.app-input {
    max-width: 16rem;
}

#main #account_balances .settings_action {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--spacing-xl, 16px);
}

/* The gear is a Material Symbol now, like every other icon on the dashboard. */
#main #account_balances .card_settings_button .sym {
    font-size: var(--icon-size-md, 20px);
    color: var(--icon-color-tertiary, #9fb1c2);
}

#main #account_balances .card_settings_button:hover .sym {
    color: var(--text-primary, #203748);
}

/* ========== Legacy color overrides — align with design system ========== */

/* Primary action buttons (#0081C9 → accent) */
.card_button, .card_button_below {
    background-color: var(--neutral-900);
    color: var(--text-inverse);
}

.card_button:hover, .card_button:focus,
.card_button_below:hover, .card_button_below:focus {
    background-color: var(--neutral-950);
    color: var(--text-inverse);
}

.card_button.secondary, .card_button_below.secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.card_button.secondary:hover {
    background-color: var(--tertiary-50);
}

/* Links and interactive text (#0081C9, #007FB9 → text-secondary) */
.dashboard_card a:not(.card_button) {
    color: var(--text-secondary);
}

.dashboard_card a:not(.card_button):hover {
    color: var(--text-primary);
}

/* Chart bar fills */
.bar_chart_bar_sum_overdue,
.bar_chart_bar_sum_expired {
    fill: var(--red-500);
}

.bar_chart_bar_sum_revenue {
    fill: var(--primary-500);
}

.bar_chart_bar_sum_expense {
    fill: var(--tertiary-700);
}

.bar_chart_bar_sum_revenue::before {
    background-color: var(--primary-500);
}

.bar_chart_bar_sum_expense::before {
    background-color: var(--tertiary-700);
}

/* Text colors (#333333, #4A565D → text tokens) */
.dashboard_card_content,
.dashboard_card_content p,
.dashboard_card_content span {
    color: var(--text-primary);
}
