* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: #eef1f5; color: #1f2937; }
.topbar { background: #1e3a5f; color: #fff; padding: 12px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar .brand { font-size: 19px; font-weight: 700; }
.topbar .wsname { background: #2c5282; border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.topbar nav a, .topbar .who { color: #dbeafe; text-decoration: none; font-size: 14.5px; padding: 7px 10px; border-radius: 8px; }
.topbar nav a:hover { background: #2c5282; color: #fff; }
.topbar .who { color: #93c5fd; }
.badge { background: #dc2626; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.wrap { max-width: 1150px; margin: 0 auto; padding: 18px 14px 40px; }
.card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.card h2 { font-size: 17px; margin-bottom: 12px; color: #1e3a5f; }
.card h3 { font-size: 15px; margin: 12px 0 8px; color: #1e3a5f; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.acct { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; }
.acct .an { font-weight: 700; font-size: 15px; }
.acct .bal { font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.acct .sub { font-size: 12.5px; color: #6b7280; }
.pos { color: #047857; } .neg { color: #b91c1c; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 8px 9px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
th { color: #475569; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
td.amt, th.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.uncat td { background: #fff7ed; }
.tablewrap { overflow-x: auto; }
input, select, textarea { font-size: 16px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1f2937; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #2c5282; }
label { display: block; font-size: 13px; color: #475569; margin: 10px 0 4px; }
.btn { display: inline-block; background: #1e3a5f; color: #fff; border: 0; border-radius: 9px; padding: 10px 16px; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #2c5282; }
.btn.small { padding: 6px 11px; font-size: 13.5px; }
.btn.grey { background: #64748b; } .btn.red { background: #b91c1c; } .btn.green { background: #047857; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.alert.error { background: #fef2f2; border: 2px solid #b91c1c; color: #7f1d1d; font-weight: 600; }
.alert.success { background: #ecfdf5; border: 2px solid #047857; color: #064e3b; font-weight: 600; }
.muted { color: #6b7280; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { margin: 0 0 4px; }
.loginbox { max-width: 400px; margin: 60px auto; }
.qcat { max-width: 210px; }
@media (max-width: 640px) { .topbar nav { margin-left: 0; } .acct .bal { font-size: 19px; } }

/* ---- Transactions page refresh (scoped to .txnpage) ---- */
.txnpage { position: relative; }
.sumbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 10px; }
.sumcard { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; background: #fbfcfe; }
.sum-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }
.sum-val { font-size: 23px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.sum-val.gold { color: #b8912a; }
.sum-link { font-size: 13px; color: #b8912a; font-weight: 600; text-decoration: none; }
.matchline { font-size: 13.5px; color: #64748b; margin-bottom: 12px; }
.txnpage .tablewrap { max-height: 74vh; overflow: auto; }
.txnpage table { font-size: 14.5px; }
.txnpage thead th { position: sticky; top: 0; background: #f1f5f9; z-index: 5; padding: 10px 12px; }
.txnpage td { padding: 14px 12px; }
.txnpage tr.uncat td { background: #fffdf5; }
.txnpage tr.uncat td:first-child { box-shadow: inset 4px 0 0 #c9a227; }
.txnpage tr.picking td, .txncard.picking { background: #eef4fb; }
.txnpage tr.flash td, .txncard.flash { background: #fdf3d7; transition: background .3s; }
.desc { display: block; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.desc.open { white-space: normal; overflow: visible; }
.catchip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid #cbd5e1; background: #f1f5f9; color: #1e3a5f; max-width: 230px; }
.catchip .car { font-size: 10px; color: #64748b; }
.catchip.is-set { background: #eef4fb; border-color: #bcd2ea; }
.catchip.is-uncat { background: #faf3dd; border-color: #c9a227; color: #7c5e10; }
.catchip:hover { border-color: #1e3a5f; }
.mreview { display: none; }
.txncards { display: none; }
.picker-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.28); z-index: 55; }
.catpicker { position: fixed; z-index: 60; width: 300px; max-width: calc(100vw - 16px); background: #fff; border-radius: 14px; box-shadow: 0 12px 34px rgba(15,23,42,.28); padding: 14px; }
.cp-head { display: flex; justify-content: space-between; align-items: center; font-size: 16.5px; font-weight: 700; color: #1e3a5f; margin-bottom: 10px; }
.cp-close { border: 1px solid #c9a227; background: #fff; color: #b8912a; width: 30px; height: 30px; border-radius: 999px; font-size: 17px; cursor: pointer; line-height: 1; }
.cp-search input { width: 100%; margin-bottom: 8px; }
.cp-list { max-height: 46vh; overflow-y: auto; }
.cp-item { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid #eef2f7; padding: 11px 6px; font-size: 15px; color: #1f2937; cursor: pointer; }
.cp-item:hover { background: #f8fafc; }
.cp-item .cp-check { color: #b8912a; font-weight: 700; visibility: hidden; }
.cp-item.current .cp-check { visibility: visible; }
.cp-item.current .cp-name { font-weight: 700; }
.cp-manage { display: block; margin-top: 12px; background: #c9a227; color: #fff; text-align: center; border-radius: 9px; padding: 10px; font-weight: 600; text-decoration: none; }

@media (max-width: 760px) {
  .sumbar { grid-template-columns: 1fr 1fr; }
  .sum-val { font-size: 20px; }
  .txnpage .tablewrap { display: none; }
  .mreview { display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: #1e3a5f; color: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14.5px; }
  .mreview strong { color: #e7c65a; font-size: 16px; }
  .txncards { display: block; }
  .txncard { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fff; }
  .txncard.uncat { border-left: 4px solid #c9a227; }
  .tc-top { display: flex; gap: 10px; align-items: flex-start; }
  .tc-date { min-width: 52px; font-weight: 700; color: #1e3a5f; font-size: 14.5px; line-height: 1.25; }
  .tc-date span { display: block; font-weight: 400; color: #64748b; font-size: 12.5px; }
  .tc-mid { flex: 1; min-width: 0; }
  .tc-desc { font-weight: 600; font-size: 14.5px; overflow-wrap: break-word; }
  .tc-acct { color: #64748b; font-size: 13px; margin-top: 2px; }
  .tc-amt { font-weight: 700; font-size: 15.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .tc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
  .catpicker { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; border-radius: 16px 16px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .cp-list { max-height: 52vh; }
}
