:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #202225;
  --muted: #656b74;
  --line: #ded8cc;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #8a4b20;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --ok: #167247;
  --warn: #a15c07;
  --blue: #145ea8;
  --shadow: 0 18px 45px rgba(32, 34, 37, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea {
  min-width: 0;
  max-width: 100%;
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover { background: var(--brand-dark); }
button.secondary { background: #ece6db; color: var(--ink); }
button.secondary:hover { background: #dfd6c8; }
button.compact { padding: 7px 10px; }
button.link-button {
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-weight: 800;
}
button.link-button:hover { text-decoration: underline; }
button.danger-text, .danger-text { color: var(--danger); }

.app {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hidden { display: none !important; }

.login-view {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar, .project-band, .metrics, .workspace { width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.user-pill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
}

.eyebrow, .label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, h4, p {
  margin-top: 0;
  overflow-wrap: anywhere;
}
h1 { margin-bottom: 0; font-size: 44px; line-height: 1.08; }
.topbar h1 { font-size: 34px; }
.admin-menu { position: relative; }
.admin-menu > summary { cursor: pointer; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; }
.admin-menu-items { position: absolute; right: 0; top: calc(100% + 8px); z-index: 100; width: 255px; max-width: calc(100vw - 32px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.admin-menu-items > button, .admin-menu-items > a { display: block; width: 100%; text-align: left; white-space: normal; text-decoration: none; padding: 10px; border: 0; border-radius: 3px; font: inherit; color: inherit; }
.admin-menu-items > a:hover { background: var(--line); }
h2 { margin-bottom: 0; font-size: 24px; }
h3 { margin-bottom: 0; font-size: 18px; }
h4 { margin-bottom: 0; font-size: 16px; }

.hint, .muted { color: var(--muted); }
.hint { margin: 0; font-size: 13px; }

.project-band {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar > *,
.project-band > *,
.project-meta,
.user-pill,
.panel,
.audit-main {
  min-width: 0;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(560px, 100%);
}

.project-meta select { min-width: 340px; }

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 0;
}

.tabs button {
  background: #ece6db;
  color: var(--ink);
}

.tabs button.active {
  background: var(--brand);
  color: #fff;
}

.tabs.portal-global-tabs {
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.portal-global-tabs:not(:has(> button:not([hidden]):not(.hidden))) {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metrics .metric-card {
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.metrics .metric-card:hover { background: #f6f3ed; border-color: var(--brand); }
.metrics .metric-card.active { border-color: var(--brand); box-shadow: inset 0 -3px var(--brand); }

.metrics span {
  display: block;
  font-size: 32px;
  font-weight: 800;
}

.metrics p { margin-bottom: 0; color: var(--muted); }
.metrics .danger { background: var(--danger-bg); border-color: #ffd1ca; color: var(--ink); }
.metrics .danger span { color: var(--danger); }

.workspace {
  display: grid;
  grid-template-columns: 250px minmax(390px, 1fr) minmax(390px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-actions, .file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.collapse-toggle {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #f1eee8;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.collapse-toggle:hover {
  background: #e4ddd1;
}

.collapsible-panel.collapsed > :not(.panel-head) {
  display: none !important;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.inline-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.filters {
  position: sticky;
  top: 16px;
  padding-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  padding: 12px 16px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }

.request-list, .details { min-height: 560px; }

#requests {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.request-card {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  background: #fbfaf7;
  color: var(--ink);
}

.request-card:hover, .request-card.active {
  border-color: var(--brand);
  background: #eef8f6;
}

.request-card p { margin: 0; color: var(--muted); }

.request-rich-text {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.request-text-block { margin: 0; white-space: normal; }

.request-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.request-inline-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.request-inline-table td {
  min-width: 120px;
  max-width: 360px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.request-inline-table tr:last-child td { border-bottom: 0; }
.request-inline-table td:last-child { border-right: 0; }

.request-table-preview {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f6f2;
}

.request-structured-wrap {
  position: relative;
  max-width: 100%;
  min-width: 0;
}

.request-structured-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.request-structured-table {
  width: max-content;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.request-structured-table td {
  box-sizing: border-box;
  padding: 4px 8px;
  line-height: 1.15;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.request-table-remove {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  background: #fff;
  color: var(--danger);
  border-color: var(--line);
}

.card-row, .detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #ece6db;
  color: var(--muted);
}

.badge.overdue { background: var(--danger-bg); color: var(--danger); }
.badge.uploaded { background: #edf7ff; color: var(--blue); }
.badge.accepted { background: #e9f8ef; color: var(--ok); }
.badge.needs_clarification { background: #fff6e7; color: var(--warn); }

.empty-state, .detail-body { padding: 18px; }
.detail-body { display: grid; gap: 18px; }
.detail-block { display: grid; gap: 10px; }
.file-list, .comment-list { display: grid; gap: 8px; }

.request-files-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.request-files-heading h3 { margin: 0; }

.request-files-heading .button-link {
  min-height: 32px;
  padding: 6px 10px;
  background: #ece6db;
  color: var(--ink);
  font-size: 12px;
}

.file-item, .comment-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfaf7;
}

.comment-item p { margin-bottom: 0; color: var(--ink); }
.file-description { margin: 2px 0 0; color: var(--ink); white-space: pre-wrap; }

.request-chat {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.request-chat-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.request-chat-heading h3 { margin: 0; }
.request-chat-heading span { color: var(--muted); font-size: 12px; }

.request-chat .comment-list {
  align-content: start;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f7f8fa;
}

.chat-message {
  justify-self: start;
  width: min(82%, 560px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
}

.chat-message.own {
  justify-self: end;
  border-color: #a9d4cd;
  background: #eef8f6;
}

.chat-message.pending { opacity: 0.72; }

.chat-message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.chat-message-head strong { font-size: 13px; }
.chat-message-head span { color: var(--muted); font-size: 11px; }
.chat-message p { margin: 5px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message time { display: block; color: var(--muted); font-size: 11px; text-align: right; }
.chat-message-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 5px; }
.chat-message-actions .link-button { padding: 0; font-size: 11px; }
.chat-message-edit { display: grid; gap: 7px; margin-top: 7px; }
.chat-message-edit > span { display: flex; justify-content: flex-end; gap: 7px; }
.chat-empty { margin: 0; color: var(--muted); text-align: center; }

.download-link {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.download-link:hover { text-decoration: underline; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.client-upload, .chat-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.chat-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.chat-form textarea { min-height: 58px; }

.project-editor {
  padding-bottom: 18px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 0;
  padding: 0 0 12px;
}

.editor-grid .wide {
  grid-column: 1 / -1;
}

.project-additional {
  margin: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fbfaf7;
}

.project-additional-content {
  padding: 6px 16px 16px;
}

.project-additional-grid {
  margin-top: 10px;
}

.stage-date-grid {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.stage-date-head,
.stage-date-grid > label {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(150px, 220px);
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.stage-date-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stage-date-grid > label {
  color: var(--ink);
}

.stage-date-grid > label input {
  margin: 0;
}

.contract-box {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfaf7;
}

.contract-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 0 16px;
}

.team-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfaf7;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  padding: 10px 0 0;
  color: var(--ink);
}

.check-row input { width: auto; margin-top: 3px; }
.check-row small { display: block; color: var(--muted); font-weight: 600; }

.access-row {
  grid-template-columns: 20px 1fr;
  align-items: start;
  color: var(--ink);
}

.person-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  background: #fff;
}

.person-card.inactive {
  opacity: 0.66;
  background: #f2eee6;
}

.person-card strong,
.person-card span,
.person-card small {
  display: block;
}

.person-card small {
  color: var(--muted);
}

.person-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(32, 34, 37, 0.24);
}

dialog::backdrop { background: rgba(32, 34, 37, 0.42); }
.dialog-body { padding-bottom: 16px; }
.dialog-body > button { margin: 16px 16px 0; }

.preview-dialog {
  width: min(1120px, calc(100% - 28px));
}

.request-card-dialog {
  width: min(960px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
}

.function-allocation-dialog {
  width: min(1240px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
}

.function-allocation-dialog .dialog-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 28px);
  padding-bottom: 0;
}

.function-allocation-suggestions-dialog {
  width: min(980px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
}

.function-allocation-suggestions-dialog .dialog-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 28px);
  padding-bottom: 0;
}

.function-allocation-suggestions-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.function-allocation-suggestions-content {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 14px 16px;
  overflow-y: auto;
}

.function-allocation-suggestion {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.function-allocation-suggestion-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.function-allocation-suggestion-check input {
  width: auto;
  margin-top: 3px;
}

.function-allocation-suggestion-check span,
.function-allocation-suggestion-check small,
.function-allocation-change strong,
.function-allocation-change small {
  display: block;
}

.function-allocation-suggestion-check small,
.function-allocation-change small,
.function-allocation-suggestion > p {
  color: var(--muted);
}

.function-allocation-change {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.function-allocation-change > div {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 10px;
  background: #f7f5f0;
}

.function-allocation-change > div > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.function-allocation-suggestion > p {
  margin: 0;
  font-size: 12px;
}

.function-allocation-toolbar,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.function-allocation-toolbar select {
  min-width: 220px;
}

.function-allocation-content {
  min-height: 0;
  padding: 0 16px 16px;
  overflow: auto;
}

.function-allocation-group {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.function-allocation-group-head {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #ece6db;
}

.function-allocation-group-head h4 {
  margin: 0;
  font-size: 15px;
}

.function-allocation-group-head .inline-check {
  margin: 0;
}

.function-allocation-table {
  min-width: 920px;
}

.function-allocation-row {
  display: grid;
  grid-template-columns: 28px 80px minmax(250px, 1.35fr) minmax(190px, .8fr) minmax(250px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
}

.function-allocation-row:first-child {
  border-top: 0;
}

.function-allocation-header {
  min-height: 36px;
  color: var(--muted);
  background: #f7f5f0;
  font-size: 12px;
  font-weight: 800;
}

.function-allocation-row > input,
.function-participants input {
  width: auto;
  margin: 0;
}

.function-responsible select {
  width: 100%;
}

.function-responsible > small,
.function-participants > small {
  display: none;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.function-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.function-participants label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: auto;
  border-bottom: 0;
}

.request-card-dialog-head {
  border-bottom: 1px solid var(--line);
}

.request-card-details {
  min-height: 0;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: 62vh;
  max-height: 72vh;
  padding: 14px;
  background: #f2eee6;
  overflow: auto;
}

.preview-body iframe {
  width: 100%;
  height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-body img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.preview-placeholder {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  text-align: center;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #ece6db;
  color: var(--ink);
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.no-padding label {
  padding: 0;
}

.dialog-section {
  margin: 12px 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfaf7;
}

.dialog-section h3 {
  margin-bottom: 8px;
}

.login-blocks-body {
  padding: 16px;
}

.login-block-list {
  display: grid;
  gap: 10px;
}

.login-block-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.login-block-row strong,
.login-block-row span {
  display: block;
}

.security-journal-dialog {
  width: min(1180px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
}

.security-journal-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(190px, 0.6fr) minmax(150px, 0.4fr) auto;
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.security-journal-filters label {
  padding: 0;
}

.security-journal-body {
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 14px 16px 18px;
}

.security-event-list {
  display: grid;
  gap: 7px;
}

.security-event-row {
  display: grid;
  grid-template-columns: 150px minmax(280px, 1fr) 90px 120px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 6px;
}

.security-event-row strong,
.security-event-row span {
  display: block;
}

.security-event-row div > span,
.security-event-row time,
.security-event-row small {
  color: var(--muted);
  font-size: 12px;
}

.security-outcome {
  border-radius: 6px;
  padding: 4px 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.security-outcome.success { background: #e8f5ee; color: var(--ok); }
.security-outcome.denied,
.security-outcome.failed { background: var(--danger-bg); color: var(--danger); }

.login-block-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.new-client-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin-top: 8px;
}

.new-client-row input {
  min-width: 0;
}

.auditor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, .9fr) minmax(220px, 1.1fr);
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.auditor-row:last-child {
  border-bottom: 0;
}

.auditor-row .check-row {
  padding: 0;
}

.auditor-function {
  width: 100%;
  min-height: 38px;
  resize: none;
  transition: min-height .16s ease;
}

.auditor-function.expanded {
  min-height: 118px;
  resize: vertical;
}

.auditor-function-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: start;
}

.documents-report {
  margin-top: 16px;
}

.document-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

#documentsReport {
  padding: 12px;
}

.document-table {
  display: grid;
  gap: 8px;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) minmax(180px, 0.8fr) 160px 90px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
  cursor: pointer;
}

.document-row:hover {
  border-color: var(--brand);
  background: #eef8f6;
}

.document-head {
  background: #ece6db;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: default;
}

.document-head:hover {
  border-color: var(--line);
  background: #ece6db;
}

.document-row strong,
.document-row small {
  display: block;
}

.document-row small {
  color: var(--muted);
}

.audit-subtabs-shell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: stretch;
  gap: 4px;
  margin-top: 16px;
  border-bottom: 1px solid var(--line);
}

.audit-subtabs {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.audit-subtabs::-webkit-scrollbar {
  display: none;
}

.audit-subtabs button {
  flex: 0 0 auto;
  min-width: max-content;
  border-radius: 6px 6px 0 0;
  padding-inline: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.audit-subtabs button:hover,
.audit-subtabs button.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: inset 0 -3px var(--brand);
}

.audit-scroll-button {
  width: 40px;
  min-width: 40px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  padding: 0;
  background: var(--surface);
  color: var(--brand-dark);
  font-size: 28px;
  line-height: 1;
}

.audit-scroll-button:disabled {
  color: var(--muted);
  opacity: 0.35;
  cursor: default;
}

.materiality-page,
.materiality-form {
  display: grid;
  gap: 16px;
}

.materiality-page {
  margin-top: 16px;
}

.materiality-statement-import {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-left: 4px solid var(--ok);
  background: #f3f8f5;
}

.materiality-statement-import h3 { margin: 2px 0 8px; font-size: 17px; }
.materiality-statement-import p:last-child { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; color: var(--muted); font-size: 12px; }
.materiality-statement-import p:last-child span { white-space: nowrap; }
.materiality-statement-import p:last-child strong { color: var(--ink); }

.planning-page,
.planning-form {
  display: grid;
  gap: 16px;
}

.planning-page {
  margin-top: 16px;
}

.planning-readiness {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.planning-readiness-item {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 3px solid #c6a44a;
}

.planning-readiness-item:last-child {
  border-right: 0;
}

.planning-readiness-item.ready {
  border-bottom-color: var(--ok);
}

.planning-readiness-item span,
.planning-readiness-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.planning-readiness-item strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.planning-document-date {
  max-width: 320px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.planning-question-list,
.planning-event-list,
.planning-change-list {
  border-top: 1px solid var(--line);
}

.planning-question {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.planning-question-label {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  line-height: 1.35;
}

.planning-question-label span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
}

.planning-question textarea,
.planning-question select {
  width: 100%;
}

.planning-subsection {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.planning-subsection h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.planning-material-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.planning-material-list > div:not(.empty-state) {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
}

.planning-material-list span,
.planning-material-list b,
.planning-change-row small {
  color: var(--muted);
  font-size: 12px;
}

.planning-material-list strong {
  overflow-wrap: anywhere;
}

.planning-material-list b {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.planning-change-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 180px minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.planning-change-row small {
  display: block;
  margin-top: 4px;
}

.planning-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

.planning-check input {
  width: 18px;
  height: 18px;
}

.planning-event-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) 180px minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.planning-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.planning-scope-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.planning-page {
  min-width: 0;
  overflow: hidden;
}

.planning-scope-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.planning-scope-table th,
.planning-scope-table td {
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.planning-scope-table th {
  background: #f4f6f5;
  color: var(--muted);
  font-size: 12px;
}

.planning-scope-table th:not(:nth-child(2)),
.planning-scope-table td:not(:nth-child(2)) {
  text-align: center;
}

.planning-table-check {
  display: inline-grid;
  place-items: center;
}

.planning-table-check input {
  width: 18px;
  height: 18px;
}

.planning-table-check span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.planning-hours {
  width: 72px;
  min-width: 72px;
  text-align: right;
}

.planning-resources {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.planning-inventory {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.2fr);
  gap: 16px;
  padding-top: 4px;
}

.planning-inventory-recommendation {
  align-content: start;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-left: 4px solid var(--accent);
  background: #f4f6f5;
}

.planning-inventory-recommendation > div:first-child {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.planning-inventory-recommendation span,
.planning-inventory-recommendation strong {
  display: block;
  width: 100%;
}

.planning-inventory-recommendation span,
.planning-inventory-recommendation small,
.planning-inventory-recommendation dt {
  color: var(--muted);
  font-size: 12px;
}

.planning-inventory-recommendation p,
.planning-inventory-recommendation dl {
  margin: 0;
}

.planning-inventory-recommendation dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.planning-inventory-recommendation dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.planning-inventory-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.planning-inventory-fields .wide {
  grid-column: 1 / -1;
}

.planning-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.financial-statements-page {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.financial-statements-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.financial-statements-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfaf7;
}

.financial-statements-source span,
.financial-statements-source small,
.financial-statements-summary span,
.financial-statements-summary small,
.financial-control span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.financial-statements-source strong,
.financial-statements-summary strong,
.financial-control strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.financial-statements-source-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.financial-statements-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.financial-statements-summary > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.financial-statements-summary > div:last-child {
  border-right: 0;
}

.financial-statements-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.financial-control {
  min-width: 0;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 3px solid var(--ok);
}

.financial-control.failed {
  border-bottom-color: var(--danger);
  background: var(--danger-bg);
}

.financial-statement-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.financial-statement-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

.financial-statement-table th,
.financial-statement-table td {
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.financial-statement-table th {
  background: #f4f6f5;
  color: var(--muted);
  font-size: 12px;
}

.financial-statement-table .number-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.financial-statement-table tr.material-row {
  background: #eef8f2;
}

.materiality-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.materiality-result > div:not(.empty-state) {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.materiality-result > div:last-child {
  border-right: 0;
}

.materiality-result span,
.materiality-result small {
  display: block;
  color: var(--muted);
}

.materiality-result span {
  font-size: 12px;
  font-weight: 800;
}

.materiality-result strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.materiality-benchmarks,
.materiality-rationale {
  padding: 16px;
}

.materiality-factor-list,
.materiality-risk-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.materiality-factor-list label,
.materiality-risk-list label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 34%);
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.materiality-factor-list label:last-child,
.materiality-risk-list label:last-child {
  border-bottom: 0;
}

.materiality-rationale {
  border-top: 1px solid var(--line);
}

.approval-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px;
  border-top: 1px solid var(--line);
  font-weight: 800;
}

input[readonly] {
  background: #f1eee8;
  color: var(--muted);
}

.audit-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.audit-sections {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.population-button {
  display: grid;
  width: 100%;
  gap: 3px;
  border-radius: 0;
  padding: 14px 16px;
  text-align: left;
  background: #fff;
  color: var(--ink);
}

.population-button:hover,
.population-button.active {
  background: #eef8f6;
  color: var(--brand-dark);
}

.population-button span {
  font-weight: 800;
}

.population-button small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.population-empty {
  display: grid;
  gap: 4px;
  padding: 16px;
  color: var(--muted);
}

.population-empty strong {
  color: var(--ink);
}

.population-list {
  display: grid;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.portfolio-summary > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.portfolio-summary > div:last-child {
  border-right: 0;
}

.portfolio-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.portfolio-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.audit-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.selection-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 0;
  padding-bottom: 16px;
}

.selection-form .wide {
  grid-column: 1 / -1;
}

.revenue-upload-form {
  grid-template-columns: 1fr;
}

.revenue-upload-form button[type="submit"] {
  width: calc(100% - 32px);
  margin: 12px 16px 0;
}

.selection-settings-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.selection-calculated-setting {
  align-content: start;
}

.selection-calculated-setting output {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #f4f6f5;
  font-size: 14px;
  font-weight: 800;
}

.selection-calculated-setting small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.selection-submit {
  padding: 12px 16px 0;
}

.selection-submit button {
  width: 100%;
}

.preliminary-selection-form {
  grid-template-columns: minmax(0, 1fr) 240px;
}

.selection-mode {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 12px 16px 0;
}

.selection-mode legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(520px, 100%);
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.segmented-control label {
  padding: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  min-height: 42px;
  padding: 11px 14px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.segmented-control label + label span {
  border-left: 1px solid var(--line);
}

.segmented-control input:checked + span {
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.segmented-control input:focus-visible + span {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.pending-selection-state {
  display: grid;
  gap: 4px;
  padding: 18px 16px;
}

.pending-selection-state span {
  color: var(--muted);
}

.register-summary,
.selection-metrics,
.observation-project-data {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.register-summary > div,
.selection-metrics > div,
.observation-project-data > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.register-summary > div:last-child,
.selection-metrics > div:last-child {
  border-right: 0;
}

.register-summary span,
.selection-metrics span,
.observation-project-data span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.register-summary strong,
.selection-metrics strong,
.observation-project-data strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.selection-documents {
  border-top: 1px solid var(--line);
  padding: 16px;
}

.selection-documents-head,
.selection-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.selection-document-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.selection-document-row {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.selection-document-row > span:first-child {
  min-width: 0;
}

.selection-document-row strong,
.selection-document-row small {
  display: block;
  overflow-wrap: anywhere;
}

.selection-document-row small {
  color: var(--muted);
}

.selection-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.selection-metrics strong {
  font-size: 22px;
}

.selection-metrics small {
  display: block;
  color: var(--muted);
}

.selection-metrics .wide {
  grid-column: 1 / -1;
}

.compliance-warning {
  background: #fff4e5;
}

.selection-calculation-matrix {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.selection-matrix-head,
.selection-matrix-row {
  display: grid;
  grid-template-columns: 120px repeat(8, minmax(110px, 1fr));
  min-width: 1100px;
}

.selection-matrix-head {
  color: var(--muted);
  background: #fbfaf7;
  font-size: 12px;
  font-weight: 800;
}

.selection-matrix-head > *,
.selection-matrix-row > * {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.selection-matrix-row.active {
  background: #edf7f4;
}

.selection-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.resizable-selection-table th {
  position: relative;
}

.resizable-selection-table {
  table-layout: fixed;
}

.resizable-selection-table th,
.resizable-selection-table td {
  min-width: 0 !important;
}

.column-resize-handle {
  position: absolute;
  z-index: 2;
  top: 0;
  right: -4px;
  width: 14px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.cutoff-missing-source { color: #b42318; font-weight: 600; }

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 9px;
  width: 1px;
  background: var(--line);
}

.column-resize-handle:hover::after,
.resizing-selection-column .column-resize-handle::after {
  background: var(--brand);
}

.resizing-selection-column {
  cursor: col-resize;
  user-select: none;
}

.column-width-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 7px;
}

.selection-list-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(125px, 170px) minmax(125px, 170px) auto auto;
  align-items: end;
  gap: 8px;
  margin: 2px 0 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf7;
}

.selection-list-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.selection-list-filter input {
  min-width: 0;
  height: 34px;
  padding: 6px 9px;
}

.selection-list-filter > span {
  align-self: center;
  white-space: nowrap;
}

.selection-context-header {
  margin: 0 0 14px;
}

.selection-context-header > .panel-head {
  padding-bottom: 10px;
}

.selection-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.selection-context-grid > div {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.selection-context-grid span,
.selection-context-grid small {
  color: var(--muted);
  font-size: 11px;
}

.selection-context-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
}

.selection-ens-reason {
  display: block;
  margin-top: 5px;
  max-width: 210px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.selection-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.selection-table th,
.selection-table td {
  border-top: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

.selection-table th {
  color: var(--muted);
  background: #fbfaf7;
  font-size: 12px;
}

.selection-table th:first-child,
.selection-table td:first-child {
  width: 42px;
  text-align: center;
}

.selection-table th:nth-child(2) { width: 30%; }
.selection-table th:nth-child(3) { width: 140px; }
.selection-table th:nth-child(4),
.selection-table th:nth-child(5),
.selection-table th:nth-child(6) { width: 70px; text-align: center; }
.selection-table td:nth-child(4),
.selection-table td:nth-child(5),
.selection-table td:nth-child(6) { text-align: center; }
.selection-table th:nth-child(7) { width: 130px; }
.selection-table th:last-child { width: 132px; }

.selection-table td strong,
.selection-table td small {
  display: block;
}

.selection-table td small {
  color: var(--muted);
}

.selection-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.investments-overlap {
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid #e6c98d;
  border-radius: 6px;
  color: #684b16;
}

.investments-selection-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.investments-selection-table th,
.investments-selection-table td {
  padding: 10px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.investments-selection-table th {
  color: var(--muted);
  background: #fbfaf7;
  font-size: 12px;
}

.investments-selection-table th:first-child,
.investments-selection-table td:first-child {
  width: 42px;
  text-align: center;
}

.investments-selection-table th:nth-child(2),
.investments-selection-table td:nth-child(2) {
  min-width: 280px;
  text-align: left;
  white-space: normal;
}

.investments-selection-table td strong,
.investments-selection-table td small {
  display: block;
}

.investments-selection-table td small {
  color: var(--muted);
}

.balance-subtabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.balance-subtabs button {
  flex: 0 0 auto;
  border-radius: 0;
  padding: 12px 16px;
  background: transparent;
  color: var(--muted);
}

.balance-subtabs button:hover,
.balance-subtabs button.active {
  background: #eef8f6;
  color: var(--brand-dark);
}

.balance-upload-form {
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
  padding: 4px 0 16px;
}

.balance-upload-form button {
  margin: 12px 16px 0;
}

.balance-upload-status {
  margin: 0 16px;
  border-left: 3px solid var(--line);
  padding: 10px 12px;
  background: #f7f8fa;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.balance-upload-status.working {
  border-left-color: #4a6fa5;
  color: var(--ink);
}

.balance-upload-status.success {
  border-left-color: var(--brand);
  background: #eef8f6;
  color: var(--brand-dark);
}

.balance-upload-status.error {
  border-left-color: #b42318;
  background: #fff3f2;
  color: #8a1c13;
}

.balance-selected-only-control {
  min-height: 36px;
  white-space: nowrap;
}

.empty-table-cell {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.selection-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.selection-settings > button[type="submit"] {
  margin: 0 16px 16px;
}

.balance-selection-table,
.revenue-selection-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

.balance-selection-table th,
.balance-selection-table td,
.revenue-selection-table th,
.revenue-selection-table td {
  border-top: 1px solid var(--line);
  padding: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.balance-selection-table th,
.revenue-selection-table th {
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
}

.balance-selection-table th:first-child,
.balance-selection-table td:first-child {
  width: 42px;
  text-align: center;
}

.balance-selection-table th:nth-child(2),
.balance-selection-table td:nth-child(2) {
  min-width: 250px;
  text-align: left;
}

.balance-selection-table th:nth-last-child(-n+4),
.balance-selection-table td:nth-last-child(-n+4) {
  text-align: center;
}

.balance-selection-table td strong,
.balance-selection-table td small {
  display: block;
}

.balance-selection-table td small {
  color: var(--muted);
}

.balance-selection-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.balance-selection-table tr.selected-row {
  background: #f4fbf8;
}

.revenue-selection-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.revenue-selection-table th:first-child,
.revenue-selection-table td:first-child,
.revenue-selection-table th:nth-child(2),
.revenue-selection-table td:nth-child(2) {
  min-width: 210px;
  text-align: left;
}

.revenue-selection-table th:nth-last-child(-n+5),
.revenue-selection-table td:nth-last-child(-n+5) {
  text-align: center;
}

.revenue-selection-table td strong,
.revenue-selection-table td small {
  display: block;
}

.revenue-selection-table td small {
  color: var(--muted);
}

.revenue-selection-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.revenue-selection-table tr.selected-row {
  background: #f4fbf8;
}

#costAuditView.audit-workspace,
#expenseAuditView.audit-workspace {
  grid-template-columns: 300px minmax(0, 1fr);
}

#costAuditView .balance-subtabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#costAuditView .balance-subtabs button {
  min-width: 0;
  padding-inline: 10px;
  white-space: normal;
}

#costAuditView .selection-metrics > div:first-child strong,
#expenseAuditView .selection-metrics > div:first-child strong {
  font-size: 16px;
}

#costAuditView .revenue-selection-table,
#expenseAuditView .revenue-selection-table {
  font-size: 12px;
}

#costAuditView .revenue-selection-table th,
#costAuditView .revenue-selection-table td,
#expenseAuditView .revenue-selection-table th,
#expenseAuditView .revenue-selection-table td {
  padding: 7px 6px;
}

#rd380PreliminaryResult .revenue-selection-table {
  min-width: 760px;
}

#expensePreliminaryResult .revenue-selection-table {
  min-width: 760px;
}

#rd380PreliminaryResult .revenue-selection-table th:first-child,
#rd380PreliminaryResult .revenue-selection-table td:first-child,
#expensePreliminaryResult .revenue-selection-table th:first-child,
#expensePreliminaryResult .revenue-selection-table td:first-child {
  min-width: 180px;
}

#rd380PreliminaryResult .revenue-selection-table th:nth-child(2),
#rd380PreliminaryResult .revenue-selection-table td:nth-child(2),
#rd380StockResult .revenue-selection-table th:nth-child(2),
#rd380StockResult .revenue-selection-table td:nth-child(2),
#expensePreliminaryResult .revenue-selection-table th:nth-child(2),
#expensePreliminaryResult .revenue-selection-table td:nth-child(2) {
  min-width: 0;
  text-align: right;
}

#rd380FinalResult .revenue-selection-table {
  min-width: 900px;
}

.rd380-population-filter {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(300px, 1fr) auto;
  align-items: end;
  gap: 10px 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.rd380-population-filter > small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.rd380-population-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
  width: 100%;
}

.rd380-population-control > div {
  display: grid;
  gap: 3px;
}

.rd380-population-control span {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .rd380-population-filter,
  .rd380-population-control {
    grid-template-columns: 1fr;
  }
}

#expenseFinalResult .revenue-selection-table {
  min-width: 900px;
}

#rd380FinalResult .revenue-selection-table th:first-child,
#rd380FinalResult .revenue-selection-table td:first-child,
#rd380FinalResult .revenue-selection-table th:nth-child(2),
#rd380FinalResult .revenue-selection-table td:nth-child(2),
#expenseFinalResult .revenue-selection-table th:first-child,
#expenseFinalResult .revenue-selection-table td:first-child,
#expenseFinalResult .revenue-selection-table th:nth-child(2),
#expenseFinalResult .revenue-selection-table td:nth-child(2) {
  min-width: 170px;
}

#rd380StockResult .revenue-selection-table {
  min-width: 860px;
}

#rd380StockResult .revenue-selection-table th:first-child,
#rd380StockResult .revenue-selection-table td:first-child {
  min-width: 210px;
}

.confirmation-journal {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.confirmation-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #fff;
}

.confirmation-meta,
.confirmation-amounts,
.confirmation-actions,
.confirmation-attachment-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
}

.confirmation-meta span,
.confirmation-amounts span {
  color: var(--muted);
}

.confirmation-meta strong,
.confirmation-amounts strong {
  color: var(--ink);
}

.confirmation-attachment-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 1fr) auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.confirmation-fields .wide {
  grid-column: 1 / -1;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: flex-start;
  gap: 5px;
}

.row-actions > button {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.row-actions > [data-new-selection-request] { order: 2; }
.row-actions > [data-create-observation],
.row-actions > [data-asset-observation],
.row-actions > [data-personnel-observation],
.row-actions > [data-estimate-observation],
.row-actions > [data-selection-observation],
.row-actions > [data-revenue-observation],
.row-actions > [data-rd380-observation],
.row-actions > [data-expense-observation] { order: 3; }
.row-actions > .third-party-request { order: 4; }

.selection-linked-requests {
  width: 100%;
}

.selection-linked-request-row > td {
  border-top: 0;
  padding: 0 10px 8px;
  text-align: left !important;
}

.selection-linked-requests summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.selection-linked-requests summary::-webkit-details-marker { display: none; }
.selection-linked-requests summary::before { content: "+ "; }
.selection-linked-requests[open] summary::before { content: "− "; }

.selection-linked-requests > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  padding-top: 6px;
}

button.selection-linked-request {
  display: grid;
  gap: 2px;
  width: 100%;
  background: #f5f2ec;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
}

button.selection-linked-request:hover { background: #ece6db; }
button.selection-linked-request strong { font-size: 12px; }
button.selection-linked-request small { color: var(--muted); }

.object-observation-host:empty { display: none; }
.object-observation-host { min-width: 0; width: 100%; }
.selection-linked-observations { margin-top: 4px; }
.selection-linked-observations > div { grid-template-columns: minmax(0, 1fr); }
.selection-linked-observations .selection-linked-request {
  grid-template-columns: minmax(120px, 1fr) minmax(0, 3fr);
  align-items: baseline;
}
.selection-linked-observations .selection-linked-request > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.selection-linked-request-row[hidden] { display: none; }

.request-selection-label {
  display: block;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  margin-top: -4px;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.observation-project-data {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.observation-project-data .wide {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
}

.observation-assessment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.observation-procedure-field {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.observation-procedure-field legend {
  padding: 0 6px;
  font-weight: 800;
}

.observation-procedure-field > p {
  margin: 0 0 10px;
}

.observation-procedure-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.observation-procedure-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  cursor: pointer;
}

.observation-procedure-option input {
  margin-top: 3px;
}

.observation-procedure-option span {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  font-weight: 600;
}

.assessment-callout {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f7f8fa;
}

.assessment-callout strong,
.assessment-callout span {
  display: block;
}

.assessment-callout span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.audit-result-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 24px;
  border: 2px solid #a9c9c4;
  border-top: 0;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(15, 118, 110, 0.12);
}

.audit-result-divider {
  padding: 10px 16px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-result-panel > .panel-head {
  padding-block: 18px;
  border-bottom-color: #c7dcd8;
  background: #eef8f6;
}

.audit-result-panel > .panel-head h3 {
  font-size: 20px;
}

.audit-result-form {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 18px;
}

.audit-result-readiness {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-result-meta {
  grid-template-columns: repeat(2, minmax(0, 280px));
}

.audit-result-band {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.audit-result-band > .panel-head {
  margin-bottom: 0;
}

.rd380-cost-elements {
  min-width: 680px;
}

.rd380-cost-elements th:first-child,
.rd380-cost-elements td:first-child {
  width: 110px;
}

.rd380-cost-elements th:last-child,
.rd380-cost-elements td:last-child {
  width: 180px;
  text-align: right;
}

.audit-result-upload {
  grid-template-columns: minmax(0, 1fr) auto;
}

.audit-result-upload.comparative-upload {
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px) auto;
}

.rd375-cutoff-table {
  min-width: 1060px;
}

.rd375-cutoff-table th:first-child,
.rd375-cutoff-table td:first-child {
  width: 260px;
}

.rd375-cutoff-table th:nth-child(4),
.rd375-cutoff-table td:nth-child(4) {
  width: 160px;
}

.rd375-cutoff-table th:nth-child(5),
.rd375-cutoff-table td:nth-child(5),
.rd375-cutoff-table th:nth-child(6),
.rd375-cutoff-table td:nth-child(6) {
  width: 155px;
}

.rd375-cutoff-table th:last-child,
.rd375-cutoff-table td:last-child {
  width: 48px;
}

.cutoff-document-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 6px;
}

@media (max-width: 860px) {
  .audit-result-upload.comparative-upload {
    grid-template-columns: 1fr;
  }
}

.audit-result-na {
  justify-self: start;
}

.rd305-reconciliation-table input {
  width: 132px;
  min-width: 108px;
}

.rd305-reconciliation-table {
  min-width: 1420px;
}

.rd305-reconciliation-table-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
}

.rd305-reconciliation-table-panel > .panel-head {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  padding: 10px 16px;
  background: #f7f8fa;
}

.rd305-reconciliation-table-panel > .panel-head > div:first-child {
  min-width: 0;
}

.rd305-reconciliation-table-panel > .panel-head .collapse-toggle {
  margin-left: auto;
}

.rd305-reconciliation-table td:nth-child(8) input {
  width: 220px;
}

.reconciliation-difference {
  min-width: 125px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reconciliation-difference small {
  display: block;
}

.reconciliation-actions {
  min-width: 120px;
}

#rd350Supplement { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.debt-confirmation-result { min-width: 0; max-width: 100%; }
.debt-confirmation-result .panel-head h4 { overflow-wrap: anywhere; }
.debt-confirmation-result td[colspan] { text-align: left; }
#rd350Supplement > h4, #rd350Supplement > .form-grid { margin: 18px 16px; }
#rd350Supplement .loan-balance-table { width: 1800px; min-width: 1800px; table-layout: fixed; }
#rd350Supplement .loan-detail-table { width: 1900px; min-width: 1900px; table-layout: fixed; }
#rd350Supplement input, #rd350Supplement select, #rd350Supplement textarea { min-width: 0; max-width: 100%; }
#rd350Supplement td { white-space: normal; overflow-wrap: anywhere; }

#rd390ReconciliationBand .selection-table {
  table-layout: fixed;
  width: 1160px;
  min-width: 1160px;
}
#rd390ReconciliationBand th:nth-child(1) { width: 140px; }
#rd390ReconciliationBand th:nth-child(2) { width: 150px; }
#rd390ReconciliationBand th:nth-child(3) { width: 180px; }
#rd390ReconciliationBand th:nth-child(4) { width: 110px; }
#rd390ReconciliationBand th:nth-child(5) { width: 130px; }
#rd390ReconciliationBand th:nth-child(6) { width: 270px; }
#rd390ReconciliationBand th:nth-child(7) { width: 180px; }
#rd390ReconciliationBand td { white-space: normal; overflow-wrap: anywhere; }
#rd390ReconciliationBand input:not([type="checkbox"]) { width: 100%; min-width: 0; }
#rd390ReconciliationBand label { display: flex; align-items: flex-start; gap: 6px; }
#rd390ReconciliationBand input[type="checkbox"] { flex: 0 0 16px; width: 16px; margin: 2px 0; }

#rd305ReconciliationSummary .reconciliation-summary-wrap {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.reconciliation-summary-table {
  width: 1545px;
  min-width: 1545px;
}

.reconciliation-summary-table input {
  width: 150px;
  min-width: 120px;
}

.reconciliation-summary-table th:first-child,
.reconciliation-summary-table td:first-child {
  width: 190px;
  min-width: 190px;
}

.reconciliation-summary-table th:nth-child(2),
.reconciliation-summary-table td:nth-child(2),
.reconciliation-summary-table th:nth-child(5),
.reconciliation-summary-table td:nth-child(5) {
  width: 155px;
}

.reconciliation-summary-table th:nth-child(3),
.reconciliation-summary-table td:nth-child(3),
.reconciliation-summary-table th:nth-child(6),
.reconciliation-summary-table td:nth-child(6) {
  width: 175px;
}

.reconciliation-summary-table th:nth-child(4),
.reconciliation-summary-table td:nth-child(4),
.reconciliation-summary-table th:nth-child(7),
.reconciliation-summary-table td:nth-child(7) {
  width: 140px;
}

.reconciliation-summary-table th:nth-child(8),
.reconciliation-summary-table td:nth-child(8) {
  width: 155px;
}

.reconciliation-summary-table th:nth-child(9),
.reconciliation-summary-table td:nth-child(9) {
  width: 240px;
}

.reconciliation-summary-table td:first-child small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.reconciliation-summary-table td:nth-child(4),
.reconciliation-summary-table td:nth-child(7) {
  min-width: 125px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.reconciliation-summary-actions {
  min-width: 240px;
}

.summary-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.summary-action-grid > button {
  width: 100%;
  white-space: nowrap;
}

.reconciliation-summary-warning {
  grid-column: 1 / -1;
  padding: 12px 16px;
}

.metric-warning {
  border-left: 3px solid #b7791f;
  background: #fff8e6 !important;
}

#rd305ReconciliationSummary .metric-warning {
  grid-column: 1 / -1;
}

#rd305ReconciliationSummary .metric-warning strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.audit-procedure-list {
  display: grid;
  gap: 8px;
  padding-inline: 16px;
}

.audit-procedure-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.audit-procedure-item:first-child {
  border-top: 0;
}

.audit-procedure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.audit-procedure-summary > span:first-child {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.audit-procedure-summary b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.audit-procedure-body {
  display: block;
  padding: 12px 0 4px 38px;
}

.procedure-observations {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.procedure-observations > summary {
  display: block;
  min-height: 0;
  padding: 9px 12px;
  background: #f5f2ec;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.procedure-observations > summary::before {
  content: "+ ";
}

.procedure-observations[open] > summary::before {
  content: "− ";
}

.procedure-observations > div {
  display: grid;
}

.procedure-observation-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1fr) minmax(0, 2fr);
  gap: 0;
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.procedure-observation-row:hover {
  background: #eef8f6;
}

.procedure-observation-row span {
  overflow: hidden;
  min-width: 0;
  padding: 8px 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.procedure-observation-row span + span {
  border-left: 1px solid var(--line);
}

.procedure-observation-row:first-child {
  border-top: 0;
}

.observation-description-field {
  display: grid;
  gap: 8px;
  padding: 12px 16px 0;
}

.observation-description-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.observation-description-head label {
  padding: 0;
}

.observation-description-field textarea {
  overflow: auto;
}

.audit-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.notebook-page {
  margin-top: 16px;
  padding: 18px 58px 28px 18px;
  background: #eef2f1;
  border: 1px solid #d1d9d7;
  border-radius: 8px;
}

.notebook-sheet {
  position: relative;
  min-height: 640px;
  border: 1px solid #d5d7ce;
  border-radius: 6px 0 6px 6px;
  background: #fffefa;
  box-shadow: 0 10px 24px rgba(30, 49, 48, 0.12);
}

.notebook-sheet::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 22px;
  width: 1px;
  background: #e7aaa0;
  pointer-events: none;
}

.notebook-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-left: 23px;
  padding: 26px 28px 18px 20px;
  border-bottom: 1px solid #d9dfdc;
  color: var(--ink);
}

.notebook-kicker {
  margin: 0 0 5px;
  color: #b95d49;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notebook-hero h2 { font-size: 26px; }
.notebook-context { margin: 7px 0 0; color: var(--muted); }

.notebook-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d5dcda;
  border-radius: 5px;
  background: #d5dcda;
}

.notebook-summary > div {
  display: grid;
  min-height: 62px;
  align-content: center;
  padding: 9px 14px;
  background: #f5f7f4;
}

.notebook-summary strong { color: var(--brand-dark); font-size: 21px; }
.notebook-summary span { color: var(--muted); font-size: 11px; }

.notebook-index {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: -44px;
  display: grid;
  width: 44px;
  gap: 7px;
}

.notebook-index button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 94px;
  border: 0;
  border-radius: 0 5px 5px 0;
  padding: 8px 6px;
  color: #213033;
  box-shadow: 3px 3px 7px rgba(36, 52, 52, 0.12);
  font-size: 13px;
  font-weight: 800;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.notebook-index button:nth-child(1) { background: #edb4a5; }
.notebook-index button:nth-child(2) { background: #a8d1c7; }
.notebook-index button:nth-child(3) { background: #f0cd83; }
.notebook-index button:nth-child(4) { background: #a9c9de; }
.notebook-index button:nth-child(5) { background: #c7b9df; }
.notebook-index button:nth-child(6) { background: #d7b0c0; }
.notebook-index button:hover { filter: brightness(0.97); }
.notebook-index button.active {
  width: 50px;
  margin-right: -6px;
  outline: 2px solid rgba(255, 255, 255, 0.82);
  outline-offset: -3px;
  box-shadow: 4px 4px 9px rgba(36, 52, 52, 0.2);
}
.notebook-index span { font-size: 11px; font-weight: 900; }

.notebook-section {
  display: none;
  margin-left: 23px;
  padding: 24px 28px 32px 20px;
}

.notebook-section.active { display: block; }

.notebook-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.notebook-section-head > div { display: flex; align-items: baseline; gap: 12px; }
.notebook-section-head > div > span { color: #d05d3e; font-size: 12px; font-weight: 900; }
.notebook-section-head h3 { font-size: 21px; }
.notebook-section-head p { margin: 0; color: var(--muted); font-size: 13px; }

.notebook-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px);
  gap: 12px;
  margin-bottom: 14px;
}

.notebook-table {
  overflow: hidden;
  border: 1px solid #d6dddb;
  border-radius: 6px;
}

.notebook-table-head,
.notebook-table-row {
  display: grid;
  align-items: center;
  min-width: 0;
}

.notebook-table-head {
  min-height: 38px;
  background: #e7efed;
  color: #495653;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.notebook-table-row {
  width: 100%;
  min-height: 46px;
  border-top: 1px solid #e1e6e5;
  border-radius: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

button.notebook-table-row:hover { background: #f1f7f5; }
.notebook-table-row > *, .notebook-table-head > * { min-width: 0; padding: 9px 12px; }
.notebook-table-row > * + *, .notebook-table-head > * + * { border-left: 1px solid #e1e6e5; }
.notebook-table-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-observation-grid { grid-template-columns: 180px minmax(160px, .8fr) 120px minmax(260px, 2fr); }
.notebook-timesheet-grid { grid-template-columns: 110px minmax(180px, 1fr) minmax(260px, 2fr) 80px 120px; }

.notebook-progress-list { border-top: 1px solid #d6dddb; }

.notebook-progress-row {
  display: grid;
  grid-template-columns: 100px minmax(230px, 1.25fr) minmax(160px, 1fr) 150px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 66px;
  border-bottom: 1px solid #d6dddb;
  border-radius: 0;
  padding: 10px 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.notebook-progress-row:hover { background: #edf5f3; }
.notebook-workdoc { color: var(--brand-dark); font-weight: 900; }
.notebook-progress-title { display: grid; }
.notebook-progress-title small { color: var(--muted); }
.notebook-progress-track { height: 7px; overflow: hidden; background: #dfe6e4; }
.notebook-progress-track i { display: block; height: 100%; background: var(--brand); }
.notebook-progress-status { justify-self: end; font-size: 12px; font-weight: 850; }
.notebook-progress-status.complete { color: var(--ok); }
.notebook-progress-status.active { color: var(--blue); }
.notebook-progress-status.idle { color: var(--muted); }

.notebook-request-list { border-top: 1px solid #d6dddb; }
.notebook-request-row {
  display: grid;
  grid-template-columns: 132px minmax(280px, 2fr) 120px minmax(150px, .8fr) 70px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  border-bottom: 1px solid #d6dddb;
  border-radius: 0;
  padding: 10px 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.notebook-request-row:hover { background: #edf5f3; }
.notebook-request-row > span { min-width: 0; }
.notebook-request-row > span:not(.badge) { display: grid; }
.notebook-request-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.notebook-request-row .badge { justify-self: start; }

.notebook-note-editor {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 0.8fr);
  gap: 12px;
  border-left: 4px solid var(--brand);
  padding: 16px 18px 18px;
  background: #f0f5f3;
}

.notebook-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.notebook-note-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}
.notebook-note-importance { flex: 0 0 180px; }

.notebook-note-meta span {
  border: 1px solid #c7d6d2;
  border-radius: 4px;
  padding: 4px 8px;
  background: #fff;
  color: #41504d;
  font-size: 11px;
}

.notebook-note-title { grid-column: 1; }
.notebook-note-files { grid-column: 2; }
.notebook-note-text { grid-column: 1 / -1; }
.notebook-note-text textarea { min-height: 250px; resize: vertical; font-size: 15px; line-height: 1.5; }
.notebook-note-actions { display: flex; grid-column: 1 / -1; align-items: end; justify-content: flex-end; gap: 8px; }
.notebook-note-list { display: grid; gap: 1px; margin-top: 12px; background: #d6dddb; }

.notebook-diary { display: grid; gap: 22px; }
.notebook-diary-day h4 {
  margin: 0;
  border-bottom: 2px solid #d7dfdc;
  padding: 0 0 8px;
  color: var(--brand-dark);
  font-size: 15px;
}
.notebook-diary-table { border-bottom: 1px solid #dfe5e3; }
.notebook-diary-row {
  display: grid;
  grid-template-columns: 72px minmax(210px, 0.8fr) minmax(260px, 1.7fr);
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid #e2e7e5;
}
.notebook-diary-row:last-child { border-bottom: 0; }
.notebook-diary-row > * { min-width: 0; padding: 9px 12px; }
.notebook-diary-row > * + * { border-left: 1px solid #e2e7e5; }
.notebook-diary-row time { color: #b55d49; font-weight: 850; }
.notebook-diary-row span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.notebook-note {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  margin: 0;
  padding: 16px 18px;
  background: #fff;
}

.notebook-note.important { border-left: 4px solid #e2a229; }
.notebook-note.critical { border-left: 4px solid var(--danger); }
.notebook-note-head { display: grid; gap: 3px; }
.notebook-note-head time { color: var(--muted); font-size: 11px; }
.notebook-importance { font-size: 12px; font-weight: 900; }
.notebook-note-body { display: grid; gap: 8px; min-width: 0; }
.notebook-note-body h4 { margin: 0; font-size: 16px; }
.notebook-note p { margin: 0; white-space: pre-wrap; }
.notebook-note-controls { display: flex; gap: 12px; }
.notebook-note-attachments { display: grid; gap: 1px; margin-top: 6px; background: #dfe5e3; }
.notebook-note-file {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 80px auto auto auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 6px 10px;
  background: #f7f9f8;
}
.notebook-note-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-note-file small { color: var(--muted); }
.notebook-empty { padding: 24px; border: 1px dashed #cbd5d2; color: var(--muted); text-align: center; }

#rd305InventoryRows input {
  min-width: 110px;
  width: 100%;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(460px, calc(100% - 40px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 250px 1fr; }
  .details { grid-column: 1 / -1; }
  .selection-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .register-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  html, body { overflow-x: hidden; }
  .app { padding: 14px; }
  .topbar, .project-band, .contract-box { display: grid; }
  .topbar h1 { font-size: 28px; }
  .login-panel h1 { font-size: 32px; }
  .user-pill {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  #currentUser { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; }
  .user-pill button { width: 100%; }
  .login-block-row { align-items: stretch; flex-direction: column; }
  .security-journal-filters,
  .security-event-row { grid-template-columns: 1fr; }
  .security-event-row { gap: 4px; }
  .security-journal-body { max-height: calc(100vh - 310px); }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs button { min-width: 0; padding-inline: 8px; }
  .audit-subtabs-shell { grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .audit-scroll-button { width: 36px; min-width: 36px; }
  .balance-subtabs { display: grid; grid-template-columns: 1fr; }
  .balance-subtabs button { width: 100%; }
  .project-meta, .contract-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }
  .project-meta select { width: 100%; min-width: 0; }
  .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .metrics, .workspace, .editor-grid, .team-grid, .form-grid, .chat-form, .document-filters, .new-client-row, .audit-workspace, .selection-form, .register-summary, .selection-metrics, .portfolio-summary, .observation-project-data, .observation-assessment-grid, .materiality-result, .materiality-factor-list label, .materiality-risk-list label, .preliminary-selection-form, .financial-statements-upload, .financial-statements-summary, .financial-statements-controls, .planning-readiness, .planning-question, .planning-material-list, .planning-change-row, .planning-event-row, .planning-risk-grid { grid-template-columns: 1fr; }
  .materiality-statement-import { align-items: stretch; flex-direction: column; }
  .materiality-statement-import button { align-self: start; }
  .planning-actions { align-items: stretch; flex-direction: column; }
  .planning-inventory,
  .planning-inventory-fields,
  .planning-inventory-recommendation dl { grid-template-columns: 1fr; }
  .planning-inventory-fields .wide { grid-column: auto; }
  .planning-actions .panel-actions { width: 100%; flex-wrap: wrap; }
  .planning-actions .panel-actions button { flex: 1 1 180px; }
  .financial-statements-source { align-items: flex-start; flex-direction: column; }
  .financial-statements-source-actions { width: 100%; }
  .financial-statements-source-actions button { flex: 1; }
  .stage-date-head { display: none; }
  .stage-date-grid > label { grid-template-columns: 1fr; }
  .segmented-control { grid-template-columns: 1fr; }
  .segmented-control label + label span { border-top: 1px solid var(--line); border-left: 0; }
  .document-row, .auditor-row { grid-template-columns: 1fr; }
  .function-allocation-toolbar { align-items: stretch; flex-direction: column; }
  .function-allocation-toolbar > * { width: 100%; }
  .function-allocation-suggestions-toolbar { align-items: stretch; flex-direction: column; }
  .function-allocation-suggestions-toolbar > * { width: 100%; }
  .function-allocation-change { grid-template-columns: 1fr; }
  .function-allocation-content { padding-inline: 10px; }
  .function-allocation-group-head { grid-template-columns: 1fr; }
  .function-allocation-table { min-width: 0; }
  .function-allocation-header { display: none; }
  .function-allocation-row {
    grid-template-columns: 28px 70px minmax(0, 1fr);
    align-items: start;
    padding-block: 12px;
  }
  .function-allocation-row > span { overflow-wrap: anywhere; }
  .function-responsible,
  .function-participants {
    grid-column: 2 / -1;
  }
  .function-responsible > small,
  .function-participants > small { display: block; margin-bottom: 5px; }
  .selection-document-row { align-items: flex-start; flex-wrap: wrap; }
  .filters { position: static; }
  .audit-sections { position: static; }
  #costAuditView.audit-workspace, #expenseAuditView.audit-workspace { grid-template-columns: 1fr; }
  .selection-table { min-width: 980px; }
  .observation-project-data .wide { grid-column: auto; }
  .observation-procedure-options { grid-template-columns: 1fr; }
  .selection-settings-grid, .confirmation-attachment-form { grid-template-columns: 1fr; }
  .selection-list-filter { grid-template-columns: 1fr 1fr; }
  .selection-list-filter label:first-child { grid-column: 1 / -1; }
  .confirmation-fields .wide { grid-column: auto; }
  .audit-result-meta { grid-template-columns: 1fr; }
  .audit-procedure-body { padding-left: 0; }
  .procedure-observation-row { grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1fr) minmax(0, 2fr); }
  .audit-result-actions { align-items: stretch; flex-direction: column; }
  .notebook-page { padding: 12px; }
  .notebook-sheet { min-height: 620px; border-radius: 6px; padding-top: 64px; }
  .notebook-sheet::before { left: 15px; }
  .notebook-index {
    top: 12px;
    right: 10px;
    left: 20px;
    display: flex;
    width: auto;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .notebook-index button {
    flex: 0 0 auto;
    min-width: 92px;
    min-height: 44px;
    border-radius: 5px 5px 0 0;
    padding: 8px 10px;
    font-size: 12px;
    writing-mode: horizontal-tb;
    transform: none;
  }
  .notebook-index button.active { width: auto; margin-right: 0; }
  .notebook-hero { grid-template-columns: 1fr; margin-left: 16px; padding: 18px 14px 16px 12px; }
  .notebook-hero h2 { font-size: 22px; }
  .notebook-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notebook-section { margin-left: 16px; padding: 20px 14px 26px 12px; }
  .notebook-section-head { align-items: flex-start; flex-direction: column; }
  .notebook-filters { grid-template-columns: 1fr; }
  .notebook-table { overflow-x: auto; }
  .notebook-observation-grid { grid-template-columns: 160px 180px 110px minmax(260px, 1fr); min-width: 760px; }
  .notebook-timesheet-grid { grid-template-columns: 105px 180px minmax(260px, 1fr) 70px 110px; min-width: 760px; }
  .notebook-progress-row, .notebook-request-row { grid-template-columns: 1fr; gap: 7px; padding: 14px 4px; }
  .notebook-progress-status { justify-self: start; }
  .notebook-note-editor, .notebook-note { grid-template-columns: 1fr; }
  .notebook-note-toolbar { align-items: stretch; flex-direction: column; }
  .notebook-note-importance { flex-basis: auto; }
  .notebook-note-title, .notebook-note-files, .notebook-note-text, .notebook-note-actions { grid-column: 1; grid-row: auto; }
  .notebook-note-text textarea { min-height: 220px; }
  .notebook-note-actions, .notebook-note-controls { flex-wrap: wrap; }
  .notebook-note-file { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .notebook-note-file .link-button, .notebook-note-file a { justify-self: start; }
  .notebook-diary-row { grid-template-columns: 60px minmax(180px, 1fr); }
  .notebook-diary-row span { grid-column: 1 / -1; border-top: 1px solid #e2e7e5; border-left: 0; white-space: normal; }
}
.rd460-page {
  display: grid;
  gap: 16px;
}

.rd460-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 12px 14px;
  border-left: 4px solid #277a68;
  background: #f3f8f6;
}

.rd460-progress strong { font-size: 20px; }
.rd460-progress small { color: var(--muted); }
.rd460-form { display: grid; gap: 16px; }
.rd460-table-wrap { overflow-x: auto; }
.rd460-forms-table { min-width: 860px; }
.rd460-forms-table th:first-child { width: 27%; }
.rd460-forms-table th:nth-child(2) { width: 20%; }
.rd460-forms-table select,
.rd460-forms-table input { width: 100%; min-width: 130px; }
.rd460-conclusion { display: grid; gap: 7px; }
.rd460-help { margin: 0 0 14px; }
.rd460-disclosure-list { display: grid; gap: 8px; }

.rd460-disclosure-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) 150px minmax(280px, 1.6fr) 190px;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.rd460-disclosure-row:first-child { border-top: 0; }
.rd460-disclosure-row.unavailable { opacity: 0.68; }
.rd460-disclosure-title { display: grid; gap: 4px; }
.rd460-disclosure-title span { color: var(--muted); font-size: 12px; }
.rd460-disclosure-row textarea { min-height: 68px; resize: vertical; }
.rd460-disclosure-actions { display: grid; gap: 5px; }
.rd460-disclosure-actions button { width: 100%; }
.rd460-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 0;
}

@media (max-width: 980px) {
  .rd460-progress { grid-template-columns: auto 1fr; }
  .rd460-progress small { grid-column: 1 / -1; }
  .rd460-disclosure-row { grid-template-columns: 1fr auto; }
  .rd460-disclosure-row textarea,
  .rd460-disclosure-actions,
  .rd460-links { grid-column: 1 / -1; }
  .rd460-disclosure-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .rd460-disclosure-row { grid-template-columns: 1fr; }
  .rd460-disclosure-row > * { grid-column: 1; }
  .rd460-disclosure-actions { grid-template-columns: 1fr; }
}

.rd345-disclosure-table { min-width: 920px; }
#rd365Supplement { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.rd245-view { min-width: 0; background: #fff; border-top: 3px solid #51695c; }
.rd245-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 16px; }
.rd245-tabs button { flex: 0 0 auto; }
#rd245Body { padding: 16px; min-width: 0; }
#rd245Body > details { border-bottom: 1px solid #dce1dd; padding: 14px 0; }
#rd245Body > details > summary { cursor: pointer; font-weight: 600; }
.rd245-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 18px 0; border-bottom: 1px solid #dce1dd; }
.rd245-row small { display: block; color: #606960; margin: 6px 0; }
.rd245-spark { grid-column: 1 / -1; border-left: 3px solid #607a67; padding-left: 12px; }
.rd245-spark input, .rd245-spark textarea { width: 100%; min-width: 0; }
.rd245-row input[type=checkbox] { width: auto; }
.rd245-row textarea, .rd245-row select, #rd245RequestText { width: 100%; max-width: 100%; min-width: 0; }
@media(max-width:650px) { .rd245-row { grid-template-columns: minmax(0,1fr); gap: 12px; } }
#rd365Supplement > *, #rd365Supplement .collapsible-panel { min-width: 0; }
#rd365Supplement .selection-table-wrap { max-width: 100%; overflow-x: auto; }
#rd365Supplement .form-grid, #rd365Supplement details, #rd365Supplement .estimate-warning { margin: 16px; }
#rd365Supplement table { min-width: 1000px; table-layout: fixed; }
#rd365Supplement .estimate-balances { min-width: 1700px; }
#rd365Supplement th:first-child { width: 150px; }
#rd365Supplement .estimate-plan th:first-child { width: 50%; }
#rd365Supplement .estimate-plan th:nth-child(2) { width: 160px; }
#rd365Supplement input, #rd365Supplement textarea, #rd365Supplement select { min-width: 0; max-width: 100%; }
#rd365Supplement td { overflow-wrap: anywhere; }
#rd365Supplement input[type="checkbox"] { width: auto; }
.estimate-check { display: flex; align-items: start; gap: 8px; margin-top: 8px; }
.estimate-risk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 16px; }
.estimate-warning { color: #a32323; }
#rd360Supplement { min-width: 0; grid-template-columns: minmax(0, 1fr); }
#rd360Supplement > *, #rd360Supplement .collapsible-panel { min-width: 0; }
#rd360Supplement .selection-table-wrap { max-width: 100%; overflow-x: auto; }
#rd360Supplement .form-grid, #rd360Supplement details, #rd360Supplement .payroll-confirm { margin: 16px; }
#rd360Supplement table { min-width: 1150px; table-layout: fixed; }
#rd360Supplement th:first-child { width: 80px; }
#rd360Supplement .payroll-balance th:first-child { width: 150px; }
#rd360Supplement .payroll-balance .badge { white-space: nowrap; }
#rd360Supplement input, #rd360Supplement textarea, #rd360Supplement select { min-width: 0; max-width: 100%; }
#rd360Supplement td { overflow-wrap: anywhere; }
#rd360Supplement .payroll-confirm { display: flex; align-items: center; gap: 8px; }
#rd360Supplement .payroll-confirm input { width: auto; }
#rd355Supplement { min-width: 0; grid-template-columns: minmax(0, 1fr); }
#rd355Supplement > *, #rd355Supplement .collapsible-panel { min-width: 0; }
#rd355Supplement .selection-table-wrap { max-width: 100%; overflow-x: auto; }
#rd355Supplement > [data-loan-add] { justify-self: start; width: 32px; margin-left: 16px; }
#rd355Supplement .payable-files:empty { display: none; }
#rd355Supplement > h4, #rd355Supplement > p, #rd355Supplement > details,
#rd355Supplement > .form-grid, #rd355Supplement > .payable-upload,
#rd355Supplement > .payable-files, #rd355Supplement > .payable-confirm { margin: 16px; }
#rd355Supplement .loan-balance-table { min-width: 1800px; table-layout: fixed; }
#rd355Supplement .loan-detail-table, .payable-cutoff-table { min-width: 1800px; table-layout: fixed; }
#rd355Supplement input, #rd355Supplement select, #rd355Supplement textarea { max-width: 100%; min-width: 0; }
#rd355Supplement td { overflow-wrap: anywhere; }
.payable-upload { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.payable-confirm { display: flex; gap: 8px; align-items: center; }
.payable-confirm input { width: auto; }
.payable-warning { color: #a32323; }
.rd345-disclosure-table th:first-child { width: 34%; }
.rd345-disclosure-table select,
.rd345-disclosure-table input { width: 100%; min-width: 120px; }
.rd345-eps-block { display: grid; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.rd345-eps-table { min-width: 980px; }
#rd345MonthlyShares { display: grid; grid-template-columns: repeat(12, minmax(64px, 1fr)); gap: 4px; padding: 5px; }
#rd345MonthlyShares input { width: 100%; min-width: 0; }
/* Display formatting never replaces the exact numeric input value. */
.audit-number-settings { display: flex; gap: 20px; flex-wrap: wrap; padding: 12px 16px; }
.audit-number-settings label { display: inline-flex; align-items: center; gap: 7px; }
.audit-number-settings input { width: auto; }
.audit-money-input { display: inline-block; position: relative; width: 100%; min-width: 110px; }
.audit-money-display { position: absolute; inset: 0; padding: 12px; pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; }
.audit-money-input:not(:focus-within) input { color: transparent; }
.audit-money-input:focus-within .audit-money-display { visibility: hidden; }
.procedure-edit-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.procedure-edit-toolbar small { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.procedure-edit-toolbar button { flex: 0 0 auto; }
.procedure-editor { display: grid; gap: 12px; padding-bottom: 16px; }
.procedure-editor.hidden { display: none; }
.procedure-editor label { display: grid; gap: 6px; min-width: 0; }
.procedure-editor textarea, .procedure-editor select { width: 100%; box-sizing: border-box; }
.procedure-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.observation-result-checks { grid-column: 1 / -1; border-top: 1px solid #d7dce0; padding-top: 12px; }
.result-check-summary { margin: 12px 16px; overflow-wrap: anywhere; }
.result-check-summary small { display: block; margin-top: 6px; color: var(--muted); }
.result-work-editor, [data-independent-editor] { margin: 12px 16px 20px; min-width: 0; }
.result-work-editor > summary, [data-independent-editor] > summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.result-work-editor .selection-table, [data-independent-editor] .selection-table { min-width: 1100px; }
.result-work-editor input, [data-independent-editor] input { max-width: 100%; }
[data-independent-editor] .selection-table th,
.result-work-editor .selection-table th { width: 160px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
[data-independent-editor] .selection-table th:first-child { width: 240px; }
[data-independent-editor="currency"] .selection-table th:first-child,
.result-work-editor .selection-table th:first-child { width: 100px; }
[data-independent-editor="currency"] .selection-table th:nth-child(2),
.result-work-editor .selection-table th:nth-child(2) { width: 260px; }
[data-independent-editor] .selection-table,
.result-work-editor .selection-table { min-width: 1600px; }
[data-title-row] input { width: 100%; min-width: 0; }
.rd305-title-table { min-width: 1200px; }
.rd305-title-table th { width: 210px; text-align: left; }
.rd305-title-table th:first-child { width: 270px; }
.rd305-title-table th:last-child { width: 60px; }
#rd305InventoryDetails { padding: 16px; }
#rd305Details .selection-table { min-width: 1350px; }
#rd305Details .selection-table th { width: 220px; text-align: left; }
#rd305Details .selection-table th:first-child { width: 280px; }
#rd305Details .selection-table th:nth-child(2) { width: 180px; }
#rd305Details .selection-table th:last-child { width: 60px; }
#rd305InventoryBand.rd305-own-inventory .selection-table { min-width: 1200px; }
#rd305InventoryBand.rd305-own-inventory .selection-table th { width: 160px; text-align: left; }
#rd305InventoryBand.rd305-own-inventory .selection-table th:first-child { width: 260px; }
#rd305InventoryBand.rd305-own-inventory .selection-table th:nth-child(6) { width: 240px; }
#rd305InventoryBand.rd305-own-inventory .selection-table th:last-child { width: 60px; }
#rd320Details .stock-detail-sheet { padding: 16px; border-bottom: 1px solid var(--border, #ddd); }
#rd320Details summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
#rd320Details { min-width: 0; width: 100%; max-width: 100%; }
#rd320Details .stock-detail-sheet { min-width: 0; max-width: 100%; overflow: hidden; }
#rd320Details .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#rd320Details .form-grid .wide { grid-column: 1 / -1; }
#rd320Details .selection-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
#rd320Details .stock-details-table { min-width: 1300px; table-layout: fixed; }
#rd320Details .stock-details-table[data-stock-table] { min-width: 1800px; }
#rd320Details .stock-details-table td { text-align: left; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 700px) { #rd320Details .form-grid { grid-template-columns: minmax(0, 1fr); } }
#rd320Details .stock-details-table th { width: 160px; text-align: left; white-space: normal; }
#rd320Details .stock-details-table th:first-child { width: 260px; }
#rd320Details .stock-details-table th:last-child { width: 200px; }
#rd320Details .stock-details-table[data-stock-table] th:last-child { width: 60px; }
#rd320Details .stock-details-table input,
#rd320Details .stock-details-table textarea { width: 100%; min-width: 0; }
#rd320Details label { min-width: 0; overflow-wrap: anywhere; }
#rd320Details output { padding: 10px 0; }

#rd325Details { min-width: 0; width: 100%; max-width: 100%; }
#rd325Details details { min-width: 0; max-width: 100%; overflow: hidden; padding: 16px; border-bottom: 1px solid var(--line); }
#rd325Details summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
#rd325Details .form-grid { grid-template-columns: minmax(0, 1fr); }
#rd325Details label { min-width: 0; overflow-wrap: anywhere; }
#rd325Details .selection-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
#rd325Details table { table-layout: fixed; }
#rd325Details .cash-disclosures { min-width: 1050px; }
#rd325Details .cash-equivalents { min-width: 1450px; }
#rd325Details table th, #rd325Details table td { white-space: normal; text-align: left; overflow-wrap: anywhere; width: 160px; }
#rd325Details .cash-disclosures th:first-child { width: 350px; }
#rd325Details .cash-equivalents th:last-child { width: 55px; }
#rd325Details input, #rd325Details textarea { min-width: 0; width: 100%; }
#rd325Details input[type="checkbox"] { width: auto; }
#rd325Details .assessment-callout { margin: 16px; }

#rd330Details { min-width: 0; width: 100%; max-width: 100%; }
#rd330Details details { min-width: 0; max-width: 100%; overflow: hidden; padding: 16px; border-bottom: 1px solid var(--line); }
#rd330Details summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
#rd330Details .form-grid { grid-template-columns: minmax(0, 1fr); }
#rd330Details label { min-width: 0; overflow-wrap: anywhere; }
#rd330Details .selection-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
#rd330Details table { table-layout: fixed; min-width: 1100px; }
#rd330Details table th, #rd330Details table td { white-space: normal; text-align: left; vertical-align: top; overflow-wrap: anywhere; width: 130px; }
#rd330Details table th:first-child, #rd330Details table td:first-child { width: 430px; text-align: left; }
#rd330Details table th:last-child, #rd330Details table td:last-child { width: 280px; }
#rd330Details select, #rd330Details textarea { min-width: 0; width: 100%; }

#rd345Details { min-width: 0; max-width: 100%; grid-template-columns: minmax(0, 1fr); }
#rd345Details details { min-width: 0; max-width: 100%; }
#rd345Details .selection-table-wrap { min-width: 0; width: 100%; max-width: 100%; overflow-x: auto; }
#rd345Details .panel-actions { flex-wrap: wrap; gap: 8px; max-width: 100%; }
#rd345Details .panel-actions button { max-width: 100%; }
.rd420-page { min-width: 0; width: 100%; }
.rd420-header, .rd420-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.rd420-header { padding: 20px 0; }
.rd420-header h3 { font-size: 22px; margin: 4px 0; }
.rd420-group { border-top: 1px solid #cad3d1; margin-bottom: 16px; }
.rd420-group > summary { display: flex; justify-content: space-between; cursor: pointer; font-size: 17px; font-weight: 600; padding: 18px 16px; list-style: none; background: #f2f5f4; }
.rd420-group > summary::after { content: "+"; flex: 0 0 20px; text-align: center; }
.rd420-group[open] > summary::after { content: "-"; }
.rd420-group-body { min-width: 0; }
.rd420-source-summary { padding: 0 16px; font-size: 13px; overflow-wrap: anywhere; }
.rd420-row { border-bottom: 1px solid #dce1df; padding: 20px 16px; min-width: 0; overflow-wrap: anywhere; }
.rd420-row h4 { font-size: 15px; line-height: 1.45; margin: 0 0 12px; }
.rd420-row-head .badge { flex-shrink: 0; }
.rd420-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px 20px; }
.rd420-fields label, .rd420-comment, .rd420-observation-dialog label { display: grid; gap: 6px; font-size: 13px; min-width: 0; }
.rd420-fields input, .rd420-fields textarea, .rd420-fields select, .rd420-comment textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.rd420-fields select { text-overflow: ellipsis; }
.rd420-fields small { color: #5a6c66; font-size: 11px; }
.rd420-amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.rd420-amounts span, .rd420-amounts strong { display: block; }
.rd420-amounts span { font-size: 12px; color: #5a6c66; margin-bottom: 6px; }
.rd420-amounts strong { font-size: 14px; }
.rd420-missing { font-size: 12px; color: #8b461d; }
.rd420-missing:empty { display: none; }
.rd420-actions, .rd420-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rd420-actions button, .rd420-links button { min-height: 30px; font-size: 12px; white-space: normal; }
.rd420-observation-dialog { width: min(740px, calc(100vw - 32px)); box-sizing: border-box; max-height: 90vh; overflow: auto; }
.rd420-observation-dialog form { display: grid; gap: 16px; }
@media (max-width: 600px) {
  .rd420-row-head, .rd420-header { flex-wrap: wrap; }
  .rd420-amounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd420-row { padding: 16px 8px; }
  .rd420-group > summary { padding: 16px 8px; }
}

/* Personal unread messages in discussions of the selected project. */
#openDiscussions { display: inline-flex; align-items: center; gap: 8px; }
#openDiscussions[hidden], .project-discussion-unread[hidden] { display: none; }
.project-discussion-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #b64036; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
