/*
 * bookkeeping.css — Bookkeeping MFE component styles
 *
 * Mirrors Invoicing's visual language so the two MFEs feel like one product.
 * All visual values reference var(--ef-*) tokens injected by EfBookkeepingApp.
 * No hardcoded colors, fonts, or spacing values (status badge semantic colors
 * are the only exception — they encode meaning, not brand).
 */

/* ------------------------------------------------------------------ *
 * Root wrapper                                                        *
 * ------------------------------------------------------------------ */
.ef-bookkeeping-root {
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    color: var(--ef-color-text);
    background: var(--ef-color-bg);
    min-height: 100%;
}

/* ------------------------------------------------------------------ *
 * Layout                                                              *
 * ------------------------------------------------------------------ */
.ef-page {
    padding: var(--ef-spacing-section);
    max-width: 1400px;
    margin: 0 auto;
    text-align: left;
}

.ef-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--ef-spacing-section) * 0.667);
    margin-bottom: var(--ef-spacing-section);
    flex-wrap: wrap;
}

.ef-header-row .ef-page-heading-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ef-actions {
    display: flex;
    align-items: center;
    gap: calc(var(--ef-spacing-section) * 0.5);
    flex-wrap: wrap;
    margin-top: var(--ef-spacing-section);
}

/* ------------------------------------------------------------------ *
 * Typography                                                          *
 * ------------------------------------------------------------------ */
.ef-heading {
    font-family: var(--ef-font-body);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ef-color-text);
    margin: 0;
}

.ef-subheading {
    font-family: var(--ef-font-body);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ef-color-text);
    margin: 0 0 0.75rem 0;
}

.ef-text-muted {
    color: var(--ef-color-text-muted);
    font-size: var(--ef-font-size-base);
}

.ef-text-sm {
    font-size: 0.875rem;
}

.ef-text-bold {
    font-weight: 600;
}

.ef-text-right {
    text-align: right;
}

.ef-text-center {
    text-align: center;
}

.ef-text-nowrap {
    white-space: nowrap;
}

/* Currency / ledger sign colours — rendered on numeric cells. */
.ef-num-positive {
    color: var(--ef-color-text);
}
.ef-num-negative {
    color: var(--ef-color-danger);
}
.ef-num-zero {
    color: var(--ef-color-text-muted);
}

/* ------------------------------------------------------------------ *
 * Context bar — top-of-page hierarchy selector for                    *
 * Samling ▸ Räkenskapsår ▸ Period                                     *
 * ------------------------------------------------------------------ */
.ef-context-bar {
    background: var(--ef-color-surface);
    border-bottom: 1px solid var(--ef-color-border);
    padding: 0.75rem var(--ef-spacing-section);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
}

.ef-context-bar-segment {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.ef-context-bar-separator {
    color: var(--ef-color-text-muted);
    font-size: 1rem;
    user-select: none;
}

.ef-context-bar-label {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.ef-context-bar-picker {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    transition: border-color 150ms ease, background 150ms ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 22rem;
}
.ef-context-bar-picker:hover:not(:disabled) {
    border-color: var(--ef-color-primary);
    background: var(--ef-color-surface);
}
.ef-context-bar-picker:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.ef-context-bar-picker-caret {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}
.ef-context-bar-picker-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-context-bar-picker-placeholder {
    color: var(--ef-color-text-muted);
    font-weight: 400;
}
.ef-context-bar-primary-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--ef-color-success);
    flex-shrink: 0;
}

.ef-context-bar-spacer {
    flex: 1;
}

.ef-context-bar-manage-link {
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--ef-radius-button);
}
.ef-context-bar-manage-link:hover {
    color: var(--ef-color-primary);
    background: var(--ef-color-bg);
}

/* Dropdown menu anchored under a picker button */
.ef-context-menu {
    position: absolute;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    min-width: 16rem;
    max-height: 24rem;
    overflow-y: auto;
    padding: 0.375rem;
    z-index: 100;
    margin-top: 0.25rem;
}
.ef-context-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text);
    cursor: pointer;
    font-size: 0.9375rem;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}
