:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --surface: #fffdf8;
  --ink: #20242a;
  --muted: #68707a;
  --line: #ded7c9;
  --teal: #126c6f;
  --teal-soft: #d9eeee;
  --brick: #a7472f;
  --brick-soft: #f3dfd7;
  --gold: #926d16;
  --gold-soft: #f6e9bf;
  --plum: #5b4b73;
  --shadow: 0 18px 45px rgba(36, 39, 43, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(18, 108, 111, 0.08), transparent 42%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: 100vh;
}

body.sidebar-collapsed .shell {
  grid-template-columns: minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid #164e52;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 24px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.16;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 14px;
  font-size: 18px;
}

.snapshot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.snapshot > div {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  display: block;
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab,
.filter,
.ghost-button,
.icon-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 42px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.tab {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  font-weight: 750;
}

.tab:hover,
.filter:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: #bcb19f;
}

.tab.is-active {
  border-color: #174f53;
  background: var(--teal);
  color: white;
}

.vision {
  margin-top: auto;
}

.collab-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.collab-panel input {
  height: 40px;
}

.sync-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

#syncStatus {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 850;
}

#syncStatus[data-mode="online"] {
  background: var(--teal-soft);
  color: #0f5255;
}

#syncStatus[data-mode="offline"] {
  background: #e7e2ee;
  color: var(--plum);
}

label {
  display: block;
  margin-bottom: 8px;
  color: #343940;
  font-size: 13px;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 128px;
  padding: 12px;
  line-height: 1.55;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 108, 111, 0.16);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px;
}

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

.actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ghost-button,
.primary-button {
  padding: 0 16px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 21px;
  font-weight: 850;
}

.primary-button {
  border-color: #76301f;
  background: var(--brick);
  color: white;
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #953e29;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.idea-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 190px) minmax(130px, 160px) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--shadow);
}

.filters {
  margin: 18px 0;
}

.filter {
  min-width: 56px;
  padding: 0 14px;
  font-weight: 800;
}

.filter.is-active {
  border-color: #55415f;
  background: var(--plum);
  color: white;
}

.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.direction,
.direction-grid,
.definition-intro,
.record-layout {
  display: grid;
  gap: 14px;
}

.axis-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border: 1px solid #b8c7c5;
  border-radius: 8px;
  background: #eef7f4;
  box-shadow: var(--shadow);
}

.axis-band h3 {
  margin-bottom: 10px;
  font-size: 24px;
}

.axis-band p,
.definition-intro p,
.definition-card p {
  margin-bottom: 0;
  color: #41484f;
  line-height: 1.65;
}

.axis-score {
  display: grid;
  place-items: center;
  min-height: 112px;
  border: 1px solid #8eb5b2;
  border-radius: 8px;
  background: var(--surface);
}

.axis-score span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.axis-score strong {
  color: var(--teal);
  font-size: 28px;
}

.direction-grid,
.definition-intro {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.direction-panel,
.flow-panel,
.decision-panel,
.definition-intro section,
.definition-card,
.record-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 36, 42, 0.07);
}

.direction-panel ul,
.definition-card ul {
  margin: 0;
  padding-left: 20px;
  color: #3d4249;
  line-height: 1.65;
}

.flow-panel,
.decision-panel {
  margin-top: 0;
}

.process-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.process-flow div {
  min-height: 108px;
  padding: 14px;
  border: 1px solid #dfd5c3;
  border-radius: 8px;
  background: #fbf8f0;
  color: #373d43;
  font-weight: 760;
  line-height: 1.45;
}

.process-flow span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--brick);
  color: white;
  font-size: 13px;
}

