/* Design system copied from support.mainit.ca (MainIT) — same variables, components, admin blue theme. */
:root {
  --red: #DA1F26;
  --green: #15924A;
  --ink: #141A21;
  --ink-2: #48586B;
  --ink-3: #93A1B2;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --line: #E5E9EF;
  --shadow-card: 0 1px 2px rgba(15,23,42,.05);
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
.x-btn svg { width: 17px; height: 17px; }
::selection { background: rgba(218,31,38,.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
@keyframes mitFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mitSheet { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.grotesk { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--ink-3); }
.pre { white-space: pre-wrap; }
.section-label { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- toasts ---------- */
.toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
.toast { padding: 11px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(15,23,42,.16); transition: opacity .4s; animation: mitFade .2s ease; }
.toast-error { background: #FCE8E9; color: #9b1c1c; border: 1px solid #f3b9bb; }
.toast-success { background: #E4F5EB; color: #15803d; border: 1px solid #a7e3bd; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; border-radius: var(--radius-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(.98); }
.btn svg { width: 17px; height: 17px; }
.btn-sm { padding: 7px 12px; font-size: 13px; gap: 6px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 1px 2px rgba(218,31,38,.25); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 1px 2px rgba(21,146,74,.25); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #DA1F2633; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; box-shadow: var(--shadow-card); }
.card.pad0 { padding: 0; }
a.card, .card.clickable { display: block; transition: box-shadow .18s, transform .18s; }
a.card:hover, .card.clickable:hover { box-shadow: 0 6px 22px rgba(15,23,42,.09); transform: translateY(-1px); }
.card.alert { border-color: var(--red); }
.divider { height: 1px; background: var(--line); }

/* ---------- pills / tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap; }
.pill.sm { padding: 3px 9px; font-size: 11.5px; }
.pill .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- fields ---------- */
.field { display: block; }
.field > .label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field > .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.input, .select, .textarea, input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=file], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-input); border: 1px solid var(--line);
  background: var(--surface); font-family: inherit; font-size: 14.5px; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(218,31,38,.12); }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.search-wrap input { padding-left: 38px; }

/* ---------- layout: admin ---------- */
.admin { min-height: 100vh; display: flex; background: var(--bg); }
.sidebar { width: 232px; flex-shrink: 0; background: var(--ink); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 20px 18px 18px; display: flex; align-items: center; gap: 10px; }
.sidebar .brand .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; }
.sidebar nav { padding: 6px 12px; display: grid; gap: 4px; }
.side-btn { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; width: 100%; text-align: left; white-space: nowrap; background: transparent; color: rgba(255,255,255,.62); }
.side-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-btn.active { background: rgba(255,255,255,.13); color: #fff; }
.side-btn svg { width: 19px; height: 19px; }
.side-btn .grow { flex: 1; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.sidebar .foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-main { flex: 1; min-width: 0; padding: 26px 30px 40px; max-width: 1180px; margin: 0 auto; width: 100%; }
.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--ink-2); font-size: 14px; margin: 4px 0 0; }
.row-between { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--bg); border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); vertical-align: middle; }
.table tr.clickable:hover td { background: var(--bg); }
.table .ttl { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.table .right { text-align: right; }

/* ---------- stats ---------- */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1 1 120px; min-width: 110px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; }
.stat.accent { background: var(--red); border-color: var(--red); }
.stat .k { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 3px; }
.stat.accent .k { color: rgba(255,255,255,.8); }
.stat .v { font-family: 'IBM Plex Mono', monospace; font-size: 18px; font-weight: 600; color: var(--ink); }
.stat.accent .v { color: #fff; }

/* ---------- sheets (dialog) ---------- */
dialog.sheet { padding: 0; border: none; border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; box-shadow: 0 24px 60px rgba(15,23,42,.28); overflow: hidden; animation: mitSheet .22s cubic-bezier(.2,.8,.2,1); }
dialog.sheet.wide { max-width: 620px; }
dialog.sheet form { display: flex; flex-direction: column; max-height: 92vh; min-height: 0; }
.sheet .sh-bd { flex: 1 1 auto; min-height: 0; padding: 20px; overflow-y: auto; }
dialog.sheet::backdrop { background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
.sheet .sh-hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet .sh-hd .t { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; }
.sheet .sh-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg); }
.x-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 12px; }