.ef-context-menu-item:hover:not(:disabled) {
    background: var(--ef-color-surface);
}
.ef-context-menu-item[aria-selected="true"] {
    background: var(--ef-color-surface);
    color: var(--ef-color-primary);
    font-weight: 600;
}
.ef-context-menu-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.ef-context-menu-item-sub {
    color: var(--ef-color-text-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}
.ef-context-menu-divider {
    height: 1px;
    background: var(--ef-color-border);
    margin: 0.375rem 0;
}
.ef-context-menu-empty {
    padding: 0.75rem;
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* ------------------------------------------------------------------ *
 * Navbar                                                              *
 * ------------------------------------------------------------------ */
.ef-navbar {
    background: var(--ef-color-bg);
    border-bottom: 1px solid var(--ef-color-border);
    padding: 0.75rem var(--ef-spacing-section);
    display: flex;
    align-items: center;
    gap: var(--ef-spacing-section);
    flex-wrap: wrap;
}
.ef-navbar-brand {
    color: var(--ef-color-text);
    font-weight: 700;
    font-size: 1.125rem;
    text-decoration: none;
}
.ef-navbar-brand:hover {
    color: var(--ef-color-primary);
}
.ef-nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.ef-nav-link {
    color: var(--ef-color-text);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: var(--ef-radius-button);
    font-size: 0.9375rem;
    transition: background 150ms ease;
}
.ef-nav-link:hover {
    background: var(--ef-color-surface);
}
.ef-nav-link-active {
    background: var(--ef-color-surface);
    color: var(--ef-color-primary);
    font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Cards                                                               *
 * ------------------------------------------------------------------ */
.ef-card {
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    padding: var(--ef-spacing-section);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 0 rgba(0, 0, 0, 0.03);
}
.ef-card-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ef-color-text);
    margin: 0 0 0.5rem 0;
}
.ef-card-subheading {
    font-size: 0.8125rem;
    color: var(--ef-color-text-muted);
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ef-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: calc(var(--ef-spacing-section) * 0.75);
    margin-bottom: var(--ef-spacing-section);
}

.ef-stat-card {
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    padding: var(--ef-spacing-section);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.ef-stat-card-label {
    color: var(--ef-color-text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.ef-stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ef-color-text);
}
.ef-stat-card-hint {
    color: var(--ef-color-text-muted);
    font-size: 0.8125rem;
}

/* ------------------------------------------------------------------ *
 * Compact mini-overview (used on the Solutions home dashboard).       *
 * Mirrors the invoicing MFE's mini-overview styling so dashboard      *
 * rows have a consistent, dense look.                                 *
 * ------------------------------------------------------------------ */
.ef-mini-overview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ef-mini-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}
@media (min-width: 600px) {
    .ef-mini-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
.ef-mini-stat {
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    padding: 0.75rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.ef-mini-stat-label {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.ef-mini-stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ef-color-text);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-mini-stat-hint {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
}
.ef-mini-stat-overdue .ef-mini-stat-value {
    color: var(--ef-color-danger);
}
.ef-mini-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ef-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: calc(var(--ef-spacing-section) * 0.667);
}
.ef-report-tile {
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    padding: var(--ef-spacing-section);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
.ef-report-tile-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ef-color-text);
    margin: 0;
}
.ef-report-tile-desc {
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    margin: 0;
    flex: 1;
}

/* ------------------------------------------------------------------ *
 * Buttons                                                             *
 * ------------------------------------------------------------------ */
.ef-btn-primary {
    background: var(--ef-color-primary);
    border: 1px solid var(--ef-color-primary);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-on-primary);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.5rem 1rem;
    transition: background 180ms ease;
    white-space: nowrap;
}
.ef-btn-primary:hover:not(:disabled) {
    background: var(--ef-color-primary-hover);
    border-color: var(--ef-color-primary-hover);
}
.ef-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ef-btn-secondary {
    background: transparent;
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.5rem 1rem;
    transition: background 180ms ease, border-color 180ms ease;
    white-space: nowrap;
}
.ef-btn-secondary:hover:not(:disabled) {
    background: var(--ef-color-surface);
    border-color: var(--ef-color-text-muted);
}
.ef-btn-secondary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ef-btn-secondary-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
}

.ef-btn-primary-sm {
    background: var(--ef-color-primary);
    border: 1px solid var(--ef-color-primary);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-on-primary);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    transition: background 180ms ease;
    white-space: nowrap;
}
.ef-btn-primary-sm:hover:not(:disabled) {
    filter: brightness(0.92);
}
.ef-btn-primary-sm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Split button: primary action + caret dropdown (used for report downloads) */
.ef-split-btn {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}
.ef-split-btn-primary,
.ef-split-btn-caret {
    background: var(--ef-color-primary);
    border: 1px solid var(--ef-color-primary);
    color: var(--ef-color-on-primary);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    transition: background 180ms ease;
    white-space: nowrap;
}
.ef-split-btn-primary {
    border-top-left-radius: var(--ef-radius-button);
    border-bottom-left-radius: var(--ef-radius-button);
    padding: 0.25rem 0.75rem;
}
.ef-split-btn-caret {
    border-top-right-radius: var(--ef-radius-button);
    border-bottom-right-radius: var(--ef-radius-button);
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}
.ef-split-btn-primary:hover:not(:disabled),
.ef-split-btn-caret:hover:not(:disabled) {
    filter: brightness(0.92);
}
.ef-split-btn-primary:disabled,
.ef-split-btn-caret:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.ef-split-btn-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    min-width: 14rem;
    max-height: 20rem;
    overflow-y: auto;
    padding: 0.375rem;
    z-index: 100;
}

