:root {
  --brand: #cc1721; --brand-dark: #a3101a; --steel: #a8adb3; --steel-dark: #6f757c;
  --ink: #1a1a1c; --muted: #6a6f75; --line: #e3e5e8; --paper: #fff; --shell: #16181a; --wash: #f5f6f7;
  --ok: #1d7a4c; --warn: #8a6516; --stop: #a31927;
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink); background: var(--wash);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--brand); padding: 9px 14px; font-weight: 600; font-size: 13px; }
button:hover { background: #fdf2f3; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.ghost { border-color: transparent; background: transparent; }
button.small { font-size: 12px; padding: 6px 10px; }
button.danger { color: var(--stop); }
input, select, textarea { border: 1px solid #d6d3ce; border-radius: 7px; background: #fff; padding: 9px 10px; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { min-height: 76px; resize: vertical; }
input.amount { text-align: right; font-variant-numeric: tabular-nums; }
/* The particulars of a passbook line are the thing being described, so the field is given
   room rather than a single line that scrolls sideways. */
.field.particulars textarea { min-height: 92px; }
a { color: var(--brand); }
h1 { font-size: 27px; letter-spacing: -.8px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
p { line-height: 1.6; }
.muted { color: var(--muted); }
.number { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--shell); color: #f3f3f3; padding: 26px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; flex-direction: column; gap: 8px; margin: 0 4px 24px; }
.brand-logo { display: block; width: 100%; max-width: 196px; height: auto; background: #fff; border-radius: 8px; padding: 7px 9px; }
.brand strong { font-size: 15px; letter-spacing: -.2px; }
.brand span { font-size: 9px; letter-spacing: 1.7px; text-transform: uppercase; color: var(--steel); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button { display: flex; align-items: center; gap: 11px; border: none; background: transparent; color: #dcdcdc; text-align: left; font-size: 13px; font-weight: 500; padding: 11px 12px; border-radius: 8px; }
.nav button:hover { background: #25282c; }
.nav button.active { background: linear-gradient(180deg, #eceef1, #c9ced4); color: #16181a; font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.nav .icon { font-size: 15px; width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #3a3a3a; padding-top: 18px; font-size: 12px; line-height: 1.6; }
.sidebar-foot button { background: transparent; color: #f3f3f3; border-color: #5b5b5b; margin-top: 10px; width: 100%; }
.sidebar-foot button:hover { background: #25282c; }

.main { min-width: 0; }
.topbar { height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; font-size: 12px; color: var(--muted); }
.topbar .balance { font-weight: 700; color: var(--brand); font-size: 14px; }
.content { padding: 26px 30px 56px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 22px; }
.module { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.module-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.module-head h2 { font-size: 17px; }
.module-head .lead { font-size: 26px; font-weight: 700; letter-spacing: -1px; color: var(--brand); font-variant-numeric: tabular-nums; }
.module-head .lead small { display: block; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: right; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { padding: 16px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; background: #fff; border-top: 0; border-left: 0; border-radius: 0; color: var(--ink); }
.tile:hover { background: #f7f8fa; }
.tile:nth-child(3n) { border-right: 0; }
.tile strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.tile span { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.tile em { display: block; font-style: normal; font-size: 11px; color: var(--brand); margin-top: 3px; font-variant-numeric: tabular-nums; }
.module-foot { padding: 14px 22px; background: #fcfbfa; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { padding: 22px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 22px; background: #fcfbfa; border-bottom: 1px solid var(--line); }
.toolbar label { font-size: 11px; font-weight: 600; display: grid; gap: 5px; color: var(--muted); }
.toolbar input, .toolbar select { font-size: 12px; padding: 7px 8px; min-width: 130px; }
.toolbar .grow { flex: 1; min-width: 180px; }

.scroll { overflow: auto; max-height: 620px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; text-align: left; }
th { font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: #5f5f63; background: #f5f4f2; position: sticky; top: 0; z-index: 1; font-weight: 700; }
td, th { padding: 12px 16px; border-bottom: 1px solid #efedea; vertical-align: top; }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f7f8fa; }
tbody tr.clickable { cursor: pointer; }
td .ref { font-weight: 700; color: var(--brand); }
td small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
tfoot td { font-weight: 700; background: #fcfbfa; border-top: 2px solid var(--line); }

.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .3px; border-radius: 999px; padding: 4px 9px; background: #f0efec; color: #55534f; white-space: nowrap; }
.badge.draft { background: #f0efec; color: #55534f; }
.badge.submitted, .badge.under_review { background: #fff3d8; color: var(--warn); }
.badge.approved, .badge.for_payment, .badge.for_disbursement { background: #e7f2ff; color: #17548c; }
.badge.paid, .badge.disbursed { background: #e4f5ec; color: var(--ok); }
.badge.rejected, .badge.cancelled { background: #ffe9e9; color: var(--stop); }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 6px; }
.notice { border: 1px solid #d7dbe0; background: #f6f8fa; color: #44494f; padding: 13px 16px; border-radius: 9px; font-size: 12.5px; line-height: 1.6; margin-bottom: 18px; }
.notice.stop { border-color: #f0c2c2; background: #fff3f3; color: var(--stop); }
.notice.ok { border-color: #bde3cd; background: #f1fbf5; color: var(--ok); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; }
.field.full { grid-column: 1 / -1; }
.field small { font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.5; }
.line-table input, .line-table select { width: 100%; font-size: 12px; padding: 7px 8px; }
.line-table td, .line-table th { padding: 7px 6px; }
.line-table .amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-strip { display: flex; justify-content: space-between; align-items: center; background: #f1f3f5; border: 1px solid #d4d8dd; border-radius: 10px; padding: 14px 18px; margin-top: 16px; font-size: 13px; font-weight: 600; }
.total-strip strong { font-size: 22px; color: var(--brand); font-variant-numeric: tabular-nums; }

dialog { border: 1px solid var(--line); border-radius: 14px; width: min(940px, calc(100vw - 28px)); max-height: 92vh; padding: 0; box-shadow: 0 24px 80px #00000030; color: var(--ink); background: #fff; }
dialog::backdrop { background: #00000073; }
.dialog-head { position: sticky; top: 0; background: #fff; z-index: 3; border-bottom: 1px solid var(--line); padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-body { padding: 22px; }
.dialog-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 14px 22px; display: flex; justify-content: flex-end; gap: 9px; z-index: 3; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.detail-grid dt { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.detail-grid dd { margin: 0; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.history li { padding: 11px 0; border-bottom: 1px solid #efedea; font-size: 12.5px; line-height: 1.6; }
.history { list-style: none; margin: 0; padding: 0; }
.history time { color: var(--muted); font-size: 11px; display: block; }
.stamp { display: inline-block; border: 2px solid var(--stop); color: var(--stop); font-weight: 800; letter-spacing: 2px; padding: 5px 12px; border-radius: 6px; transform: rotate(-2deg); font-size: 13px; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-story { background: var(--shell); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: space-between; }
.login-logo { display: block; width: min(420px, 100%); height: auto; background: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 28px; }
.login-story h1 { font-size: 46px; line-height: 1.15; letter-spacing: -1.8px; font-weight: 500; max-width: 480px; }
.login-story p { color: #cfcfcf; max-width: 420px; font-size: 14px; }
.login-story .eyebrow { color: var(--steel); }
.login-card { border: 1px solid #3b4046; background: #1e2124; border-radius: 14px; padding: 22px; max-width: 400px; }
.login-card span { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--steel); }
.login-card strong { display: block; font-size: 25px; margin: 12px 0 16px; }
.login-card .bars { display: flex; gap: 8px; align-items: flex-end; height: 58px; }
.login-card i { flex: 1; background: linear-gradient(180deg, #d7dbdf, #8f959c); border-radius: 3px 3px 0 0; height: 45%; }
.login-card i:nth-child(2) { height: 68%; background: var(--brand); }
.login-card i:nth-child(3) { height: 52%; }
.login-card i:nth-child(4) { height: 88%; background: var(--brand); }
.login-card i:nth-child(5) { height: 74%; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 25px; letter-spacing: -.6px; margin-bottom: 8px; }
.login-form label { display: grid; gap: 7px; margin-bottom: 16px; font-size: 12px; font-weight: 600; }
.login-form button { width: 100%; margin-top: 6px; }
.login-form .footnote { font-size: 11px; color: var(--muted); margin-top: 20px; line-height: 1.6; }

#toast { position: fixed; bottom: 22px; right: 22px; z-index: 40; background: #232323; color: #fff; padding: 13px 19px; border-radius: 9px; font-size: 13px; max-width: 420px; display: none; box-shadow: 0 8px 30px #00000030; }
#toast.visible { display: block; }
#toast.stop { background: var(--stop); }
.loading { padding: 70px; text-align: center; color: var(--muted); }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { flex-shrink: 0; }
  /* With the header laid out as a strip, the account controls sit opposite the logo on the
     top line rather than taking a row of their own. */
  .sidebar { position: relative; }
  .sidebar-foot { position: absolute; top: 22px; right: 18px; width: auto; margin: 0; padding: 0;
    border-top: 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
  .sidebar-foot button { margin-top: 0; width: auto; }
  .brand-logo { max-width: 168px; }
  .module-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-story { padding: 32px; }
  .login-story h1 { font-size: 32px; }
  .login-card { display: none; }
}
@media (max-width: 680px) {
  .sidebar-foot { position: static; margin-top: 14px; padding-top: 12px; border-top: 1px solid #3a3a3a; justify-content: flex-start; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:nth-child(3n) { border-right: 1px solid var(--line); }
  .tile:nth-child(2n) { border-right: 0; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .toolbar, .actions, button, #toast { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .scroll { max-height: none; overflow: visible; }
}

/* Utility classes. The Content Security Policy forbids inline style attributes, so every
   layout tweak the views need lives here. */
.sub-note { margin: 4px 0 0; font-size: 12px; }
.section-gap { margin-top: 22px; }
.gap-lg { margin-top: 20px; }
.gap-sm { margin-top: 10px; }
.small-text { font-size: 12.5px; }
.fine-print { font-size: 11px; color: #8d8d8d; }
.lede { font-size: 13px; margin-bottom: 22px; }
.file-input { margin-top: 10px; font-size: 12px; }
.scroll-short { max-height: 260px; }
.col-qty { width: 88px; }
.col-unit { width: 118px; }

/* Review comments: permanent feedback from the reviewer to the maker. */
.comment-box { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }
.comment-box textarea { width: 100%; min-height: 70px; }
td small.has-comments { color: var(--brand); font-weight: 600; }

/* The logo is the dashboard button: one logo, and one way home. */
.sidebar .brand { display: inline-flex; align-self: flex-start; width: auto; max-width: 100%; border: 1px solid transparent; background: transparent; padding: 6px; text-align: left; border-radius: 10px; }
.sidebar .brand:hover { background: #25282c; }
.sidebar .brand span { display: block; font-size: 9px; letter-spacing: 1.7px; text-transform: uppercase; color: var(--steel); padding-left: 3px; }
.bank-balances .module-head { padding: 16px 20px; }
tr.voided td { opacity: .55; text-decoration: line-through; }
tr.voided td small { text-decoration: none; }

/* The mascot greets the signed-in user from the dashboard heading row. */
.hello { display: flex; align-items: center; gap: 13px; flex-shrink: 0; max-width: 100%;
  padding: 9px 20px 9px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(100deg, #ffffff 0%, #f2f4f6 55%, #fbe9ea 100%); }
.hello-mascot { flex-shrink: 0; width: 66px; height: auto; display: block; filter: drop-shadow(0 5px 8px rgba(20, 16, 14, .22)); }
.hello-copy { min-width: 0; }
.hello-copy strong { display: block; font-size: 17px; letter-spacing: -.3px; color: var(--ink); }
.hello-copy span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 760px) {
  .hello { gap: 10px; padding: 8px 14px 8px 8px; }
  .hello-mascot { width: 52px; }
  .hello-copy strong { font-size: 15px; }
  .hello-copy span { font-size: 11px; }
}

/* The greeting keeps its place beside the dashboard title: the heading text shrinks and wraps
   inside its own column rather than pushing the card onto a line of its own. */
.dashboard-head { flex-wrap: nowrap; align-items: center; }
.dashboard-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.dashboard-head .hello { flex: 0 0 auto; }
@media (max-width: 620px) {
  .dashboard-head { flex-wrap: wrap; align-items: flex-start; }
  .dashboard-head .hello { margin-top: 4px; }
}

/* Settings lives with the account controls, not with the module navigation. */
.sidebar-foot button.active { background: linear-gradient(180deg, #eceef1, #c9ced4); color: #16181a; border-color: #c9ced4; font-weight: 700; }

/* A single emoji marks each module card, sized to sit on the heading's own line. */
.card-emoji { display: inline-block; font-size: 19px; line-height: 1; margin-right: 9px; vertical-align: -2px; }

/* Each module card is headed by a red band. Everything inside it is re-coloured for contrast,
   so no inherited grey or brand-red text is left sitting on the red. */
.module-head { background: linear-gradient(100deg, var(--brand) 0%, var(--brand-dark) 100%); border-bottom-color: var(--brand-dark); color: #fff; }
.module-head h2 { color: #fff; }
.module-head p, .module-head .muted, .module-head .sub-note { color: rgba(255, 255, 255, .85); }
.module-head .lead { color: #fff; }
.module-head .lead small { color: rgba(255, 255, 255, .78); }
