:root {
  font-family: "Segoe UI", Tahoma, system-ui, sans-serif;
  color: #172136;
  background: #f4f7fb;
  font-synthesis: none;
  --navy: #112547;
  --blue: #174fc7;
  --muted: #53627a;
  --line: #dce4ef;
  --paper: #fff;
  --surface: #f5f8fe;
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 24px; scroll-behavior: smooth; }
body { margin: 0; line-height: 1.6; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.22; text-wrap: balance; color: var(--navy); }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { color: #0b388f; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button, summary { touch-action: manipulation; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid #3577ee; outline-offset: 4px; }
.muted { color: var(--muted); }
.wrap { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }
.skip { position: fixed; top: 10px; left: 12px; padding: 8px 14px; z-index: 10; background: white; transform: translateY(-200%); }
.skip:focus { transform: translateY(0); }

.header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
  width: min(1330px, calc(100% - 64px));
  min-height: 74px;
  margin-inline: auto;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
}
.brand { display: block; flex: none; color: var(--navy); text-decoration: none; font-weight: 750; font-size: .95rem; line-height: 1.2; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; font-weight: 550; }
.nav { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; justify-content: center; }
.nav a { font-size: .88rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a { padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { background: #edf3ff; color: var(--blue); }
.account { flex: none; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.account span { padding: 4px 8px; border-radius: 6px; background: var(--surface); }

.hero {
  margin-block: 42px 32px;
  padding: clamp(26px, 4.5vw, 60px);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: clamp(24px, 5vw, 66px);
  align-items: center;
  border: 1px solid #d9e5fa;
  border-radius: 24px;
  background: linear-gradient(116deg, #f9fbff 10%, #e6efff 100%);
}
.eyebrow { margin-bottom: 14px; color: var(--blue); font-size: .76rem; font-weight: 750; letter-spacing: .085em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.55rem, 5.8vw, 5rem); font-weight: 750; line-height: 1.02; letter-spacing: -.055em; }
.hero-copy > p:not(.eyebrow) { margin-top: 20px; color: #405572; font-size: clamp(1rem, 1.45vw, 1.18rem); max-width: 520px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.button {
  display: inline-flex; min-height: 42px; justify-content: center; align-items: center; gap: 8px;
  padding: 8px 15px; border: 1px solid #cfd9ea; border-radius: 9px; text-decoration: none; text-align: center;
  color: var(--navy); background: white; font-weight: 650; font-size: .9rem;
}
.button:hover { background: #f1f5ff; border-color: #9eb7e3; }
.button.primary { color: white; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: #103fad; border-color: #103fad; }
.button.logout { min-height: 34px; padding: 4px 11px; font-size: .8rem; }
.hero-summary { color: white; background: #173467; border-radius: 18px; padding: 26px; }
.estimate { padding: 0 0 17px; border-bottom: 1px solid #5370a0; }
.estimate span, .estimate p, .milestones span { display: block; color: #d3e2ff; font-size: .9rem; }
.estimate strong { display: block; margin: 5px 0; font-size: clamp(2.8rem, 4.4vw, 4.1rem); letter-spacing: -.06em; line-height: 1.05; white-space: nowrap; }
.estimate strong small { font-size: .43em; font-weight: 600; letter-spacing: -.02em; }
.milestones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.milestones strong { display: block; font-size: 1.65rem; line-height: 1.25; }
.milestones small { font-size: .63em; font-weight: 600; }
.page-title { max-width: 830px; margin: 52px 0 30px; }
.page-title h1, .login h1, .status h1 { font-size: clamp(2rem, 4.5vw, 3.6rem); letter-spacing: -.045em; }
.page-title p { margin-top: 12px; color: var(--muted); font-size: 1.06rem; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 25%); gap: 22px; align-items: start; }
.card { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); }
.document, .question-layout { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 16px; overflow-anchor: none; }
.document-section { padding: clamp(18px, 2.6vw, 32px); }
.section-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 18px; margin-bottom: 16px; }
.section-bar h2 { font-size: clamp(1.18rem, 2vw, 1.55rem); }
.section-bar h3 { font-size: 1.06rem; }
.sidebar { position: sticky; top: 20px; display: grid; gap: 14px; }
.side-box { padding: 17px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.side-box h2 { font-size: .93rem; margin-bottom: 10px; }
.side-box a { display: block; color: var(--muted); font-size: .87rem; text-decoration: none; padding: 5px 0; }
.side-box a:hover { color: var(--blue); text-decoration: underline; }
.materials a { display: flex; justify-content: space-between; gap: 8px; color: var(--blue); }
.materials a span { font-size: .75rem; color: var(--muted); }
.prose { overflow-wrap: break-word; }
.prose > * + * { margin-top: 12px; }
.prose > h3:not(:first-child) { margin-top: 33px; }
.prose > h4:not(:first-child) { margin-top: 22px; }
.prose ul, .prose ol { padding-left: 23px; margin-bottom: 0; }
.prose li + li { margin-top: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--line); }
.prose blockquote { margin-inline: 0; padding: 5px 12px; border-left: 3px solid #9bb9f5; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-scroll table { width: 100%; min-width: 570px; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.table-scroll th, .table-scroll td { padding: 11px 12px; text-align: left; vertical-align: top; }
.table-scroll th { background: #ebf2fd; color: var(--navy); font-weight: 650; }
.table-scroll td { border-top: 1px solid var(--line); }
.table-scroll tr:nth-child(even) { background: #f8faff; }
.table-scroll .align-right { text-align: right; white-space: nowrap; }
.table-scroll .align-center { text-align: center; }
.budget-section table { table-layout: fixed; min-width: 680px; }
.budget-section th:nth-child(1) { width: 18%; }
.budget-section th:nth-child(2) { width: 54%; }
.budget-section th:nth-child(3) { width: 14%; }
.budget-section th:nth-child(4) { width: 14%; }
.budget-section th.align-right { white-space: normal; text-wrap: balance; }
.budget-section th:nth-child(n+3), .budget-section td:nth-child(n+3) { padding-inline: 8px; }
.stage-note { padding: 13px 16px; border-left: 3px solid #a9bde1; border-radius: 8px; background: #f4f7fd; }
.stage-note strong:first-child { display: block; margin-bottom: 3px; color: var(--navy); }
.stage-note.customer-note { border-left-color: #3670db; background: #ecf3ff; }
.stage-note.customer-note strong:first-child { color: #153f99; }
.phase-summary { margin-top: 18px; }
.stage-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  gap: 10px 18px; width: 100%; font-size: 1.02rem; line-height: 1.35; text-wrap: wrap;
}
.stage-period { text-align: right; white-space: nowrap; font-size: .84rem; font-weight: 550; color: var(--muted); }
.proposal-stage .stage-heading { margin-bottom: 11px; }
.proposal-stage + .proposal-stage { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); }
.diagram-link { display: grid; gap: 10px; text-decoration: none; font-weight: 650; font-size: .9rem; }
.diagram-link img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.diagram-link:hover span { text-decoration: underline; }
.discuss { flex: none; padding: 4px 8px; border: 0; border-radius: 7px; color: var(--blue); background: transparent; font-size: .84rem; font-weight: 650; }
.discuss:hover, .discuss:focus-visible, .discuss[aria-expanded="true"] { background: #edf3ff; }
.discussion-panel { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 220ms ease; }
.discussion-panel[inert] { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 220ms ease, visibility 0s 220ms; }
.discussion-inner { min-height: 0; overflow: hidden; }
.count { display: inline-flex; min-width: 20px; padding: 0 5px; justify-content: center; border-radius: 999px; background: #e5edfd; color: #214d9a; font-size: .75rem; }
.phase > summary, .question > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 17px clamp(18px, 2.6vw, 30px);
  color: var(--navy); font-weight: 700; font-size: 1.06rem; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
.disclosure-icon { display: grid; flex: 0 0 12px; width: 12px; height: 12px; place-items: center; color: var(--blue); }
.disclosure-icon::before, .disclosure-icon::after {
  content: ""; grid-area: 1 / 1; width: 10px; height: 2px; border-radius: 2px; background: currentColor;
}
.disclosure-icon::after { transform: rotate(90deg); transition: transform 220ms ease; }
details[open] > summary .disclosure-icon::after { transform: rotate(0deg); }
.phase[open] > summary, .question[open] > summary { border-bottom: 1px solid var(--line); }
.phase-body, .question-body { padding: 16px clamp(18px, 2.6vw, 30px) 22px; }
.phase-body > .task:first-child { border-top: 0; padding-top: 0; }
.task { padding: 22px 0; border-top: 1px solid var(--line); }
.task:last-child { padding-bottom: 0; }
.task .section-bar { margin-bottom: 10px; }

.question-layout { max-width: 940px; }
.question-meta { display: flex; flex: none; gap: 9px; align-items: center; }
.badge { padding: 2px 8px; border-radius: 999px; background: #edf3ff; color: #244d9a; font-size: .75rem; }
.badge.discussion { color: #74500b; background: #fff2d8; }
.badge.resolved { color: #176045; background: #e4f5ed; }
.question-author { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; font-weight: 550; }
.question-text { margin-bottom: 18px; }
.question-status { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.question-status label { display: grid; gap: 5px; color: var(--navy); font-size: .88rem; font-weight: 650; }
.question-status select { min-height: 42px; padding: 6px 10px; border: 1px solid #b5c4db; border-radius: 8px; background: white; color: var(--navy); font: inherit; font-weight: 400; }
.thread { margin-bottom: 18px; padding: 16px; border: 1px solid #cbdaf5; border-radius: 10px; background: var(--surface); }
.thread h3 { margin-bottom: 12px; font-size: 1.06rem; }
.message-group { margin: 10px 0 15px; }
.message { padding: 11px 13px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.message.reply { margin: 6px 0 0 18px; border-left: 3px solid #aec5ec; }
.message-meta { display: flex; flex-wrap: wrap; column-gap: 10px; align-items: baseline; font-size: .82rem; }
.message-meta strong { color: var(--blue); }
.message-meta .role-client { color: #176045; }
.message-meta time { color: var(--muted); font-size: .76rem; }
.message-body { margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-box { margin: 4px 0 0 14px; }
.reply-box summary { width: max-content; padding: 3px 0; color: var(--blue); font-size: .84rem; cursor: pointer; list-style: none; }
.form { display: grid; justify-items: start; gap: 12px; }
.comment-form { margin-top: 12px; }
.form label { display: grid; gap: 5px; width: 100%; color: var(--navy); font-weight: 650; font-size: .92rem; }
.form input:not([type="hidden"]), .form textarea {
  width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; color: #172136; background: white;
  border: 1px solid #b5c4db; border-radius: 8px; font-weight: 400;
}
.form textarea { resize: vertical; }
.form-error { margin: 14px 0; color: #90232b; background: #fff0f0; padding: 9px 12px; border-radius: 8px; }
.login-wrap { min-height: calc(100vh - 76px); min-height: calc(100dvh - 76px); display: grid; align-content: center; justify-items: center; padding: 32px 0; }
.login, .status { width: min(100%, 460px); padding: clamp(24px, 4vw, 38px); }
.login h1, .status h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.login .muted, .status p { margin: 12px 0 22px; }
.login .button { width: 100%; margin-top: 4px; }
.status { margin: 40px auto; }
.footer { margin-top: 38px; border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .83rem; }

@media (max-width: 1120px) {
  .header-inner { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding-block: 13px; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .account { justify-self: end; }
}
@media (max-width: 820px) {
  .wrap { width: calc(100% - 36px); }
  .header-inner { width: calc(100% - 36px); }
  .hero { margin-top: 24px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-row: 1; position: static; grid-template-columns: 1fr 1fr; }
  .page-title { margin-top: 32px; }
}
@media (max-width: 580px) {
  .wrap, .header-inner { width: calc(100% - 28px); }
  .header-inner { gap: 8px 4px; padding-block: 10px; }
  .account { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .account span { font-size: .69rem; }
  .button.logout { padding-inline: 8px; font-size: .76rem; }
  .nav a { font-size: .8rem; padding: 5px 7px; }
  .brand { font-size: .82rem; white-space: nowrap; }
  .brand small { font-size: .72rem; }
  .hero { grid-template-columns: 1fr; gap: 22px; padding: 22px; margin-bottom: 18px; }
  .hero h1 { font-size: clamp(2.3rem, 11vw, 3.1rem); }
  .hero-summary { padding: 20px; }
  .hero-actions { margin-top: 18px; }
  .sidebar { grid-template-columns: 1fr; gap: 8px; }
  .side-box { padding: 12px 15px; }
  .side-box nav { display: flex; flex-wrap: wrap; gap: 0 10px; }
  .section-bar { flex-wrap: wrap; gap: 4px 8px; }
  .section-bar .discuss { margin-left: -8px; }
  .question > summary { flex-wrap: wrap; }
  .question-meta { margin-left: auto; }
  .stage-heading { column-gap: 11px; font-size: .96rem; }
  .stage-period { font-size: .76rem; }
}

@supports (interpolate-size: allow-keywords) {
  details { interpolate-size: allow-keywords; }
  details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 220ms ease, content-visibility 220ms allow-discrete;
  }
  details[open]::details-content { block-size: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  details::details-content, .disclosure-icon::after, .discussion-panel, .discussion-panel[inert] { transition: none; }
}