.decision-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.decision-table > div {
  min-height: 132px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.decision-table strong {
  display: block;
  margin-bottom: 10px;
}

.decision-table p {
  margin: 10px 0 0;
  color: #4b5158;
  font-size: 14px;
  line-height: 1.55;
}

.status,
.phase {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.status.decided,
.phase {
  background: var(--teal-soft);
  color: #0f5255;
}

.status.review {
  background: var(--gold-soft);
  color: var(--gold);
}

.status.proposed {
  background: #e7e2ee;
  color: var(--plum);
}

.status-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.status-field select {
  height: 38px;
}

.chip.status-proposed {
  background: #e7e2ee;
  color: var(--plum);
}

.chip.status-review {
  background: var(--gold-soft);
  color: var(--gold);
}

.chip.status-decided {
  background: var(--teal-soft);
  color: #0f5255;
}

.chip.status-parked {
  background: #edf1f3;
  color: #4c5661;
}

.definition-intro {
  margin-bottom: 14px;
}

.definition-intro section:first-child {
  grid-column: span 2;
}

.phase-list {
  display: grid;
  gap: 8px;
}

.phase-list span {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #3e454d;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.definition-card {
  min-height: 330px;
}

.definition-card header {
  margin-bottom: 12px;
}

.definition-card h3 {
  margin: 10px 0 0;
}

.definition-section {
  margin-top: 16px;
}

.definition-section strong {
  display: block;
  margin-bottom: 8px;
  color: #2f363d;
}

.record-layout {
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
}

.record-panel {
  min-height: 220px;
}

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

.decision-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 12px;
  align-items: end;
}

.decision-form .full-field {
  grid-column: 1 / -1;
}

.decision-form textarea {
  min-height: 118px;
}

.confirmed-list,
.open-question-list,
.discussion-log {
  display: grid;
  gap: 10px;
}

.record-item,
.discussion-item {
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.record-item strong,
.discussion-item span {
  display: block;
  margin-top: 10px;
  color: #2f363d;
}

.record-item p,
.discussion-item p {
  margin: 10px 0 0;
  color: #464d55;
  line-height: 1.55;
}

.record-item small,
.discussion-item small,
.comment small {
  color: var(--muted);
  font-weight: 700;
}

.discussion-log {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.idea-card {
  display: grid;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 36, 42, 0.07);
}

.idea-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.idea-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.delete-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.delete-button:hover {
  border-color: var(--line);
  color: var(--brick);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.chip.module {
  background: var(--teal-soft);
  color: #0f5255;
}

.chip.priority-High {
  background: var(--brick-soft);
  color: #8c3926;
}

.chip.priority-Medium {
  background: var(--gold-soft);
  color: var(--gold);
}

.chip.priority-Low {
  background: #e7e2ee;
  color: var(--plum);
}

.chip.author {
  background: #edf1f3;
  color: #4c5661;
}

.card-note {
  align-self: end;
  width: 100%;
  min-height: 62px;
  padding: 10px;
  border: 1px solid #e5dece;
  border-radius: 8px;
  background: #fbf8f0;
  color: #41464d;
  line-height: 1.45;
}

.idea-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.vote-button,
.comment-form button {
  min-height: 34px;
  border: 1px solid #cfc5b4;
  border-radius: 8px;
  background: #fbf8f0;
  color: #334047;
  font-weight: 850;
}

.vote-button {
  padding: 0 12px;
}

.vote-button:hover,
.comment-form button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.comments {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment,
.comment-empty {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f5f1e8;
  color: #454b52;
  font-size: 13px;
  line-height: 1.45;
}

.comment strong {
  display: block;
  margin-bottom: 4px;
  color: #2e343a;
}

.comment-empty {
  color: var(--muted);
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  margin-top: 10px;
}

.comment-form input {
  height: 36px;
  font-size: 13px;
}

.matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.module-panel,
.outline section {
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 36, 42, 0.07);
}

.module-panel h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.module-panel ol,
.outline ul {
  margin: 0;
  padding-left: 20px;
  color: #3d4249;
  line-height: 1.6;
}

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

.empty-state {
  padding: 28px;
  border: 1px dashed #cfc5b4;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  text-align: center;
}

.report-workbench {
  display: grid;
  gap: 14px;
}

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border: 1px solid #b8c7c5;
  border-radius: 8px;
  background: #edf7f5;
  box-shadow: var(--shadow);
}

.report-hero h3 {
  margin-bottom: 10px;
  font-size: 26px;
}

.report-hero p {
  margin-bottom: 0;
  color: #41484f;
  line-height: 1.65;
}

.readiness-gauge {
  display: grid;
  place-items: center;
  min-height: 132px;
  border: 1px solid #8eb5b2;
  border-radius: 8px;
  background: var(--surface);
}

.readiness-gauge span {
  color: var(--teal);
  font-size: 34px;
  font-weight: 900;
}

.readiness-gauge small {
  color: var(--muted);
  font-weight: 800;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(340px, 0.92fr);
  gap: 14px;
}

.report-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.report-subtab {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #3b4249;
  font-weight: 850;
}

.report-subtab:hover {
  border-color: #cfc5b4;
  background: #fbf8f0;
}

.report-subtab.is-active {
  border-color: #174f53;
  background: var(--teal);
  color: white;
}

.report-tab-panel {
  display: none;
}

.report-tab-panel.is-active {
  display: block;
}

.report-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 36, 42, 0.07);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.panel-heading h3 {
  margin-bottom: 0;
}

.engagement-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.engagement-form .title-field {
  grid-column: span 2;
}

.lookup-status {
  margin-top: 12px;
}

.upload-box {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px dashed #c9beab;
  border-radius: 8px;
  background: #fbf8f0;
}

.structure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.structure-grid article {
  min-height: 132px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.structure-grid span,
.block-heading span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brick);
  color: white;
  font-size: 13px;
  font-weight: 900;
}

