/* ═══════════════════════════════════════════════════════════
   PTR Tally — Global Stylesheet
   Fonts: Fraunces (display) + DM Mono (body/data)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Fraunces:opsz,wght@9..144,300;9..144,600&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */
:root {
    --ink:        #1a1a18;
    --paper:      #f5f2eb;
    --canvas:     #e8e4db;
    --accent:     #2d6a4f;
    --accent2:    #b7410e;
    --rule:       #c8c4b8;
    --muted:      #7a7670;
    --white:      #ffffff;

    --success-bg: #d1fae5;
    --success-border: #6ee7b7;
    --success-text:   #065f46;
    --warn-bg:    #fdf8ec;
    --warn-border:#e8c97a;
    --warn-text:  #7a5c10;
    --danger-bg:  #fee2e2;
    --danger-border: #fca5a5;
    --danger-text:#991b1b;

    --radius-sm:  2px;
    --radius-md:  4px;
    --shadow-card: 3px 3px 0 var(--rule);
    --shadow-card-hover: 4px 4px 0 #aaa;
    --shadow-modal: 6px 6px 0 var(--rule);
    --transition: 0.15s ease;
}

/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: var(--canvas);
    color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    line-height: 1.15;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography helpers ──────────────────────────────────── */
.font-display  { font-family: 'Fraunces', serif; }
.font-mono     { font-family: 'DM Mono', monospace; }

