:root {
  --bg: #f6f4f0; --card: #fff; --text: #1f1d1a; --muted: #6b665e; --line: #e4e0d8;
  --accent: #7a4a24; --accent-text: #fff; --warn-bg: #fff4dc; --warn: #8a5a00;
  --ok: #2e6b3a; --danger: #b3261e; --chip: #efebe4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513; --card: #221f1c; --text: #ece7df; --muted: #a39d93; --line: #39342e;
    --accent: #c98a52; --accent-text: #1a1410; --warn-bg: #3a2e14; --warn: #f0c46a;
    --ok: #7cc48a; --danger: #ff8a80; --chip: #2e2a25;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
header.top h1 { font-size: 20px; margin: 0; }
header.top .sub { font-size: 13px; color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px;
  padding: 9px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .count { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } .cards .stat:last-child { grid-column: span 2; } }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; margin-bottom: 16px;
  background: var(--card); }
.drop.over { border-color: var(--accent); }
.drop .btn { margin: 4px; }
.drop p { margin: 8px 0 0; font-size: 13px; }

section h2 { font-size: 16px; margin: 22px 0 10px; }
.review { border-color: var(--accent); margin-bottom: 12px; }
.review .warn, .note { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; margin-bottom: 10px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.form .full { grid-column: span 2; }
@media (max-width: 560px) { .form { grid-template-columns: 1fr; } .form .full { grid-column: span 1; } }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 54px; resize: vertical; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.row-actions .spacer { flex: 1; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.thumb { display: flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 8px; padding: 4px 8px;
  font-size: 13px; }
.thumb a { color: var(--text); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px;
  cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line);
  align-items: center; cursor: pointer; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--bg); }
.item .main { min-width: 0; }
.item .v { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .d { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.pill { display: inline-block; font-size: 11px; border-radius: 999px; padding: 1px 8px; background: var(--chip);
  color: var(--muted); font-weight: 500; }
.pill.submitted { color: var(--warn); }
.pill.reimbursed { color: var(--ok); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; font-size: 13px; }

.report { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.report label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.report select, .report input { width: auto; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text);
  width: min(640px, calc(100vw - 24px)); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin: 0 0 12px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
.busy { font-size: 13px; color: var(--muted); margin-top: 8px; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px;
  width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; }