.ef-btn-danger-sm {
    background: transparent;
    border: 1px solid var(--ef-color-danger);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-danger);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    transition: background 180ms ease;
    white-space: nowrap;
}
.ef-btn-danger-sm:hover:not(:disabled) {
    background: var(--ef-color-danger);
    color: var(--ef-color-on-danger);
}
.ef-btn-danger-sm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ef-btn-success-sm {
    background: transparent;
    border: 1px solid var(--ef-color-success);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-success);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    transition: background 180ms ease;
    white-space: nowrap;
}
.ef-btn-success-sm:hover:not(:disabled) {
    background: var(--ef-color-success);
    color: #ffffff;
}
.ef-btn-success-sm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ef-btn-link {
    background: none;
    border: none;
    color: var(--ef-color-primary);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.5rem;
    text-decoration: underline;
}
.ef-btn-link:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ *
 * Alerts                                                              *
 * ------------------------------------------------------------------ */
.ef-alert {
    border: 1px solid transparent;
    border-radius: var(--ef-radius-card);
    font-family: var(--ef-font-body);
    margin-bottom: var(--ef-spacing-section);
    padding: calc(var(--ef-spacing-section) * 0.5) var(--ef-spacing-section);
}
.ef-alert-info {
    background: var(--ef-color-surface);
    border-color: var(--ef-color-border);
    color: var(--ef-color-text);
}
.ef-alert-danger {
    background: var(--ef-color-surface);
    border-color: var(--ef-color-danger);
    color: var(--ef-color-danger);
}
.ef-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--ef-spacing-section) * 0.667);
}
.ef-alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ *
 * Loading spinner                                                     *
 * ------------------------------------------------------------------ */
.ef-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--ef-color-border);
    border-top-color: var(--ef-color-primary);
    border-radius: 50%;
    animation: ef-spin 0.65s linear infinite;
    vertical-align: middle;
}
.ef-spinner-sm {
    width: 0.875rem;
    height: 0.875rem;
}
@keyframes ef-spin {
    to { transform: rotate(360deg); }
}
.ef-loading-center {
    display: flex;
    justify-content: center;
    padding: calc(var(--ef-spacing-section) * 2) 0;
}

/* ------------------------------------------------------------------ *
 * Table                                                               *
 *                                                                     *
 * Header backgrounds use color-mix(text, surface) so they stay visibly *
 * elevated above the surface in both light and dark themes (avoids the *
 * "header blends into the background" problem in dark mode where the   *
 * raw surface token is too close to the page bg).                      *
 * ------------------------------------------------------------------ */
.ef-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    background: var(--ef-color-surface);
}
.ef-table {
    border-collapse: collapse;
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    width: 100%;
}
.ef-table th {
    background: color-mix(in srgb, var(--ef-color-text) 7%, var(--ef-color-surface));
    border-bottom: 2px solid var(--ef-color-border);
    color: var(--ef-color-text);
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    text-transform: none;
}
.ef-table td {
    border-bottom: 1px solid var(--ef-color-border);
    color: var(--ef-color-text);
    padding: 0.6875rem 0.75rem;
    vertical-align: middle;
}
.ef-table td.ef-text-right {
    font-variant-numeric: tabular-nums;
}
/* The `.ef-table td` / `.ef-table-compact td` rules above set `color` with
 * specificity 0,1,1 — equal to `.ef-num-*` but later in source — so they
 * would otherwise erase the +/−/0 sign colour. Scope the sign colours to
 * `td` so they reach specificity 0,2,1 and win deterministically. */