.structure-grid strong {
  display: block;
  margin-top: 12px;
  color: #2f363d;
}

.structure-grid small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.audit-config {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.audit-config textarea {
  min-height: 86px;
}

.audit-paragraph-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.audit-paragraph-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.audit-paragraph-item strong {
  display: block;
  color: #2f363d;
}

.audit-paragraph-item p {
  margin: 8px 0 0;
  color: #464d55;
  line-height: 1.55;
}

.notes-questionnaire-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d7cebd;
  border-radius: 8px;
  background: #fbf8f0;
}

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

.notes-questionnaire-form .field:first-child,
.notes-questionnaire-form .field:nth-child(2) {
  grid-column: span 2;
}

.notes-questionnaire-form textarea {
  min-height: 104px;
  resize: vertical;
}

.trial-balance-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.adjustment-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d7cebd;
  border-radius: 8px;
  background: #fbf8f0;
}

.adjustment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.adjustment-lines {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.adjustment-line {
  display: grid;
  grid-template-columns: minmax(92px, 120px) minmax(240px, 1fr) minmax(120px, 180px) 36px;
  gap: 8px;
  align-items: center;
}

.adjustment-line select,
.adjustment-line input {
  width: 100%;
}

.adjustment-toolbar {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
  align-items: center;
}

.adjustment-balance-check {
  margin-left: auto;
  color: #7a351f;
  font-size: 13px;
  font-weight: 850;
}

.adjustment-balance-check[data-balanced="true"] {
  color: #0f5255;
}

.adjustment-form .title-field {
  min-width: 280px;
}

.adjustment-summary,
.adjustment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.adjustment-impact {
  margin-top: 12px;
}

.impact-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.impact-heading strong {
  color: #2f363d;
}

.impact-heading small {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.45;
  text-align: right;
}

.impact-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.impact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.impact-table th,
.impact-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eee5d7;
  text-align: left;
  vertical-align: top;
}

.impact-table th {
  position: sticky;
  top: 0;
  background: #f4efe5;
  color: #343940;
  z-index: 1;
}

.adjustment-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.adjustment-item strong {
  display: block;
  color: #2f363d;
}

.adjustment-item p {
  margin: 6px 0;
  color: #464d55;
  line-height: 1.45;
}

.adjustment-line-summary {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  color: #464d55;
  line-height: 1.45;
}

.adjustment-item small {
  color: var(--muted);
  font-weight: 750;
}

.working-paper-list {
  display: grid;
  gap: 12px;
}

.working-paper-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.working-paper-summary article {
  padding: 14px;
  border: 1px solid #d7cebd;
  border-radius: 8px;
  background: #fbf8f0;
}

.working-paper-summary strong {
  display: block;
  color: var(--teal);
  font-size: 28px;
  line-height: 1;
}

