html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.admin-grid-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

/* Grids with Excel-style filters: let the filter popup extend past the card
   instead of being clipped when the grid only has a few rows. */
.admin-grid-wrapper.grid-popups-visible {
    overflow: visible;
}

[data-theme='dark'] .admin-grid-wrapper {
    background: #2d3748;
}

.admin-grid-wrapper .e-grid {
    border: none !important;
    min-width: 0;
}

.admin-grid-wrapper .e-grid .e-gridheader {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme='dark'] .admin-grid-wrapper .e-grid .e-gridheader {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Page header: every page starts with one h1.page-title and an optional p.page-subtitle. */
.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 1.25rem;
}

/* Inside a tabbed section (Manager, Admin, My Settings, My Profile) the sub-page heading
   sits one level below the page title, with the same subtitle style. */
.admin-content > h3,
.manager-content > h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.admin-content > h3 + p.text-secondary,
.manager-content > h3 + p.text-secondary {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

/* Shared Admin Portal Shell Styles */
.admin-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Section tabs (SectionTabs component) */
.portal-tabs-container {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
}

.portal-tabs {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    column-gap: 2rem;
}

.portal-tabs li {
    padding: 0.75rem 0;
    position: relative;
}

.portal-tabs li a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.portal-tabs li:hover a,
.portal-tabs li.active a {
    color: #1b6ec2;
}

.portal-tabs li.active a {
    font-weight: 600;
}

.portal-tabs li.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #1b6ec2;
}

[data-theme='dark'] .portal-tabs-container {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme='dark'] .portal-tabs li a {
    color: #a0aec0;
}

[data-theme='dark'] .portal-tabs li:hover a,
[data-theme='dark'] .portal-tabs li.active a {
    color: #63b3ed;
}

[data-theme='dark'] .portal-tabs li.active::after {
    background: #63b3ed;
}

.admin-grid-wrapper .e-pivotview {
    border: none !important;
    min-width: 0;
}