/* ---------- dropzone ---------- */
.dropzone { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); font-size: 13.5px; flex-wrap: wrap; }
.dropzone input[type=file] { font-size: 13px; border: none; padding: 0; width: auto; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink-2); }
.empty .t { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; background: var(--surface); }
.brand-panel { position: relative; overflow: hidden; background: var(--ink); color: #fff; flex: 1 1 0; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-panel .matrix { position: absolute; inset: 0; opacity: .16; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(43,212,74,.5) 22px 23px); -webkit-mask-image: linear-gradient(120deg,transparent,#000 60%); mask-image: linear-gradient(120deg,transparent,#000 60%); }
.brand-panel .top { position: relative; display: flex; align-items: center; gap: 12px; }
.brand-panel .top .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 27px; letter-spacing: -0.02em; }
.brand-panel h2 { position: relative; font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
.brand-panel p { position: relative; font-size: 15px; color: rgba(255,255,255,.7); line-height: 1.6; max-width: 360px; margin: 0; }
.brand-panel .addr { position: relative; font-size: 12.5px; color: rgba(255,255,255,.5); font-family: 'IBM Plex Mono', monospace; }
.signin-pane { flex: 1 1 0; display: flex; align-items: center; justify-content: center; padding: 48px 44px; background: var(--bg); }
.signin { width: 100%; max-width: 380px; }
.signin h1 { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
.signin .sub { font-size: 14px; color: var(--ink-2); margin: 0 0 22px; }
.notice { margin-top: 20px; padding: 11px 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.notice strong { color: var(--ink-2); }

/* mobile */
.admin-topbar { display: none; }
.admin-bottomnav { display: none; }
@media (max-width: 760px) {
  .sidebar { display: none; }
  .admin-main { padding: 16px 16px 88px; }
  .grid2 { grid-template-columns: 1fr; }
  .login { flex-direction: column; }
  .brand-panel { padding: 30px 24px 26px; }
  .brand-panel h2, .brand-panel p { display: none; }
  .signin-pane { padding: 28px 20px 40px; }
  .hide-mobile { display: none !important; }
  dialog.sheet { max-width: 100%; margin: auto auto 0; border-radius: 20px 20px 0 0; }
  .admin-topbar { display: flex; position: sticky; top: 0; z-index: 50; background: #1E5FBF; color: #fff; padding: 12px 16px; align-items: center; gap: 10px; }
  .admin-topbar .word { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; }
  .admin-bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px 10px; }
  .admin-bottomnav a { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--ink-3); font-size: 11px; font-weight: 600; position: relative; }
  .admin-bottomnav a.active { color: var(--red); }
}
@media (min-width: 761px) { .only-mobile { display: none !important; } }

/* ===== Light-blue admin theme + larger fonts (same as support.mainit.ca admin) ===== */
.admin{ --blue:#2F80ED; --blue-dark:#1E5FBF; --blue-deep:#173F7D; --blue-soft:#EAF2FE; font-size:16px; }
.admin, .admin input, .admin textarea, .admin select, .admin button, .admin .btn{ font-size:15.5px; }
.admin .page-title{ font-size:30px; }
.admin .page-sub, .admin .hint, .admin .muted{ font-size:14.5px; }
.admin .section-label{ font-size:12.5px; }
.admin table, .admin table td, .admin table th{ font-size:15px; }
.admin .card{ font-size:15.5px; }
.admin .sidebar{ background:linear-gradient(180deg,#1E5FBF,#173F7D); color:#fff; }
.admin .side-btn{ color:rgba(255,255,255,.78); }
.admin .side-btn:hover{ background:rgba(255,255,255,.12); color:#fff; }
.admin .side-btn.active{ background:rgba(255,255,255,.2); color:#fff; }
.admin a{ color:var(--blue); }
.admin .btn-primary{ background:var(--blue); border-color:var(--blue); color:#fff; box-shadow:0 1px 2px rgba(47,128,237,.3); }
.admin .btn-primary:hover{ background:var(--blue-dark); border-color:var(--blue-dark); }
.admin input:focus, .admin textarea:focus, .admin select:focus{ border-color:var(--blue); box-shadow:0 0 0 3px rgba(47,128,237,.15); }
.admin .chip.active{ background:var(--blue); border-color:var(--blue); color:#fff; }
.admin .nav-badge{ background:var(--blue-soft); color:var(--blue-dark); }

/* ===== acc-specific helpers ===== */
.filters-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.amount-cell { font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: var(--ink); }
.pill-biz { background: #EAF2FE; color: #1E5FBF; }
.pill-personal { background: #FBF0DD; color: #C2700A; }
.pill-unreviewed { background: var(--bg); color: var(--ink-3); border: 1px dashed var(--line); }
.pill-pending { background: #FCE8E9; color: var(--red); }
.pill-confirmed { background: #E4F5EB; color: #15803d; }
.src-tag { font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.receipt-thumb { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
