/* Client portal: same tokens and type as the marketing site. */
@font-face { font-family: "Syne"; font-weight: 400; font-display: swap; src: url("/assets/fonts/syne-400.woff2") format("woff2"); }
@font-face { font-family: "Syne"; font-weight: 600; font-display: swap; src: url("/assets/fonts/syne-600.woff2") format("woff2"); }
@font-face { font-family: "Syne"; font-weight: 800; font-display: swap; src: url("/assets/fonts/syne-800.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-weight: 400; font-display: swap; src: url("/assets/fonts/dm-mono-400.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-weight: 500; font-display: swap; src: url("/assets/fonts/dm-mono-500.woff2") format("woff2"); }

:root {
  --bg: #faf7f2; --bg-2: #f1ece3; --rule: #e4ddd1; --fg: #1c1b19; --fg-mid: #57534c; --fg-dim: #6e6960;
  --dark: #181816; --dark-fg: #edeae3; --dark-mid: #a8a49d;
  --accent: #5ae68a; --accent-ink: #187040; --on-accent: #181816;
  --warn: #9a3412; --warn-bg: #fdeee6; --warn-rule: #f1c3ab;
  --head: "Syne", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;
  --pad-x: clamp(1rem, 4vw, 2.5rem); --max-w: 90rem;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--head); font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-ink); text-underline-offset: 0.2em; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--fg); color: var(--bg); padding: 0.75rem 1rem; z-index: 2000; }
.skip:focus { top: 1rem; }
[hidden] { display: none !important; }

