:root {
  --brand: #2563EB;
  --navy: #1F2A44;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #6b7686;
  --line: #e4e8f0;
  --success: #1a7f48;
  --warn: #9a6700;
  --danger: #b3261e;
  --info: #1e5fb0;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 24px 60px; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--navy); border-bottom: 1px solid var(--navy);
  padding: 14px 24px;
}
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 46px; }
.topnav { display: flex; gap: 20px; }
.topnav a { color: #cdd7e6; font-weight: 600; }
.topnav a:hover { color: #fff; text-decoration: none; }
.who { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.who .muted { color: #9fb0c6; }
.who .btn-link { color: #cdd7e6; }
.who .btn-link:hover { color: #fff; }

/* headings + layout */
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.summary { margin: 4px 0 10px; }
.bulk-xero { margin: 0 0 12px; }
.remind-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.remind-row form { display: inline; }
.remind-row select { margin-top: 0; }

/* buttons */
.btn, button.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c9d0dc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e4c4c2; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.spacer { flex: 1; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink);
  background: #fff;
}
input.num { text-align: right; }
.filters, .upload, .inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input[type=search] { width: 280px; }
.filters input, .filters select, .upload input, .inline-form input, .inline-form select { width: auto; margin-top: 0; }

/* tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { background: #fafbfe; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.grid tr:last-child td { border-bottom: none; }
.grid .num { text-align: right; }
.row-actions { white-space: nowrap; display: flex; gap: 12px; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.success { background: #e3f5ea; color: var(--success); }
.badge.warn { background: #fcf1d8; color: var(--warn); }
.badge.danger { background: #fce3e1; color: var(--danger); }
.badge.info { background: #e2eefb; color: var(--info); }
.badge.muted { background: #eef1f6; color: var(--muted); }

/* alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert.success { background: #e3f5ea; color: var(--success); }
.alert.danger { background: #fce3e1; color: var(--danger); }
.alert.info { background: #e2eefb; color: var(--info); }

/* login */
.login-card { max-width: 360px; margin: 8vh auto; background: var(--card); padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); }
.login-card { overflow: hidden; }
.login-card h1 { margin-bottom: 2px; }
.login-logo-band {
  background: var(--navy);
  margin: -28px -28px 22px;
  padding: 30px 28px;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
}
.login-logo { width: 300px; max-width: 100%; display: block; margin: 0 auto; }
.login-card .btn { width: 100%; margin-top: 6px; }

/* Microsoft sign-in */
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 8px; font-weight: 600; }
.ms-logo { display: inline-grid; grid-template-columns: 9px 9px; grid-gap: 2px; }
.ms-logo span { width: 9px; height: 9px; display: block; }
.ms-logo span:nth-child(1) { background: #f25022; }
.ms-logo span:nth-child(2) { background: #7fba00; }
.ms-logo span:nth-child(3) { background: #00a4ef; }
.ms-logo span:nth-child(4) { background: #ffb900; }
.or { display: flex; align-items: center; text-align: center; color: var(--muted); margin: 14px 0 6px; font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.or span { padding: 0 10px; }

/* empty */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h1 { font-size: 40px; }

/* review */
.review-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: start; }
.preview { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 16px; }
.preview img { width: 100%; border-radius: 6px; display: block; }
.review-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field-row { display: flex; gap: 14px; }
.field-row label { flex: 1; }
fieldset.lines, fieldset.xero-coding { border: 1px solid var(--line); border-radius: 8px; margin: 14px 0; padding: 10px 12px; }
fieldset.lines legend, fieldset.xero-coding legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
fieldset.xero-coding { background: #f7f9ff; border-color: #d6e0fb; }
.lines-grid th, .lines-grid td { padding: 4px 6px; }
.lines-grid input { margin-top: 0; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.side-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.side-actions form { display: inline; }

/* admin */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; }
.panel .inline-form { margin-top: 14px; }

.xero-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.xero-row form { display: inline; }

.foot { text-align: center; padding: 20px; font-size: 12px; }

@media (max-width: 820px) {
  .review-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
}