.working-paper-summary span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.working-paper-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.working-paper-section > div:first-child {
  display: flex;
  gap: 10px;
  align-items: center;
}

.working-paper-section h4 {
  margin: 0;
  font-size: 16px;
}

.working-paper-section p {
  margin: 0;
  color: #464d55;
  line-height: 1.55;
}

.working-paper-section ul {
  margin: 0;
  padding-left: 20px;
  color: #464d55;
  line-height: 1.55;
}

.paper-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.working-paper-table-wrap {
  overflow: auto;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.working-paper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.working-paper-table th,
.working-paper-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eee5d7;
  text-align: left;
  vertical-align: top;
}

.working-paper-table th {
  background: #f4efe5;
  color: #343940;
}

.workpaper-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
}

.workpaper-tools label {
  display: grid;
  gap: 6px;
  min-width: 280px;
  color: #343940;
  font-size: 13px;
  font-weight: 850;
}

.workpaper-tools small {
  color: var(--muted);
  line-height: 1.45;
}

.workpaper-account-table {
  min-width: 1280px;
}

.workpaper-account-table td:first-child small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}

.workpaper-account-table textarea {
  width: 100%;
  min-width: 240px;
  min-height: 72px;
  resize: vertical;
  font-size: 13px;
}

.workpaper-account-table select,
.compact-input {
  width: 100%;
  min-width: 120px;
  height: 36px;
  font-size: 13px;
}

.workpaper-account-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.workpaper-account-heading {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, auto);
  gap: 14px;
  align-items: start;
}

.workpaper-account-heading small,
.workpaper-account-actions small,
.linked-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.workpaper-account-heading strong {
  display: block;
  margin: 2px 0;
  color: #20242a;
}

.workpaper-account-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.workpaper-account-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.workpaper-account-fields label {
  display: grid;
  gap: 6px;
  color: #343940;
  font-size: 13px;
  font-weight: 850;
}

.workpaper-account-fields textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-size: 13px;
}

.workpaper-account-fields select {
  width: 100%;
  min-width: 120px;
  height: 36px;
  font-size: 13px;
}

.workpaper-account-fields .wide-field {
  grid-column: span 2;
}

.workpaper-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sampling-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 160px) minmax(140px, 180px) minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.sampling-account-picker {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #d8cebd;
  border-radius: 8px;
  background: #fffdfa;
}

.sampling-account-list {
  display: grid;
  gap: 6px;
}

.sampling-account-option {
  display: grid;
  grid-template-columns: 18px minmax(120px, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  border-radius: 6px;
  background: #f8f2e8;
  color: #303840;
  font-size: 13px;
  font-weight: 800;
}

.sampling-account-option.is-all {
  grid-template-columns: 18px minmax(120px, 1fr) auto;
  background: #eef7f4;
}

.sampling-account-option input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.sampling-account-option small {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.sampling-output {
  margin-top: 14px;
}

.sampling-table {
  min-width: 1740px;
}

.sampling-table textarea {
  width: 100%;
  min-width: 220px;
  min-height: 58px;
  resize: vertical;
  font-size: 13px;
}

.sampling-table select {
  min-width: 108px;
  height: 36px;
  font-size: 13px;
}

.sample-review-control {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.reason-input {
  min-width: 150px;
}

.readonly-value {
  display: inline-flex;
  min-width: 92px;
  min-height: 34px;
  align-items: center;
  color: #303840;
  font-weight: 800;
  white-space: nowrap;
}

.trial-status {
  margin-bottom: 12px;
}

.mapping-issues {
  color: #7a351f;
  line-height: 1.55;
}

.mapping-issues ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.mapping-note {
  margin: 0 0 10px;
  font-size: 13px;
}

.mapping-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mapping-table th,
.mapping-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eee5d7;
  text-align: left;
  vertical-align: top;
}

.mapping-table th {
  position: sticky;
  top: 0;
  background: #f4efe5;
  color: #343940;
  z-index: 1;
}

.mapping-table tr.is-unmapped {
  background: #f8ebe6;
}

.mapping-table small {
  color: var(--muted);
  font-weight: 750;
}

.mapping-select {
  width: 100%;
  min-width: 220px;
  height: 36px;
  background: #fffdf8;
  font-size: 13px;
}

.number-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.required-list,
.document-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.required-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.required-item,
.document-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.required-item span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: var(--brick-soft);
  color: #8c3926;
  font-weight: 900;
}

.required-item.is-ready span {
  background: var(--teal-soft);
  color: #0f5255;
}

.required-item strong,
.document-item strong {
  display: block;
  color: #2f363d;
}

.required-item small,
.document-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.document-item {
  justify-content: space-between;
  align-items: center;
}

.ai-panel {
  align-self: start;
}

.ai-summary {
  margin-bottom: 14px;
}

.score-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid #d7cebd;
  border-radius: 8px;
  background: #fbf8f0;
}

