/* A plain office-register look: paper background, real tables, one green accent, large type. */

:root {
  --ink: #1d2327;
  --muted: #5a656d;
  --line: #d6d9d6;
  --line-strong: #9aa3a8;
  --paper: #ffffff;
  --page: #f5f4ef;
  --accent: #1f5c45;
  --accent-dark: #15412f;
  --accent-soft: #e6efe9;
  --danger: #9d2b25;
  --danger-soft: #fbeceb;
  --warn-soft: #fdf3d4;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; margin-top: 0; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */

.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: .6rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
}
.brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.top nav a {
  color: var(--ink); text-decoration: none; padding: .45rem .75rem; border-radius: 4px; font-weight: 600;
}
.top nav a:hover { background: var(--accent-soft); }
.top nav a[aria-current="page"] { background: var(--accent); color: #fff; }
.search { display: flex; gap: .35rem; margin-left: auto; }
.search input { width: 15rem; }
.me { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.me form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* Messages */

.message {
  background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--accent);
  padding: .8rem 1rem; margin-bottom: 1.25rem; font-weight: 600;
}
.message.error { border-left-color: var(--danger); background: var(--danger-soft); }

/* Page heading */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head p { color: var(--muted); margin: 0; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }
.crumbs a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Boxes */

.box { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem; margin-bottom: 1.25rem; }
.box > h2:first-child { margin-bottom: .75rem; }
.box-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; margin-bottom: .75rem; }
.box-head h2 { margin: 0; }
.notice { background: var(--warn-soft); border: 1px solid #e8d59a; border-radius: 6px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1.25rem; align-items: start; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.figure { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.25rem; }
.figure .label { color: var(--muted); font-size: .9rem; }
.figure .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Buttons */

.button, button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem;
  padding: .4rem 1.1rem; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--accent-dark); color: #fff; }
.button.plain, button.plain { background: var(--paper); color: var(--accent); }
.button.plain:hover, button.plain:hover { background: var(--accent-soft); color: var(--accent-dark); }
.button.danger, button.danger { background: var(--paper); color: var(--danger); border-color: var(--danger); }
.button.danger:hover, button.danger:hover { background: var(--danger-soft); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; font-weight: 400; }
.inline { display: inline; margin: 0; }

/* Forms */

