/* Finance Review: plain CSS, laptop and tablet. */
:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2433; --muted: #5d6576; --line: #d9dde5; --line-soft: #eceef2;
  --accent: #1f5fa8; --accent-ink: #fff; --danger: #b3261e; --ok: #1e7b45; --warn: #9a6700;
  --flash: #fff2b3; --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 .3em; background: #fff; font-size: .85em; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: #17345e; color: #fff; padding: .6rem 1.25rem; }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.usernav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .9rem; }
.usernav .who { font-weight: 600; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.35); }
.usernav .linklike { color: #fff; }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

main.page { max-width: 1200px; margin: 1.25rem auto; padding: 0 1rem; }
main.wide { margin: 1rem 0; padding: 0 1rem; }
main.narrow { max-width: 460px; margin: 3rem auto; padding: 0 1rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.twocol { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.twocol .grow { flex: 1 1 560px; min-width: 0; }
.twocol .side { flex: 0 1 340px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.headactions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tabs a { margin-left: .9rem; text-decoration: none; color: var(--muted); padding-bottom: 2px; }
.tabs a.current { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }

.button, button, select, input[type=text], input[type=search], input[type=password], input[type=email], input[type=date], textarea, input[type=file] {
  font: inherit; color: inherit; }
.button, button:not(.linklike) { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: .4rem .85rem; cursor: pointer; text-decoration: none; color: var(--ink); line-height: 1.3; }
.button:hover, button:not(.linklike):hover { border-color: #aab2c0; }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--danger); }
button.small { padding: .15rem .5rem; font-size: .82rem; }
.wide { width: 100%; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=date], textarea, select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .55rem; background: #fff; max-width: 100%; }
form div { margin-bottom: .7rem; }
form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
form .helptext { display: block; color: var(--muted); font-size: .8rem; }
.card form input[type=text], .card form input[type=password], .card form input[type=email], .card form textarea { width: 100%; }
.card form label + input { margin-bottom: .7rem; }
.errors, .errorlist { color: var(--danger); font-size: .9rem; padding-left: 0; list-style: none; margin: .25rem 0 .6rem; }
.note { color: var(--muted); font-size: .85rem; margin-top: .9rem; }
.breakglass { margin-top: 1rem; }
.breakglass summary { cursor: pointer; color: var(--muted); margin-bottom: .6rem; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: .6rem .9rem; border-radius: var(--radius); background: #e8f0fb; border: 1px solid #c4d6f0; margin-bottom: .4rem; }
.msg.success { background: #e7f5ec; border-color: #b9e0c7; }
.msg.error { background: #fbeaea; border-color: #efc2bf; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: 99px;
  background: var(--line-soft); color: var(--muted); vertical-align: middle; }
.badge.flagged { background: #fdecc8; color: var(--warn); }
.badge.removed { background: #fbe3e1; color: var(--danger); }
.badge.archived { background: #e6e8ec; }
.badge.reviewed { background: #dff2e6; color: var(--ok); }

.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.filters label { display: inline-flex; align-items: center; gap: .3rem; font-weight: 400; margin: 0; }
.filters input[type=search] { min-width: 260px; }
.exportform { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.exportform label { display: inline-flex; gap: .25rem; align-items: center; font-weight: 400; margin: 0; }
.pager { display: flex; gap: .9rem; align-items: center; font-size: .9rem; margin: .4rem 0; flex-wrap: wrap; }

.table-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table-wrap.short { max-height: none; border: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { padding: .38rem .55rem; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; z-index: 2; background: #eef1f6; border-bottom: 1px solid var(--line); font-size: .85rem; white-space: nowrap; }
thead th a { color: var(--ink); text-decoration: none; }
thead th a:hover { text-decoration: underline; }
table.list td.actions { font-size: .85rem; }
table.list td.actions a, table.list td.actions form { margin-right: .5rem; white-space: nowrap; }

table.grid { font-size: .88rem; }
table.grid td.rownum, table.grid th.rownum { color: var(--muted); text-align: right; position: sticky; left: 0; background: #fafbfc; z-index: 1; }
table.grid thead th.rownum { z-index: 3; background: #eef1f6; }
table.grid td.cell { min-width: 6rem; max-width: 28rem; white-space: pre-wrap; word-break: break-word; }
table.grid td.cell[hx-get] { cursor: text; }
table.grid td.cell[hx-get]:hover { background: #f3f7fd; outline: 1px dashed #b6c8e6; outline-offset: -2px; }
table.grid td.cell[hx-get]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid td.editing { padding: .15rem; background: #f3f7fd; }
table.grid td.editing form { margin: 0; }
table.grid td.editing input { width: 100%; min-width: 10rem; padding: .25rem .4rem; }
table.grid tr.st-reviewed td.rownum { box-shadow: inset 4px 0 0 var(--ok); }
table.grid tr.st-flagged td { background: #fffaf0; }
table.grid tr.st-flagged td.rownum { box-shadow: inset 4px 0 0 #e0a100; }
table.grid tr.st-removed td { color: var(--muted); text-decoration: line-through; }
table.grid tr.st-removed td.actions, table.grid tr.st-removed td.status-cell { text-decoration: none; }
.st-select { padding: .15rem .3rem; font-size: .85rem; }
.st-select.st-flagged { border-color: #e0a100; background: #fff7e0; }
.st-select.st-reviewed { border-color: #8fcfa6; background: #effaf3; }
.count { display: inline-block; min-width: 1.2em; text-align: center; font-weight: 600; }

@keyframes flash { from { background: var(--flash); } to { background: transparent; } }
.flash, tr.flash td { animation: flash 1.4s ease-out; }

table.audit td.val { max-width: 22rem; white-space: pre-wrap; word-break: break-word; font-size: .85rem; }
table.audit tr.act-delete td { background: #fff6f5; }

.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(420px, 92vw); background: #fff; border-left: 1px solid var(--line);
  box-shadow: -6px 0 18px rgba(20,30,50,.12); transform: translateX(105%); transition: transform .2s ease; z-index: 20;
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; }
#drawer-body { padding: .9rem 1rem; overflow-y: auto; flex: 1; }
.drawer-sub { margin: 0 0 .6rem; color: var(--muted); }
.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
.comments li { border-bottom: 1px solid var(--line-soft); padding: .55rem 0; }
.comments .meta { font-size: .82rem; color: var(--muted); }
.comments p { margin: .25rem 0 0; white-space: normal; }
.commentform textarea { width: 100%; margin-bottom: .5rem; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: #1d2433; color: #fff;
  padding: .6rem 1rem; border-radius: var(--radius); transition: transform .2s ease; z-index: 30; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

.errorpage { text-align: center; padding: 3rem 1rem; }
.errorpage .code { font-size: 3rem; font-weight: 700; color: var(--muted); margin: 0; }

@media (max-width: 800px) {
  main.wide { padding: 0 .5rem; }
  .filters input[type=search] { min-width: 0; flex: 1 1 100%; }
  .table-wrap { max-height: calc(100vh - 300px); }
}