.score-card.ready {
  border-color: #a7c9c6;
  background: #eef7f4;
}

.score-card span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal);
  font-weight: 900;
}

.score-card strong {
  display: block;
  margin-bottom: 6px;
}

.score-card p {
  margin-bottom: 8px;
  color: #454b52;
  line-height: 1.55;
}

.score-card small {
  color: var(--muted);
  font-weight: 750;
}

.ai-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ai-lists section {
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.bridge-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #d7cebd;
  border-radius: 8px;
  background: #fbf8f0;
}

.bridge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bridge-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.bridge-state {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: var(--surface);
}

.bridge-state.running,
.bridge-state.queued {
  border-color: #8eb5b2;
  background: #eef7f4;
}

.bridge-state.failed {
  border-color: #d2a18f;
  background: #f8ebe6;
}

.bridge-state strong {
  color: #2f363d;
}

.bridge-state span,
.bridge-state p,
.bridge-state small {
  color: #4b5158;
  line-height: 1.45;
}

.bridge-output {
  display: grid;
  gap: 10px;
}

.bridge-output h4 {
  margin: 0 0 8px;
}

.bridge-output ul {
  margin: 0;
  padding-left: 20px;
  color: #7a351f;
  line-height: 1.55;
}

.bridge-suggestion,
.bridge-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fffbf4;
}

.bridge-note {
  display: block;
}

.bridge-suggestion strong,
.bridge-note strong {
  display: block;
  color: #2f363d;
}

.bridge-suggestion p,
.bridge-note p {
  margin: 6px 0;
  color: #464d55;
  line-height: 1.5;
}

.bridge-suggestion small {
  color: var(--muted);
  line-height: 1.45;
}

.ai-lists h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.ai-lists ul,
.pdf-page ol {
  margin: 0;
  padding-left: 20px;
  color: #444b52;
  line-height: 1.6;
}

.report-preview {
  display: grid;
  gap: 18px;
  counter-reset: report-page;
}

.report-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid #e1d8c9;
  border-radius: 8px;
  background: #fbf8f0;
}

.formal-report {
  display: grid;
  gap: 18px;
  counter-reset: report-page;
}

.block-heading {
  display: flex;
  grid-column: 1 / -1;
  gap: 10px;
  align-items: center;
  color: #2f363d;
}

.pdf-page {
  position: relative;
  width: min(100%, 210mm);
  min-height: 297mm;
  margin: 0 auto;
  padding: 17mm 16mm 18mm;
  border: 1px solid #d8d0c2;
  border-radius: 2px;
  background: #fffefb;
  color: #20242a;
  box-shadow: 0 16px 36px rgba(36, 32, 26, 0.12);
  counter-increment: report-page;
}

.pdf-page.cover-page {
  display: grid;
  align-content: center;
  text-align: center;
  counter-increment: none;
}

.formal-page {
  font-family: "Times New Roman", "Noto Serif TC", "Songti TC", serif;
}

.pdf-page-header,
.pdf-page-footer {
  position: absolute;
  left: 16mm;
  right: 16mm;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #555;
  font-size: 11px;
  line-height: 1.3;
}

.pdf-page-header {
  top: 8mm;
  padding-bottom: 4px;
  border-bottom: 1px solid #cfc7b8;
}

.pdf-page-footer {
  bottom: 8mm;
  padding-top: 4px;
  border-top: 1px solid #cfc7b8;
}

