/* App UI chrome. Brand values come from brand/tokens.css. Only status flags add colour. */
@import url("brand/tokens.0daaecf48467.css");

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #fff; color: var(--bim-grey); font-family: var(--font-body); font-size: 15px; line-height: 1.4; }
a { color: var(--bim-blue); text-decoration: none; }
a:hover { color: var(--bim-blue-accent); text-decoration: underline; }

.topbar { min-height: var(--nav-height); background: var(--bim-blue); color: #fff; display: flex; align-items: center; flex-wrap: wrap; padding: 8px 20px; gap: 12px 24px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.topbar .logo img { height: 34px; display: block; }
.topbar nav a { color: #fff; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
.topbar nav a:hover { color: #fff; text-decoration: underline; }
.topbar .who { margin-left: auto; font-size: 13px; opacity: 0.9; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; color: var(--bim-blue); margin: 0 0 10px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; margin-top: 34px; }
h3 { font-size: 16px; margin-top: 18px; color: var(--bim-grey); }
.lede { max-width: 760px; }

.btn { display: inline-block; background: var(--bim-blue); color: #fff; border: 1px solid var(--bim-blue); border-radius: var(--radius); padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--bim-blue-accent); border-color: var(--bim-blue-accent); color: #fff; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--bim-blue); }
.btn.secondary:hover { background: var(--bim-grey-light); color: var(--bim-blue); }
.btn.ghost { background: transparent; color: var(--bim-blue-accent); border-color: var(--bim-blue-accent); }

table.grid { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
table.grid th, table.grid td { padding: 8px 10px; text-align: left; vertical-align: top; }
table.grid thead th { background: var(--bim-grey-light); color: var(--bim-grey); font-weight: 700; }
table.grid tbody tr { border-bottom: 1px solid var(--bim-grey-light); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr.total td { font-weight: 700; }

.flag { display: inline-block; padding: 2px 8px; border-radius: var(--radius); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.3px; }
.flag.red { background: var(--flag-red); }
.flag.amber { background: var(--flag-amber); }
.flag.green { background: var(--flag-green); }
.flag.blue { background: var(--bim-blue); }

.card { border: 1px solid var(--bim-grey-light); border-radius: var(--radius); padding: 16px; background: #fff; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.muted { color: #7a7a7a; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 13px; }

/* forms and page furniture */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pagehead h1 { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.filters select, .filters input { padding: 7px 9px; border: 1px solid var(--bim-grey-light); border-radius: var(--radius); font: inherit; }
.form fieldset { border: 1px solid var(--bim-grey-light); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 14px; }
.form legend { font-weight: 700; color: var(--bim-blue); padding: 0 6px; }
.form.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form.two-col .actions { grid-column: 1 / -1; }
.form p { margin: 0 0 10px; }
.form label { display: block; font-size: 13px; color: var(--bim-grey); font-weight: 700; margin-bottom: 3px; }
.form input[type=text], .form input[type=email], .form input[type=date], .form input[type=number], .form input[type=search], .form select, .form textarea,
input.cell, select.cell { width: 100%; padding: 7px 9px; border: 1px solid #c9c9c9; border-radius: var(--radius); font: inherit; color: var(--bim-grey); background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus, input.cell:focus { outline: 2px solid var(--bim-blue-accent); border-color: var(--bim-blue-accent); }
@media (max-width: 800px) { .form.two-col { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 0; }
.kv dt { font-weight: 700; color: var(--bim-grey); font-size: 13px; }
.kv dd { margin: 0; }
.linkbtn { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; margin-left: 8px; }
.messages .msg { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; background: var(--bim-grey-light); border-left: 4px solid var(--bim-blue); }
.messages .msg.error { border-left-color: var(--flag-red); }
.messages .msg.success { border-left-color: var(--flag-green); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.files, .audit { list-style: none; padding: 0; margin: 0 0 12px; }
.files li, .audit li { padding: 4px 0; border-bottom: 1px solid var(--bim-grey-light); }
.clip { max-width: 320px; }
table.grid td.flagcell { white-space: nowrap; }

/* costing sheet */
.costing .item { margin-bottom: 14px; padding: 12px 14px; }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-head .grow, .grow { flex: 1; min-width: 200px; }
.item-no { font-weight: 700; color: var(--bim-blue); white-space: nowrap; }
.item-subtotal { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
table.grid.compact th, table.grid.compact td { padding: 4px 6px; font-size: 14px; }
table.lines tr.blank td { background: #fff8e6; }
input.cell.num { text-align: right; }
input.cell.overridden { border-color: var(--flag-amber); background: #fff8e6; }
.addline { margin-top: 8px; }
.addline .results { margin: 6px 0; }
.results table.grid { margin: 4px 0; }
.wording { margin-top: 8px; }
.wording textarea { width: 100%; margin-bottom: 6px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.scope-hit { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bim-grey-light); }
.scope-hit.blocked { opacity: 0.7; }
.scope-preview .item-title { font-weight: 700; color: var(--bim-heading); margin: 10px 0 4px; }
.scope-preview ul { margin: 0 0 6px; }
.flagtext { color: var(--flag-red); }
.clauses li { cursor: copy; padding: 3px 0; border-bottom: 1px dotted var(--bim-grey-light); }
.clauses li.exclusion { color: #7a3b00; }
.draft { white-space: pre-wrap; font-family: inherit; background: var(--bim-grey-light); padding: 10px; border-radius: var(--radius); font-size: 13px; }
.totals { background: #f6f8fb; }

/* jobs board */
.board-pm { margin: 18px 0 6px; color: var(--bim-blue); }
.exc { display: inline-block; background: #fff3e0; color: #7a3b00; border-left: 3px solid var(--flag-amber); padding: 1px 6px; margin: 1px 4px 1px 0; font-size: 12px; }
.exc.red { background: #fdecea; color: #7f1d1d; border-left-color: var(--flag-red); }
.gates { display: flex; gap: 6px; }
.gate { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: var(--bim-grey-light); color: var(--bim-grey); }
.gate.done { background: var(--flag-green); color: #fff; }
.stage-steps { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 12px; }
.stage-steps span { padding: 4px 10px; border-radius: 14px; background: var(--bim-grey-light); font-size: 13px; }
.stage-steps span.current { background: var(--bim-blue); color: #fff; }
.stage-steps span.past { background: #cfe0f3; }
.checklist li { list-style: none; padding: 4px 0; border-bottom: 1px solid var(--bim-grey-light); display: flex; gap: 8px; align-items: center; }
.checklist { padding: 0; margin: 0 0 10px; }
.tabs { display: flex; gap: 2px; margin: 18px 0 0; border-bottom: 2px solid var(--bim-blue); flex-wrap: wrap; }
.tabs a { padding: 8px 14px; background: var(--bim-grey-light); color: var(--bim-grey); border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; }
.tabs a.active { background: var(--bim-blue); color: #fff; }
.gantt { width: 100%; border-collapse: collapse; }
.gantt .bar { background: var(--bim-blue-accent); height: 12px; border-radius: 2px; position: relative; }
.gantt .bar .done { background: var(--bim-blue); height: 100%; border-radius: 2px; }

tr.flagrow td { background: #fff8e6; }