/* Fits the pivot (its width comes from its column count, see ExpensePivotTable). */
.home-pivot-wrapper {
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

.e-pivottooltiptemplate.e-tooltip-wrap {
    width: max-content !important;
    max-width: min(36rem, 90vw);
}

/* Expenses and Transfers: compact grids so all columns fit without scrolling sideways.
   Slimmer rows and padding, 13px text; text longer than its column is cut with "…". */
.compact-grid {
    padding: 12px 14px;
}

.compact-grid .e-grid,
.compact-grid .e-grid .e-rowcell,
.compact-grid .e-grid .e-headercell .e-headertext,
.compact-grid .e-grid .e-toolbar .e-tbar-btn-text {
    font-size: 13px;
}

.compact-grid .e-grid .e-rowcell,
.compact-grid .e-grid .e-headercell {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.compact-grid .e-grid .e-rowcell {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-grid .e-grid .e-headercell {
    height: 34px !important;
}

/* The inline edit row keeps room for its inputs, just a bit tighter. */
.compact-grid .e-grid .e-editedrow .e-rowcell,
.compact-grid .e-grid .e-addedrow .e-rowcell,
.compact-grid .e-grid .e-gridform .e-rowcell {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    overflow: visible;
}

.compact-grid .e-grid .e-gridform .e-input-group,
.compact-grid .e-grid .e-gridform select.e-input,
.compact-grid .e-grid .e-gridform input.form-control {
    font-size: 13px;
    min-height: 28px;
}

.compact-grid .e-grid .e-toolbar {
    min-height: 36px;
}

/* My Months: a compact table, as wide as its content. */
.admin-grid-wrapper.my-months {
    width: fit-content;
    max-width: 100%;
}

.my-months td,
.my-months th {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    white-space: nowrap;
}

.my-months td.text-end {
    font-variant-numeric: tabular-nums;
}

.my-months .btn-sm {
    padding: 0.1rem 0.5rem;
}

.my-months .opening-input {
    width: 10rem;
    margin-left: auto;
}

/* Cells that have no tooltip (Home's house-total columns) render this marker: hide the whole popup. */
.e-tooltip-wrap:has(.pivot-tip-hidden) {
    display: none !important;
}

/* Pivot cell tooltip (Home and House Summary): title, subtitle, entries, total. */
.e-pivottooltiptemplate.e-tooltip-wrap .e-tip-content {
    padding: 0.6rem 0.75rem;
}

.pivot-tip {
    min-width: 16rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #212529;
}

.pivot-tip-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.pivot-tip-subtitle {
    color: #6c757d;
}

.pivot-tip-empty {
    margin-top: 0.4rem;
    color: #6c757d;
    font-style: italic;
}

.pivot-tip-total {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e2e5ea;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pivot-tip-items {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e2e5ea;
    max-height: 12rem;
    overflow: auto;
}

.pivot-item-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.1rem 0;
}

.pivot-item-tooltip-row span:first-child {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.pivot-item-tooltip-row span:last-child {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pivot-item-tooltip-more {
    margin-top: 0.25rem;
    color: #5c6570;
}

.source-summary-wrapper {
    width: fit-content;
    max-width: 100%;
    padding: 0;
    overflow-x: auto;
}

.source-summary {
    width: max-content;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.source-summary-col-name {
    /* Min width for typical names; grows when needed */
    min-width: 18ch;
}

.source-summary-col-ccy {
    min-width: 3ch;
}

.source-summary-col-num {
    /* Fits at least -100,000.00; grows for larger values like -10,000,000.00 */
    min-width: 12ch;
}

.source-summary th,
.source-summary td {
    border: 1px solid #d7dbe0;
    padding: 0.45rem 0.65rem;
    white-space: nowrap;
    box-sizing: border-box;
}

.source-summary thead th {
    font-weight: 600;
    text-align: center;
    background: #f7f8fa;
    color: #3d4654;
}

.source-summary .source-summary-name {
    min-width: 18ch;
    text-align: left;
    font-weight: 500;
}

.source-summary .source-summary-ccy {
    min-width: 3ch;
    text-align: center;
}

.source-summary .source-summary-num {
    min-width: 12ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Column headers (In, Out, Diff, Balance) are centred; the amounts below stay right-aligned. */
.source-summary thead th.source-summary-num {
    text-align: center;
}

.source-summary-neg {
    color: #b42318;
}

[data-theme='dark'] .source-summary th,
[data-theme='dark'] .source-summary td {
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme='dark'] .source-summary thead th {
    background: #243044;
    color: #e7ecf3;
}

[data-theme='dark'] .source-summary-neg {
    color: #fda29b;
}

/* Plain <select>s in a grid's inline edit row fill their cell. Left to size themselves,
   they grow and shrink with their options (e.g. Transfers' To list after From changes).
   Text inputs need nothing extra: Bootstrap's .form-control is already width: 100%. */
.e-grid .e-gridform select.e-input {
    width: 100%;
    min-width: 0;
}

/* Help page: a short table of contents, then one card per section. */
.help-page { max-width: 900px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 1.25rem; font-size: 0.9rem; }
.help-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; scroll-margin-top: 4.5rem; }
.help-section h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.help-role { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #1b6ec2; background: #e8f1fb; border-radius: 4px; padding: 0.1rem 0.4rem; }
.help-list { margin: 0; }
.help-list dt { font-weight: 600; margin-top: 0.75rem; }
.help-list dt:first-child { margin-top: 0; }
.help-list dd { margin: 0.15rem 0 0; color: #374151; }
[data-theme='dark'] .help-section { background: #2d3748; border-color: rgba(255, 255, 255, 0.12); }
[data-theme='dark'] .help-list dd { color: #cbd5e1; }

/* Admin Logs and Logins: a toolbar above the grid, level badges and the selected entry's details. */
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.admin-toolbar-select { width: auto; min-width: 7rem; }
.log-file-select { min-width: 14rem; }
.admin-toolbar-spacer { flex: 1 1 1rem; }
.admin-toolbar-summary { font-size: 0.875rem; color: #6b7280; margin-left: 0.5rem; }

.log-badge { display: inline-block; font-size: 0.72rem; font-weight: 600; line-height: 1.4; border-radius: 4px; padding: 0 0.4rem; }
.log-badge-error { background: #fde8e8; color: #b42318; }
.log-badge-warning { background: #fef3c7; color: #92400e; }
.log-badge-info { background: #e8f1fb; color: #1b6ec2; }
.log-badge-ok { background: #dcfce7; color: #166534; }
.log-badge-muted { background: #f3f4f6; color: #4b5563; }

.log-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; }
.log-level-chip { border: 1px solid #d1d5db; background: #fff; color: #374151; border-radius: 999px; padding: 0.1rem 0.7rem; font-size: 0.85rem; }
.log-level-chip:hover { border-color: #9ca3af; }
.log-level-chip.active { background: #1b6ec2; border-color: #1b6ec2; color: #fff; }
.log-level-count { font-size: 0.75rem; opacity: 0.75; margin-left: 0.15rem; }
.log-more { font-size: 0.75rem; color: #6b7280; margin-left: 0.4rem; }

.log-details { margin-top: 0.75rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.log-details-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e5e7eb; font-size: 0.875rem; }
.log-details-text { margin: 0; padding: 0.75rem; max-height: 45vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; background: #f8f9fa; border-radius: 0 0 8px 8px; }

[data-theme='dark'] .log-level-chip { background: #2d3748; color: #e2e8f0; border-color: rgba(255, 255, 255, 0.2); }
[data-theme='dark'] .log-level-chip.active { background: #1b6ec2; border-color: #1b6ec2; color: #fff; }
[data-theme='dark'] .log-details { background: #2d3748; border-color: rgba(255, 255, 255, 0.12); }
[data-theme='dark'] .log-details-header { border-color: rgba(255, 255, 255, 0.12); }
[data-theme='dark'] .log-details-text { background: #1f2937; color: #e5e7eb; }

/* Home summary pivot sized to its content (widths computed in ExpensePivotTable): Syncfusion sets the
   row-header column to 200px and the grid to the sum of its columns, so both are overridden here. */
.fit-pivot .e-pivotview table.e-table > colgroup > col:first-child {
    width: var(--pivot-row-header-width) !important;
}

.fit-pivot .e-pivotview .sf-grid {
    width: var(--pivot-table-width) !important;
}

/* Import rules: the "try a memo" box, and transfer rows in the import's classify grid. */
.import-rule-try { width: 18rem; max-width: 100%; }
.import-transfer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: 0.875rem; }
.import-rule-selection { padding: 0.35rem 0; }
.import-rule-merge-list { max-height: 9rem; overflow-y: auto; }
