:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #232321;
  --muted: #77746d;
  --line: #dedbd3;
  --accent: #7d8a63;
  --accent-dark: #596444;
  --soft: #ece9e1;
  --danger: #a94c45;
  --shadow: 0 18px 60px rgba(45, 42, 36, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 80px; }
.topbar { display:flex; justify-content:space-between; gap:24px; align-items:flex-start; margin-bottom:28px; }
.eyebrow { margin:0 0 8px; color:var(--accent-dark); font-size:12px; letter-spacing:.16em; font-weight:800; }
h1 { margin:0; font-family: Georgia, "Songti SC", serif; font-weight:500; font-size:clamp(34px, 5vw, 56px); letter-spacing:-.035em; }
.sub { margin:12px 0 0; color:var(--muted); font-size:15px; }
.top-actions { display:flex; gap:10px; padding-top:4px; }
.btn { border:1px solid var(--line); border-radius:999px; background:var(--panel); color:var(--ink); padding:10px 16px; font-weight:700; transition:.16s ease; }
.btn:hover { transform:translateY(-1px); }
.btn-primary { background:var(--ink); color:white; border-color:var(--ink); }
.btn-ghost { background:rgba(255,255,255,.58); }
.full { width:100%; border-radius:14px; padding:13px; }
.summary-card { background:var(--ink); color:white; border-radius:22px; padding:26px 30px; display:flex; align-items:end; justify-content:space-between; box-shadow:var(--shadow); }
.summary-card span { color:#c8c7c3; font-size:13px; }
.summary-card strong { display:block; margin-top:7px; font-family: Georgia, serif; font-size:42px; font-weight:500; }
.summary-meta { display:flex; gap:18px; }
.admin-panel { margin-top:22px; background:var(--panel); border:1px solid var(--line); border-radius:22px; padding:24px; box-shadow:var(--shadow); }
.admin-head { display:flex; justify-content:space-between; gap:22px; margin-bottom:18px; }
.admin-head h2, .section-title h2 { margin:0; font-size:18px; }
.admin-head p { margin:6px 0 0; font-size:13px; color:var(--muted); }
.purpose-wrap { width:min(360px, 48%); }
label span { display:block; margin:0 0 7px; color:var(--muted); font-size:12px; font-weight:700; }
input { width:100%; border:1px solid var(--line); border-radius:12px; padding:11px 12px; outline:none; background:#fff; color:var(--ink); }
input:focus { border-color:#9da78c; box-shadow:0 0 0 3px rgba(125,138,99,.12); }
.dropzone { border:1.5px dashed #b9b6ae; min-height:128px; border-radius:18px; display:flex; align-items:center; justify-content:center; gap:16px; background:#faf9f6; transition:.16s; }
.dropzone.drag, .dropzone:hover { border-color:var(--accent); background:#f4f5ef; }
.upload-icon { width:44px; height:44px; border-radius:50%; display:grid; place-items:center; background:var(--ink); color:#fff; font-size:28px; line-height:1; }
.dropzone strong { font-size:16px; }
.dropzone p { margin:5px 0 0; color:var(--muted); font-size:12px; }
.queue { display:grid; gap:8px; margin-top:12px; }
.queue-item { padding:10px 12px; border-radius:12px; background:var(--soft); display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:13px; }
.spinner { width:16px; height:16px; border:2px solid #c8c5bd; border-top-color:var(--ink); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.records-section { margin-top:34px; }
.section-title { display:flex; align-items:center; justify-content:space-between; margin:0 0 12px; }
.badge { border:1px solid var(--line); background:rgba(255,255,255,.5); padding:6px 10px; border-radius:999px; font-size:11px; color:var(--muted); }
.table-wrap { border:1px solid var(--line); border-radius:18px; overflow:hidden; background:var(--panel); box-shadow:var(--shadow); }
table { width:100%; border-collapse:collapse; table-layout:fixed; }
th { background:#e8e6df; text-align:left; font-size:12px; letter-spacing:.03em; color:#5c5a55; padding:12px 14px; }
td { border-top:1px solid #ece9e1; padding:12px 14px; vertical-align:middle; font-size:14px; }
th:nth-child(1), td:nth-child(1) { width:22%; }
th:nth-child(2), td:nth-child(2) { width:18%; }
th:nth-child(3), td:nth-child(3) { width:27%; }
th:nth-child(4), td:nth-child(4) { width:12%; }
th:nth-child(5), td:nth-child(5) { width:13%; }
.money { text-align:right; font-variant-numeric:tabular-nums; }
.receipt-thumb { width:62px; height:62px; object-fit:cover; border-radius:9px; border:1px solid var(--line); display:block; cursor:zoom-in; background:#eee; }
.row-actions { display:flex; gap:6px; }
.icon-btn { border:0; background:#f1efe9; border-radius:10px; padding:7px 9px; }
.icon-btn.danger { color:var(--danger); }
.empty-state { padding:34px; text-align:center; color:var(--muted); }
.hidden { display:none !important; }
.modal { border:0; border-radius:22px; padding:0; width:min(440px, calc(100% - 26px)); box-shadow:0 30px 100px rgba(0,0,0,.25); }
.modal::backdrop, .image-dialog::backdrop { background:rgba(28,28,26,.55); backdrop-filter:blur(4px); }
.modal-card { padding:26px; position:relative; }
.modal-card h3 { margin:0; font-size:24px; }
.modal-card > p:not(.eyebrow):not(.error-text) { color:var(--muted); font-size:13px; line-height:1.6; }
.modal-card label { display:block; margin:16px 0; }
.modal-close { position:absolute; top:14px; right:14px; border:0; background:#f0eee8; width:32px; height:32px; border-radius:50%; font-size:20px; }
.error-text { color:var(--danger); min-height:18px; font-size:12px; }
.confirm-card { width:min(760px, 100%); }
#confirmDialog { width:min(760px, calc(100% - 26px)); }
.confirm-layout { display:grid; grid-template-columns:minmax(210px, .8fr) 1.2fr; gap:24px; }
.confirm-image { width:100%; max-height:520px; object-fit:contain; border-radius:14px; background:#f1efe9; }
.amount-input { position:relative; }
.amount-input i { position:absolute; left:12px; top:10px; font-style:normal; color:var(--muted); }
.amount-input input { padding-left:28px; }
.confidence { font-size:12px !important; margin:6px 0 4px !important; }
.note { background:#f6f4ef; border-radius:10px; padding:9px 11px; font-size:12px !important; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.image-dialog { border:0; background:transparent; padding:30px; max-width:92vw; max-height:92vh; }
.image-dialog img { max-width:86vw; max-height:82vh; object-fit:contain; border-radius:12px; display:block; }
.image-close { position:fixed; top:22px; right:28px; width:40px; height:40px; border:0; border-radius:50%; background:white; font-size:24px; }
.toast { position:fixed; left:50%; bottom:28px; transform:translate(-50%, 16px); background:var(--ink); color:#fff; border-radius:999px; padding:10px 16px; font-size:13px; opacity:0; pointer-events:none; transition:.2s; z-index:99; }
.toast.show { opacity:1; transform:translate(-50%, 0); }
.edit-input { min-width:0; padding:7px 8px; border-radius:8px; font-size:13px; }
@media (max-width: 760px) {
  .app-shell { width:min(100% - 22px, 1180px); padding-top:28px; }
  .topbar, .admin-head { flex-direction:column; }
  .top-actions { width:100%; }
  .top-actions .btn { flex:1; }
  .summary-card { align-items:flex-start; gap:18px; flex-direction:column; }
  .summary-meta { width:100%; justify-content:space-between; }
  .purpose-wrap { width:100%; }
  .table-wrap { overflow-x:auto; }
  table { min-width:820px; }
  .confirm-layout { grid-template-columns:1fr; }
  .confirm-image { max-height:260px; }
}


.group-start td { border-top: 2px solid #d7d3c9; }
.group-purpose { font-weight: 750; color: var(--ink); vertical-align: top; padding-top: 17px; }
.group-purpose-empty { color: transparent; }
.group-total td { background: #faf9f6; border-top: 1px solid #d7d3c9; }
.group-total-label { text-align: right; font-weight: 750; color: #5c5a55; }
.group-total-amount { font-weight: 850; color: var(--ink); }