.ef-table td.ef-num-positive,
.ef-table-compact td.ef-num-positive {
    color: var(--ef-color-text);
}
.ef-table td.ef-num-negative,
.ef-table-compact td.ef-num-negative {
    color: var(--ef-color-danger);
}
.ef-table td.ef-num-zero,
.ef-table-compact td.ef-num-zero {
    color: var(--ef-color-text-muted);
}
.ef-table tbody tr:last-child td {
    border-bottom: none;
}
.ef-table tbody tr:hover {
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
}
.ef-table tbody tr.ef-row-clickable {
    cursor: pointer;
}
.ef-table tbody tr.ef-row-active {
    background: color-mix(in srgb, var(--ef-color-primary) 14%, transparent);
}

/* Nested tables inside modals — compact, no border wrapper */
.ef-table-compact {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9375rem;
}
.ef-table-compact th,
.ef-table-compact td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--ef-color-border);
}
.ef-table-compact th {
    background: color-mix(in srgb, var(--ef-color-text) 6%, var(--ef-color-surface));
    color: var(--ef-color-text);
    font-weight: 600;
    text-align: left;
    font-size: 0.8125rem;
}
.ef-table-compact td {
    color: var(--ef-color-text);
    vertical-align: top;
}
.ef-table-compact td.ef-text-right {
    font-variant-numeric: tabular-nums;
}
.ef-table-compact tbody tr:last-child td {
    border-bottom: none;
}

/* ------------------------------------------------------------------ *
 * Toolbar (search / filter row above the table)                       *
 * ------------------------------------------------------------------ */
.ef-toolbar {
    display: flex;
    align-items: flex-end;
    gap: calc(var(--ef-spacing-section) * 0.667);
    flex-wrap: wrap;
    margin-bottom: var(--ef-spacing-section);
}
.ef-toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 12rem;
}
.ef-toolbar-field-grow {
    flex: 1 1 18rem;
}
.ef-toolbar-field-end {
    margin-left: auto;
    align-self: flex-end;
    min-width: 0;
}

/* ------------------------------------------------------------------ *
 * Sortable column headers                                             *
 * ------------------------------------------------------------------ */
.ef-sort-th {
    cursor: pointer;
    user-select: none;
    transition: background 150ms ease;
}
.ef-sort-th:hover,
.ef-sort-th:focus {
    background: var(--ef-color-bg);
    outline: none;
}
.ef-sort-th-active {
    color: var(--ef-color-primary);
}
.ef-sort-label {
    margin-right: 0.375rem;
}
.ef-sort-arrow {
    font-size: 0.85em;
    opacity: 0.7;
}
.ef-sort-th-active .ef-sort-arrow {
    opacity: 1;
}

/* ------------------------------------------------------------------ *
 * Pagination bar                                                      *
 * ------------------------------------------------------------------ */