.eyebrow {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.text-muted-mono { color: var(--muted); font-size: 12px; }

/* ── Layout ──────────────────────────────────────────────── */
.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.centered-wrap {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}

/* ── Sticky page header / toolbar ───────────────────────── */
.page-header {
    background: var(--ink);
    color: var(--white);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-header-title {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 300;
}

.page-header-sub {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rule);
    margin-top: 2px;
}

.page-header-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Sheet / Card surface ────────────────────────────────── */
.sheet {
    background: var(--white);
    border: 1px solid #ccc;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition);
}

.sheet:hover { box-shadow: var(--shadow-card-hover); }

.sheet-padded { padding: 40px 48px 48px; }

.sheet-sm { max-width: 460px; width: 100%; }
.sheet-md { max-width: 700px; width: 100%; }
.sheet-lg { max-width: 900px; width: 100%; }

/* ── Sheet header rule ───────────────────────────────────── */
.sheet-rule {
    border: none;
    border-top: 2.5px solid var(--ink);
    margin: 0 0 20px;
}

.sheet-rule-light {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 0;
}

/* ── Section header (dark bar, used on cards/tables) ─────── */
.section-header {
    background: var(--ink);
    color: var(--white);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.section-header-title {
    font-family: 'Fraunces', serif;
    font-size: 15px;
    font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.06em;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Primary — dark fill */
.btn-primary {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}
.btn-primary:hover:not(:disabled) { background: #333; color: var(--white); text-decoration: none; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }

/* Accent — forest green */
.btn-accent {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}
.btn-accent:hover:not(:disabled)  { filter: brightness(1.12); color: var(--white); text-decoration: none; }

/* Danger — terracotta */
.btn-danger {
    background: var(--accent2);
    color: var(--white);
    border-color: var(--accent2);
}
.btn-danger:hover:not(:disabled)  { filter: brightness(1.12); color: var(--white); text-decoration: none; }

/* Ghost — outline only */
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); background: var(--paper); }

/* Ghost accent */
.btn-ghost-accent {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-ghost-accent:hover:not(:disabled) { background: var(--accent); color: var(--white); }

/* Ghost danger */
.btn-ghost-danger {
    background: transparent;
    color: var(--accent2);
    border-color: var(--accent2);
}
.btn-ghost-danger:hover:not(:disabled) { background: var(--accent2); color: var(--white); }

/* Sizes */
.btn-sm  { padding: 6px 12px; font-size: 11px; }
.btn-lg  { padding: 13px 36px; font-size: 13px; letter-spacing: 0.1em; }
.btn-full { width: 100%; }

/* ── Form controls ───────────────────────────────────────── */
.mono-input,
.mono-select,
.mono-textarea {
    width: 100%;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: border-color var(--transition);
}

.mono-input:focus,
.mono-select:focus,
.mono-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.mono-input::placeholder { color: var(--muted); }

.mono-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7670' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.tally-input {
    width: 100%;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--rule);
    padding: 5px 8px;
    text-align: right;
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), background var(--transition);
}
.tally-input:focus  { outline: none; border-color: var(--accent); background: #f0fdf4; }
.tally-input.ocr-filled { background: #ecfdf5; border-color: var(--success-border); }

.form-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

/* ── Tables ──────────────────────────────────────────────── */
.mono-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mono-table th {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1.5px solid var(--ink);
    border-top: 1px solid var(--rule);
    background: var(--paper);
    text-align: left;
    white-space: nowrap;
}

.mono-table th.text-right,
.mono-table td.text-right { text-align: right; }

.mono-table th.text-center,
.mono-table td.text-center { text-align: center; }

.mono-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #ede9e0;
    vertical-align: middle;
}

.mono-table tbody tr:last-child td { border-bottom: 1.5px solid var(--rule); }
.mono-table tbody tr.has-data { background: #f0fdf4; }

.mono-table tfoot td {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    border-top: 1.5px solid var(--rule);
    border-bottom: none;
    padding: 8px 10px;
    background: var(--paper);
}

.mono-table tfoot.dark td {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}

/* ── Badges / pills ──────────────────────────────────────── */
.badge {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border: 1px solid;
    border-radius: var(--radius-sm);
}

.badge-default  { background: var(--paper);       border-color: var(--rule);           color: var(--muted); }
.badge-success  { background: var(--success-bg);  border-color: var(--success-border); color: var(--success-text); }
.badge-warn     { background: var(--warn-bg);     border-color: var(--warn-border);    color: var(--warn-text); }
.badge-danger   { background: var(--danger-bg);   border-color: var(--danger-border);  color: var(--danger-text); }
.badge-dark     { background: var(--ink);         border-color: var(--ink);            color: var(--white); }
.badge-accent   { background: var(--accent);      border-color: var(--accent);         color: var(--white); }

/* ── Alert boxes ─────────────────────────────────────────── */
.mono-alert {
    padding: 12px 16px;
    font-size: 12px;
    border: 1.5px solid;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.mono-alert-warn   { background: var(--warn-bg);   border-color: var(--warn-border);   color: var(--warn-text); }
.mono-alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.mono-alert-success{ background: var(--success-bg);border-color: var(--success-border);color: var(--success-text); }

/* ── Modal ───────────────────────────────────────────────── */
.mono-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,20,18,0.65);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.mono-modal-backdrop.open { display: flex; }

.mono-modal {
    background: var(--white);
    border: 1px solid #ccc;
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.mono-modal-header {
    background: var(--ink);
    color: var(--white);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.mono-modal-title {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 300;
}

.btn-close-modal {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color var(--transition);
}
.btn-close-modal:hover { color: var(--white); }

.mono-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px;
}

.mono-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Church pill (landing page) ──────────────────────────── */
.church-pill {
    border: 1.5px solid var(--rule);
    padding: 14px 20px;
    margin-bottom: 24px;
    text-align: center;
}
.church-pill-label {
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}
.church-pill-name {
    font-family: 'Fraunces', serif;
    font-size: 20px;
    font-weight: 600;
}

/* ── Progress / OCR status ───────────────────────────────── */
.ocr-status-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.06em;
    min-height: 16px;
    margin-top: 8px;
}

.ocr-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--rule);
    flex-shrink: 0;
    transition: background var(--transition);
}
.ocr-dot.scanning { background: var(--accent); animation: pulse 0.8s infinite; }
.ocr-dot.done     { background: #10b981; }
.ocr-dot.error    { background: var(--accent2); }

.progress-bar-wrap {
    flex: 1;
    height: 3px;
    background: #ddd;
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
    width: 0%;
}

/* ── Scan / print worksheet ──────────────────────────────── */
.worksheet {
    display: none;
    background: var(--white);
    padding: 40px 48px 48px;
    border: 1px solid #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}
.worksheet.active { display: block; }

.worksheet-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: end;
    border-bottom: 2.5px solid var(--ink);
    padding-bottom: 14px;
    margin-bottom: 6px;
    gap: 8px;
}

.worksheet-church {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 8px;
}

/* ── Metric summary cards ────────────────────────────────── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--white);
    border: 1px solid #ccc;
    box-shadow: var(--shadow-card);
    padding: 16px;
    text-align: center;
}

.metric-label {
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.metric-value {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
}

.grand-total-banner {
    background: var(--ink);
    color: var(--white);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.grand-total-label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rule);
}

.grand-total-value {
    font-family: 'Fraunces', serif;
    font-size: 24px;
    font-weight: 600;
}

/* ── Chart card ──────────────────────────────────────────── */
.chart-card {
    background: var(--white);
    border: 1px solid #ccc;
    box-shadow: var(--shadow-card);
    padding: 20px;
}

.chart-title {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
}

/* ── Breadcrumbs ─────────────────────────────────────────── */
.mono-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.06em;
    padding: 10px 24px;
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
}
.mono-breadcrumb a { color: var(--muted); text-decoration: none; }
.mono-breadcrumb a:hover { color: var(--ink); }
.mono-breadcrumb-sep { color: var(--rule); }
.mono-breadcrumb-active { color: var(--ink); }