/* Header */
.p-header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 0 var(--pad-x); }
.p-header-in { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.p-logo { display: inline-flex; align-items: center; gap: 0.5em; line-height: 1; text-decoration: none; color: var(--fg); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.03em; }
.p-logo-text { display: flex; flex-direction: column; }
/* Three-bar mark, shared with designtoscale.co.uk and the Websites site. */
.p-mark { display: flex; align-items: flex-end; gap: 0.16em; flex-shrink: 0; }
.p-mark i { display: block; width: 0.28em; border-radius: 0.06em; background: currentColor; transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.p-mark i:nth-child(1) { height: 0.6em; } .p-mark i:nth-child(2) { height: 1em; } .p-mark i:nth-child(3) { height: 1.45em; }
a.p-logo:hover .p-mark i:nth-child(1) { height: 0.45em; } a.p-logo:hover .p-mark i:nth-child(2) { height: 1.45em; } a.p-logo:hover .p-mark i:nth-child(3) { height: 1em; }
.p-logo small { font-family: var(--mono); font-weight: 400; font-size: 0.6rem; letter-spacing: 0.04em; text-transform: uppercase; margin-top: 0.35em; }
.p-nav { display: flex; align-items: center; gap: 0.25rem 1.25rem; flex-wrap: wrap; justify-content: flex-end; }
.p-nav a, .p-nav button.p-link { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mid); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0.5rem 0; }
.p-nav a[aria-current="page"] { color: var(--fg); border-bottom: 2px solid var(--accent); }
.p-who { font-family: var(--mono); font-size: 0.75rem; color: var(--fg-dim); }

main { flex: 1; width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 2rem var(--pad-x) 4rem; }
.p-footer { border-top: 1px solid var(--rule); padding: 1.25rem var(--pad-x); font-family: var(--mono); font-size: 0.75rem; color: var(--fg-dim); }
.p-footer-in { max-width: var(--max-w); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.p-footer button { background: none; border: 0; text-decoration: underline; cursor: pointer; color: inherit; }

/* Type */
.p-label { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); display: block; margin-bottom: 0.5rem; }
h1, .p-h1 { font-weight: 800; font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.05; letter-spacing: -0.03em; }
h1 em, h2 em { font-style: normal; color: var(--fg-mid); }
h2, .p-h2 { font-weight: 800; font-size: clamp(1.25rem, 2.5vw, 1.5rem); line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.p-muted { color: var(--fg-mid); }
.p-small { font-size: 0.875rem; }
.p-mono { font-family: var(--mono); }
.p-section { margin-top: 2.5rem; }
.p-section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.625rem 1.25rem; font-family: var(--mono); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; border: 1px solid var(--fg); background: transparent; color: var(--fg); cursor: pointer; border-radius: 0; }
.btn:hover { background: var(--bg-2); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-solid:hover { background: #4fd67c; }
.btn-dark { background: var(--fg); color: var(--bg); }
.btn-dark:hover { background: #33312d; }
.btn-warn { border-color: var(--warn); color: var(--warn); }
.btn-small { min-height: 2.25rem; padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Billing summary */
.billing { border: 1px solid var(--rule); background: #fff; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.billing > div { padding: 1.25rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.billing dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); margin-bottom: 0.375rem; }
.billing dd { font-weight: 600; font-size: 1.05rem; line-height: 1.3; }
.billing dd small { display: block; font-weight: 400; font-size: 0.875rem; color: var(--fg-mid); margin-top: 0.25rem; }
.billing-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.status { display: inline-flex; align-items: center; gap: 0.5rem; }
.status::before { content: ""; width: 0.6rem; height: 0.6rem; background: var(--accent); flex: none; }
.status-warn::before { background: var(--warn); }
.status-wait::before { background: var(--fg-dim); }
.alert { border: 1px solid var(--warn-rule); background: var(--warn-bg); color: var(--warn); padding: 1rem 1.25rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between; }
.alert p { color: #6b2410; }
.alert strong { color: var(--warn); }

/* Board */
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); background: #fff; }
.col { border-right: 1px solid var(--rule); min-height: 12rem; display: flex; flex-direction: column; }
.col:last-child { border-right: 0; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0.875rem 1rem; border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; background: var(--bg); }
.col-head .count { color: var(--fg-mid); }
.col-list { flex: 1; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; min-height: 6rem; }
.col-empty { font-size: 0.875rem; color: var(--fg-dim); padding: 0.25rem; }
.card { display: block; width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--rule); padding: 0.875rem; cursor: pointer; position: relative; }
.card:hover { border-color: var(--fg-dim); }
.card-meta { display: flex; justify-content: space-between; gap: 0.5rem; font-family: var(--mono); font-size: 0.7rem; color: var(--fg-mid); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.375rem; }
.card-title { font-weight: 600; font-size: 0.95rem; line-height: 1.35; overflow-wrap: anywhere; }
.card-reply { margin-top: 0.5rem; font-size: 0.85rem; color: var(--fg-mid); border-left: 2px solid var(--accent); padding-left: 0.5rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.625rem; }
.tag { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--rule); padding: 0.125rem 0.375rem; color: var(--fg-mid); background: #fff; }
.tag-accent { border-color: var(--accent); background: #e7fbee; color: var(--accent-ink); }
.tag-warn { border-color: var(--warn-rule); background: var(--warn-bg); color: var(--warn); }
.tag-client { color: var(--fg); }
.show-older { font-family: var(--mono); font-size: 0.75rem; background: none; border: 0; text-decoration: underline; color: var(--accent-ink); cursor: pointer; padding: 0.25rem; text-align: left; }
.card-move { margin-top: 0.625rem; display: flex; gap: 0.5rem; align-items: center; }
.card-move label { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; color: var(--fg-mid); }
.card-move select { font-size: 0.8rem; padding: 0.25rem; border: 1px solid var(--rule); background: #fff; flex: 1; min-width: 0; }
.sortable-ghost { opacity: 0.4; }
.sortable-drag { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

/* Board tabs (phones) */
.board-tabs { display: none; }
@media (max-width: 56rem) {
  .board-tabs { display: flex; overflow-x: auto; border: 1px solid var(--rule); border-bottom: 0; background: var(--bg); }
  .board-tabs button { flex: 1 0 auto; padding: 0.75rem 0.875rem; border: 0; border-right: 1px solid var(--rule); background: none; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; color: var(--fg-mid); white-space: nowrap; }
  .board-tabs button[aria-selected="true"] { background: #fff; color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
  .board { grid-template-columns: 1fr; }
  .board[data-tabs="on"] .col { display: none; border-right: 0; }
  .board[data-tabs="on"] .col.is-active { display: flex; }
  .board[data-tabs="on"] .col-head { display: none; }
}

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-bottom: 1rem; }
.toolbar label { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-mid); display: inline-flex; align-items: center; gap: 0.5rem; }
.toolbar select { text-transform: none; letter-spacing: 0; font-family: var(--head); font-size: 0.95rem; color: var(--fg); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.field label, .field legend { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mid); }
.field input[type=text], .field input[type=email], .field input[type=url], .field input[type=number], .field input[type=date], .field select, .field textarea, .toolbar select { border: 1px solid #cfc7b9; background: #fff; padding: 0.625rem 0.75rem; border-radius: 0; width: 100%; }
.field textarea { min-height: 8rem; resize: vertical; }
.field-hint { font-size: 0.85rem; color: var(--fg-mid); }
.field-error { font-size: 0.85rem; color: var(--warn); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; }
.check { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent-ink); }
.note { background: var(--bg-2); border-left: 3px solid var(--accent); padding: 0.75rem 1rem; font-size: 0.9rem; margin-bottom: 1rem; }
.file-list li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; padding: 0.375rem 0; border-bottom: 1px solid var(--rule); }
.file-list button { background: none; border: 0; color: var(--warn); text-decoration: underline; cursor: pointer; font-size: 0.8rem; }

/* Dialogs */
dialog { border: 1px solid var(--fg); background: var(--bg); color: var(--fg); padding: 0; width: min(44rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); margin: auto; }
dialog::backdrop { background: rgba(24,24,22,0.55); }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.dlg-body { padding: 1.25rem 1.5rem 1.5rem; }
.dlg-close { background: none; border: 1px solid var(--rule); width: 2.5rem; height: 2.5rem; cursor: pointer; font-size: 1.25rem; line-height: 1; flex: none; }
@media (max-width: 40rem) { dialog { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border: 0; } }

/* Ticket detail */
.detail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 1.25rem; }
.detail-grid { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-mid); margin-bottom: 1rem; }
.quote { border: 1px solid var(--fg); background: #fff; padding: 1.25rem; margin: 1.25rem 0; }
.quote-price { font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; }
.quote dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; font-size: 0.9rem; margin: 0.75rem 0 1rem; }
.quote dt { color: var(--fg-mid); }
.thread { border-top: 1px solid var(--rule); margin-top: 1.25rem; padding-top: 1.25rem; }
.thread li { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.thread .who { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-mid); display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; }
.thread .who-admin { color: var(--accent-ink); }
.thread p { white-space: pre-wrap; overflow-wrap: anywhere; }
.att-list { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.att-list a { font-size: 0.9rem; }
.admin-tools { border-top: 1px solid var(--rule); margin-top: 1.25rem; padding-top: 1.25rem; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); font-weight: 500; background: var(--bg); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .btn { white-space: nowrap; }

/* Login */
.login { max-width: 26rem; margin: 3rem auto 0; }
.login h1 { margin-bottom: 0.75rem; }
.login p { margin-bottom: 1.25rem; }
.code-input { font-family: var(--mono) !important; font-size: 1.5rem !important; letter-spacing: 0.4em; text-align: center; }
.mock-box { border: 1px dashed var(--fg-dim); padding: 1rem; margin-top: 2rem; font-size: 0.875rem; }
.mock-box .btn-row { margin-top: 0.75rem; }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 3000; max-width: min(24rem, calc(100vw - 2rem)); }
.toast { background: var(--dark); color: var(--dark-fg); padding: 0.75rem 1rem; font-size: 0.875rem; border-left: 3px solid var(--accent); }
.toast .p-mono { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dark-mid); margin-bottom: 0.125rem; }

/* Billing summary: flex so there are never empty cells */
.billing { display: flex; flex-wrap: wrap; }
.billing > div { flex: 1 1 13rem; }
.billing > .billing-actions { flex-basis: 100%; border-right: 0; border-bottom: 0; }
details > summary.p-label { display: list-item; margin-bottom: 0; }

/* Admin dashboard */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); background: #fff; margin-top: 1.5rem; }
.fig { padding: 1.125rem 1.25rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.fig dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); margin-bottom: 0.375rem; }
.fig dd { font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; line-height: 1.15; }
.fig dd small { display: block; font-weight: 400; font-size: 0.85rem; letter-spacing: 0; color: var(--fg-mid); margin-top: 0.375rem; line-height: 1.4; }
.fig-sub { font-weight: 400; font-size: 0.85rem; letter-spacing: 0; color: var(--fg-mid); }
.fig-dark { background: var(--dark); color: var(--dark-fg); border-color: var(--dark); }
.fig-dark dt, .fig-dark dd small { color: var(--dark-mid); }
.fig-dark dd { color: var(--accent); }
.fig-warn { background: var(--warn-bg); }
.fig-warn dd { color: var(--warn); }
.warn-text { color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2.5rem; }
@media (min-width: 72rem) { .dash-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.dash-h3 { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); font-weight: 500; margin: 1.5rem 0 0.625rem; }
.dl-list { border: 1px solid var(--rule); background: #fff; }
.dl-item { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: 0.75rem 1rem; align-items: start; padding: 0.875rem 1rem; border-bottom: 1px solid var(--rule); }
.dl-item:last-child { border-bottom: 0; }
.dl-item.is-warn { background: #fffaf7; box-shadow: inset 3px 0 0 var(--warn); }
.dl-date { display: flex; flex-direction: column; font-family: var(--mono); font-size: 0.8rem; }
.dl-date small { color: var(--fg-mid); font-size: 0.7rem; }
.is-warn .dl-date small { color: var(--warn); }
.dl-body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.dl-body p { color: var(--fg-mid); }
.dl-go { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.dl-empty { padding: 1rem; }
.todo-form { display: grid; grid-template-columns: minmax(0, 1fr) 10rem 11rem auto; gap: 0 0.75rem; align-items: end; margin-top: 1rem; }
.todo-form .field { margin-bottom: 0; }
.todo-form .field-error { grid-column: 1 / -1; margin-top: 0.25rem; }
.done-list { margin-top: 1rem; }
.done-list summary { cursor: pointer; }
.done-list li { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.done-list s { color: var(--fg-mid); }
.p-link-btn { background: none; border: 0; text-decoration: underline; color: var(--warn); cursor: pointer; font-size: 0.8rem; margin-left: auto; }
.table-warn { border-color: var(--warn-rule); }
.where strong { display: block; white-space: nowrap; }
.bar { display: block; width: 7rem; height: 4px; background: var(--bg-2); margin-top: 0.375rem; }
.bar i { display: block; height: 100%; background: var(--accent-ink); }
@media (max-width: 48rem) {
.todo-form { grid-template-columns: 1fr 1fr; }
.todo-form .todo-title { grid-column: 1 / -1; margin-bottom: 0.75rem; }
.todo-form .btn { grid-column: 1 / -1; margin-top: 0.75rem; }
.dl-item { grid-template-columns: 4.5rem minmax(0, 1fr); }
.dl-go { grid-column: 2; }
.fig dd { font-size: 1.35rem; }
}
.figs { display: flex; flex-wrap: wrap; }
.fig { flex: 1 1 14rem; }
@media (max-width: 40rem) {
.fig { flex-basis: 50%; padding: 0.875rem 1rem; }
.fig-dark { flex-basis: 100%; }
.fig dd { font-size: 1.2rem; }
.fig dd small { font-size: 0.78rem; }
}

/* Client stages */
.pipe { list-style: none; display: flex; flex-wrap: wrap; margin: 1rem 0 0; padding: 0; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.pipe li { flex: 1 1 9rem; }
.pipe-btn { display: block; width: 100%; height: 100%; text-align: left; background: #fff; border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); box-shadow: inset 0 3px 0 transparent; padding: .875rem 1.125rem; cursor: pointer; font: inherit; color: inherit; }
.pipe-btn:hover, .pipe-btn:focus-visible { background: var(--bg-2); }
.pipe-btn.is-on { box-shadow: inset 0 3px 0 var(--accent); background: var(--bg-2); }
.pipe-label { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-mid); }
.pipe-btn strong { display: block; font-family: var(--head); font-size: 1.5rem; font-weight: 800; line-height: 1.25; }
.pipe-btn small { display: block; font-size: .8rem; color: var(--fg-mid); }
.stage { display: inline-flex; align-items: center; gap: .375rem; font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; padding: .125rem .375rem; border: 1px solid var(--rule); background: #fff; color: var(--fg-mid); white-space: nowrap; }
.stage::before { content: ""; width: .5rem; height: .5rem; flex: none; background: var(--fg-dim); }
.stage-lead::before { background: transparent; border: 1px solid var(--fg-mid); }
.stage-quote::before { background: var(--fg-mid); }
.stage-build::before { background: var(--accent); }
.stage-live { border-color: var(--accent); background: #e7fbee; color: var(--accent-ink); }
.stage-live::before { background: var(--accent-ink); }
.stage-lost { color: var(--fg-dim); }
.stage-select, .inline-date { font: inherit; font-size: .85rem; padding: .25rem .375rem; border: 1px solid var(--rule); background: #fff; }
.todo-links { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.todo-links ul { list-style: none; padding: 0; margin: .5rem 0 1rem; }
.todo-links li { display: flex; gap: .75rem; align-items: baseline; justify-content: space-between; padding: .375rem 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 40rem) { .pipe li { flex-basis: 50%; } }

/* To do (yours and the portal's) versus heads up */
.dl-key { display: flex; flex-wrap: wrap; gap: .375rem 1.25rem; margin: 0 0 .75rem; }
.dl-key span { display: inline-flex; align-items: center; gap: .4rem; }
.key { display: inline-block; width: .75rem; height: .75rem; flex: none; }
.key-mine { border: 2px solid var(--fg); background: #fff; }
.key-auto { background: var(--accent); }
.dl-list .dl-item.is-mine { border-left: 3px solid var(--fg); }
.dl-list .dl-item.is-auto { border-left: 3px solid var(--accent); }
.aware { margin-top: 2rem; padding: 1rem 1.125rem 1.125rem; background: var(--bg-2); border: 1px dashed var(--fg-dim); }
.aware .p-section-head { margin-bottom: .25rem; }
.dl-aware { margin-top: .75rem; }
.dl-aware .dl-item { background: transparent; border-left: 0; }
.dl-aware .dl-item.is-warn { border-left: 3px solid var(--warn); }
.dl-aware .dl-go { color: var(--fg-mid); }
.todo-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.todo-form .field { flex: 1 1 10rem; margin: 0; }
.todo-form .todo-title, .todo-form .field-error { flex-basis: 100%; }
.todo-form .field-error:empty { display: none; }

/* Admin side navigation */
.p-shell { flex: 1; display: grid; grid-template-columns: 15rem minmax(0, 1fr); width: 100%; max-width: calc(var(--max-w) + 15rem); margin: 0 auto; }
.p-shell > main { max-width: none; margin: 0; min-width: 0; }
body:has(.p-shell) .p-header-in, body:has(.p-shell) .p-footer-in { max-width: calc(var(--max-w) + 15rem); }
.p-side { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding: 2rem 1rem 2rem var(--pad-x); border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 1.25rem; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-h { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mid); margin: 0 0 0.35rem 0.6rem; }
.p-side a:not(.btn) { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; color: var(--fg); text-decoration: none; font-size: 0.92rem; border-left: 3px solid transparent; }
.p-side a:not(.btn):hover, .p-side a:not(.btn):focus-visible { background: var(--bg-2); }
.p-side a[aria-current="page"] { background: #fff; border-left-color: var(--accent); font-weight: 700; }
.side-badge { font-style: normal; font-family: var(--mono); font-size: 0.72rem; min-width: 1.5rem; text-align: center; padding: 0.1rem 0.35rem; background: var(--fg); color: var(--bg); }
.side-badge.is-warn { background: var(--warn); color: #fff; }
.side-cta { text-align: center; }
a.pipe-btn { color: inherit; text-decoration: none; }
.quote-sum { margin: 0.25rem 0 1rem; padding: 0.75rem 1rem; background: var(--bg-2); border-left: 3px solid var(--accent); }
.quote-sum:empty { display: none; }
@media (max-width: 56rem) {
  .p-shell { display: block; }
  .p-side { position: static; max-height: none; flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 0.5rem var(--pad-x); gap: 0.25rem; }
  .side-group { flex-direction: row; }
  .side-h { display: none; }
  .p-side a:not(.btn) { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .p-side a[aria-current="page"] { border-bottom-color: var(--accent); }
  .side-cta { white-space: nowrap; }
}

/* Invoices */
@media (min-width: 56rem) { .figs.figs-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.inv-build { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 80rem) { .inv-build { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } .inv-preview { position: sticky; top: 1rem; } }
.inv-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 4.5rem 7rem auto; gap: .5rem; align-items: end; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.inv-line .field { margin: 0; }
@media (max-width: 40rem) { .inv-line { grid-template-columns: 1fr 1fr; } }
#ib-add { max-width: 100%; }
.inv-preview .inv { font-size: .85rem; }
.inv-tools { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.inv-tools p { flex-basis: 100%; margin: 0; }
.inv { background: #fff; color: #111; border: 1px solid var(--rule); padding: clamp(1.25rem, 4vw, 3rem); max-width: 52rem; font-size: .95rem; line-height: 1.5; }
.inv h2, .inv h3 { margin: 0; }
.inv-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; border-bottom: 3px solid var(--accent); padding-bottom: 1rem; }
.inv-brand { font-family: var(--head); font-weight: 800; font-size: 1.2em; margin: 0; }
.inv-title { text-align: right; }
.inv-title h2 { font-family: var(--head); font-size: 1.6em; text-transform: uppercase; letter-spacing: .02em; }
.inv-stamp { display: inline-block; margin-top: .35rem; padding: .15rem .6rem; border: 2px solid currentColor; font-family: var(--mono); font-size: .8em; text-transform: uppercase; color: #666; }
.inv-stamp.is-paid { color: #137a3b; } .inv-stamp.is-over { color: #b3261e; } .inv-stamp.is-void { color: #b3261e; }
.inv-small { display: block; font-size: .8em; color: #555; margin: .15rem 0 0; }
.inv-missing { color: #b3261e; font-family: var(--mono); font-size: .85em; }
.inv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem 1.5rem; margin: 1.25rem 0; }
.inv-meta dt, .inv-parties h3 { font-family: var(--mono); font-size: .75em; text-transform: uppercase; letter-spacing: .06em; color: #555; font-weight: 400; }
.inv-meta dd { margin: .15rem 0 0; font-weight: 600; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.inv-parties p { margin: .3rem 0 0; }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th { text-align: left; font-family: var(--mono); font-size: .75em; text-transform: uppercase; font-weight: 400; color: #555; border-bottom: 1px solid #111; padding: .4rem .5rem .4rem 0; }
.inv-lines td { border-bottom: 1px solid #ddd; padding: .6rem .5rem .6rem 0; vertical-align: top; }
.inv-lines th:not(:first-child), .inv-lines td:not(:first-child) { text-align: right; white-space: nowrap; }
.inv-totals { margin: 1rem 0 0 auto; max-width: 20rem; }
.inv-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.inv-totals dd { margin: 0; font-family: var(--mono); }
.inv-total { border-top: 2px solid #111; margin-top: .3rem; padding-top: .5rem !important; font-weight: 700; font-size: 1.1em; }
.inv-foot { margin-top: 2rem; border-top: 1px solid #ddd; padding-top: 1rem; }
.inv-foot p { margin: 0 0 .5rem; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  #header, #footer, .p-side, .skip, .no-print, .toasts { display: none !important; }
  .p-shell { display: block; max-width: none; }
  #main { padding: 0; margin: 0; max-width: none; }
  .inv { border: 0; padding: 0; max-width: none; font-size: 10.5pt; }
  .inv-stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.inv-add { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: 1rem 0 1.25rem; }
.inv-add .field { flex: 1 1 18rem; margin: 0; }
#ib-address, #ib-notes { min-height: 4.5rem; }

/* Quotes and pay links */
.inv-pay{word-break:break-all}
.inv-line .p-muted.p-small{align-self:end;padding-bottom:.75rem}