label { display: block; font-weight: 600; margin-bottom: .3rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 4px;
  padding: .5rem .65rem; min-height: 2.6rem; max-width: 100%;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 1.2rem; height: 1.2rem; margin: 0 .5rem 0 0; vertical-align: -.15rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid #8fb9a5; outline-offset: 1px;
}
.field { margin-bottom: 1.1rem; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 32rem; }
.field .help { color: var(--muted); font-size: .9rem; margin-top: .25rem; }
.field .errors, .form-errors { color: var(--danger); font-weight: 600; }
.form-errors { background: var(--danger-soft); border: 1px solid #e3b4b1; padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.field ul.choices { list-style: none; padding: 0; margin: 0; }
.field ul.choices li { margin-bottom: .35rem; }
.field ul.choices label, .check label { font-weight: 400; display: inline; }
.optional { color: var(--muted); font-weight: 400; }
.amount-shown { color: var(--accent-dark); font-weight: 600; font-size: .95rem; margin-top: .2rem; min-height: 1.4rem; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.25rem .25rem; margin: 0 0 1.25rem; min-width: 0; }
legend { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; padding: 0 .4rem; }
.form-buttons { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters label { font-size: .85rem; color: var(--muted); }

/* Tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line-strong); }
tbody tr:hover { background: #fafaf7; }
td.money, th.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
td.tick { width: 2rem; }
.empty { color: var(--muted); padding: 1rem 0; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* Stages */

.stages { display: flex; flex-wrap: wrap; gap: .3rem; }
a.stage { text-decoration: none; }
.stage { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
/* One clearly different colour per stage: green, grey, yellow, blue, pink, charcoal. */
.stage-available { background: #9fdbb0; color: #0d4421; }
.stage-not_for_sale { background: #e2e4e7; color: #3f464d; box-shadow: inset 0 0 0 1px #b4bac0; }
.stage-committed { background: #ffd23f; color: #4d3700; }
.stage-in_progress { background: #8ab8f5; color: #082a5c; }
.stage-sold { background: #f0a3d0; color: #5c0f42; }
.stage-transferred { background: #2b2f33; color: #fff; }
.status-Overdue { color: var(--danger); font-weight: 700; }
.status-Received { color: #1e5b33; }
.edit-rows input { width: 100%; min-width: 9rem; }
.edit-rows td { vertical-align: top; }
.steps { margin-bottom: 1rem; }
.steps td { vertical-align: top; }
.steps input { width: 100%; min-width: 5rem; }
.steps td:first-child input { min-width: 12rem; }

/* Board */

.legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.block { margin-bottom: 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr)); gap: .35rem; }
.tile {
  display: block; text-align: center; text-decoration: none; padding: .45rem .2rem; border-radius: 4px;
  font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid rgba(0, 0, 0, .08); line-height: 1.2;
}
.tile small { display: block; font-weight: 400; font-size: .7rem; }
.tile.corner { position: relative; }
.tile.corner::after {
  content: ""; position: absolute; top: 0; right: 0; border-top-right-radius: 4px;
  border-style: solid; border-width: 0 .7rem .7rem 0; border-color: transparent currentColor transparent transparent;
}
.tile:hover { outline: 3px solid var(--ink); }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }

/* Reports */

.tabbar { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.tabbar a {
  padding: .65rem 1.1rem; margin-bottom: -2px; border-bottom: 3px solid transparent;
  color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.tabbar a:hover { color: var(--ink); background: var(--accent-soft); }
.tabbar a[aria-current="page"] { color: var(--accent-dark); border-bottom-color: var(--accent); }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.report-head p { margin: 0 0 .25rem; }
.filter-summary { font-size: .9rem; color: var(--muted); }
.export { display: flex; flex-wrap: wrap; gap: .5rem; }
.box.flush { padding: 0; }
table.sortable th { padding: 0; }
button.sort {
  all: unset; box-sizing: border-box; display: block; width: 100%; padding: .55rem .7rem; cursor: pointer;
  font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700;
}
button.sort:hover { color: var(--ink); background: var(--accent-soft); }
button.sort:focus-visible { outline: 3px solid #8fb9a5; }
th[aria-sort] button.sort { color: var(--accent-dark); }
th[aria-sort="ascending"] button.sort::after { content: " ▲"; font-size: .7rem; }
th[aria-sort="descending"] button.sort::after { content: " ▼"; font-size: .7rem; }
table.sortable tbody tr:nth-child(even) { background: #fafaf6; }

/* History */

ul.history { list-style: none; padding: 0; margin: 0; }
ul.history li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
ul.history li:last-child { border-bottom: 0; }
ul.history .when { color: var(--muted); font-size: .85rem; display: block; }

.login { max-width: 26rem; margin: 4rem auto; }
.login .field input { width: 100%; }

@media (max-width: 1150px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  html { font-size: 17px; }
  .top-inner { padding: .6rem 1rem; }
  .search { margin-left: 0; width: 100%; }
  .search input { flex: 1; width: auto; }
  main { padding: 1rem 1rem 3rem; }
  .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; }
  h1 { font-size: 1.5rem; }
  .edit-rows thead { display: none; }
  .edit-rows tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .edit-rows td { display: block; border: 0; padding: .2rem 0; text-align: left; }
  .edit-rows tfoot td { display: inline; }
}

@media print {
  .top, .actions, .no-print, form.bulk-bar { display: none !important; }
  html { font-size: 12px; }
  main { max-width: none; padding: 0; }
  .figures { grid-template-columns: repeat(4, 1fr); }
  th, td { padding: .3rem .4rem; }
  body { background: #fff; }
  .box { border: 0; padding: 0; }
}