/* ── Pagination ──────────────────────────────────────────── */
.mono-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mono-pagination .page-item .page-link {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    padding: 5px 11px;
    border: 1px solid var(--rule);
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-block;
    border-radius: var(--radius-sm);
}

.mono-pagination .page-item .page-link:hover { background: var(--paper); border-color: var(--ink); }
.mono-pagination .page-item.active .page-link { background: var(--ink); color: var(--white); border-color: var(--ink); }
.mono-pagination .page-item.disabled .page-link { opacity: 0.35; cursor: not-allowed; }

/* ── Utility ─────────────────────────────────────────────── */
.no-print   { }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.text-left  { text-align: left; }
.fw-medium  { font-weight: 500; }
.muted      { color: var(--muted); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.anim-fade-slide { animation: fadeSlide 0.22s ease; }

/* ── Print ───────────────────────────────────────────────── */
@page { margin: 12mm 10mm; size: A4; }

@media print {
    body { background: var(--white); }

    .no-print,
    nav,
    .page-header,
    .mono-breadcrumb,
    .btn,
    header,
    footer { display: none !important; }

    .sheet, .worksheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .worksheet {
        display: block !important;
        page-break-after: always;
    }

    .mono-table th,
    .mono-table td {
        border: 1px solid #999 !important;
        font-size: 12px !important;
        padding: 5px 6px !important;
    }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .sheet-padded { padding: 24px 20px 28px; }
    .page-header  { padding: 10px 16px; }
    .metric-value { font-size: 18px; }
    .grand-total-value { font-size: 18px; }
    .btn-lg { padding: 11px 24px; }
}

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Fraunces:opsz,wght@9..144,300;9..144,600&display=swap');

:root {
    --ink:    #1a1a18;
    --paper:  #f5f2eb;
    --accent: #2d6a4f;
    --accent2:#b7410e;
    --rule:   #c8c4b8;
    --muted:  #7a7670;
}

body { font-family: 'DM Mono', monospace; background: #e8e4db; color: var(--ink); }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    background: var(--ink);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-header-title {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 300;
}
.page-header-sub {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rule);
}

/* ── Grid of bial cards ──────────────────────────────────── */
.bial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 24px;
}

