:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #61656b;
  --border: #d9dad6;
  --accent: #1f5f8b;
  --error: #b42318;
  --draft: #6b7280;
  --open: #b45309;
  --answered: #1f5f8b;
  --closed: #15803d;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
code { font-size: 13px; }

.topbar {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
#whoami { margin-left: auto; color: var(--muted); }
#whoami, #verification-address { overflow-wrap: anywhere; min-width: 0; }
#verification-form { min-width: 0; }
#verification-form button { margin: 4px 4px 4px 0; }

button {
  font: inherit; padding: 6px 14px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.secondary { background: var(--surface); color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: 0.5; cursor: default; }

:focus-visible { outline: 3px solid #e0a100; outline-offset: 2px; }
button.link:focus-visible { outline-offset: 1px; border-radius: 2px; }

.skip-link { position: absolute; left: 8px; top: -40px; padding: 6px 10px; background: var(--accent); color: #fff; z-index: 10; }
.skip-link:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

input, textarea, select {
  font: inherit; width: 100%; padding: 6px 8px; margin: 4px 0 10px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text);
}
input[type="checkbox"] { width: auto; margin: 0 6px 0 0; }
label { display: block; color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; color: var(--text); font-size: 14px; align-self: center; }
[aria-busy="true"] { opacity: 0.7; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--error); min-height: 1em; margin: 8px 0 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1 1 140px; }
.row.buttons { gap: 8px; margin-top: 4px; }
.overdue { color: var(--error); font-weight: 600; }

.login { display: grid; place-items: start center; padding: 60px 16px; }
.login form { width: 100%; max-width: 360px; }
#recovery-view > section { width: 100%; max-width: 394px; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 400px; gap: 20px; padding: 20px; align-items: start; }
.layout:has(> #detail[hidden]) { grid-template-columns: 220px minmax(0, 1fr); }
.projects ul { list-style: none; padding: 0; margin: 0; }
.projects li button {
  width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 4px;
}
.projects li button[aria-current="true"] { background: var(--surface); outline: 1px solid var(--border); }
.projects .company { display: block; font-size: 12px; color: var(--muted); }

#new-rfi { margin-bottom: 16px; }
#new-rfi summary { cursor: pointer; color: var(--accent); }
#new-rfi form { margin-top: 12px; }
.filters { align-items: flex-end; margin-bottom: 12px; }
.filters > div { flex: 0 1 160px; }
.filters select { margin-bottom: 0; }
#rfi-count { align-self: center; margin-left: auto; }

.table-wrap { overflow-x: auto; }
.layout > * { min-width: 0; }
#controls-content, #field-content { overflow-wrap: anywhere; }
.field-version dl { margin: 12px 0; }
.field-version dt { font-weight: 600; }
.field-version dd { margin: 0 0 8px; white-space: pre-wrap; }
.field-entry-list fieldset { border: 1px solid var(--border); padding: 12px; margin: 12px 0; min-width: 0; }
#field-content form { margin: 16px 0; }
#field-content li, #controls-content li { overflow-wrap: anywhere; }
#administration form { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
#administration h3 { font-size: 15px; margin-top: 16px; }
.member-list { list-style: none; padding: 0; }
.member-list li { padding: 10px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.member-list button { margin-top: 6px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.financial-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.financial-table tbody tr { cursor: default; }
.controls-table { min-width: 680px; overflow-wrap: normal; }
.controls-table td { font-variant-numeric: tabular-nums; }
.controls-table tbody tr { cursor: default; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.selected { background: #eef3f7; }
.row-open { text-align: left; font-weight: 500; }
.row-open[aria-current="true"] { font-weight: 600; }

.status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: #fff; }
.status.Draft { background: var(--draft); }
.status.Open { background: var(--open); }
.status.Answered { background: var(--answered); }
.status.Closed { background: var(--closed); }

.detail { position: sticky; top: 20px; }
.detail-head { display: flex; align-items: flex-start; gap: 8px; }
.detail-head h2 { flex: 1; }
.detail dl { display: grid; grid-template-columns: 100px 1fr; gap: 6px 10px; margin: 0 0 16px; }
.detail dt { color: var(--muted); font-size: 13px; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.audit { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.audit li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.audit pre { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .layout, .layout:has(> #detail[hidden]) { grid-template-columns: 1fr; padding: 16px; }
  .detail { position: static; }
}

@media (max-width: 600px) {
  .layout { padding: 12px; gap: 14px; }
  .topbar { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  #whoami { font-size: 13px; }
  th, td { padding: 6px 8px; font-size: 14px; }
  .detail dl { grid-template-columns: 1fr; gap: 2px 0; }
  .detail dt { margin-top: 8px; }
  .filters > div { flex: 1 1 120px; }
  #rfi-count { margin-left: 0; flex-basis: 100%; }
  button { min-height: 40px; }
  button.link { min-height: 0; }
}

/* Project workspace: register-first layout, separate operational areas. */
:root { --bg:#f4f3ef; --text:#243332; --muted:#596866; --border:#d6ddda; --accent:#185b50; font-size:15px; line-height:1.5; }
h1 { font-size:28px; letter-spacing:-.7px; line-height:1.2; }
h2 { font-size:20px; } h3 { font-size:16px; }
.topbar { height:68px; padding:0 28px; gap:24px; }
.brand { color:var(--text); font-size:26px; font-weight:750; letter-spacing:-1px; text-decoration:none; }
.brand-dot { color:#b86231; }
.product-label { border-left:1px solid var(--border); padding-left:24px; color:var(--muted); font-size:13px; }
button { min-height:40px; padding:9px 16px; border-radius:3px; font-weight:600; }
button:hover:not(:disabled) { filter:brightness(.94); }
button.secondary { color:var(--text); border-color:#bdc8c3; }
button.link { min-height:32px; font-weight:600; }
input,select,textarea { min-height:42px; padding:9px 11px; margin:6px 0 16px; border-color:#b8c5bf; border-radius:3px; }
input[type=checkbox] { min-height:initial; }
label { color:#43544e; font-size:13px; font-weight:600; }
.layout,.layout:has(> #detail[hidden]) { grid-template-columns:224px minmax(0,1fr); gap:0; padding:0; min-height:calc(100vh - 68px); }
.workspace-rail { background:#223b36; color:#fff; padding:30px 18px; align-self:stretch; }
.workspace-rail label { color:#bdcec7; font-size:11px; letter-spacing:1px; text-transform:uppercase; }
.workspace-rail select { background:#304c45; color:#fff; border-color:#587269; font-size:13px; margin-bottom:30px; }
.workspace-links { display:grid; gap:5px; }
.workspace-links button { text-align:left; background:transparent; border:0; color:#dce6e1; padding:12px 14px; border-radius:3px; }
.workspace-links button[aria-current=page] { background:#eaf0eb; color:#193e33; }
.workspace-links button[data-workspace=admin] { margin-top:32px; border-top:1px solid #50655d; border-radius:0; }
.workspace-links button:disabled { opacity:.55; }
.rail-context { color:#bdcec7; font-size:12px; margin:32px 12px 0; }
.workspace-body { padding:34px 40px 64px; min-width:0; }
.workspace-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:28px; }
.workspace-heading p { color:var(--muted); margin:8px 0 0; max-width:650px; }
.workspace-heading button { flex-shrink:0; }
.project-context { display:flex; justify-content:space-between; gap:20px; border-bottom:1px solid var(--border); padding-bottom:14px; margin-bottom:28px; }
.project-context h2 { font-size:13px; margin:0; color:#455c54; }
#project-role { font-size:12px; color:var(--muted); white-space:nowrap; }
.error:empty,[role=status]:empty { display:none; }
#app-error:not(:empty) { margin-bottom:20px; }
.projects ul { border-top:2px solid #314d43; }
.projects li { border-bottom:1px solid var(--border); }
.projects li button { position:relative; padding:24px 44px 24px 8px; border-radius:0; font-size:20px; font-weight:600; }
.projects li button::after { content:'Open project →'; position:absolute; right:12px; top:34px; font-size:13px; font-weight:500; color:var(--accent); }
.projects li button:hover { background:#e9eee8; }
.projects .company { font-size:13px; margin-top:6px; font-weight:400; }
.projects li button[aria-current=true] { outline:none; background:#e9eee8; }
.rfi-layout { display:grid; grid-template-columns:minmax(0,1fr); gap:28px; align-items:start; }
.rfi-layout:has(> .detail:not([hidden])) { grid-template-columns:minmax(0,1fr) minmax(320px,400px); }
.rfi-register { min-width:0; }
.card { border-radius:3px; padding:22px; }
details { margin-bottom:20px; border:1px solid var(--border); padding:16px 20px; background:white; border-radius:3px; }
summary { cursor:pointer; font-weight:600; color:var(--accent); }
details[open]>summary { margin-bottom:20px; }
#new-rfi { padding:14px 20px; }
.filters { padding:4px 0 18px; border-bottom:1px solid var(--border); }
.filters > div { flex:1 1 150px; }
.filters .check { padding-top:20px; }
table { border:0; }
th { background:#e8ece7; letter-spacing:.3px; font-size:11px; text-transform:uppercase; padding:13px 14px; }
td { padding:17px 14px; font-size:14px; }
tbody tr:hover,tbody tr.selected { background:#edf3ef; }
.status { display:inline-block; border-radius:2px; font-size:11px; padding:3px 8px; white-space:nowrap; }
.status.Draft { color:#4e5b60; background:#e7ebed; }
.status.Open { color:#75470a; background:#fbebc7; }
.status.Answered { color:#25516b; background:#dfeef5; }
.status.Closed { color:#256143; background:#e0eee3; }
.status.Void { color:#62666a; background:#e8e8e8; }
.detail { top:20px; background:#fff; border:1px solid var(--border); padding:24px; }
.detail .card { border:0; padding:0; }
#administration { max-width:1050px; }
#administration > form { background:white; border:1px solid var(--border); padding:24px; margin:24px 0; max-width:640px; }
#administration > div:has(> #admin-company) { max-width:420px; margin:24px 0; }
#administration > h3 { border-top:2px solid #536d60; padding-top:20px; margin-top:32px; }
#administration form h3 { margin:0 0 20px; }
.member-list li { display:flex; align-items:center; gap:16px; padding:16px 0; }
.member-list li span { flex:1; }
.member-list button { background:transparent; color:#8b3c30; border-color:#cfb8b1; font-size:12px; margin:0; }
#field-content > ul { list-style:none; padding:0; border-top:2px solid #536d60; }
#field-content > ul li { border-bottom:1px solid var(--border); }
#field-content > ul li button { background:white; color:var(--text); border:0; width:100%; text-align:left; padding:20px; border-radius:0; }
#field-content > h3 { margin-top:28px; }
#field-content form,#controls-content form { max-width:760px; }
.field-entry-list fieldset { background:#f6f7f4; }
.login { padding-top:70px; }
.login form { max-width:410px; }
@media(max-width:1250px) { .workspace-body { padding:28px; } .rfi-layout:has(> .detail:not([hidden])) { grid-template-columns:minmax(0,1fr); } .detail { position:static; } }
@media(max-width:800px) {
 .layout,.layout:has(> #detail[hidden]) { grid-template-columns:1fr; }
 .workspace-rail { padding:16px 20px; }
 .workspace-rail select { margin:5px 0 14px; }
 .workspace-links { display:flex; flex-wrap:wrap; gap:4px; }
 .workspace-links button { padding:8px 12px; font-size:13px; }
 .workspace-links button[data-workspace=admin] { margin:0; border:0; }
 .rail-context { display:none; }
 .workspace-body { padding:26px 20px; }
 .workspace-heading { flex-direction:column; gap:16px; }
 .workspace-heading p { font-size:14px; }
 .product-label { display:none; }
 .project-context { flex-wrap:wrap; gap:6px; }
}
@media(max-width:500px) {
 .topbar { height:auto; min-height:68px; padding:12px 18px; gap:10px; }
 .brand { font-size:23px; } #whoami { font-size:11px; max-width:140px; }
 .topbar button { padding:6px 10px; font-size:12px; }
 h1 { font-size:25px; }
 .projects li button { font-size:18px; padding:20px 8px; }
 .projects li button::after { position:static; display:block; margin-top:12px; }
 .member-list li { flex-wrap:wrap; } .member-list li span { flex-basis:100%; }
 .detail { padding:18px; } .row > div { min-width:0; }
}