.pdf-page-number::after {
  content: "-A" counter(report-page) "-";
}

.pdf-page-body {
  min-height: 252mm;
}

.cover-center {
  display: grid;
  gap: 16px;
  align-content: center;
  min-height: 210mm;
}

.cover-center h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
}

.cover-center h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.cover-center p,
.cover-footer p {
  margin: 0;
  color: #30343a;
  font-size: 16px;
}

.cover-footer {
  position: absolute;
  right: 16mm;
  bottom: 18mm;
  left: 16mm;
  display: grid;
  gap: 8px;
}

.formal-title {
  position: relative;
  margin-bottom: 12px;
  text-align: center;
}

.formal-title h3,
.formal-title h2,
.formal-title p,
.formal-title small {
  margin: 0;
}

.formal-title h3 {
  font-size: 18px;
  font-weight: 700;
}

.formal-title h2 {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
}

.formal-title p {
  margin-top: 6px;
  color: #30343a;
  font-size: 13px;
}

.formal-title small {
  position: absolute;
  right: 0;
  bottom: 0;
  color: #30343a;
  font-size: 12px;
}

.period-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 4px 0 2px 36%;
  color: #30343a;
  font-size: 12px;
  text-align: center;
}

.pdf-page h2 {
  margin-bottom: 14px;
  font-size: 30px;
}

.pdf-page h3 {
  margin: 0 0 14px;
}

.pdf-page h5 {
  margin: 10px 0 4px;
  font-size: 13px;
}

.pdf-page h4 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.pdf-page p {
  color: #454b52;
  line-height: 1.65;
}

.pdf-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  font-size: 12px;
}

.pdf-page th,
.pdf-page td {
  padding: 5px 6px;
  border: 0;
  border-bottom: 1px solid #d8d0c2;
  text-align: left;
  vertical-align: top;
}

.pdf-page th {
  background: transparent;
  font-weight: 500;
}

.formal-statement-table {
  table-layout: fixed;
  border-top: 2px solid #4a4a4a;
  border-bottom: 2px solid #4a4a4a;
}

.formal-statement-table thead {
  display: table-header-group;
}

.formal-statement-table thead th {
  border-bottom: 2px solid #4a4a4a;
  text-align: center;
  white-space: nowrap;
}

.formal-statement-table th:first-child {
  width: 48%;
}

.formal-statement-table .number-cell {
  width: 18%;
  text-align: right;
  white-space: nowrap;
}

.formal-statement-table .percent-cell {
  width: 8%;
  text-align: right;
  white-space: nowrap;
}

.formal-statement-table .muted-number {
  color: #666;
}

.pdf-page .section-row th,
.pdf-page .statement-band th {
  padding-top: 9px;
  border-bottom: 1px solid #a9a091;
  color: #20242a;
  font-weight: 700;
}

.pdf-page .statement-band th {
  text-align: center;
}

.pdf-page .total-row th,
.pdf-page .total-row td {
  border-top: 1.5px solid #4a4a4a;
  border-bottom: 2px solid #4a4a4a;
  font-weight: 700;
}

.toc-table {
  margin-top: 24px;
  font-size: 15px;
}

.toc-table th:last-child,
.toc-table td:last-child {
  width: 70px;
  text-align: center;
}