/* ── Bial card ───────────────────────────────────────────── */
.bial-card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 3px 3px 0 var(--rule);
    padding: 18px 20px 14px;
    position: relative;
    transition: box-shadow 0.15s;
}
.bial-card:hover { box-shadow: 4px 4px 0 #aaa; }

.bial-card-name {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 2px;
}
.bial-card-sub {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
}

.bial-card-actions { display: flex; gap: 8px; }

.btn-card {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.06em;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-ocr {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}
.btn-ocr:hover { background: var(--accent); color: #fff; }
.btn-ocr:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-manual {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.btn-manual:hover { background: #333; }

/* ── Progress pill ───────────────────────────────────────── */
.progress-pill {
    position: absolute;
    top: 12px; right: 12px;
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    background: var(--paper);
    border: 1px solid var(--rule);
    color: var(--muted);
}
.progress-pill.done { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }

/* ── OCR status bar ──────────────────────────────────────── */
.ocr-status-bar {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.06em;
    min-height: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ocr-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--rule);
    flex-shrink: 0;
}
.ocr-dot.scanning { background: var(--accent); animation: pulse 0.8s infinite; }
.ocr-dot.done     { background: #10b981; }
.ocr-dot.error    { background: var(--accent2); }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* ── Footer action ───────────────────────────────────────── */
.page-footer {
    padding: 20px 24px 40px;
    text-align: center;
}
.btn-review {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 36px;
    background: var(--ink);
    color: #fff;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-review:hover { background: var(--accent); }

/* ── Modal ───────────────────────────────────────────────── */
.mono-modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20,20,18,0.65);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.mono-modal-backdrop.open { display: flex; }

.mono-modal {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 6px 6px 0 var(--rule);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.mono-modal-header {
    background: var(--ink);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.mono-modal-title {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 300;
}
.btn-close-modal {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.btn-close-modal:hover { color: #fff; }

.mono-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
}

.mono-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Entry table ─────────────────────────────────────────── */
.entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.entry-table th {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1.5px solid var(--ink);
    background: var(--paper);
    text-align: center;
    white-space: nowrap;
}
.entry-table th:nth-child(1),
.entry-table th:nth-child(2) { text-align: left; }

.entry-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #ede9e0;
    vertical-align: middle;
}
.entry-table tbody tr.has-data { background: #f0fdf4; }
.entry-table tfoot td {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    border-top: 1.5px solid var(--rule);
    border-bottom: none;
    padding: 8px 10px;
    background: var(--paper);
}

.tally-input {
    width: 100%;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    border: 1px solid var(--rule);
    padding: 5px 8px;
    text-align: right;
    background: #fff;
    transition: border-color 0.12s;
    border-radius: 0;
}
.tally-input:focus { outline: none; border-color: var(--accent); background: #f0fdf4; }
.tally-input.ocr-filled { background: #ecfdf5; border-color: #6ee7b7; }

.row-total { font-weight: 500; text-align: right; color: var(--ink); }

/* ── Camera preview modal ────────────────────────────────── */
.camera-modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: #000;
    z-index: 300;
    flex-direction: column;
}
.camera-modal-backdrop.open { display: flex; }

#camera-video {
    width: 100%;
    flex: 1;
    object-fit: cover;
}
.camera-toolbar {
    background: #111;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.btn-capture {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid #aaa;
    cursor: pointer;
    transition: transform 0.1s;
    flex-shrink: 0;
}
.btn-capture:active { transform: scale(0.92); }
.btn-cam-cancel {
    background: none;
    border: 1.5px solid #444;
    color: #aaa;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    padding: 8px 16px;
    cursor: pointer;
}
.btn-cam-cancel:hover { border-color: #aaa; color: #fff; }
.cam-hint {
    color: #666;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-align: center;
    max-width: 200px;
}

/* ── Scan overlay on video ───────────────────────────────── */
.scan-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scan-frame {
    width: 88%;
    height: 70%;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
    position: relative;
}
.scan-frame::before, .scan-frame::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border-color: #fff;
    border-style: solid;
}
.scan-frame::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.scan-frame::after  { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

/* ── Parallel OCR progress ───────────────────────────────── */
.ocr-queue-banner {
    background: var(--ink);
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.08em;
    padding: 8px 24px;
    display: none;
    align-items: center;
    gap: 12px;
}
.ocr-queue-banner.visible { display: flex; }
.ocr-queue-bar {
    flex: 1;
    height: 3px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}
.ocr-queue-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
    width: 0%;
}