:root {
  /* Energise palette — taken from energiseresorts.com */
  --ink: #262626;
  --muted: #6b6b6b;
  --line: #e4e1da;
  --bg: #F7F6F4;
  --card: #ffffff;
  --accent: #7E8E5A;        /* Energise olive */
  --accent-dark: #66744a;
  --accent-soft: #eef0e6;
  --charcoal: #303030;
  --good: #4f7a3a;
  --warn: #a8640c;
  --bad: #b3261e;
  --radius: 4px;
  --font-main: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-head: "Quattrocento", Georgia, serif;
  font-size: 14.5px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-main); color: var(--ink); background: var(--bg); line-height: 1.5; }
h1, h2, h3, .brand { font-family: var(--font-head); font-weight: 700; letter-spacing: .2px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- shell ---------- */
.topbar { background: var(--charcoal); color: #fff; border-bottom: 3px solid var(--accent); display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 56px; }
.topbar .brand { font-size: 17px; letter-spacing: .5px; white-space: nowrap; }
.topbar .brand small { display: block; font-weight: 400; opacity: .7; font-size: 11px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #d6deea; padding: 6px 9px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.topbar { gap: 18px; }
.topbar nav a.on, .topbar nav a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.topbar .who { font-size: 13px; color: #c3ccd9; white-space: nowrap; }
.topbar .who form { display: inline; }
.topbar .who button { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; text-decoration: underline; }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
h1 { font-size: 27px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.tiles { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.tiles { grid-template-columns: 1fr; } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 30px; font-family: var(--font-head); font-weight: 700; color: var(--ink); }
.tile { border-top: 3px solid var(--accent); }
a.tile:hover { text-decoration: none; background: var(--accent-soft); }
.tile .l { color: var(--muted); font-size: 13px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); padding: 8px 10px; }
td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.empty { color: var(--muted); padding: 14px 0; }

/* ---------- budget meter ---------- */
.meter { position: relative; height: 10px; background: #edf0f4; border-radius: 5px; min-width: 120px; overflow: hidden; }
.meter span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 5px; }
.meter { background: #ebe8e1; }
.meter.warn span { background: var(--warn); }
.meter.bad span { background: var(--bad); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f4; color: var(--muted); white-space: nowrap; }
.badge.DRAFT, .badge.SUBMITTED { background: #eef0f4; color: #4a5368; }
.badge.PENDING { background: #fff3dc; color: #8a5208; }
.badge.APPROVED, .badge.ACCEPTED { background: var(--accent-soft); color: var(--accent); }
.badge.ISSUED, .badge.REGISTERED { background: #e3f3e8; color: var(--good); }
.badge.REJECTED, .badge.CANCELLED, .badge.SUSPENDED { background: #fbe7e6; color: var(--bad); }
.badge.SUPERSEDED, .badge.SKIPPED { background: #f0f0f0; color: #888; }
.flag { color: var(--warn); font-weight: 600; }
.flag.bad { color: var(--bad); }

/* ---------- forms ---------- */
form p, .field { margin: 0 0 14px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d6d2c8; border-radius: var(--radius); font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { margin-right: 6px; }
textarea { resize: vertical; }
.helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; font-weight: 400; }
.errorlist { color: var(--bad); margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.btn { display: inline-block; padding: 8px 18px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; letter-spacing: .3px; cursor: pointer; }
.btn:hover { text-decoration: none; background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.lines-table input, .lines-table textarea { padding: 6px 8px; }
.lines-table td { padding: 6px 4px; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: var(--accent-soft); }
.messages li.error { background: #fbe7e6; color: var(--bad); }
.messages li.success { background: #e3f3e8; color: var(--good); }
.problems { background: #fff6e5; border: 1px solid #f0d49b; border-radius: 6px; padding: 10px 14px 10px 32px; margin: 0 0 16px; }

/* ---------- steps (approval trail) ---------- */
.trail { list-style: none; margin: 0; padding: 0; }
.trail li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trail li:last-child { border-bottom: 0; }
.trail .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #eef0f4; color: #4a5368; }
.trail .APPROVED .dot { background: var(--good); color: #fff; }
.trail .REJECTED .dot { background: var(--bad); color: #fff; }
.trail .current .dot { background: var(--warn); color: #fff; }
dl.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------- public pages ---------- */
.public { max-width: 900px; margin: 30px auto; }
.public .head { margin-bottom: 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 4px; margin: 0 0 18px; background: #fff; }
legend { font-family: var(--font-head); font-weight: 700; font-size: 16px; padding: 0 6px; color: var(--accent-dark); }

/* ---------- vendor declarations ---------- */
.terms ol.declarations { margin: 0 0 12px; padding-left: 22px; }
.terms ol.declarations li { margin-bottom: 8px; line-height: 1.5; }
.terms .accept { background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; margin-top: 8px; }

/* ---------- CST comparison ---------- */
table.cst th.vendor { text-align: center; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 13px; border-left: 1px solid var(--line); }
table.cst th.vendor.sel { background: var(--accent-soft); }
table.cst td.low { background: #e3f3e8; font-weight: 600; }
table.cst td { white-space: nowrap; }
table.cst td:nth-child(2) { white-space: normal; min-width: 200px; }
@media print { .topbar, .btn, form, .messages { display: none !important; } main { padding: 0; } .card { border: 0; } }

/* ---------- bills ---------- */
.good { color: var(--good); font-weight: 600; }
td.flagcell { background: #fff3dc; }
.badge.MEASURED, .badge.VETTED { background: #fff3dc; color: #8a5208; }
.badge.CERTIFIED, .badge.PREPARED, .badge.PAYMENT, .badge.AUTHORISED { background: var(--accent-soft); color: var(--accent); }
.badge.PAID, .badge.AMENDED { background: #e3f3e8; color: var(--good); }
.badge.RETURNED { background: #fbe7e6; color: var(--bad); }
table.compact { font-size: 13px; }
table.compact th, table.compact td { padding: 7px 6px; }
table.compact th { font-size: 11px; }
table.compact td:nth-child(2) { min-width: 160px; }

/* ---------- pending with ---------- */
.pending { background: #fff8e6; border: 1px solid #f0d49b; border-radius: 6px; padding: 9px 14px; margin: 0 0 18px; font-size: 14px; }
.pending.nobody { background: #fbe7e6; border-color: #f0b4b0; }
.pending-label { color: #8a5208; font-weight: 600; margin-right: 6px; }
.pending-action { color: var(--muted); }
.switcher select { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 5px 8px; font-size: 13px; width: auto; }
.switcher option { color: #262626; }
label.choice { display: block; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
p.note { font-size: 13px; color: var(--muted); background: var(--bg); border-left: 3px solid var(--accent); padding: 6px 10px; margin: 0 0 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--accent); margin: 0 0 4px; font-weight: 600; }

/* Energise ornament: thin olive rule under page titles */
main > h1, main > .row > h1 { position: relative; }
main > h1::after { content: ""; display: block; width: 48px; height: 2px; background: var(--accent); margin-top: 8px; }
.switcher select { max-width: 150px; }
.topbar nav a { padding: 6px 8px; font-size: 13.5px; }
.topbar .who { font-size: 12px; }
@media (max-width: 1300px) { .topbar .brand small { display: none; } }
.topbar { gap: 12px; padding: 0 16px; }
.topbar nav { gap: 0; }
.topbar nav a { padding: 6px 7px; font-size: 13px; }
.switcher select { max-width: 128px; }
.badge.ORDERED { background: #e3f3e8; color: var(--good); }
main { max-width: 1360px; }
table.compact th, table.compact td { padding: 7px 5px; }
table.compact td:nth-child(2) { min-width: 140px; }

/* Abbreviations: full form on hover / tap (see core/glossary.py) */
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.abbr-tip { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: #303030; color: #F7F6F4; font-size: 12px; }
@media print { abbr[title] { text-decoration: none; } }
footer.footnote { max-width: 1360px; margin: 0 auto; padding: 8px 24px 32px; font-size: 12px; color: #6b6b6b; }
@media print { footer.footnote { display: none; } }
