:root {
  color-scheme: light;
  --ink: #172641;
  --muted: #52647b;
  --line: #dce6f1;
  --field-line: #c6d4e2;
  --paper: #fff;
  --surface: #f4f7fb;
  --navy: #03142d;
  --navy-raised: #112455;
  --sky: #5d85aa;
  --blue-wash: #eaf2fa;
  --accent: #426891;
  --accent-dark: #294b75;
  --gold: #fccd00;
  --gold-hover: #edb900;
  --mint: #e7f5f1;
  --warning: #894e12;
  --radius: 16px;
  --shadow: 0 2px 5px #11245505, 0 8px 24px #11245508;
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.52;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
h1, h2, h3, p, dl { margin: 0; }
h1 { font-size: clamp(1.65rem, 3.2vw, 2.4rem); line-height: 1.15; font-weight: 700; letter-spacing: -.04em; overflow-wrap: anywhere; }
h2 { font-size: 1.17rem; line-height: 1.3; font-weight: 680; letter-spacing: -.018em; }
h3 { font-size: 1.01rem; overflow-wrap: anywhere; }
p + p { margin-top: .65rem; }
small { font-size: .83rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88rem; }
.nowrap { white-space: nowrap; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 225px minmax(0, 1fr); background: linear-gradient(165deg, var(--surface), #edf3f9); }
.sidebar { min-height: 100vh; position: sticky; top: 0; height: fit-content; display: flex; flex-direction: column; gap: 33px; padding: 28px 16px 21px; background: var(--paper); border-inline-end: 1px solid var(--line); }
.brand { display: grid; justify-items: start; gap: 9px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 155px; max-width: 100%; height: auto; }
.brand small { color: var(--muted); font-size: .75rem; }
.sidebar .brand { padding-inline: 10px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { padding: 9px 11px; display: flex; gap: 8px; align-items: center; border-radius: 10px; color: var(--muted); font-weight: 550; }
.nav-link span { width: 24px; flex: none; text-align: center; color: var(--accent); font-size: 1.13rem; }
.nav-link:hover { background: var(--surface); text-decoration: none; color: var(--navy-raised); }
.nav-link.selected { background: var(--blue-wash); box-shadow: inset 3px 0 var(--gold); color: var(--navy-raised); font-weight: 700; }
.sidebar-footer { color: var(--muted); margin-top: auto; padding: 13px 6px 0; display: flex; gap: 7px; align-items: center; border-top: 1px solid var(--line); font-size: .78rem; }
.demo-dot { width: 7px; height: 7px; background: var(--gold); border-radius: 50%; }
.topbar { min-height: 70px; padding: 9px clamp(18px, 4vw, 56px); display: flex; gap: 14px; justify-content: space-between; align-items: center; background: #fffffff2; border-bottom: 1px solid var(--line); }
.topbar-title { color: var(--muted); font-size: .89rem; font-weight: 550; }
.profile { display: flex; align-items: center; gap: 9px; line-height: 1.24; }
.profile b, .profile small { display: block; }
.profile small { color: var(--muted); margin-top: 3px; }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue-wash); color: var(--accent-dark); font-weight: 700; }
.text-btn { padding: 6px; color: var(--accent-dark); border: 0; background: transparent; margin-left: 8px; font-size: .86rem; }
.text-btn:hover { text-decoration: underline; }
.content { width: min(100%, 1510px); margin-inline: auto; padding: 29px clamp(18px, 4vw, 56px) 58px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 4px 0 23px; }
.page-head p { margin-top: 7px; }
.panel { margin-bottom: 16px; padding: clamp(15px, 2.2vw, 25px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > h2 { margin-bottom: 13px; }
.panel > h2 + p { margin-bottom: 14px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-heading p { margin-top: 4px; }
.narrow { max-width: 650px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 19px; }
.metrics.dense { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; padding: clamp(11px, 2vw, 19px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.dense .metric { background: var(--surface); box-shadow: none; }
.metric span { display: block; color: var(--muted); font-size: .84rem; }
.metric strong { display: block; margin-top: 4px; font-size: clamp(1.15rem, 2vw, 1.82rem); line-height: 1.2; letter-spacing: -.026em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric.accent { border-color: var(--navy-raised); background: var(--navy-raised); color: white; }
.metric.accent span { color: #c5d5eb; }
.scroll { min-width: 0; overflow-x: auto; }
.records { width: 100%; border-collapse: collapse; text-align: left; }
.records th, .records td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.records th { white-space: nowrap; background: var(--surface); color: var(--accent-dark); font-weight: 650; font-size: .83rem; }
.records tbody tr:last-child td { border-bottom: 0; }
.records tbody tr:hover td { background: #f7faff; }
.records small { display: block; margin-top: 3px; }
.project-register td { vertical-align: top; }
.project-register-filtered { min-width: 900px; }
.project-register .column-filters td { background: var(--surface); padding-block: 5px 10px; vertical-align: top; }
.project-register .column-filters input, .project-register .column-filters select { font-size: .85rem; padding: 6px 8px; }
.project-register .column-filters select { min-width: 205px; }
.next-step-filters { display: flex; gap: 5px; flex-wrap: wrap; }
.next-step-filters > input { flex: 1 1 112px; }
.project-register .registry-child td { background: #f5f9fe; font-size: .9rem; }
.project-register .registry-child td:first-child { box-shadow: inset 3px 0 #a5c3df; padding-inline-start: 18px; }
.project-register .registry-child:hover td { background: var(--blue-wash); }
.line-title { font-weight: 700; }
.badge { display: inline-block; border-radius: 100px; padding: 3px 9px; background: #eaf0f6; color: #344e67; font-size: .77rem; font-weight: 650; line-height: 1.4; }
.stage-estimate { color: #1f5580; background: #e5f1ff; }
.stage-offer { color: #524b82; background: #efebfc; }
.stage-work, .stage-closed { color: #156053; background: var(--mint); }
.stage-intermediate { color: #255350; background: #dfefeb; }
.stage-work_unsigned, .stage-handover { color: var(--warning); background: #fff0dd; }
.pagination { padding-top: 15px; display: flex; gap: 14px; justify-content: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 7px 13px; border: 1px solid var(--field-line); border-radius: 9px; background: var(--paper); color: var(--ink); font-weight: 650; text-align: center; line-height: 1.28; }
.btn:hover { background: var(--blue-wash); text-decoration: none; }
.btn-primary { border-color: var(--gold); background: var(--gold); color: var(--navy); box-shadow: 0 2px 6px #11245512; }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions > form { margin: 0; }
.stack, .field { display: grid; gap: 13px; }
.field { gap: 5px; }
label { display: grid; align-content: start; gap: 5px; color: var(--accent-dark); font-size: .88rem; font-weight: 650; }
label.check { display: flex; align-items: center; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px 10px; background: var(--paper); border: 1px solid var(--field-line); border-radius: 9px; color: var(--ink); }
[data-intake] input[readonly] { background: var(--surface); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 650; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #5d6d7f; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 17px; }
.filter-bar label:first-child { flex: 1 1 210px; }
.filter-bar label:nth-child(2) { flex: 0 1 270px; }
.notice { border-radius: 8px; margin-bottom: 15px; padding: 10px 13px; background: #fff4e4; color: #72470e; border: 1px solid #eed9b7; }
.notice.success { background: var(--mint); color: #156053; border-color: #b7ddcf; }
.notice.error, .errorlist { color: #96362d; }
.notice.error { background: #fff2f0; border-color: #eccac5; }
.errorlist { padding-left: 18px; margin: 0; }

.crumb { display: inline-block; margin-bottom: 13px; font-size: .88rem; }
.project-head { align-items: end; }
.heading-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.project-number { color: #435d72; font-weight: 650; }
.project-deadline { flex: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.project-deadline span, .project-deadline strong { display: block; }
.project-deadline span { font-size: .8rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 19px; padding: 4px; background: var(--blue-wash); border: 1px solid var(--line); border-radius: 12px; }
.tabs a { padding: 7px 14px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 650; }
.tabs a[aria-current=page] { color: var(--navy-raised); background: var(--paper); box-shadow: 0 1px 5px #1124551a; }
.tabs a:hover { text-decoration: none; background: var(--paper); }
.tabs a:focus-visible { outline-offset: -3px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px 12px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dt { color: var(--muted); }
.facts.compact { max-width: 420px; }
.description { margin-top: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.next-action { font-weight: 730; font-size: 1.1rem; }
.task-list { padding: 0; margin: 13px 0 0; list-style: none; }
.task-list li { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.list > a, .list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list > :last-child { border-bottom: 0; }
.list small, .timeline small { display: block; color: var(--muted); }
.revisions > div { flex-wrap: wrap; }
.timeline { margin: 0; padding-left: 20px; }
.timeline li { padding: 8px 6px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.timeline li:last-child { border: 0; }
.estimate-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.estimate-toolbar label:first-child { max-width: 115px; }
.expense { padding: 14px 0; border-top: 1px solid var(--line); }
.expense small { color: var(--muted); }
.expense-amounts { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.expense-amounts dt { font-size: .83rem; color: var(--muted); }
.expense-amounts dd { margin: 0; font-weight: 650; }
.payment-form { align-items: end; margin-top: 13px; }
.decision { margin-top: 15px; }

.project-files { scroll-margin-top: 16px; }
.project-files .panel-heading { align-items: center; flex-wrap: wrap; }
.project-files-heading { display: flex; align-items: baseline; gap: 8px; }
.file-upload { margin-bottom: 14px; }
.file-upload > summary { width: fit-content; list-style: none; cursor: pointer; }
.file-upload > summary::-webkit-details-marker { display: none; }
.file-upload-form { margin-top: 10px; padding: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.project-file-list { list-style: none; padding: 0; margin: 0; }
.project-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.project-file:last-child { padding-bottom: 0; }
.project-file-icon { display: grid; place-items: center; width: 30px; height: 34px; border-radius: 6px; color: var(--accent-dark); background: var(--blue-wash); }
.project-file-details { overflow-wrap: anywhere; }
.project-file-details small { display: block; margin-top: 2px; }
.project-files-compact { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 12px 16px; }
.project-files-compact .panel-heading { gap: 8px; margin: 0; }
.project-files-compact .file-upload { margin: 0; }
.project-files-compact > .file-upload[open], .project-files-compact > .project-file-list,
.project-files-compact > .notice, .project-files-compact > p { grid-column: 1 / -1; }
.project-files-compact .project-file-list { max-block-size: 14rem; overflow: auto; }
.project-files-compact .project-file { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 3px 2px; font-size: .88rem; }
.project-files-compact .project-file-details small { display: inline; margin: 0 0 0 6px; }
.project-files-compact .panel-heading .btn, .project-files-compact summary.btn,
.project-files-compact .project-file .btn { min-height: 32px; padding: 4px 8px; font-size: .82rem; white-space: nowrap; }

.work-task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.work-task:first-child { padding-top: 0; }
.work-task:last-child { padding-bottom: 0; border-bottom: 0; }
.work-task-title p { margin: 4px 0 6px; overflow-wrap: anywhere; }
.work-task-action { display: flex; flex-wrap: wrap; gap: 8px; justify-content: end; align-items: center; align-self: start; }
.work-task-reminder { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; background: var(--blue-wash); border-inline-start: 3px solid var(--sky); border-radius: 7px; padding: 8px 11px; }
.work-task-reminder time { font-size: .83rem; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); background: var(--surface); }
.login-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: start;
  gap: 22px;
  padding: clamp(30px, 5vw, 78px);
  background: radial-gradient(ellipse at left bottom, #315578, transparent 63%), linear-gradient(150deg, var(--navy), var(--navy-raised));
  color: white;
}
.login-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -17rem -15rem auto;
  width: 34rem;
  aspect-ratio: 1;
  border: 1px solid #ffffff36;
  border-radius: 50%;
  box-shadow: 0 0 0 3rem #fff1, 0 0 0 6rem #ffffff0a;
  pointer-events: none;
}
.login-brand .brand { padding: 13px 16px; border-radius: 12px; background: var(--paper); }
.login-brand .brand-logo { width: 170px; }
.login-brand p { align-self: center; max-width: 12ch; font-size: clamp(2rem, 4.1vw, 4.15rem); font-weight: 700; line-height: 1.1; letter-spacing: -.04em; }
.login-card { place-self: center; width: min(calc(100% - 36px), 440px); margin-block: 26px; padding: clamp(23px, 5vw, 40px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.login-card > p { margin: 10px 0 24px; }
.login-card .btn { min-height: 44px; margin-top: 9px; }
.login-card form { gap: 10px; }
.login-card input { min-height: 42px; margin-bottom: 3px; }
.offer-page { padding: clamp(11px, 4vw, 48px); }
.offer-sheet { background: var(--paper); width: min(100%, 950px); margin: 0 auto; padding: clamp(15px, 4vw, 44px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.offer-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 28px 0; }
.offer-heading .brand-logo { width: 142px; }
.offer-sheet h1 { margin-bottom: 12px; }
.offer-sheet p { margin: 5px 0 19px; }
.offer-section { margin: 17px 0; }
.offer-section h3 { margin-bottom: 6px; }
.offer-totals { max-width: 370px; margin: 20px 0 0 auto; }
.offer-totals dd { text-align: right; }
@media (max-width: 1010px) {
  .shell { grid-template-columns: 185px minmax(0, 1fr); }
  .sidebar { padding-inline: 9px; }
  .content, .topbar { padding-inline: 21px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .project-file { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .project-file-icon { display: none; }
  .work-task { grid-template-columns: minmax(0, 1fr); }
  .work-task-action { justify-content: start; }
  .shell { display: block; }
  .sidebar { position: static; min-height: 0; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 13px 8px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding-inline: 3px; }
  .sidebar .brand-logo { width: 130px; }
  .sidebar .brand small { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .nav-link { font-size: .86rem; padding: 5px 7px; }
  .sidebar-footer { display: none; }
  .topbar { min-height: 48px; justify-content: end; }
  .topbar-title { display: none; }
  .content { padding: 18px 12px 30px; }
  .page-head { align-items: start; gap: 12px; flex-wrap: wrap; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .metrics, .metrics.dense { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tabs a { padding-inline: 10px; }
  .records th, .records td { padding: 8px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .login-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-brand { gap: 20px; padding: 24px; }
  .login-brand::before { inset: auto -12rem -12rem auto; width: 23rem; }
  .login-brand .brand-logo { width: 138px; }
  .login-brand p { max-width: none; font-size: clamp(1.45rem, 5.5vw, 2rem); }
  .login-card { align-self: start; }
}
@media print {
  @page offer { size: A4; margin: 12mm; }
  :root, body, .offer-sheet { background: white; }
  .offer-page, .offer-sheet { padding: 0; border: 0; }
  .offer-sheet { border-radius: 0; box-shadow: none; }
  .offer-page { page: offer; font-size: 10pt; line-height: 1.3; }
  .offer-heading { margin: 0 0 6mm; }
  .offer-heading .brand-logo { width: 36mm; }
  .offer-sheet h1 { margin-bottom: 2mm; font-size: 19pt; }
  .offer-sheet h2 { font-size: 12pt; }
  .offer-sheet h3 { font-size: 10.5pt; }
  .offer-sheet p { margin: 1mm 0 4mm; }
  .offer-section { margin: 3mm 0; }
  .offer-section h3 { break-after: avoid; }
  .offer-sheet .records { table-layout: auto; font-size: 9pt; }
  .offer-sheet .records th, .offer-sheet .records td { padding: 1.6mm; }
  .offer-sheet .records th { font-size: 8.5pt; white-space: normal; }
  .offer-sheet .records th:first-child, .offer-sheet .records .nowrap { white-space: nowrap; }
  .offer-sheet tr, .offer-totals { break-inside: avoid; }
  .offer-totals { margin-top: 4mm; }
  .offer-sheet .scroll { overflow: visible; }
  .print-hidden { display: none; }
}
