html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    background: #f5f5f5;
    margin: 0;
}

/* ── Header ─────────────────────────────────────────── */
.app-header {
    background: #003DA5;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: 52px;
    font-size: 14px;
}
.header-icon  { font-size: 22px; }
.header-title { font-size: 18px; font-weight: 700; }
.header-sub   { font-size: 11px; color: #AACCFF; margin-top: 3px; }
.header-coffee { margin-left: auto; font-size: 12px; color: #AACCFF; text-decoration: none; }
.header-coffee:hover { color: white; text-decoration: underline; }
.header-about { margin-left: 16px; font-size: 12px; color: #AACCFF; text-decoration: none; }
.header-about:hover { color: white; text-decoration: underline; }

/* ── Main content ───────────────────────────────────── */
.content { padding: 16px; }

/* ── Drop zone ──────────────────────────────────────── */
.drop-zone {
    background: white;
    border: 2px solid #003DA5;
    border-radius: 6px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}
.drop-zone { position: relative; }
.drop-zone.dragging { background: #E8F0FE; }
.drop-zone:has(.drop-input:focus-visible) { outline: 2px solid #003DA5; outline-offset: 2px; }
.drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.drop-icon  { font-size: 26px; }
.drop-title { font-size: 14px; font-weight: 600; color: #003DA5; }
.drop-sub   { font-size: 12px; color: #888; margin-top: 2px; }
.drop-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

/* Hide the real file input (still reachable by keyboard), style the label as a button */
.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.file-input:focus-visible + label { outline: 2px solid #003DA5; outline-offset: 2px; }
.file-input:disabled + label { background: #aaa; color: white; border-color: #aaa; cursor: default; }

/* ── Workbook bar and messages ──────────────────────── */
.workbook-bar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 32px;
}
.workbook-name { font-weight: 600; color: #003DA5; }
.working { color: #003DA5; font-weight: 600; margin-bottom: 12px; }
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #F0F7FF;
    border-left: 3px solid #003DA5;
    border-radius: 0 4px 4px 0;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.message-error { background: #FFE4E4; border-left-color: #B00020; }
.message-body { flex: 1; }
.message-detail { font-size: 11px; color: #666; margin-top: 4px; }
.message-action { margin-top: 8px; }
.message-close { background: none; border: none; font-size: 18px; line-height: 1; cursor: pointer; color: #555; }
.earlier-bar, .mismatch-banner {
    background: #FFF4CC;
    border-left: 3px solid #B8860B;
    border-radius: 0 4px 4px 0;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mismatch-banner { display: block; }
.mismatch-banner ul { margin: 6px 0 0; padding-left: 20px; }
.file-notes { margin: 0 0 12px; padding-left: 20px; color: #555; }
.nothing-new { color: #555; padding: 10px 0; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}
.btn:disabled { background: #aaa !important; cursor: default; }
.btn-primary  { background: #003DA5; color: white; }
.btn-primary:hover:not(:disabled) { background: #002D7A; color: white; }
.btn-secondary { background: white; color: #003DA5; border: 1.5px solid #003DA5; }
.btn-secondary:hover { background: #E8F0FE; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Summary bar ────────────────────────────────────── */
.summary-bar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.chip {
    background: #E8F0FE;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
}
.ms-auto { margin-left: auto; }

/* ── Grid ───────────────────────────────────────────── */
.grid-wrapper {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: auto;
    max-height: calc(100vh - 240px);
}
.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.receipt-table thead th {
    background: #003DA5;
    color: white;
    font-weight: 600;
    padding: 8px;
    position: sticky;
    top: 0;
    text-align: left;
    white-space: nowrap;
}
.receipt-table tbody tr:nth-child(even) { background: #FAFCFF; }
.receipt-table tbody tr.row-return      { background: #FFE4E4 !important; }
.receipt-table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
.receipt-table .num { text-align: right; }
.receipt-table td.to-confirm { background: #FFF4CC; }
.chip-confirm { background: #FFF4CC; }
.btn-confirm { margin-left: 6px; padding: 1px 8px; }

.cat-select {
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    padding: 1px 4px;
    width: 140px;
}
.notes-input {
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    padding: 1px 4px;
    width: 160px;
}

/* ── About page ─────────────────────────────────────── */
.about-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 32px 40px;
    max-width: 640px;
    margin: 0 auto;
}
.about-logo  { font-size: 48px; text-align: center; }
.about-title { font-size: 22px; font-weight: 700; color: #003DA5; text-align: center; margin: 8px 0 4px; }
.about-edition { text-align: center; color: #888; font-size: 12px; margin-bottom: 24px; }
.about-card section { margin-bottom: 20px; }
.about-card h2 { font-size: 14px; font-weight: 700; color: #003DA5; margin-bottom: 8px; }
.about-card ul { margin: 0; padding-left: 20px; }
.about-card li { margin-bottom: 4px; }
.about-back { text-align: center; margin-top: 28px; }
.about-section-privacy    { background: #F0F7FF; border-left: 3px solid #003DA5; padding: 10px 14px; border-radius: 0 4px 4px 0; }
.about-section-disclaimer { background: #FFF8E6; border-left: 3px solid #B8860B; padding: 10px 14px; border-radius: 0 4px 4px 0; }
.about-section-author     { text-align: center; }
.about-section-author p   { margin: 4px 0; }
.about-coffee { margin-top: 10px !important; font-style: italic; }

/* ── Blazor error UI ────────────────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0; left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    display: none;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem; height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}
.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #003DA5;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

.about-para-gap { margin-top: 8px; }

/* Privacy check and update banner */
.privacy-ok   { color: #1B6E2D; font-weight: 600; }
.privacy-warn { background: #FFF8E6; border-left: 3px solid #B8860B; padding: 8px 12px; }
.about-card ol { margin: 0; padding-left: 20px; }
.update-banner { background: #E8F0FE; border-bottom: 1px solid #003DA5; padding: 8px 20px; font-size: 13px; }
.update-banner .btn { margin-left: 10px; }