.ef-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--ef-spacing-section) * 0.667);
    flex-wrap: wrap;
    margin-top: var(--ef-spacing-section);
    padding-top: calc(var(--ef-spacing-section) * 0.5);
}
.ef-pagination-info {
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.ef-pagination-spinner {
    vertical-align: middle;
}
.ef-pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}
.ef-pagination-page-indicator {
    color: var(--ef-color-text);
    font-size: 0.875rem;
    padding: 0 0.5rem;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Form                                                                *
 * ------------------------------------------------------------------ */
.ef-form-section {
    margin-bottom: var(--ef-spacing-section);
}

.ef-form-grid {
    display: grid;
    gap: calc(var(--ef-spacing-section) * 0.667);
}
.ef-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.ef-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .ef-form-grid-3,
    .ef-form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.ef-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.ef-form-label {
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    font-weight: 500;
}

.ef-form-control {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.375rem 0.75rem;
    width: 100%;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ef-form-control:focus {
    border-color: var(--ef-color-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--ef-color-primary) 20%, transparent);
    outline: none;
}

.ef-form-select {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.375rem 0.75rem;
    width: 100%;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ef-form-select:focus {
    border-color: var(--ef-color-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--ef-color-primary) 20%, transparent);
    outline: none;
}

/* ------------------------------------------------------------------ *
 * Status badges & action rows                                         *
 * ------------------------------------------------------------------ */
.ef-status-badge {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.ef-status-primary {
    background: #e9f8ef;
    color: #166534;
    border-color: #bbe6c7;
}
.ef-status-secondary {
    background: #f1f1f1;
    color: #525252;
    border-color: #d6d6d6;
}
.ef-status-selected {
    background: #eef4ff;
    color: #1d4ed8;
    border-color: #c7d7ff;
}
.ef-status-locked {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.ef-status-info {
    background: #eef4ff;
    color: #1d4ed8;
    border-color: #c7d7ff;
}
.ef-status-warning {
    background: #fff4e6;
    color: #9a3412;
    border-color: #fed7aa;
}

.ef-action-row {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ------------------------------------------------------------------ *
 * Modal                                                               *
 *                                                                     *
 * The modal sits on top of the page on a 45 % black backdrop. The      *
 * frame itself uses the surface token (so it stays distinct from the   *
 * page bg) and the header/footer get a slight color-mix tint over the  *
 * surface, which works equally well in light and dark themes. Without  *
 * this, in dark mode the page bg and surface are visually so close     *
 * that the header bar becomes invisible.                               *
 * ------------------------------------------------------------------ */
.ef-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.ef-modal {
    background: var(--ef-color-surface, #fff);
    color: var(--ef-color-text, #111);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    width: 100%;
    max-width: 32rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ef-modal-lg {
    max-width: 68rem;
}
.ef-modal-wide {
    max-width: 48rem;
}

/* Sub-sections used by EfModal.Header / .Body / .Footer */
.ef-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: color-mix(in srgb, var(--ef-color-text) 6%, var(--ef-color-surface));
    border-bottom: 1px solid var(--ef-color-border);
    flex-shrink: 0;
}
.ef-modal-title-wrap {
    min-width: 0;
}
.ef-modal-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0;
    color: var(--ef-color-text);
}
.ef-modal-close {
    background: none;
    border: none;
    color: var(--ef-color-text-muted);
    cursor: pointer;
    font-size: 1.375rem;
    line-height: 1;
    padding: 0.125rem 0.5rem;
    flex-shrink: 0;
    border-radius: var(--ef-radius-button);
    transition: color 150ms ease, background 150ms ease;
}
.ef-modal-close:hover {
    color: var(--ef-color-text);
    background: color-mix(in srgb, var(--ef-color-text) 12%, transparent);
}
.ef-modal-body {
    padding: 1.25rem;
    flex: 1 1 auto;
    overflow-y: auto;
    background: var(--ef-color-surface);
}
.ef-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    flex-wrap: wrap;
    padding: 0.875rem 1.25rem;
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
    border-top: 1px solid var(--ef-color-border);
    flex-shrink: 0;
}

/* Form action row used when buttons live inside .ef-modal-body
 * (no .ef-modal-footer slot). Extends to the edges of the body so the
 * divider line reads as a footer separator, with a slight tint for the
 * extra elevation cue. */
.ef-modal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin: var(--ef-spacing-section) -1.25rem -1.25rem -1.25rem;
    padding: 0.875rem 1.25rem;
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
    border-top: 1px solid var(--ef-color-border);
}

/* Flat modal (no sub-sections) — kept for backward compat */
.ef-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------------ *
 * Empty state                                                         *
 * ------------------------------------------------------------------ */
.ef-empty-state {
    background: var(--ef-color-surface, #fff);
    border: 1px solid var(--ef-color-border, #e5e5e5);
    border-radius: var(--ef-radius-card);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 40rem;
    margin: 0 auto;
}
.ef-empty-state p {
    margin: 0;
    color: var(--ef-color-text-muted, #555);
    line-height: 1.5;
}
.ef-empty-state button {
    align-self: flex-start;
    margin-top: 0.5rem;
}

/* ------------------------------------------------------------------ *
 * Account lookup (autocomplete for account fields)                    *
 * ------------------------------------------------------------------ */
.ef-account-lookup {
    position: relative;
    display: block;
}
.ef-account-lookup .form-control {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    font-variant-numeric: tabular-nums;
    padding: 0.375rem 0.625rem;
}
.ef-account-lookup .form-control:focus {
    border-color: var(--ef-color-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--ef-color-primary) 20%, transparent);
    outline: none;
}
.ef-account-lookup-hint {
    display: block;
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    margin-top: 0.125rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-account-lookup-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    list-style: none;
    margin: 0.25rem 0 0 0;
    padding: 0.25rem;
    max-height: 20rem;
    overflow-y: auto;
    min-width: 18rem;
}
.ef-account-lookup-option {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--ef-radius-button);
    cursor: pointer;
    font-size: 0.9375rem;
}
.ef-account-lookup-option:hover,
.ef-account-lookup-option-active {
    background: var(--ef-color-surface);
}
.ef-account-lookup-option-active {
    color: var(--ef-color-primary);
}
.ef-account-lookup-option-num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 3.25rem;
}
.ef-account-lookup-option-name {
    color: var(--ef-color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-account-lookup-option-active .ef-account-lookup-option-name {
    color: inherit;
}
.ef-account-lookup-empty {
    padding: 0.625rem 0.5rem;
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* ------------------------------------------------------------------ *
 * Account picker (controlled autocomplete used by host MFEs)          *
 * Mirrors ef-account-lookup but takes a controlled value/onChange     *
 * instead of the legacy DataContext form binding.                     *
 * ------------------------------------------------------------------ */
.ef-account-picker {
    position: relative;
    display: block;
}
.ef-account-picker-input {
    width: 100%;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    padding: 0.375rem 0.625rem;
}
.ef-account-picker-input:focus {
    border-color: var(--ef-color-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--ef-color-primary) 20%, transparent);
    outline: none;
}
.ef-account-picker-input:disabled {
    background: var(--ef-color-surface);
    color: var(--ef-color-text-muted);
    cursor: not-allowed;
}
.ef-account-picker-hint {
    display: block;
    color: var(--ef-color-text-muted);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-account-picker-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    margin: 0.25rem 0 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-card);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    max-height: 16rem;
    overflow-y: auto;
    min-width: 18rem;
}
.ef-account-picker-option {
    display: flex;
    align-items: baseline;
    gap: 0.625rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    color: var(--ef-color-text);
    font-size: 0.9375rem;
}
.ef-account-picker-option:hover,
.ef-account-picker-option-active {
    background: var(--ef-color-surface);
}
.ef-account-picker-option-active {
    color: var(--ef-color-primary);
}
.ef-account-picker-option-num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 3.25rem;
}
.ef-account-picker-option-name {
    color: var(--ef-color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ef-account-picker-option-active .ef-account-picker-option-name {
    color: inherit;
}
.ef-account-picker-empty {
    padding: 0.625rem 0.5rem;
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* ------------------------------------------------------------------ *
 * Sheet (verifikat) create page                                       *
 * ------------------------------------------------------------------ */
.ef-sheet-create-breadcrumb {
    margin-bottom: 0.5rem;
}
.ef-sheet-create-breadcrumb .ef-btn-link {
    padding: 0.125rem 0;
    text-decoration: none;
    font-size: 0.9375rem;
}
.ef-sheet-create-breadcrumb .ef-btn-link:hover {
    text-decoration: underline;
}

.ef-sheet-create-card {
    margin-bottom: var(--ef-spacing-section);
}

.ef-sheet-create-meta {
    align-items: end;
}

.ef-sheet-create-transactions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.ef-sheet-create-transactions-header,
.ef-sheet-create-transactions-row {
    display: grid;
    grid-template-columns: minmax(8rem, 2fr) minmax(7rem, 1fr) minmax(7rem, 1fr) 2.5rem;
    gap: 0.5rem;
    align-items: start;
}
/* min-width: 0 lets grid cells shrink below their intrinsic content size so
 * the wrapped Form.Control / AccountLookup inputs don't push the grid wider
 * than the modal body. Without this the row can overflow horizontally when
 * the modal is narrower than the input's preferred width. */
.ef-sheet-create-transactions-row > * {
    min-width: 0;
}

.ef-sheet-create-transactions-header {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.25rem 0.125rem;
    border-bottom: 1px solid var(--ef-color-border);
    margin-bottom: 0.25rem;
}

.ef-sheet-create-transactions-row {
    padding: 0.25rem 0;
}

.ef-sheet-create-transactions-col-amount {
    text-align: right;
}
.ef-sheet-create-transactions-col-amount .form-control {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ef-sheet-create-transactions-col-action {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ef-sheet-create-transactions-col-action .btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* When a FormInputDebetCredit / AccountLookup wraps each cell, remove the
 * stacked form-group margin so rows stay dense. */
.ef-sheet-create-transactions .form-group,
.ef-sheet-create-transactions-row .mb-3 {
    margin-bottom: 0 !important;
}

/* Live balance strip under the transactions table */
.ef-sheet-create-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(8rem, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    margin-top: 0.5rem;
}
.ef-sheet-create-summary-col {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    text-align: right;
}
.ef-sheet-create-summary-col:first-child,
.ef-sheet-create-summary-col:nth-child(2) {
    text-align: right;
}
.ef-sheet-create-summary-label {
    color: var(--ef-color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.ef-sheet-create-summary-value {
    font-variant-numeric: tabular-nums;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ef-color-text);
}
.ef-sheet-create-summary-balanced .ef-sheet-create-summary-value {
    color: var(--ef-color-success);
}
.ef-sheet-create-summary-unbalanced .ef-sheet-create-summary-value {
    color: var(--ef-color-danger);
}

.ef-sheet-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: var(--ef-spacing-section);
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: var(--ef-color-bg);
    padding: 0.75rem 0;
    border-top: 1px solid var(--ef-color-border);
}

@media (max-width: 768px) {
    .ef-sheet-create-transactions-header {
        display: none;
    }
    .ef-sheet-create-transactions-row {
        grid-template-columns: 1fr 1fr 2.5rem;
        grid-template-areas:
            "account account action"
            "debet credit action";
        row-gap: 0.375rem;
    }
    .ef-sheet-create-transactions-col-account {
        grid-area: account;
    }
    .ef-sheet-create-transactions-col-amount:first-of-type {
        grid-area: debet;
    }
    .ef-sheet-create-transactions-col-amount:nth-of-type(2) {
        grid-area: credit;
    }
    .ef-sheet-create-transactions-col-action {
        grid-area: action;
    }
}

/* ------------------------------------------------------------------ *
 * Sheet (verifikat) edit form — used inside the SheetTable edit modal.*
 * Reuses the ef-sheet-create-* transaction grid so the edit and       *
 * create experiences feel identical.                                  *
 * ------------------------------------------------------------------ */
.ef-sheet-update-meta {
    align-items: end;
    margin-bottom: var(--ef-spacing-section);
}
.ef-sheet-update-rows-heading {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------------ *
 * Definition list (used in detail modals)                             *
 *                                                                     *
 * The dt/dd pair is the verification details readout. Wrapping in a   *
 * subtle card-like background helps the labels read clearly in dark   *
 * mode where the muted token can fade against the modal bg.           *
 * ------------------------------------------------------------------ */
.ef-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1rem;
    margin: 0 0 1rem 0;
    padding: 0.875rem 1rem;
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
}
.ef-dl dt {
    color: var(--ef-color-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    align-self: center;
}
.ef-dl dd {
    margin: 0;
    color: var(--ef-color-text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    align-self: center;
}

/* ------------------------------------------------------------------ *
 * Compact form elements (automation / template editor)               *
 * ------------------------------------------------------------------ */

/* Inline label + input pair (e.g. filter row in VerificationList) */
.ef-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ef-color-text);
    white-space: nowrap;
}

/* ef-label: block label in compact form rows */
.ef-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ef-color-text);
}

/* ef-input: full-width text input (shorthand for ef-form-control) */
.ef-input {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.375rem 0.625rem;
    width: 100%;
}
.ef-input:focus {
    border-color: var(--ef-color-primary);
    outline: none;
}
.ef-input:disabled {
    background: var(--ef-color-surface);
    color: var(--ef-color-text-muted);
    cursor: not-allowed;
}

/* ef-input-sm: compact single-line input (fits inside table cells) */
.ef-input-sm {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    width: 100%;
}
.ef-input-sm:focus {
    border-color: var(--ef-color-primary);
    outline: none;
}

/* ef-select: full-width select (shorthand for ef-form-select) */
.ef-select {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.375rem 0.625rem;
    width: 100%;
}
.ef-select:focus {
    border-color: var(--ef-color-primary);
    outline: none;
}

/* ef-select-sm: compact select (fits inside table cells) */
.ef-select-sm {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: 0.8125rem;
    padding: 0.2rem 0.5rem;
    width: 100%;
}
.ef-select-sm:focus {
    border-color: var(--ef-color-primary);
    outline: none;
}

/* ef-form: semantic container for a form region */
.ef-form {
    display: block;
}

/* ef-form-row: horizontal grid row inside a form */
.ef-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ef-form-actions: button row at the bottom of a form */
.ef-form-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-top: var(--ef-spacing-section);
}

/* ------------------------------------------------------------------ *
 * Bootstrap form-control override                                     *
 *                                                                     *
 * The shared FormInput* components (FormInputText, FormInputDate,     *
 * FormInputDebetCredit, FormInputIterator) render react-bootstrap     *
 * Form.Group / Form.Label / Form.Control, which produce the .form-    *
 * group / .form-label / .form-control class names. Bootstrap's        *
 * defaults assume a light page, so in our themed MFE they break dark  *
 * mode (white inputs on a near-black page).                           *
 *                                                                     *
 * These overrides only apply inside .ef-bookkeeping-root so we don't  *
 * affect anything else on the host page, and they reuse the same      *
 * tokens / focus styling as ef-form-control for a consistent look.    *
 * ------------------------------------------------------------------ */
.ef-bookkeeping-root .form-label {
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.ef-bookkeeping-root .form-control,
.ef-bookkeeping-root .form-select {
    background: var(--ef-color-bg);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    box-sizing: border-box;
    color: var(--ef-color-text);
    font-family: var(--ef-font-body);
    font-size: var(--ef-font-size-base);
    padding: 0.375rem 0.625rem;
    width: 100%;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ef-bookkeeping-root .form-control::placeholder {
    color: var(--ef-color-text-muted);
    opacity: 0.7;
}
.ef-bookkeeping-root .form-control:focus,
.ef-bookkeeping-root .form-select:focus {
    background: var(--ef-color-bg);
    color: var(--ef-color-text);
    border-color: var(--ef-color-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--ef-color-primary) 20%, transparent);
    outline: none;
}
.ef-bookkeeping-root .form-control:disabled,
.ef-bookkeeping-root .form-control[readonly],
.ef-bookkeeping-root .form-select:disabled {
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
    color: var(--ef-color-text-muted);
    cursor: not-allowed;
}
.ef-bookkeeping-root .form-control.is-invalid,
.ef-bookkeeping-root .form-select.is-invalid {
    border-color: var(--ef-color-danger);
}
.ef-bookkeeping-root .invalid-feedback {
    color: var(--ef-color-danger);
    font-size: 0.8125rem;
}

/* The FormInputIterator delete row button uses react-bootstrap's
 * Button variant="info" — recolor it as a quiet icon-style action so
 * it blends with the rest of the ef-* button vocabulary. */
.ef-bookkeeping-root .btn.btn-info {
    background: transparent;
    border: 1px solid var(--ef-color-border);
    color: var(--ef-color-text-muted);
    border-radius: var(--ef-radius-button);
    box-shadow: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.ef-bookkeeping-root .btn.btn-info:hover:not(:disabled),
.ef-bookkeeping-root .btn.btn-info:focus:not(:disabled) {
    background: color-mix(in srgb, var(--ef-color-text) 6%, var(--ef-color-surface));
    color: var(--ef-color-text);
    border-color: var(--ef-color-text-muted);
}

/* FormInputDate wraps the input in a Bootstrap InputGroup with a
 * calendar trigger rendered as .input-group-text. Bootstrap defaults
 * give it a light-gray bg that clashes in dark mode. */
.ef-bookkeeping-root .input-group {
    flex-wrap: nowrap;
}
.ef-bookkeeping-root .input-group-text {
    background: color-mix(in srgb, var(--ef-color-text) 4%, var(--ef-color-surface));
    border: 1px solid var(--ef-color-border);
    color: var(--ef-color-text);
    cursor: pointer;
    transition: background 150ms ease;
}
.ef-bookkeeping-root .input-group-text:hover {
    background: color-mix(in srgb, var(--ef-color-text) 10%, var(--ef-color-surface));
}

/* ef-heading-sm: secondary section heading */
.ef-heading-sm {
    font-family: var(--ef-font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ef-color-text);
    margin: 0 0 0.625rem 0;
}

/* ef-btn-link-sm: text-style inline button (compact) */
.ef-btn-link-sm {
    background: none;
    border: none;
    color: var(--ef-color-primary);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    padding: 0.125rem 0.25rem;
    text-decoration: underline;
    white-space: nowrap;
}
.ef-btn-link-sm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ef-btn-icon-sm: small icon-only action button (move / remove row) */
.ef-btn-icon-sm {
    background: transparent;
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-button);
    color: var(--ef-color-text-muted);
    cursor: pointer;
    font-family: var(--ef-font-body);
    font-size: 0.875rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    transition: background 150ms ease, color 150ms ease;
    white-space: nowrap;
}
.ef-btn-icon-sm:hover:not(:disabled) {
    background: var(--ef-color-surface);
    color: var(--ef-color-text);
}
.ef-btn-icon-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ef-link: styled anchor / router link */
.ef-link {
    color: var(--ef-color-primary);
    text-decoration: none;
}
.ef-link:hover {
    text-decoration: underline;
}

/* ef-table-nested: borderless table used inside other table cells */
.ef-table-nested {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.875rem;
}
.ef-table-nested th,
.ef-table-nested td {
    padding: 0.3125rem 0.5rem;
    border-bottom: 1px solid var(--ef-color-border);
    text-align: left;
    vertical-align: middle;
}
.ef-table-nested th {
    font-weight: 600;
    color: var(--ef-color-text-muted);
    font-size: 0.8125rem;
    background: transparent;
}
.ef-table-nested tbody tr:last-child td {
    border-bottom: none;
}

/* ef-stat-grid: responsive grid for stat cards */
.ef-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin-bottom: var(--ef-spacing-section);
}
