:root {
  --bg: #f4f6f9;
  --sidebar: #1f2a37;
  --sidebar-active: #2f4156;
  --accent: #2563eb;
  --border: #e2e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: #cbd5e1; flex-shrink: 0; }
.sidebar .brand { padding: 18px 16px; font-weight: 700; color: #fff; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { display: flex; flex-direction: column; padding: 8px 0; }
.sidebar nav a { color: #cbd5e1; padding: 10px 16px; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; border-left: 3px solid var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.topbar .page-title { font-weight: 600; font-size: 16px; }
.topbar .user { color: var(--muted); display: flex; gap: 12px; align-items: center; }
.content { padding: 24px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
.card h2 { margin: 0 0 12px; font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.month-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.month-card h3 { margin: 0 0 6px; }
.month-card .meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.month-card .stats { display: flex; gap: 16px; font-size: 13px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.in_progress { background: #dbeafe; color: #1d4ed8; }
.badge.needs_receipts { background: #fef3c7; color: var(--warn); }
.badge.complete { background: #dcfce7; color: var(--ok); }
.badge.review { background: #fef3c7; color: var(--warn); }
.badge.high { background: #dcfce7; color: var(--ok); }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
tr.uncoded td { background: #fffbeb; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

input, select, button, textarea { font: inherit; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; width: 100%; background: #fff;
}
table input, table select { padding: 4px 6px; }
input.cell-num { text-align: right; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: none; padding: 9px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.btn-danger { background: #dc2626; }
.btn.btn-danger:hover { background: #b91c1c; }

/* Account picker modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 100; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 8px; width: 480px; max-width: 92vw; max-height: 72vh; display: flex; flex-direction: column; padding: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#acct-search { width: 100%; padding: 8px; margin-bottom: 8px; box-sizing: border-box; }
.acct-list { overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.acct-item { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; }
.acct-item:hover { background: #eff6ff; }
.btn-link { color: var(--accent); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash-ok { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a { padding: 9px 16px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: #fff; border-color: var(--border); color: var(--text); font-weight: 600; margin-bottom: -1px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 180px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.upload-zones { display: flex; gap: 16px; flex-wrap: wrap; }
.upload-zones form { flex: 1; min-width: 240px; border: 2px dashed var(--border); border-radius: 8px; padding: 16px; text-align: center; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: #fff; padding: 28px; border-radius: 10px; border: 1px solid var(--border); width: 320px; }
.login-box h1 { font-size: 18px; margin: 0 0 16px; }
.saved { color: var(--ok); font-size: 12px; }
