:root {
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    color: #18212f;
    background: #f5f7fa;
    font-synthesis: none;
}

/* Bank import and receipt relationships share the existing neutral palette. */
.bank-panel { padding: 24px; margin-bottom: 24px; min-width: 0; }
.bank-panel h2 { margin-top: 0; }
.bank-panel p { max-width: 85ch; line-height: 1.6; }
.bank-panel form { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.bank-panel input[type="file"] { max-width: 100%; }
.bank-panel button, .match-proposal button { padding: 12px 18px; border: 0; border-radius: 10px; background: #18212f; color: white; font: inherit; cursor: pointer; }
.bank-panel a, .bank-link, .match-proposal h3 a { color: #315e85; text-decoration: underline; text-underline-offset: 3px; }
.bank-summary { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 12px 24px; padding: 20px; background: #f5f7fa; border-radius: 12px; }
.bank-summary dt { font-weight: 600; color: #596473; }
.bank-summary dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bank-table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid #e4e8ee; border-radius: 12px; margin: 20px 0; }
.bank-table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 14px; }
.bank-table th { background: #f5f7fa; color: #596473; font-size: 12px; letter-spacing: .025em; text-align: left; }
.bank-table th, .bank-table td { padding: 16px; vertical-align: top; border-bottom: 1px solid #e6eaf0; line-height: 1.55; }
.bank-table tbody tr:last-child td { border-bottom: 0; }
.bank-table tbody tr:hover { background: #fafbfd; }
.bank-table .number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bank-copy { min-width: 190px; max-width: 390px; overflow-wrap: anywhere; }
.bank-reference { display: block; min-width: 0; max-width: 46ch; overflow-wrap: anywhere; color: #596473; font-size: 13px; }
.bank-badge { display: inline-block; width: fit-content; padding: 4px 9px; border-radius: 7px; font-size: 12px; font-weight: 650; line-height: 1.5; }
.badge-new { color: #235634; background: #e7f5ec; }
.badge-known { color: #465568; background: #edf0f4; }
.badge-matched { color: #235c65; background: #e3f2f3; }
.badge-review { color: #79501b; background: #fff1d8; }
.bank-link { display: block; margin-top: 8px; font-size: 13px; line-height: 1.5; }
.match-proposal { padding: 24px 0; border-top: 1px solid #e6eaf0; }
.match-pair { display: grid; grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); gap: 20px; }
.match-pair h3 { margin: 10px 0; overflow-wrap: anywhere; }
.match-arrow { align-self: center; color: #778190; font-size: 24px; }
.match-ack { display: flex; gap: 10px; align-items: baseline; line-height: 1.5; }
.match-ack input { width: auto; }
.transaction-copy { min-width: 0; overflow-wrap: anywhere; }
.transaction-entry.match-matched { border-left: 3px solid #80aeb3; }
.transaction-entry.match-ambiguous { border-left: 3px solid #c69b51; }
@media (max-width: 700px) {
    .bank-panel { padding: 16px; }
    .bank-summary { grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 16px; }
    .bank-summary dd { margin-bottom: 12px; }
    .match-pair { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .match-arrow { display: none; }
    .bank-panel form { align-items: stretch; flex-direction: column; }
    .bank-panel button { width: 100%; }
    .bank-table th, .bank-table td { padding: 12px; }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f7fa;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
    min-width: 0;
    padding: 24px 18px;
    background: #ffffff;
    border-right: 1px solid #e6eaf0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #18212f;
    color: #ffffff;
    font-weight: 800;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 2px;
    color: #778190;
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    padding: 11px 13px;
    border-radius: 10px;
    color: #596473;
    font-weight: 600;
}

.nav a:hover {
    background: #f2f4f7;
}

.nav a.active {
    background: #eef1f5;
    color: #18212f;
}

.main {
    min-width: 0;
    width: 100%;
    max-width: 1440px;
    padding: 42px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #778190;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.15;
}

.subtitle {
    margin: 8px 0 0;
    color: #697483;
}

.notice,
.panel,
.card {
    background: #ffffff;
    border: 1px solid #e4e8ee;
    border-radius: 16px;
}

.notice {
    padding: 20px 22px;
    margin-bottom: 22px;
}

.notice p {
    margin: 7px 0 0;
    color: #697483;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.card {
    padding: 20px;
}

.card-label {
    display: block;
    margin-bottom: 14px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 28px;
}

.card small {
    color: #8a94a2;
}

.panel {
    padding: 22px;
}

.panel h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.panel p {
    margin: 0;
    color: #697483;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid #e6eaf0;
    }

    .nav {
        grid-template-columns: repeat(4, auto);
        overflow-x: auto;
    }

    .main {
        padding: 24px;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

.filter-bar {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px;
    margin-bottom: 22px;
    background: #ffffff;
    border: 1px solid #e4e8ee;
    border-radius: 16px;
}

.filter-bar label {
    display: grid;
    gap: 6px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.filter-bar input {
    min-width: 170px;
    padding: 10px 12px;
    border: 1px solid #d7dce4;
    border-radius: 9px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
}

.filter-bar button {
    padding: 11px 16px;
    border: 0;
    border-radius: 9px;
    background: #18212f;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.filter-bar button:hover {
    opacity: 0.9;
}

.notice.error {
    border-color: #e3bcbc;
}

.breakdown {
    margin-top: 22px;
    display: grid;
}

.breakdown > div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 13px 0;
    border-bottom: 1px solid #edf0f4;
}

.breakdown span {
    color: #697483;
}

.breakdown-total {
    margin-top: 4px;
    border-bottom: 0 !important;
    font-size: 18px;
}

.breakdown-total span,
.breakdown-total strong {
    color: #18212f;
}

@media (max-width: 620px) {
    .filter-bar {
        align-items: stretch;
    }

    .filter-bar label,
    .filter-bar input,
    .filter-bar button {
        width: 100%;
    }
}

.filter-bar {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px;
    margin-bottom: 22px;
    background: #ffffff;
    border: 1px solid #e4e8ee;
    border-radius: 16px;
}

.filter-bar label {
    display: grid;
    gap: 6px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.filter-bar input {
    min-width: 170px;
    padding: 10px 12px;
    border: 1px solid #d7dce4;
    border-radius: 9px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
}

.filter-bar button {
    padding: 11px 16px;
    border: 0;
    border-radius: 9px;
    background: #18212f;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.filter-bar button:hover {
    opacity: 0.9;
}

.notice.error {
    border-color: #e3bcbc;
}

.breakdown {
    margin-top: 22px;
    display: grid;
}

.breakdown > div {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 13px 0;
    border-bottom: 1px solid #edf0f4;
}

.breakdown span {
    color: #697483;
}

.breakdown-total {
    margin-top: 4px;
    border-bottom: 0 !important;
    font-size: 18px;
}

.breakdown-total span,
.breakdown-total strong {
    color: #18212f;
}

@media (max-width: 620px) {
    .filter-bar {
        align-items: stretch;
    }

    .filter-bar label,
    .filter-bar input,
    .filter-bar button {
        width: 100%;
    }
}

.product-search {
    max-width: 620px;
    margin-bottom: 22px;
}

.search-field {
    display: grid;
    gap: 7px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.search-row {
    display: flex;
    gap: 8px;
}

.search-row input {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid #d7dce4;
    border-radius: 9px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
}

.search-row button {
    padding: 11px 17px;
    border: 0;
    border-radius: 9px;
    background: #18212f;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.product-picker {
    margin-bottom: 22px;
}

.product-links {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
}

.product-links a {
    padding: 8px 11px;
    border: 1px solid #dfe4ea;
    border-radius: 999px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.product-links a:hover,
.product-links a.selected {
    border-color: #aeb7c2;
    background: #eef1f5;
}

.analysis-heading {
    margin: 30px 0 18px;
}

.analysis-heading h2 {
    margin: 0;
    font-size: 28px;
}

.analysis-heading p:last-child {
    margin: 6px 0 0;
    color: #697483;
}

.emphasis-card {
    border-color: #bec7d2;
}

.table-wrap {
    width: 100%;
    margin-top: 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: #697483;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table .number {
    text-align: right;
    white-space: nowrap;
}

.secondary {
    display: block;
    margin-top: 3px;
    color: #8a94a2;
    font-weight: 400;
}

.empty-state {
    margin-top: 20px;
    padding: 18px;
    border-radius: 10px;
    background: #f7f8fa;
    color: #697483;
}

@media (max-width: 620px) {
    .search-row {
        display: grid;
    }
}

.transaction-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(220px, 2fr) auto;
    align-items: end;
    gap: 12px;
    padding: 18px;
    margin-bottom: 22px;
    background: #ffffff;
    border: 1px solid #e4e8ee;
    border-radius: 16px;
}

.transaction-filters label {
    display: grid;
    gap: 6px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.transaction-filters input,
.transaction-filters select {
    width: 100%;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #d7dce4;
    border-radius: 9px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
}

.transaction-filters button {
    padding: 11px 16px;
    border: 0;
    border-radius: 9px;
    background: #18212f;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.transaction-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.badge,
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef1f5;
    color: #4e5968;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.source-amazon {
    background: #f4f0e7;
}

.source-spar {
    background: #edf4ec;
}

.source-bank {
    background: #edf1f7;
}

.status-matched {
    background: #e9f5ec;
    color: #31633c;
}

.status-partial,
.status-ambiguous {
    background: #faf3df;
    color: #735e1d;
}

.status-unmatched,
.status-not_found {
    background: #f8eaea;
    color: #7e3c3c;
}

.status-not_applicable,
.status.neutral {
    background: #f0f2f5;
    color: #66717f;
}

.negative {
    color: #496453;
}

.transaction-table td:nth-child(3) {
    max-width: 440px;
    overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
    .transaction-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .transaction-filters button {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .transaction-filters {
        grid-template-columns: 1fr;
    }
}

.row-link {
    display: block;
}

.clickable-row:hover {
    background: #f8f9fb;
}

.back-link {
    padding: 9px 12px;
    border: 1px solid #dfe4ea;
    border-radius: 9px;
    background: #ffffff;
    color: #596473;
    font-weight: 600;
    white-space: nowrap;
}

.detail-section {
    margin-bottom: 22px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 20px 0 0;
}

.detail-grid > div {
    padding: 14px 16px;
    border: 1px solid #edf0f4;
    margin: -1px 0 0 -1px;
}

.detail-grid dt {
    margin-bottom: 5px;
    color: #697483;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.wide-detail {
    grid-column: 1 / -1;
}

.returned-label {
    display: block;
    margin-top: 5px;
    color: #7e3c3c;
    font-weight: 700;
}

.discount-row td {
    padding-top: 0;
    border-bottom: 1px solid #edf0f4;
}

.discount-chip {
    display: inline-flex;
    padding: 5px 8px;
    margin: 3px 5px 3px 0;
    border-radius: 999px;
    background: #f3f0e8;
    color: #665a36;
    font-size: 12px;
    font-weight: 600;
}

.bank-detail-row td {
    padding-top: 0;
    color: #697483;
    font-size: 12px;
}

@media (max-width: 820px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        display: grid;
    }
}

.review-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.small-action {
    display: inline-flex;
    padding: 6px 9px;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    background: #ffffff;
    color: #4e5968;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.small-action:hover {
    background: #f4f6f8;
}

@media (max-width: 820px) {
    .review-cards {
        grid-template-columns: 1fr;
    }
}

.edit-form {
    display: grid;
    gap: 26px;
    margin-top: 22px;
}

.form-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-section h3 {
    grid-column: 1 / -1;
    margin: 0 0 4px;
}

.form-section label {
    display: grid;
    gap: 7px;
    color: #697483;
    font-size: 13px;
    font-weight: 700;
}

.form-section input,
.form-section select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #d7dce4;
    border-radius: 9px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
}

.form-section input[readonly] {
    background: #f4f6f8;
    color: #697483;
}

.form-section small {
    color: #8a94a2;
    font-weight: 400;
    line-height: 1.4;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #edf0f4;
}

.edit-actions button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
}

.edit-actions button {
    border: 0;
    background: #18212f;
    color: #ffffff;
    cursor: pointer;
}

.secondary-button {
    border: 1px solid #dfe4ea;
    background: #ffffff;
    color: #596473;
}

@media (max-width: 720px) {
    .form-section {
        grid-template-columns: 1fr;
    }
}

.advanced-filters {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.filter-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1180px) {
    .advanced-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .advanced-filters {
        grid-template-columns: 1fr;
    }
}


/* M08 personal expense allocation controls */

.allocation-cell {
    min-width: 260px;
}

.allocation-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.allocation-form {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.partial-form {
    display: inline-flex;
}

.partial-amount {
    width: 66px;
    padding: 6px 7px;
    border: 1px solid #d7dce4;
    border-radius: 8px;
    background: #ffffff;
    color: #18212f;
    font: inherit;
    font-size: 12px;
}

.allocation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    background: #ffffff;
    color: #596473;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.allocation-button:hover {
    background: #f4f6f8;
}

.allocation-button.active {
    border-color: #aeb8c4;
    background: #e9edf2;
    color: #18212f;
}

.allocation-link {
    text-decoration: none;
}

.allocation-meta {
    display: block;
    margin-top: 5px;
    color: #8a94a2;
    font-size: 11px;
}

.purchase-allocation-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #edf0f4;
}

.item-allocation-controls {
    min-width: 250px;
}

@media (max-width: 900px) {
    .purchase-allocation-block {
        display: grid;
    }

    .allocation-cell {
        min-width: 220px;
    }
}


/* ==========================================================
   M08 UI PASS 1 — banking-style transaction experience
   ========================================================== */

:root {
    --fa-navy: #0b2d62;
    --fa-blue: #2367d7;
    --fa-blue-soft: #eaf2ff;
    --fa-green: #07883e;
    --fa-text: #17325b;
    --fa-muted: #687b99;
    --fa-line: #dfe6ef;
    --fa-bg: #eef3f8;
    --fa-card: #ffffff;
}


body {
    background: var(--fa-bg);
    color: var(--fa-text);
}


.sidebar {
    background: #ffffff;
    border-right-color: #dfe6ef;
}


.brand-mark {
    background: var(--fa-navy);
}


.nav a {
    color: #536985;
}


.nav a:hover {
    background: #f2f6fb;
}


.nav a.active {
    background: #e8f0fb;
    color: var(--fa-navy);
}


.main {
    max-width: 1500px;
}


h1,
.panel h2 {
    color: var(--fa-navy);
}


.subtitle,
.eyebrow {
    color: var(--fa-muted);
}


.card,
.panel,
.notice,
.filter-drawer {
    border-color: var(--fa-line);

    box-shadow:
        0 5px 18px
        rgba(24, 57, 94, 0.05);
}


.transactions-page-header {
    margin-bottom: 20px;
}


/* FILTER DRAWER */

.filter-drawer {
    margin-bottom: 24px;
    overflow: hidden;

    background: #ffffff;

    border:
        1px solid
        var(--fa-line);

    border-radius: 15px;
}


.filter-drawer > summary {
    display: flex;
    align-items: center;
    gap: 16px;

    padding: 14px 18px;

    cursor: pointer;

    color: var(--fa-navy);

    font-weight: 750;

    list-style: none;
}


.filter-drawer > summary::-webkit-details-marker {
    display: none;
}


.filter-drawer > summary::after {
    content: "⌄";

    margin-left: auto;

    color: var(--fa-blue);

    font-size: 18px;
}


.filter-drawer[open] > summary::after {
    transform: rotate(180deg);
}


.filter-drawer > summary small {
    margin-left: 8px;

    color: var(--fa-muted);

    font-size: 12px;
    font-weight: 600;
}


.filter-drawer .transaction-filters {
    margin: 0;

    border: 0;
    border-top:
        1px solid
        var(--fa-line);

    border-radius: 0;

    box-shadow: none;
}


.transaction-filters button,
.primary-button {
    background: var(--fa-blue);
}


/* TRANSACTION FEED */

.transaction-feed {
    overflow: hidden;

    background: #ffffff;

    border:
        1px solid
        var(--fa-line);

    border-radius: 16px;

    box-shadow:
        0 6px 22px
        rgba(24, 57, 94, 0.06);
}


.transaction-month {
    margin: 0;

    padding:
        18px
        20px
        13px;

    border-bottom:
        1px solid
        var(--fa-line);

    color: var(--fa-navy);

    background: #fbfdff;

    font-size: 18px;
}


.transaction-entry {
    position: relative;

    border-bottom:
        1px solid
        var(--fa-line);

    background: #ffffff;
}


.transaction-entry:last-child {
    border-bottom: 0;
}


.transaction-main-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 18px;

    align-items: center;

    min-height: 82px;

    padding: 0 18px;
}


.transaction-entry:hover
> .transaction-main-row {
    background: #f9fbfe;
}


.transaction-entry.expanded
> .transaction-main-row {
    background: #f7faff;
}


.transaction-open-area {
    min-width: 0;

    display: grid;

    grid-template-columns:
        70px
        48px
        minmax(0, 1fr);

    gap: 14px;

    align-items: center;

    padding: 13px 0;

    border: 0;

    background: transparent;

    color: inherit;

    font: inherit;

    text-align: left;
}


.transaction-open-area:not(:disabled) {
    cursor: pointer;
}


.transaction-open-area:disabled {
    cursor: default;
}


/* DATE */

.transaction-date {
    display: flex;

    align-items: baseline;

    gap: 5px;

    color: var(--fa-navy);

    white-space: nowrap;
}


.transaction-date strong {
    font-size: 16px;
}


.transaction-date span {
    font-size: 13px;
}


/* SOURCE ICON */

.source-orb {
    width: 44px;
    height: 44px;

    display: grid;

    place-items: center;

    border-radius: 50%;

    background: #edf4fc;

    color: var(--fa-blue);

    font-weight: 800;
}


.source-orb-spar {
    background: #eaf6ee;
    color: #087a3d;
}


.source-orb-amazon {
    background: #fff4df;
    color: #9b5e00;
}


.source-orb-cash {
    background: #edf8ef;
    color: #158343;
}


.source-word-spar {
    font-size: 18px;
}


.source-word-amazon {
    font-family: Georgia, serif;
    font-size: 25px;
    font-weight: 700;
}


.source-glyph {
    font-size: 18px;
}


/* COPY */

.transaction-copy {
    min-width: 0;

    display: block;
}


.transaction-merchant {
    display: block;

    margin-bottom: 3px;

    overflow: hidden;

    color: var(--fa-navy);

    font-size: 16px;
    line-height: 1.25;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.transaction-description {
    display: block;

    overflow: hidden;

    color: #587092;

    font-size: 14px;
    line-height: 1.35;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.transaction-meta {
    display: block;

    margin-top: 5px;

    color: #8292a8;

    font-size: 11px;
}


.expand-hint {
    color: var(--fa-blue);
}


/* MONEY */

.transaction-actions {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 16px;
}


.transaction-money {
    min-width: 135px;

    text-align: right;
}


.transaction-money strong {
    display: block;

    color: var(--fa-navy);

    font-size: 17px;

    white-space: nowrap;
}


.transaction-money.money-positive strong {
    color: var(--fa-green);
}


.transaction-money small {
    display: block;

    margin-top: 3px;

    color: var(--fa-muted);

    font-size: 11px;

    white-space: nowrap;
}


/* THREE-STATE SWITCH */

.foreign-switch {
    width: 54px;
    height: 28px;

    padding: 0;

    border: 0;

    background: transparent;

    cursor: pointer;
}


.foreign-switch-track {
    position: relative;

    display: block;

    width: 54px;
    height: 28px;

    border-radius: 999px;

    background: #d8dee7;

    transition:
        background 160ms ease,
        box-shadow 160ms ease;
}


.foreign-switch-knob {
    position: absolute;

    top: 4px;
    left: 4px;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    background: #ffffff;

    box-shadow:
        0 1px 4px
        rgba(20, 42, 72, 0.24);

    transition:
        left 160ms ease;
}


.foreign-switch.state-own
.foreign-switch-track {
    background: #d9e0e9;
}


.foreign-switch.state-own
.foreign-switch-knob {
    left: 4px;
}


.foreign-switch.state-partial
.foreign-switch-track {
    background: #8eb8f3;
}


.foreign-switch.state-partial
.foreign-switch-knob {
    left: 17px;
}


.foreign-switch.state-foreign
.foreign-switch-track {
    background: var(--fa-blue);
}


.foreign-switch.state-foreign
.foreign-switch-knob {
    left: 30px;
}


.foreign-switch:hover
.foreign-switch-track {
    box-shadow:
        0 0 0 4px
        rgba(35, 103, 215, 0.10);
}


/* INLINE DETAILS */

.transaction-inline-detail {
    border-top:
        1px solid
        #dce6f2;

    background: #f7faff;
}


.inline-loading,
.inline-error,
.inline-empty {
    padding:
        18px
        90px
        20px
        150px;

    color: var(--fa-muted);

    font-size: 13px;
}


.inline-error {
    color: #9b3f46;
}


.inline-purchase-content {
    padding:
        16px
        24px
        22px
        150px;
}


.inline-detail-top {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    align-items: center;

    margin-bottom: 10px;
}


.inline-detail-top > div strong,
.inline-detail-top > div span {
    display: block;
}


.inline-detail-top > div strong {
    color: var(--fa-navy);

    font-size: 14px;
}


.inline-detail-top > div span {
    margin-top: 3px;

    color: var(--fa-muted);

    font-size: 12px;
}


.inline-full-detail {
    color: var(--fa-blue);

    font-size: 12px;
    font-weight: 700;
}


.inline-items {
    overflow: hidden;

    border:
        1px solid
        #dde7f2;

    border-radius: 12px;

    background: #ffffff;
}


.inline-item-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        60px
        100px
        70px;

    gap: 12px;

    align-items: center;

    min-height: 58px;

    padding: 9px 13px;

    border-bottom:
        1px solid
        #e8edf3;
}


.inline-item-row:last-child {
    border-bottom: 0;
}


.inline-item-main {
    min-width: 0;
}


.inline-item-main strong {
    display: block;

    color: var(--fa-navy);

    font-size: 13px;
}


.inline-item-main span,
.inline-item-main small {
    display: block;

    margin-top: 2px;

    overflow: hidden;

    color: var(--fa-muted);

    font-size: 11px;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.inline-item-quantity,
.inline-item-amount {
    color: #526986;

    font-size: 13px;

    text-align: right;
}


.inline-item-amount {
    color: var(--fa-navy);

    font-weight: 700;
}


/* DIALOG */

.allocation-dialog {
    width:
        min(
            520px,
            calc(100vw - 32px)
        );

    padding: 0;

    border: 0;

    border-radius: 18px;

    background: transparent;

    box-shadow:
        0 24px 70px
        rgba(5, 30, 68, 0.25);
}


.allocation-dialog::backdrop {
    background:
        rgba(13, 34, 62, 0.34);

    backdrop-filter: blur(2px);
}


.allocation-dialog-card {
    margin: 0;

    padding: 22px;

    border-radius: 18px;

    background: #ffffff;
}


.allocation-dialog-header {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    align-items: flex-start;
}


.allocation-dialog-kicker {
    color: var(--fa-muted);

    font-size: 11px;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.07em;
}


.allocation-dialog h3 {
    margin: 3px 0 0;

    color: var(--fa-navy);

    font-size: 22px;
}


.dialog-close {
    width: 34px;
    height: 34px;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background: #f0f4f8;

    color: #536985;

    font-size: 22px;

    cursor: pointer;
}


.allocation-total-line {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    margin: 20px 0 12px;

    padding: 11px 13px;

    border-radius: 10px;

    background: #f4f7fb;

    color: var(--fa-muted);

    font-size: 13px;
}


.allocation-total-line strong {
    color: var(--fa-navy);
}


.allocation-choice-list {
    display: grid;

    gap: 8px;
}


.allocation-choice {
    display: grid;

    grid-template-columns:
        auto
        1fr;

    gap: 11px;

    align-items: flex-start;

    padding: 12px 13px;

    border:
        1px solid
        var(--fa-line);

    border-radius: 11px;

    cursor: pointer;
}


.allocation-choice:has(input:checked) {
    border-color: #79a9ed;

    background: #f3f8ff;
}


.allocation-choice input {
    margin-top: 3px;

    accent-color: var(--fa-blue);
}


.allocation-choice strong,
.allocation-choice small {
    display: block;
}


.allocation-choice strong {
    color: var(--fa-navy);

    font-size: 14px;
}


.allocation-choice small {
    margin-top: 2px;

    color: var(--fa-muted);

    font-size: 12px;
}


.partial-fields {
    display: grid;

    grid-template-columns:
        1fr
        auto
        1fr;

    gap: 10px;

    align-items: end;

    padding:
        8px
        8px
        10px
        36px;
}


.partial-fields label {
    display: grid;

    gap: 5px;

    color: var(--fa-muted);

    font-size: 11px;

    font-weight: 700;
}


.share-equals {
    padding-bottom: 9px;

    color: #8a9ab0;
}


.money-input {
    display: flex;

    align-items: center;

    overflow: hidden;

    border:
        1px solid
        #d6dfeb;

    border-radius: 9px;

    background: #ffffff;
}


.money-input input {
    min-width: 0;
    width: 100%;

    padding: 9px 8px;

    border: 0;

    outline: 0;

    color: var(--fa-navy);

    font: inherit;
}


.money-input span {
    padding-right: 9px;

    color: var(--fa-muted);
}


.itemised-partial-hint {
    margin:
        0
        8px
        4px
        36px;

    padding: 10px 12px;

    border-radius: 9px;

    background: #edf5ff;

    color: #42678f;

    font-size: 12px;

    line-height: 1.45;
}


.allocation-error {
    margin-top: 12px;

    padding: 10px 12px;

    border-radius: 9px;

    background: #fff0f1;

    color: #9b3f46;

    font-size: 12px;
}


.allocation-dialog-actions {
    display: flex;

    justify-content: flex-end;

    gap: 9px;

    margin-top: 20px;

    padding-top: 16px;

    border-top:
        1px solid
        var(--fa-line);
}


.primary-button {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 10px 16px;

    border: 0;

    border-radius: 9px;

    color: #ffffff;

    font: inherit;

    font-weight: 700;

    cursor: pointer;
}


.primary-button:disabled {
    opacity: 0.6;

    cursor: wait;
}


/* RESPONSIVE */

@media (max-width: 900px) {

    .transaction-main-row {
        gap: 10px;

        padding: 0 12px;
    }


    .transaction-open-area {
        grid-template-columns:
            52px
            42px
            minmax(0, 1fr);

        gap: 9px;
    }


    .source-orb {
        width: 38px;
        height: 38px;
    }


    .transaction-actions {
        gap: 9px;
    }


    .inline-purchase-content,
    .inline-loading,
    .inline-error,
    .inline-empty {
        padding-left: 20px;
    }
}


@media (max-width: 680px) {

    .transaction-open-area {
        grid-template-columns:
            40px
            36px
            minmax(0, 1fr);
    }


    .transaction-date {
        display: grid;

        gap: 0;
    }


    .transaction-description {
        max-width: 180px;
    }


    .transaction-money {
        min-width: auto;
    }


    .transaction-money strong {
        font-size: 14px;
    }


    .transaction-actions {
        align-items: flex-end;

        flex-direction: column;
    }


    .inline-item-row {
        grid-template-columns:
            minmax(0, 1fr)
            80px
            60px;
    }


    .inline-item-quantity {
        display: none;
    }


    .partial-fields {
        grid-template-columns: 1fr;

        padding-left: 36px;
    }


    .share-equals {
        display: none;
    }
}

/* M08: hidden allocation details must stay hidden */
.bank-dropzone { border: 2px dashed #bccbd7; border-radius: 12px; padding: 18px; margin-bottom: 16px; background: #f8fafc; }
.bank-dropzone.drag-active { border-color: #2862a5; background: #eef5ff; }
.bank-dropzone p, .bank-batch-file summary { overflow-wrap: anywhere; }
.bank-batch-file { margin: 16px 0; border: 1px solid #dce3eb; border-radius: 10px; padding: 14px; }
.bank-batch-file summary { cursor: pointer; font-weight: 600; padding: 4px 0 12px; }
.bank-batch-rows { max-height: 480px; }

.partial-fields[hidden],
.itemised-partial-hint[hidden] {
    display: none !important;
}
