:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #d5dce6;
  --line-strong: #91a2b8;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --page: #e9eef5;
  --kpmg-blue: #00338d;
  --kpmg-medium-blue: #005eb8;
  --error: #a43835;
  --font-ui: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --font-data: Arial, "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.tools-shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  width: min(100%, 1500px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(145, 162, 184, 0.42);
}

.tools-spine {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px 0 20px;
  color: #ffffff;
  background: var(--kpmg-blue);
}

.tools-spine strong {
  flex: 1;
  font-family: var(--font-data);
  font-size: 10px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tools-spine span {
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 700;
}

.tools-workspace {
  min-width: 0;
}

.tools-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 116px;
  padding: 26px 42px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-code {
  margin: 0 0 4px;
  color: var(--kpmg-medium-blue);
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.35;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.tools-topbar p,
.access-panel p,
.tool-panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--kpmg-blue);
  border-radius: 3px;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  color: #ffffff;
  background: var(--kpmg-blue);
}

.secondary-button {
  color: var(--kpmg-blue);
  background: var(--surface);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.tool-tab:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(0, 145, 218, 0.28);
  outline-offset: 2px;
}

.access-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 36px;
  width: min(880px, calc(100% - 48px));
  margin: 64px auto;
  padding: 28px 30px 32px;
  border-top: 4px solid var(--kpmg-blue);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

.access-panel label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.access-panel input {
  min-width: 0;
  height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.form-status {
  grid-column: 1 / -1;
  color: var(--error) !important;
}

.tool-console {
  padding: 28px 42px 48px;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  border-bottom: 2px solid var(--kpmg-blue);
}

.tool-tab {
  min-height: 46px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  color: var(--ink);
  background: var(--surface);
  font-weight: 700;
}

.tool-tab.active {
  border-color: var(--kpmg-blue);
  color: #ffffff;
  background: var(--kpmg-blue);
}

.tool-panel {
  min-height: 520px;
  padding-top: 28px;
}

.tool-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tool-placeholder {
  display: grid;
  min-height: 260px;
  place-items: center;
  margin-top: 28px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line);
}

.tool-form label {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.tool-form input,
.tool-form select,
.tool-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
}

.tool-form input,
.tool-form select {
  height: 42px;
  padding: 8px 12px;
}

.tool-form textarea {
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
}

.tool-form input:focus-visible,
.tool-form select:focus-visible,
.tool-form textarea:focus-visible {
  border-color: var(--kpmg-medium-blue);
  outline: 3px solid rgba(0, 145, 218, 0.18);
  outline-offset: 1px;
}

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

.form-actions,
.result-actions,
.result-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-actions .form-status {
  margin: 0;
  color: var(--muted) !important;
}

.form-actions .form-status.error {
  color: var(--error) !important;
}

.tool-result {
  padding-top: 28px;
}

.result-toolbar {
  justify-content: space-between;
  padding-bottom: 14px;
}

.result-toolbar h3 {
  margin: 0;
  font-size: 16px;
}

.report-table-shell {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--kpmg-blue);
}

.report-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-ui);
  font-size: 13px;
}

.report-table th {
  padding: 10px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  background: var(--kpmg-blue);
  font-weight: 700;
  text-align: center;
}

.report-table td {
  padding: 12px 10px;
  border-top: 1px solid var(--kpmg-medium-blue);
  border-right: 1px solid var(--kpmg-medium-blue);
  vertical-align: middle;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-table th:nth-child(1),
.report-table td:nth-child(1) {
  width: 230px;
  text-align: left;
}

.report-table th:nth-child(2),
.report-table td:nth-child(2),
.report-table th:nth-child(3),
.report-table td:nth-child(3),
.report-table th:nth-child(4),
.report-table td:nth-child(4),
.report-table th:nth-child(5),
.report-table td:nth-child(5) {
  width: 120px;
}

.report-table td:nth-child(2) {
  text-align: center;
}

.report-table td:nth-child(3),
.report-table td:nth-child(4),
.report-table td:nth-child(5) {
  text-align: right;
}

.report-table th:nth-child(6),
.report-table td:nth-child(6) {
  width: 190px;
  text-align: left;
}

.report-table th:nth-child(7),
.report-table td:nth-child(7) {
  width: 260px;
  text-align: left;
}

.report-table th:nth-child(8),
.report-table td:nth-child(8) {
  width: 120px;
  text-align: center;
}

.report-table a {
  color: var(--kpmg-medium-blue);
}

.result-source-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.image-organizer-form {
  display: grid;
  gap: 18px;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line);
}

.image-drop-zone {
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-top: 4px solid var(--kpmg-blue);
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

.image-drop-zone strong {
  color: var(--ink);
  font-size: 16px;
}

.image-drop-zone span {
  margin-bottom: 8px;
  font-size: 12px;
}

.image-input-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.image-input-preview img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  object-position: left top;
  background: #ffffff;
}

.image-input-preview div {
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}

.image-organizer-result {
  padding-top: 28px;
}

.narrative-editor {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.narrative-editor textarea {
  width: 100%;
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--kpmg-blue);
  border-radius: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
}

.blue-image-output {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.blue-image-output img {
  display: block;
  width: min(100%, 1200px);
  max-height: 760px;
  object-fit: contain;
  object-position: left top;
}

.privacy-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

  .tools-spine {
    display: none;
  }

  .tools-topbar,
  .tool-console {
    padding-right: 20px;
    padding-left: 20px;
  }

  .tools-topbar,
  .tool-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .access-panel {
    grid-template-columns: 1fr;
    width: calc(100% - 32px);
    margin: 32px auto;
  }

  .access-panel form {
    grid-template-columns: 1fr;
  }

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

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

  .full-field {
    grid-column: 1;
  }

  .form-actions,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions > * {
    flex: 1;
  }

  .image-input-preview {
    grid-template-columns: 1fr;
  }
}