.toc-table td:first-child {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.toc-table td:first-child::after {
  content: "";
  flex: 1;
  border-bottom: 1px dotted #aaa;
}

.toc-subrow td:first-child {
  padding-left: 24px;
  font-size: 13px;
}

.formal-prose {
  font-size: 14px;
  line-height: 1.9;
}

.formal-prose h4,
.formal-notes h4 {
  margin: 16px 0 6px;
  font-size: 15px;
}

.formal-notes h5 {
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
}

.formal-notes h6 {
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 700;
}

.formal-prose p,
.formal-notes p,
.statement-note {
  color: #30343a;
  line-height: 1.75;
}

.important-note-section {
  break-inside: avoid;
  margin-bottom: 12px;
}

.note-detail-table {
  width: 100%;
  margin: 4px 0 8px;
  border-collapse: collapse;
  font-size: 11px;
}

.note-detail-table th,
.note-detail-table td {
  border: 1px solid #c9ced6;
  padding: 5px 6px;
  vertical-align: top;
}

.note-detail-table th {
  background: #f0f3f7;
  font-weight: 700;
}

.note-detail-table th:first-child {
  width: 28%;
}

.note-detail-table th:nth-child(2),
.note-detail-table th:nth-child(3) {
  width: 18%;
}

.eas-note-table {
  width: 100%;
  margin: 6px 0 10px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.45;
}

.eas-note-table th,
.eas-note-table td {
  border: 0;
  padding: 2px 6px;
  background: transparent;
  vertical-align: bottom;
}

.eas-note-table th:first-child,
.eas-note-table td:first-child {
  width: 43%;
  padding-left: 2px;
  text-align: left;
}

.eas-note-table th:nth-child(2),
.eas-note-table th:nth-child(3),
.eas-note-table td:nth-child(2),
.eas-note-table td:nth-child(3) {
  width: 28.5%;
  text-align: right;
}

.eas-note-table thead th {
  color: #111;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.eas-note-table thead th span {
  display: inline-block;
  min-width: 42mm;
  padding: 0 3mm 2px;
  border-bottom: 1px solid #222;
  text-align: center;
}

.eas-note-table .eas-amount {
  display: inline-block;
  min-width: 34mm;
  text-align: right;
  white-space: nowrap;
}

.eas-note-table .eas-subtotal-amount {
  padding-bottom: 1px;
  border-bottom: 1px solid #222;
}

.eas-note-table .eas-total-amount {
  padding-bottom: 1px;
  border-bottom: 3px double #222;
}

.eas-note-table .eas-total-row td:first-child {
  font-weight: 700;
}

.signature-block {
  display: grid;
  gap: 10px;
  justify-content: end;
  margin-top: 26px;
  min-width: 260px;
  text-align: left;
}

.equity-table th:first-child {
  width: 30%;
}

.cashflow-table th:first-child {
  width: 72%;
}

.notes-page .pdf-page-body {
  column-count: 1;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tabs {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .tab {
    text-align: center;
  }

  .idea-form,
  .outline,
  .direction-grid,
  .definition-intro,
  .process-flow,
  .decision-table,
  .record-layout,
  .decision-form,
  .report-hero,
  .report-grid,
  .engagement-form,
  .upload-box,
  .adjustment-form,
  .notes-questionnaire-form,
  .sampling-form,
  .workpaper-account-heading,
  .workpaper-account-fields,
  .working-paper-summary,
  .structure-grid,
  .audit-config,
  .ai-lists {
    grid-template-columns: 1fr;
  }

  .notes-questionnaire-form .field:first-child,
  .notes-questionnaire-form .field:nth-child(2) {
    grid-column: auto;
  }

  .impact-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .impact-heading small {
    text-align: left;
  }

  .adjustment-line {
    grid-template-columns: 1fr;
  }

  .adjustment-balance-check {
    margin-left: 0;
  }

  .wide-panel,
  .decision-form .full-field {
    grid-column: auto;
  }

  .definition-intro section:first-child {
    grid-column: auto;
  }

  .workpaper-account-fields .wide-field {
    grid-column: auto;
  }

  .axis-band {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .report-hero,
  .report-subtabs,
  .report-tab-panel:not(#reportTabPreview),
  #reportTabPreview > .report-panel > .panel-heading {
    display: none !important;
  }

  .shell,
  .workspace,
  .view.is-active,
  .report-workbench,
  #reportTabPreview,
  #reportTabPreview .report-panel,
  .report-preview,
  .report-block {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: white;
  }

  .pdf-page {
    width: auto;
    min-height: 276mm;
    page-break-after: always;
    break-after: page;
    border: 0;
    border-radius: 0;
    padding: 17mm 16mm 18mm;
    box-shadow: none;
  }

  .pdf-page table {
    page-break-inside: auto;
  }

  .pdf-page thead {
    display: table-header-group;
  }

  .pdf-page tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

}

@media (max-width: 560px) {
  .sidebar,
  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .snapshot {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 24px;
  }
}
