/* UI-2: vouchers + treasury (accounting app). Builds on app.css tokens (--mz-*). */

/* ---------- list filters ---------- */
.ui2-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; flex: 1 1 auto; min-width: 0; }
.ui2-filter-search { flex: 1 1 220px; max-width: 320px; }
.ui2-filter-date { flex: 0 1 170px; min-width: 150px; }
.ui2-filter-party { flex: 0 1 220px; min-width: 180px; }
.ui2-desc { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui2-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }

@media (max-width: 767.98px) {
    .ui2-filter-search, .ui2-filter-party { flex: 1 1 100%; max-width: none; }
    .ui2-filter-date { flex: 1 1 calc(50% - .25rem); min-width: 0; }
    .ui2-desc { max-width: 160px; }
    .ui2-stats { grid-template-columns: 1fr 1fr; }
    .ui2-stats > :last-child { grid-column: 1 / -1; }
}

/* ---------- voucher line grid ---------- */
.ui2-lines { min-width: 940px; }
.ui2-lines .ui2-col-account { min-width: 240px; }
.ui2-lines .ui2-col-detail { min-width: 190px; }
.ui2-lines .ui2-col-desc { min-width: 170px; }
.ui2-lines .ui2-col-money { width: 150px; min-width: 130px; }
.ui2-lines .ui2-col-actions { width: 84px; }
.ui2-lines td { vertical-align: top; }
.ui2-lines tbody tr { transition: background-color .2s ease; }
.ui2-lines tbody tr:focus-within td { background: var(--mz-teal-50); }
.ui2-lines .ui2-row-empty .row-no { opacity: .5; }
.ui2-lines tfoot td { vertical-align: middle; }
.ui2-sub { font-size: .75rem; color: var(--mz-subtle); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ui2-lines tbody tr { animation: ui2-row-in .22s ease-out; }
@keyframes ui2-row-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ui2-lines tbody tr { animation: none; } }

/* ---------- treasury editor ---------- */
.ui2-seg { flex-wrap: wrap; }
.ui2-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.ui2-method { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem .4rem; border: 1px solid var(--mz-border);
    border-radius: var(--mz-radius-sm); background: #fff; color: var(--mz-muted); font-size: .82rem; text-align: center; transition: all .18s ease; }
.ui2-method i { font-size: 1.35rem; }
.ui2-method:hover:not(:disabled) { border-color: var(--mz-teal-500); color: var(--mz-navy-800); }
.ui2-method.active { border-color: var(--mz-teal-500); background: var(--mz-teal-50); color: var(--mz-teal-600); box-shadow: 0 0 0 .15rem rgba(16, 161, 145, .15); }
.ui2-method:disabled { opacity: .65; cursor: default; }
.ui2-method:disabled.active { opacity: 1; }

/* ---------- printable paper (voucher print, treasury receipt) ---------- */
.ui2-paper { background: #fff; border: 1px solid var(--mz-border); border-radius: var(--mz-radius); box-shadow: var(--mz-shadow-sm);
    max-width: 210mm; margin: 0 auto; padding: 14mm 12mm; color: var(--mz-text); font-size: .9rem; }
.ui2-paper-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: start; border-bottom: 2px solid var(--mz-navy-800);
    padding-bottom: .75rem; margin-bottom: .9rem; }
.ui2-paper-head h1 { font-size: 1.3rem; margin: 0; text-align: center; color: var(--mz-navy-900); align-self: center; }
.ui2-paper-company { display: flex; flex-direction: column; gap: .2rem; }
.ui2-paper-company strong { font-size: 1.05rem; }
.ui2-paper-company span { color: var(--mz-muted); font-size: .85rem; }
.ui2-paper-meta { display: grid; grid-template-columns: auto auto; gap: .2rem .75rem; margin: 0; justify-self: end; font-size: .85rem; }
.ui2-paper-meta dt { color: var(--mz-muted); font-weight: 400; }
.ui2-paper-meta dd { margin: 0; font-weight: 500; }
.ui2-paper-desc { margin: 0 0 .75rem; }
.ui2-paper-desc span { color: var(--mz-muted); }
.ui2-paper-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ui2-paper-table th, .ui2-paper-table td { border: 1px solid var(--mz-border-strong); padding: .4rem .5rem; vertical-align: top; }
.ui2-paper-table thead th { background: var(--mz-surface-2); font-weight: 500; text-align: center; white-space: nowrap; }
.ui2-paper-table tfoot td { font-weight: 700; background: var(--mz-surface-2); }
.ui2-paper-table .c-row { width: 3rem; text-align: center; }
.ui2-paper-table .c-code { width: 5.5rem; text-align: center; direction: ltr; }
.ui2-paper-table .c-money { width: 8.5rem; text-align: left; direction: ltr; white-space: nowrap; font-feature-settings: "tnum" 1; }
.ui2-paper-kv th { width: 9rem; background: var(--mz-surface-2); font-weight: 500; text-align: right; }
.ui2-paper-line-desc { color: var(--mz-muted); font-size: .8rem; margin-top: .15rem; }
.ui2-paper-note { color: var(--mz-muted); font-size: .8rem; margin: .5rem 0 0; }
.ui2-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.75rem; }
.ui2-signs div { border: 1px dashed var(--mz-border-strong); border-radius: 8px; height: 5.5rem; padding: .5rem; display: flex; justify-content: center; }
.ui2-signs span { color: var(--mz-muted); font-size: .85rem; }
.ui2-paper-foot { margin-top: 1rem; color: var(--mz-subtle); font-size: .75rem; text-align: left; }
.ui2-print-only { display: none; }

@media (max-width: 767.98px) {
    .ui2-paper { padding: 1rem .75rem; overflow-x: auto; }
    .ui2-paper-head { grid-template-columns: 1fr; }
    .ui2-paper-head h1 { text-align: start; }
    .ui2-paper-meta { justify-self: start; }
    .ui2-paper-table { min-width: 620px; }
    .ui2-paper-kv { min-width: 0; }
}

@media print {
    .ui2-paper { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 11px; }
    .ui2-paper-table { min-width: 0; font-size: 10.5px; }
    .ui2-paper-table thead { display: table-header-group; }
    .ui2-paper-table tr { break-inside: avoid; }
    .ui2-signs { break-inside: avoid; }
    .ui2-print-only { display: block; }
}
